ReactOS PowerPC WIP. This will be edited and merged, and likely shrunk.
authorArt Yerkes <art.yerkes@gmail.com>
Sat, 24 Jun 2006 21:34:12 +0000 (21:34 +0000)
committerArt Yerkes <art.yerkes@gmail.com>
Sat, 24 Jun 2006 21:34:12 +0000 (21:34 +0000)
Hacks will be removed and indeed your favorite assembly snippet will
eventually not be just 'blr', so please *don't panic*.

svn path=/branches/powerpc/; revision=22592

50 files changed:
reactos/Makefile
reactos/ReactOS-ppc.rbuild
reactos/boot/freeldr/bootsect/ofwboot.s
reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
reactos/boot/freeldr/freeldr/drivemap.c
reactos/boot/freeldr/freeldr/include/freeldr.h
reactos/hal/hal/hal.c
reactos/include/ddk/ndis.h
reactos/include/ddk/winddk.h
reactos/include/ndk/mmtypes.h
reactos/include/ndk/powerpc/ketypes.h
reactos/include/ndk/pstypes.h
reactos/include/reactos/debug.h
reactos/include/reactos/elf/machine.h
reactos/include/reactos/libs/pseh/setjmp.h
reactos/include/reactos/probe.h
reactos/include/winnt.h
reactos/lib/kjs/ksrc/longjmp.S
reactos/lib/kjs/ksrc/setjmp.S
reactos/lib/pseh/pseh.rbuild
reactos/lib/rossym/find.c
reactos/lib/rtl/heap.c
reactos/lib/rtl/nls.c
reactos/ntoskrnl/ex/init.c
reactos/ntoskrnl/ex/power.c
reactos/ntoskrnl/ex/sysinfo.c
reactos/ntoskrnl/include/internal/arch/ke.h
reactos/ntoskrnl/include/internal/arch/mm.h
reactos/ntoskrnl/include/internal/arch/ps.h
reactos/ntoskrnl/include/internal/ex.h
reactos/ntoskrnl/include/internal/ntoskrnl.h
reactos/ntoskrnl/include/internal/powerpc/ke.h
reactos/ntoskrnl/io/pnpmgr.c
reactos/ntoskrnl/kd/kdmain.c
reactos/ntoskrnl/kd/wrappers/gdbstub.c
reactos/ntoskrnl/ke/apc.c
reactos/ntoskrnl/ke/bug.c
reactos/ntoskrnl/ke/clock.c
reactos/ntoskrnl/ke/dpc.c
reactos/ntoskrnl/ke/ipi.c
reactos/ntoskrnl/ke/kthread.c
reactos/ntoskrnl/ke/main.c
reactos/ntoskrnl/ke/process.c
reactos/ntoskrnl/ke/profile.c
reactos/ntoskrnl/mm/pagefile.c
reactos/ntoskrnl/ntoskrnl.def
reactos/ntoskrnl/ntoskrnl.rbuild
reactos/ntoskrnl/ps/debug.c
reactos/ntoskrnl/ps/idle.c
reactos/ntoskrnl/ps/psmgr.c

index 8ec2925..8b555f9 100644 (file)
@@ -376,7 +376,13 @@ $(ROS_AUTOMAKE): $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
        $(ECHO_RBUILD)
        $(Q)$(RBUILD_TARGET) $(ROS_RBUILDFLAGS) mingw
 
-world: all bootcd livecd
+world: all
+       $(MAKE) KDBG=$(KDBG) DBG=$(DBG) \
+               ROS_AUTOMAKE=$(ROS_AUTOMAKE) \
+               ROS_INSTALL=$(ROS_INSTALL) \
+               ROS_INTERMEDIATE=$(ROS_INTERMEDIATE) \
+               ROS_OUTPUT=$(ROS_OUTPUT) \
+               bootcd livecd
 
 universe:
        $(MAKE) KDBG=1 DBG=1 \
index 418405a..1b0f1b5 100644 (file)
   <define name="_PPC_" />
   <define name="__PowerPC__" />
   <define name="_REACTOS_" />
-  <define name="__MINGW_IMPORT" empty="true" />
+  <define name="__MINGW_IMPORT">extern</define>
   <define name="stdcall" empty="true" />       
   <define name="__stdcall__" empty="true" />
   <define name="fastcall" empty="true" />
   <define name="cdecl" empty="true" />
   <define name="__cdecl__" empty="true" />
   <define name="dllimport" empty="true" />
-  <compilerflag>-v</compilerflag>
+  <define name="WORDS_BIGENDIAN" empty="true" />
   <if property="MP" value="1">
     <define name="CONFIG_SMP" value="1" />
   </if>
     <define name="KDBG" value="1" />
     <property name="DBG_OR_KDBG" value="true" />
   </if>
-  <compilerflag>-Wpointer-arith</compilerflag>
 
   <include>.</include>
   <include>include</include>
-  <include>include/reactos</include>
-  <include>include/libs</include>
-  <include>include/drivers</include>
-  <include>include/subsys</include>
-  <include>include/ndk</include>
-  <include>include</include>
   <include>include/crt</include>
   <include>include/ddk</include>
+  <include>include/GL</include>
+  <include>include/ndk</include>
+  <include>include/reactos</include>
+  <include>include/reactos/libs</include>
 
   <directory name="base">
     <xi:include href="base/base.rbuild" />
index d367382..ac9b039 100644 (file)
@@ -6,6 +6,7 @@ _start:
        .long   0
        .long   0
        
+       .globl _begin
 _begin:
        sync                    
        isync
@@ -19,16 +20,18 @@ _begin:
        mtmsr   %r0             
        isync                   
 
-       bl      setup_bats                                     
-
-       li      %r8,0x3030
-       mtmsr   %r8
-
        /* Store ofw call addr */
        mr      %r21,%r5
        lis     %r10,0xe00000@ha
        stw     %r5,ofw_call_addr - _start@l(%r10)
 
+       bl      setup_bats
+
+       li      %r8,0x3030
+       mtmsr   %r8
+
+       bl      ofw_print_regs
+
        lis     %r4,_binary_freeldr_tmp_end@ha
        addi    %r4,%r4,_binary_freeldr_tmp_end@l
        lis     %r3,_binary_freeldr_tmp_start@ha
@@ -61,7 +64,7 @@ _begin:
        lis     %r3,call_ofw@ha
        addi    %r3,%r3,call_ofw - _start
        
-       b       call_freeldr
+       blr
 
 /*
  * lifted from ppc/boot/openfirmware/misc.S
index 23997df..4e17e0a 100644 (file)
 #define NDEBUG
 #include <debug.h>
 
+int xstrnicmp( const char *a, const char *b, int n ) {
+       while( n-- && *a && (*a++ == *b++) );
+       return *a - *b;
+}
+
 /* Base Addres of Kernel in Physical Memory */
 #define KERNEL_BASE_PHYS 0x200000
 
@@ -131,7 +136,7 @@ FrLdrGetKernelBase(VOID)
     while ((p = strchr(p, '/')) != NULL) {
         
         /* Find "/3GB" */
-        if (!strnicmp(p + 1, "3GB", 3)) {
+        if (!xstrnicmp(p + 1, "3GB", 3)) {
             
             /* Make sure there's nothing following it */
             if (p[4] == ' ' || p[4] == 0) {
index a10a5cc..af886a8 100644 (file)
@@ -171,6 +171,7 @@ ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName)
 
 VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
 {
+#ifdef _M_IX86
        ULONG*  RealModeIVT = (ULONG*)0x00000000;
        USHORT* BiosLowMemorySize = (USHORT*)0x00000413;
 
@@ -202,6 +203,7 @@ VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap)
        RealModeIVT[0x13] = DriveMapHandlerSegOff;
 
        CacheInvalidateCacheData();
+#endif
        DriveMapInstalled = TRUE;
 }
 
index c2cf1e1..6f17840 100644 (file)
@@ -61,6 +61,8 @@
 #include <arch/i386/machpc.h>
 #include <arch/i386/machxbox.h>
 #include <internal/i386/ke.h>
+#elif defined(_PPC_)
+#include <arch/powerpc/compat.h>
 #endif
 /* misc files */
 #include <keycodes.h>
index 995a1df..f793201 100644 (file)
@@ -836,13 +836,14 @@ KeQueryPerformanceCounter(
 }
 
 #undef KeRaiseIrql
-VOID
-NTAPI
+NTOSAPI
+KIRQL
+DDKAPI
 KeRaiseIrql(
-  KIRQL NewIrql,
-  PKIRQL OldIrql)
+    IN KIRQL NewIrql)
 {
   UNIMPLEMENTED;
+  return 0;
 }
 
 
index 55516be..865be83 100644 (file)
@@ -4126,7 +4126,6 @@ typedef struct _NDIS_INTERRUPT {
   KEVENT  DpcsCompletedEvent;
 } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
 
-
 typedef enum _NDIS_WORK_ITEM_TYPE {
   NdisWorkItemRequest,
   NdisWorkItemSend,
index ee3e711..8110847 100644 (file)
@@ -5268,9 +5268,189 @@ KfReleaseSpinLock(
 
 #define KeGetDcacheFillSize() 1L
 
-#endif /* _X86_ */
+#elif defined(_PPC_)
+
+typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
+
+#define PASSIVE_LEVEL                      0
+#define LOW_LEVEL                          0
+#define APC_LEVEL                          1
+#define DISPATCH_LEVEL                     2
+#define PROFILE_LEVEL                     27
+#define CLOCK1_LEVEL                      28
+#define CLOCK2_LEVEL                      28
+#define IPI_LEVEL                         29
+#define SYNCH_LEVEL                     (IPI_LEVEL-1)
+#define POWER_LEVEL                       30
+#define HIGH_LEVEL                        31
+extern NTOSAPI PVOID MmHighestUserAddress;
+extern NTOSAPI PVOID MmSystemRangeStart;
+extern NTOSAPI ULONG_PTR MmUserProbeAddress;
+
+#define MM_HIGHEST_USER_ADDRESS           MmHighestUserAddress
+#define MM_SYSTEM_RANGE_START             MmSystemRangeStart
+#define MM_USER_PROBE_ADDRESS             MmUserProbeAddress
+#define MM_LOWEST_USER_ADDRESS            (PVOID)0x10000
+#define MM_LOWEST_SYSTEM_ADDRESS          (PVOID)0xC0C00000
+
+#define KI_USER_SHARED_DATA               0xffdf0000
+#define SharedUserData                    ((KUSER_SHARED_DATA * CONST) KI_USER_SHARED_DATA)
+
+#define EFLAG_SIGN                        0x8000
+#define EFLAG_ZERO                        0x4000
+#define EFLAG_SELECT                      (EFLAG_SIGN | EFLAG_ZERO)
+
+#define RESULT_NEGATIVE                   ((EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_ZERO                       ((~EFLAG_SIGN & EFLAG_ZERO) & EFLAG_SELECT)
+#define RESULT_POSITIVE                   ((~EFLAG_SIGN & ~EFLAG_ZERO) & EFLAG_SELECT)
+
+typedef struct _KPCR_TIB {
+  PVOID  ExceptionList;         /* 00 */
+  PVOID  StackBase;             /* 04 */
+  PVOID  StackLimit;            /* 08 */
+  PVOID  SubSystemTib;          /* 0C */
+  _ANONYMOUS_UNION union {
+    PVOID  FiberData;           /* 10 */
+    DWORD  Version;             /* 10 */
+  } DUMMYUNIONNAME;
+  PVOID  ArbitraryUserPointer;  /* 14 */
+  struct _KPCR_TIB *Self;       /* 18 */
+} KPCR_TIB, *PKPCR_TIB;         /* 1C */
+
+#define PCR_MINOR_VERSION 1
+#define PCR_MAJOR_VERSION 1
+
+typedef struct _KPCR {
+  KPCR_TIB  Tib;                /* 00 */
+  struct _KPCR  *Self;          /* 1C */
+  struct _KPRCB  *Prcb;         /* 20 */
+  KIRQL  Irql;                  /* 24 */
+  ULONG  IRR;                   /* 28 */
+  ULONG  IrrActive;             /* 2C */
+  ULONG  IDR;                   /* 30 */
+  PVOID  KdVersionBlock;        /* 34 */
+  PUSHORT  IDT;                 /* 38 */
+  PUSHORT  GDT;                 /* 3C */
+  struct _KTSS  *TSS;           /* 40 */
+  USHORT  MajorVersion;         /* 44 */
+  USHORT  MinorVersion;         /* 46 */
+  KAFFINITY  SetMember;         /* 48 */
+  ULONG  StallScaleFactor;      /* 4C */
+  UCHAR  SpareUnused;           /* 50 */
+  UCHAR  Number;                /* 51 */
+} KPCR, *PKPCR;                 /* 54 */
+
+#if !defined(__INTERLOCKED_DECLARED)
+#define __INTERLOCKED_DECLARED
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedIncrement(
+  IN PLONG  VOLATILE  Addend);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedDecrement(
+  IN PLONG  VOLATILE  Addend);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedCompareExchange(
+  IN OUT PLONG  VOLATILE  Destination,
+  IN LONG  Exchange,
+  IN LONG  Comparand);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedExchange(
+  IN OUT PLONG  VOLATILE  Target,
+  IN LONG Value);
+
+NTOSAPI
+LONG
+DDKFASTAPI
+InterlockedExchangeAdd(
+  IN OUT PLONG VOLATILE  Addend,
+  IN LONG  Value);
+
+/*
+ * PVOID
+ * InterlockedExchangePointer(
+ *   IN OUT PVOID VOLATILE  *Target,
+ *   IN PVOID  Value)
+ */
+#define InterlockedExchangePointer(Target, Value) \
+  ((PVOID) InterlockedExchange((PLONG) Target, (LONG) Value))
+
+/*
+ * PVOID
+ * InterlockedCompareExchangePointer(
+ *   IN OUT PVOID  *Destination,
+ *   IN PVOID  Exchange,
+ *   IN PVOID  Comparand)
+ */
+#define InterlockedCompareExchangePointer(Destination, Exchange, Comparand) \
+  ((PVOID) InterlockedCompareExchange((PLONG) Destination, (LONG) Exchange, (LONG) Comparand))
+
+#endif /* !__INTERLOCKED_DECLARED */
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KefAcquireSpinLockAtDpcLevel(
+  IN PKSPIN_LOCK  SpinLock);
+
+NTOSAPI
+VOID
+DDKFASTAPI
+KefReleaseSpinLockFromDpcLevel(
+  IN PKSPIN_LOCK  SpinLock);
+
+NTHALAPI
+KIRQL
+DDKFASTAPI
+KfAcquireSpinLock(
+  IN PKSPIN_LOCK SpinLock);
+
+NTHALAPI
+VOID
+DDKFASTAPI
+KfReleaseSpinLock(
+  IN PKSPIN_LOCK SpinLock,
+  IN KIRQL NewIrql);
+
+#define KeAcquireSpinLockAtDpcLevel(SpinLock) KefAcquireSpinLockAtDpcLevel(SpinLock)
+#define KeReleaseSpinLockFromDpcLevel(SpinLock) KefReleaseSpinLockFromDpcLevel(SpinLock)
+#define KeAcquireSpinLock(a,b)  *(b) = KfAcquireSpinLock(a)
+#define KeReleaseSpinLock(a,b)  KfReleaseSpinLock(a,b)
+
+#define RtlCopyMemoryNonTemporal RtlCopyMemory
 
+#define KeGetDcacheFillSize() 1L
+
+typedef enum _INTERLOCKED_RESULT {
+  ResultNegative = -1,
+  ResultZero = 0,
+  ResultPositive = 1
+} INTERLOCKED_RESULT;
 
+typedef struct _KFLOATING_SAVE {
+    ULONG Fr[32];
+} KFLOATING_SAVE, *PKFLOATING_SAVE;
+
+static __inline
+ULONG
+DDKAPI
+KeGetCurrentProcessorNumber(VOID)
+{
+       return 0; // XXX arty fixme
+}
+#endif /* _X86_ */
 
 /*
 ** Utillity functions
@@ -8653,6 +8833,15 @@ KeMemoryBarrier(
 #endif
 }
 
+#elif defined(_PPC_)
+
+static __inline
+VOID
+KeMemoryBarrier(
+  VOID)
+{
+}
+
 #endif
 
 NTOSAPI
@@ -8959,6 +9148,35 @@ KeRaiseIrqlToSynchLevel(
 #define KeLowerIrql(a) KfLowerIrql(a)
 #define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
 
+#elif defined(_PPC_)
+
+NTHALAPI
+VOID
+FASTCALL
+KfLowerIrql(
+  IN KIRQL  NewIrql);
+
+NTHALAPI
+KIRQL
+FASTCALL
+KfRaiseIrql(
+  IN KIRQL  NewIrql);
+
+NTHALAPI
+KIRQL
+DDKAPI
+KeRaiseIrqlToDpcLevel(
+  VOID);
+  
+NTHALAPI
+KIRQL
+DDKAPI
+KeRaiseIrqlToSynchLevel(
+    VOID);
+
+#define KeLowerIrql(a) KfLowerIrql(a)
+#define KeRaiseIrql(a,b) *(b) = KfRaiseIrql(a)
+
 #else
 
 NTOSAPI
index 3ff541b..7d2682b 100644 (file)
@@ -207,6 +207,7 @@ typedef struct _SECTION_IMAGE_INFORMATION
 //
 // PTE Structures
 //
+#ifndef _M_PPC
 typedef struct _MMPTE
 {
     union
@@ -221,6 +222,12 @@ typedef struct _MMPTE
         MMPTE_LIST List;
     };
 } MMPTE, *PMMPTE;
+#else
+typedef struct _MMPTE
+{
+       ULONG Long;
+} MMPTE, *PMMPTE;
+#endif
 
 //
 // Section Information structure
index 739fb7a..548c261 100644 (file)
@@ -31,6 +31,45 @@ Author:
 #define IPI_FREEZE              3
 #define IPI_PACKET_READY        4
 #define IPI_SYNCH_REQUEST       10
+#define MAXIMUM_VECTOR          0x100
+
+#ifndef ROUND_UP
+#define ROUND_UP(x,y) (((x) + ((y)-1)) & ~((y)-1))
+#endif
+
+typedef double DOUBLE;
+
+typedef struct _FX_SAVE_AREA {
+    ULONG Fr[32];
+} FX_SAVE_AREA;
+
+typedef struct _LDT_ENTRY {
+    USHORT LimitLow;
+    USHORT BaseLow;
+    union
+    {
+        struct
+        {
+            UCHAR BaseMid;
+            UCHAR Flags1;
+            UCHAR Flags2;
+            UCHAR BaseHi;
+        } Bytes;
+        struct
+        {
+            ULONG BaseMid : 8;
+            ULONG Type : 5;
+            ULONG Dpl : 2;
+            ULONG Pres : 1;
+            ULONG LimitHi : 4;
+            ULONG Sys : 1;
+            ULONG Reserved_0 : 1;
+            ULONG Default_Big : 1;
+            ULONG Granularity : 1;
+            ULONG BaseHi : 8;
+        } Bits;
+    } HighWord;
+} LDT_ENTRY;
 
 //
 // Trap Frame Definition
@@ -42,7 +81,7 @@ typedef struct _KTRAP_FRAME
     UCHAR PreviousMode;\r
     UCHAR SavedApcStateIndex;\r
     UCHAR SavedKernelApcDisable;\r
-    UCHAR ExceptionRecord[ROUND_UP(sizeof(EXCEPTION_RECORD), ULONGLONG];\r
+    UCHAR ExceptionRecord[ROUND_UP(sizeof(EXCEPTION_RECORD), sizeof(ULONGLONG))];\r
     ULONG FILL2;\r
     ULONG Gpr0;\r
     ULONG Gpr1;\r
@@ -403,7 +442,8 @@ typedef struct _KIPCR
 //
 // TSS Definition
 //
-typedef struct _KTSS, KTSS, *PKTSS;
+typedef struct _KTSS {
+} KTSS, *PKTSS;
 
 //
 // PowerPC Exception Frame
index 954e1c5..942d0ae 100644 (file)
@@ -1117,7 +1117,11 @@ typedef struct _EPROCESS
 #endif
     union
     {
+#ifdef _M_IX86
         HARDWARE_PTE_X86 PagedirectoryPte;
+#else
+       HARDWARE_PTE_PPC PagedirectoryPte;
+#endif
         ULONGLONG Filler;
     };
     ULONG Session;
index a668913..7e99d2c 100644 (file)
@@ -125,7 +125,7 @@ RtlAssert(
 #elif defined(_M_MIPS)
 #define ASM_BREAKPOINT "\nbreak\n"
 #else
-#error Unsupported architecture.
+#define ASM_BREAKPOINT "\ntwi 1\n"
 #endif
 
 #ifndef KEBUGCHECK
index 27d7e49..a570b1c 100644 (file)
@@ -5,6 +5,10 @@
 #define _REACTOS_ELF_MACHINE_IS_TARGET
 #include <elf/elf-i386.h>
 #undef _REACTOS_ELF_MACHINE_IS_TARGET
+#elif defined(_M_PPC)
+#define _REACTOS_ELF_MACHINE_IS_TARGET
+#include <elf/elf-powerpc.h>
+#undef _REACTOS_ELF_MACHINE_IS_TARGET
 #else
 #error Unsupported target architecture
 #endif
index c7096b4..575c7cf 100644 (file)
@@ -34,6 +34,13 @@ typedef struct __SEHJmpBuf
  unsigned long JB_Edi;
 }
 _SEHJmpBuf_t[1];
+#elif defined(_M_PPC)
+typedef struct __SEHJmpBuf
+{
+ unsigned long R[32];
+ unsigned long LR, CTR;
+}
+_SEHJmpBuf_t[1];
 #endif
 
 #ifdef __cplusplus
index 04e8336..e13dfa8 100644 (file)
@@ -5,6 +5,10 @@
 #error Header intended for use by NTOSKRNL/WIN32K only!
 #endif
 
+#if defined(_M_PPC)
+extern ULONG_PTR MmUserProbeAddress;
+#endif
+
 static const UNICODE_STRING __emptyUnicodeString = {0};
 static const LARGE_INTEGER __emptyLargeInteger = {{0, 0}};
 static const ULARGE_INTEGER __emptyULargeInteger = {{0, 0}};
index bfaab02..f793c8d 100644 (file)
@@ -1838,6 +1838,9 @@ typedef struct _CONTEXT {
        DWORD Dr6;
        DWORD Dr7;
 } CONTEXT;
+typedef struct _FLOATING_SAVE_AREA {
+       DWORD Fr[32];
+} FLOATING_SAVE_AREA;
 #elif defined(_ALPHA_)
 #define CONTEXT_ALPHA  0x20000
 #define CONTEXT_CONTROL        (CONTEXT_ALPHA|1L)
@@ -3699,16 +3702,21 @@ typedef struct _OBJECT_TYPE_LIST {
 
 static __inline__ PVOID GetCurrentFiber(void)
 {
+#ifdef _X86_
     void* ret;
     __asm__ __volatile__ (
        "movl   %%fs:0x10,%0"
        : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
        );
     return ret;
+#elif defined(_PPC_)
+       return NULL;
+#endif
 }
 
 static __inline__ struct _TEB * NtCurrentTeb(void)
 {
+#ifdef _X86_
     struct _TEB *ret;
 
     __asm__ __volatile__ (
@@ -3718,6 +3726,9 @@ static __inline__ struct _TEB * NtCurrentTeb(void)
     );
 
     return ret;
+#elif defined(_PPC_)
+    return NULL;
+#endif
 }
 
 #elif defined(__WATCOMC__)
@@ -3778,13 +3789,14 @@ InterlockedBitTestAndSet(IN LONG *Base,
                          IN LONG Bit)
 {
        LONG OldBit;
-
+#ifdef _M_IX86
        __asm__ __volatile__("lock "
                             "btsl %2,%1\n\t"
                             "sbbl %0,%0\n\t"
                             :"=r" (OldBit),"=m" (*Base)
                             :"Ir" (Bit)
                             : "memory");
+#endif
        return OldBit;
 }
 
@@ -3793,19 +3805,24 @@ InterlockedBitTestAndReset(IN LONG *Base,
                           IN LONG Bit)
 {
        LONG OldBit;
-
+#ifdef _M_IX86
        __asm__ __volatile__("lock "
                             "btrl %2,%1\n\t"
                             "sbbl %0,%0\n\t"
                             :"=r" (OldBit),"=m" (*Base)
                             :"Ir" (Bit)
                             : "memory");
+#endif
        return OldBit;
 }
 
 #endif
 
+#ifdef _M_IX86
 #define YieldProcessor() __asm__ __volatile__("pause");
+#elif defined(_M_PPC)
+#define YieldProcessor() __asm__("ori 0,0,0");
+#endif
 
 #if defined(_AMD64_)
 #if defined(_M_AMD64)
index f998344..7cb15cf 100644 (file)
@@ -38,7 +38,8 @@
          *     return PC
          */
 
-.globl _longjmp
+#ifdef _M_IX86
+       .globl _longjmp
 _longjmp:
         pushl   %ebp
         movl    %esp,%ebp
@@ -69,4 +70,8 @@ _longjmp:
          */
         
         jmpl    *20(%ecx)
-       
+#else
+       .globl _longjmp
+_longjmp:
+       blr
+#endif
index 885908e..2d310dc 100644 (file)
@@ -37,7 +37,8 @@
          *     ptr to jmp_buf
          *     return PC
          */
-.globl _setjmp
+#ifdef _M_IX86
+       .globl _setjmp
 _setjmp:       
         pushl   %ebp
         movl    %esp,%ebp
@@ -56,4 +57,8 @@ _setjmp:
         xorl    %eax,%eax               /* return 0 the first time */
         leave
         ret
-
+#else
+       .globl _setjmp
+_setjmp:
+       blr
+#endif
index 15e9642..29ae456 100644 (file)
@@ -1,8 +1,16 @@
 <module name="pseh" type="staticlibrary">
        <define name="__USE_W32API" />
-       <directory name="i386">
-               <file>framebased.asm</file>
-               <file>setjmp.asm</file>
-       </directory>
+       <if property='ARCH' value='i386'>
+               <directory name="i386">
+                       <file>framebased.asm</file>
+                       <file>setjmp.asm</file>
+               </directory>
+       </if>
+       <if property='ARCH' value='powerpc'>
+               <directory name="powerpc">
+                       <file>framebased.s</file>
+                       <file>setjmp.s</file>
+               </directory>
+       </if>
        <file>framebased.c</file>
 </module>
index 6f18c35..8487f9d 100644 (file)
@@ -104,7 +104,11 @@ RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo,
   if (RosSymInfo->Symbols == NULL || RosSymInfo->SymbolsCount == 0 ||
       RosSymInfo->Strings == NULL || RosSymInfo->StringsLength == 0)
     {
+#ifdef _X86_
 __asm__("int $3\n");
+#elif defined(_PPC_)
+__asm__("twi 0,0,0\n");
+#endif
       DPRINT1("Uninitialized RosSymInfo\n");
       return FALSE;
     }
index d420a85..d9d0cf1 100644 (file)
@@ -962,6 +962,7 @@ int HEAP_IsInsideHeap(
 
 void DumpStackFrames ( PULONG Frame, ULONG FrameCount )
 {
+#ifdef _M_IX86
        ULONG i=0;
 
        DbgPrint("Frames: ");
@@ -983,6 +984,7 @@ void DumpStackFrames ( PULONG Frame, ULONG FrameCount )
                DbgPrint(" ");
        }
        DbgPrint("\n");
+#endif
 }
 
 /***********************************************************************
index 9923dbc..6789b24 100644 (file)
@@ -365,7 +365,7 @@ RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
    DPRINT("RtlResetRtlTranslations() called\n");
 
    /* Set ANSI data */
-   NlsAnsiToUnicodeTable = NlsTable->AnsiTableInfo.MultiByteTable;
+   NlsAnsiToUnicodeTable = (void *)NlsTable->AnsiTableInfo.MultiByteTable;
    NlsUnicodeToAnsiTable = NlsTable->AnsiTableInfo.WideCharTable;
    NlsDbcsUnicodeToAnsiTable = (PWCHAR)NlsTable->AnsiTableInfo.WideCharTable;
    NlsMbCodePageTag = (NlsTable->AnsiTableInfo.DBCSCodePage != 0);
@@ -374,7 +374,7 @@ RtlResetRtlTranslations(IN PNLSTABLEINFO NlsTable)
    DPRINT("Ansi codepage %hu\n", NlsAnsiCodePage);
 
    /* Set OEM data */
-   NlsOemToUnicodeTable = NlsTable->OemTableInfo.MultiByteTable;
+   NlsOemToUnicodeTable = (void *)NlsTable->OemTableInfo.MultiByteTable;
    NlsUnicodeToOemTable = NlsTable->OemTableInfo.WideCharTable;
    NlsDbcsUnicodeToOemTable = (PWCHAR)NlsTable->OemTableInfo.WideCharTable;
    NlsMbOemCodePageTag = (NlsTable->OemTableInfo.DBCSCodePage != 0);
index f9c1e11..d81ee30 100644 (file)
@@ -73,7 +73,9 @@ InitSystemSharedUserPage (PCSZ ParameterLine)
     *   The shared user page has been zeroed-out right after creation.
     *   There is NO need to do this again.
     */
+#ifdef _M_IX86
     Ki386SetProcessorFeatures();
+#endif
 
     /* Set the Version Data */
     SharedUserData->NtProductType = NtProductWinNt;
@@ -238,6 +240,7 @@ VOID
 STDCALL
 ExecuteRuntimeAsserts(VOID)
 {
+#ifdef _M_IX86
     /*
      * Fail at runtime if someone has changed various structures without
      * updating the offsets used for the assembler code.
@@ -265,6 +268,7 @@ ExecuteRuntimeAsserts(VOID)
     ASSERT(FIELD_OFFSET(KTSS, Esp0) == KTSS_ESP0);
     ASSERT(FIELD_OFFSET(KTSS, IoMapBase) == KTSS_IOMAPBASE);
     ASSERT(sizeof(FX_SAVE_AREA) == SIZEOF_FX_SAVE_AREA);
+#endif
 }
 
 __inline
index 3dd62db..acdc62c 100644 (file)
@@ -36,7 +36,9 @@ KiHaltProcessorDpcRoutine(IN PKDPC Dpc,
    while (TRUE)
      {
        KfRaiseIrql(SYNCH_LEVEL);
+#ifdef _M_IX86
        Ke386HaltProcessor();
+#endif
      }
 }
 
index b9dc72c..9dd9a19 100644 (file)
@@ -1646,8 +1646,9 @@ NtFlushInstructionCache (
        )
 {
         PAGED_CODE();
-
+#ifdef _M_IX86
        __asm__("wbinvd\n");
+#endif
        return STATUS_SUCCESS;
 }
 
index 8cdcf9c..d71629c 100644 (file)
@@ -21,6 +21,8 @@
 
 #ifdef _M_IX86
 #include "../i386/ke.h"
+#elif defined(_M_PPC)
+#include "../powerpc/ke.h"
 #else
 #error "Unknown processor"
 #endif
index aded673..ba71467 100644 (file)
@@ -21,6 +21,8 @@
 
 #ifdef _M_IX86
 #include <internal/i386/mm.h>
+#elif defined(_M_PPC)
+#include <internal/powerpc/mm.h>
 #else
 #error "Unknown processor"
 #endif
index c10edcb..014124f 100644 (file)
@@ -4,6 +4,9 @@
 #ifdef _M_IX86
 #define KiArchContextSwitch          KiSwapContext
 #define KiArchInitThreadWithContext  Ke386InitThreadWithContext
+#elif defined(_M_PPC)
+#define KiArchContextSwitch         KiSwapContext
+#define KiArchInitThreadWithContext  KePPCInitThreadWithContext
 #else
 #error "Unknown processor"
 #endif
index 8eb5cfb..ff149a0 100644 (file)
@@ -16,6 +16,7 @@ extern POBJECT_TYPE ExEventPairObjectType;
   EX_HANDLE_ENTRY_AUDITONCLOSE)))
 
 /* Note: we only use a spinlock on SMP. On UP, we cli/sti intead */
+#ifdef _M_IX86
 #ifndef CONFIG_SMP
 #define ExAcquireResourceLock(l, i) { \
     (void)i; \
@@ -25,6 +26,11 @@ extern POBJECT_TYPE ExEventPairObjectType;
 #else
 #define ExAcquireResourceLock(l, i) KeAcquireSpinLock(l, i);
 #define ExReleaseResourceLock(l, i) KeReleaseSpinLock(l, i);
+#endif /* CONFIG_SMP */
+#elif defined(_M_PPC) /* _M_IX86 */
+/* XXX arty fixme */
+#define ExAcquireResourceLock(l,i) KeAcquireSpinLock(l,i);
+#define ExReleaseResourceLock(l,i) KeReleaseSpinLock(l,i);
 #endif
 
 /* INITIALIZATION FUNCTIONS *************************************************/
index 65b6e2b..2fa20e4 100644 (file)
 #ifdef _NTOSKRNL_
 
 #include "ke.h"
+#ifdef _M_IX86
 #include "i386/mm.h"
 #include "i386/fpu.h"
 #include "i386/v86m.h"
+#elif defined(_M_PPC)
+#include "powerpc/mm.h"
+#else
+#error "Unknown CPU"
+#endif
 #include "ob.h"
 #include "mm.h"
 #include "ps.h"
@@ -247,7 +253,8 @@ DefaultQueryInfoBufferCheck(UINT Class,
 /* on Itanium if the 24 most significant bits are set, we're not dealing with
    offsets anymore. */
 #define IsPointerOffset(Ptr)  (((ULONG_PTR)(Ptr) & 0xFFFFFF0000000000ULL) == 0)
-
+#elif defined(_PPC_)
+#define IsPointerOffset(Ptr) ((LONG_PTR)(Ptr) >= 0)
 #else
 #error IsPointerOffset() needs to be defined for this architecture
 #endif
index a297360..cfa1416 100644 (file)
@@ -126,11 +126,53 @@ __asm__ __volatile__("mfmsr 0\n\t" \
 
 #define KePPCHaltProcessor()     ;
 
-#endif /* __ASM__ */
-
 #define KeArchEraseFlags()
 #define KeArchDisableInterrupts() KePPCDisableInterrupts()
 
+static __inline struct _KPRCB * KeGetCurrentPrcb(
+  VOID)
+{
+  ULONG Value = 0;
+  return (struct _KPRCB *) Value;
+}
+
+static __inline KIRQL KeGetCurrentIrql(
+    VOID)
+{
+    return PASSIVE_LEVEL;
+}
+
+VOID
+STDCALL
+KePPCInitThreadWithContext(
+       PKTHREAD Thread,
+       PKSYSTEM_ROUTINE SystemRoutine,
+       PKSTART_ROUTINE StartRoutine,
+       PVOID StartContext,
+       PCONTEXT Context);
+
+VOID
+STDCALL
+KeApplicationProcessorInitDispatcher(
+  VOID);
+
+VOID
+STDCALL
+KeCreateApplicationProcessorIdleThread(
+  ULONG Id);
+
+#ifdef _NTOSKRNL_ /* FIXME: Move flags above to NDK instead of here */
+VOID
+STDCALL
+KiThreadStartup(PKSYSTEM_ROUTINE SystemRoutine,
+                PKSTART_ROUTINE StartRoutine,
+                PVOID StartContext,
+                BOOLEAN UserThread,
+                KTRAP_FRAME TrapFrame);
+#endif
+
+#endif /* __ASM__ */
+
 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_POWERPC_KE_H */
 
 /* EOF */
index 7863df2..0f836ff 100644 (file)
@@ -775,6 +775,7 @@ IopInitiatePnpIrp(PDEVICE_OBJECT DeviceObject,
    return Status;
 }
 
+ULONG TreeTraverse = 0;
 
 NTSTATUS
 IopTraverseDeviceTreeNode(PDEVICETREE_TRAVERSE_CONTEXT Context)
@@ -782,6 +783,10 @@ IopTraverseDeviceTreeNode(PDEVICETREE_TRAVERSE_CONTEXT Context)
    PDEVICE_NODE ParentDeviceNode;
    PDEVICE_NODE ChildDeviceNode;
    NTSTATUS Status;
+   ULONG Indent = TreeTraverse;
+
+   while( Indent-- ) DbgPrint(" ");
+   DPRINT1("Checking device node 0x%x\n", Context->DeviceNode);
 
    /* Copy context data so we don't overwrite it in subsequent calls to this function */
    ParentDeviceNode = Context->DeviceNode;
@@ -793,6 +798,8 @@ IopTraverseDeviceTreeNode(PDEVICETREE_TRAVERSE_CONTEXT Context)
       return Status;
    }
 
+   TreeTraverse++;
+       
    /* Traversal of all children nodes */
    for (ChildDeviceNode = ParentDeviceNode->Child;
         ChildDeviceNode != NULL;
@@ -804,10 +811,19 @@ IopTraverseDeviceTreeNode(PDEVICETREE_TRAVERSE_CONTEXT Context)
       Status = IopTraverseDeviceTreeNode(Context);
       if (!NT_SUCCESS(Status))
       {
-         return Status;
+        Indent = TreeTraverse;
+        while( Indent-- ) DbgPrint(" ");
+        DPRINT1("Device node 0x%x done (bad)\n", Context->DeviceNode);
+        TreeTraverse--;
+        return Status;
       }
    }
 
+   Indent = TreeTraverse;
+   while( Indent-- ) DbgPrint(" ");
+   DPRINT1("Device node 0x%x done (good)\n", Context->DeviceNode);
+
+   TreeTraverse--;
    return Status;
 }
 
index 88b5e04..126914d 100644 (file)
@@ -198,7 +198,11 @@ KeEnterKernelDebugger(VOID)
     KdEnteredDebugger = TRUE;
 
     /* Halt the CPU */
+#ifdef _M_IX86
     for (;;) Ke386HaltProcessor();
+#elif defined(_M_PPC)
+    for (;;);
+#endif
 }
 
 /*
index 64047de..8c6c174 100644 (file)
@@ -129,6 +129,7 @@ typedef struct _CPU_REGISTER
 
 static CPU_REGISTER GspRegisters[NUMREGS] =
 {
+#ifdef _M_IX86
   { 4, FIELD_OFFSET(KTRAP_FRAME, Eax), FIELD_OFFSET(CONTEXT, Eax), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Ecx), FIELD_OFFSET(CONTEXT, Ecx), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, Edx), FIELD_OFFSET(CONTEXT, Edx), FALSE },
@@ -145,6 +146,7 @@ static CPU_REGISTER GspRegisters[NUMREGS] =
   { 4, FIELD_OFFSET(KTRAP_FRAME, SegEs), FIELD_OFFSET(CONTEXT, SegEs), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, SegFs), FIELD_OFFSET(CONTEXT, SegFs), TRUE },
   { 4, FIELD_OFFSET(KTRAP_FRAME, SegGs), FIELD_OFFSET(CONTEXT, SegGs), TRUE }
+#endif
 };
 
 static PCHAR GspThreadStates[DeferredReady+1] =
@@ -563,8 +565,12 @@ GspLong2Hex(PCHAR *Address,
 static LONG
 GspGetEspFromTrapFrame(PKTRAP_FRAME TrapFrame)
 {
+#ifdef _M_IX86
   return KeGetPreviousMode() == KernelMode
          ? (LONG) &TrapFrame->HardwareEsp : (LONG)TrapFrame->HardwareEsp;
+#elif defined(_M_PPC)
+  return 0;
+#endif
 }
 
 
@@ -613,12 +619,14 @@ GspGetRegisters(PCHAR Address,
               case ESP:
                 Value = (ULONG_PTR) (KernelStack + 8);
                 break;
+#ifdef _M_IX86
               case CS:
                 Value = KGDT_R0_CODE;
                 break;
               case DS:
                 Value = KGDT_R0_DATA;
                 break;
+#endif
               default:
                 Value = 0;
                 break;
@@ -1332,12 +1340,16 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
       DPRINT("Thread %p acquired mutex\n", PsGetCurrentThread());
 
       /* Disable hardware debugging while we are inside the stub */
+#ifdef _M_IX86
 #if defined(__GNUC__)
       __asm__("movl %0,%%db7" : /* no output */ : "r" (0));
 #elif defined(_MSC_VER)
       __asm mov eax, 0  __asm mov dr7, eax
 #else
 #error Unknown compiler for inline assembler
+#endif
+#elif defined(_M_PPC)
+       /* XXX arty fixme */
 #endif
 
       GspUnloadBreakpoints(TrapFrame);
@@ -1373,6 +1385,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
           ptr = GspMem2Hex((PCHAR) &Esp, ptr, 4, 0);
           *ptr++ = ';';
   
+#ifdef _M_IX86
           *ptr++ = HexChars[EBP];
           *ptr++ = ':';
           ptr = GspMem2Hex((PCHAR) &TrapFrame->Ebp, ptr, 4, 0);       /* FP */
@@ -1382,6 +1395,7 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
           *ptr++ = ':';
           ptr = GspMem2Hex((PCHAR) &TrapFrame->Eip, ptr, 4, 0);        /* PC */
           *ptr++ = ';';
+#endif
 
           *ptr = '\0';
 
@@ -1558,12 +1572,16 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
                     Context->EFlags |= 0x100;
                   }
 
+#ifdef _M_IX86
 #if defined(__GNUC__)
                 asm volatile ("movl %%db6, %0\n" : "=r" (dr6_) : );
 #elif defined(_MSC_VER)
                 __asm mov eax, dr6  __asm mov dr6_, eax;
 #else
 #error Unknown compiler for inline assembler
+#endif
+#elif defined(_M_PPC)
+               /* XXX arty fixme */
 #endif
                 if (!(dr6_ & 0x4000))
                   {
@@ -1581,12 +1599,16 @@ KdpGdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
                       }
                   }
                 GspLoadBreakpoints(TrapFrame);
+#ifdef _M_IX86
 #if defined(__GNUC__)
                 asm volatile ("movl %0, %%db6\n" : : "r" (0));
 #elif defined(_MSC_VER)
                 __asm mov eax, 0  __asm mov dr6, eax;
 #else
 #error Unknown compiler for inline assembler
+#endif
+#elif defined(_M_PPC)
+               /* XXX arty fixme */
 #endif
 
                 if (NULL != GspDbgThread)
index a367aee..4f02df5 100644 (file)
@@ -908,8 +908,10 @@ KiInitializeUserApc(IN PKEXCEPTION_FRAME ExceptionFrame,
     DPRINT("KiInitializeUserApc(TrapFrame %x/%x)\n", TrapFrame,
             KeGetCurrentThread()->TrapFrame);
 
+#ifdef _M_IX86
     /* Don't deliver APCs in V86 mode */
     if (TrapFrame->EFlags & X86_EFLAGS_VM) return;
+#endif
 
     /* Save the full context */
     Context.ContextFlags = CONTEXT_FULL | CONTEXT_DEBUG_REGISTERS;
@@ -928,9 +930,11 @@ KiInitializeUserApc(IN PKEXCEPTION_FRAME ExceptionFrame,
                       &Context,
                       sizeof(CONTEXT));
 
+#ifdef _M_IX86
         /* Run at APC dispatcher */
         TrapFrame->Eip = (ULONG)KeUserApcDispatcher;
         TrapFrame->HardwareEsp = Stack;
+#endif
 
         /* Setup the stack */
         *(PULONG_PTR)(Stack + 0 * sizeof(ULONG_PTR)) = (ULONG_PTR)NormalRoutine;
index d471ca4..b6c09d5 100644 (file)
@@ -35,7 +35,9 @@ static LIST_ENTRY BugcheckCallbackListHead = {NULL,NULL};
 static LIST_ENTRY BugcheckReasonCallbackListHead = {NULL,NULL};
 static ULONG InBugCheck;
 static PRTL_MESSAGE_RESOURCE_DATA KiBugCodeMessages;
+#ifdef _M_IX86
 static ULONG KeBugCheckCount = 1;
+#endif
 
 /* FUNCTIONS *****************************************************************/
 
@@ -298,6 +300,7 @@ KeBugCheckWithTf(ULONG BugCheckCode,
                  ULONG BugCheckParameter4,
                  PKTRAP_FRAME Tf)
 {
+#ifdef _M_IX86
     KIRQL OldIrql;
     BOOLEAN GotExtendedCrashInfo = FALSE;
     PVOID Address = 0;
@@ -469,6 +472,9 @@ KeBugCheckWithTf(ULONG BugCheckCode,
 
     /* Halt this CPU now */
     for (;;) Ke386HaltProcessor();
+#elif defined(_M_PPC)
+    for (;;);
+#endif
 }
 
 /*
index 29a27cd..7a5171b 100644 (file)
@@ -260,6 +260,7 @@ KeUpdateRunTime(
    CurrentThread = Prcb->CurrentThread;
    CurrentProcess = CurrentThread->ApcState.Process;
 
+#ifdef _M_IX86
    /*
     * Cs bit 0 is always set for user mode if we are in protected mode.
     * V86 mode is counted as user time.
@@ -288,6 +289,7 @@ KeUpdateRunTime(
          Prcb->KernelTime++;
       }
    }
+#endif
 
 #if 0
    DpcLastCount = Prcb->DpcLastCount;
@@ -341,6 +343,7 @@ KeUpdateSystemTime(
  * FUNCTION: Handles a timer interrupt
  */
 {
+#ifdef _M_IX86
    LARGE_INTEGER Time;
 
    ASSERT(KeGetCurrentIrql() == PROFILE_LEVEL);
@@ -378,6 +381,7 @@ KeUpdateSystemTime(
     * Queue a DPC that will expire timers
     */
    KeInsertQueueDpc(&KiExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
+#endif
 }
 
 /*
index 5ca1616..40b8f84 100644 (file)
@@ -441,7 +441,7 @@ KiQuantumEnd(VOID)
     /* Set DPC Event if requested */
     if (Prcb->DpcSetEventRequest)
     {
-        KeSetEvent(&Prcb->DpcEvent, 0, 0);
+        KeSetEvent((void *)&Prcb->DpcEvent, 0, 0);
     }
 
     /* Check if Quantum expired */
index a43593a..e95d5be 100644 (file)
@@ -33,7 +33,9 @@ KiIpiSendRequest(KAFFINITY TargetSet, ULONG IpiRequest)
       if (TargetSet & Current)
       {
          Pcr = (PKPCR)(KPCR_BASE + i * PAGE_SIZE);
+#ifdef _M_IX86
         Ke386TestAndSetBit(IpiRequest, &Pcr->Prcb->IpiFrozen);
+#endif
         HalRequestIpi(i);
       }
    }
@@ -48,8 +50,10 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
                     IN PVOID ExceptionFrame)
 {
 #ifdef DBG
+#ifdef _M_IX86
    LARGE_INTEGER StartTime, CurrentTime, Frequency;
    ULONG Count = 5;
+#endif
 #endif
    PKPRCB Prcb;
 
@@ -59,6 +63,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
 
    Prcb = KeGetCurrentPrcb();
 
+#ifdef _M_IX86
    if (Ke386TestAndClearBit(IPI_APC, &Prcb->IpiFrozen))
    {
       HalRequestSoftwareInterrupt(APC_LEVEL);
@@ -111,6 +116,7 @@ KiIpiServiceRoutine(IN PKTRAP_FRAME TrapFrame,
       }
       (void)InterlockedExchangePointer(&Prcb->SignalDone, NULL);
    }
+#endif
    DPRINT("KiIpiServiceRoutine done\n");
    return TRUE;
 }
@@ -140,11 +146,13 @@ KiIpiSendPacket(KAFFINITY TargetSet, VOID (STDCALL*WorkerRoutine)(PVOID), PVOID
        {
          Prcb = ((PKPCR)(KPCR_BASE + i * PAGE_SIZE))->Prcb;
          while(0 != InterlockedCompareExchangeUL(&Prcb->SignalDone, (LONG)CurrentPrcb, 0));
+#ifdef _M_IX86
          Ke386TestAndSetBit(IPI_SYNCH_REQUEST, &Prcb->IpiFrozen);
          if (Processor != CurrentPrcb->SetMember)
          {
             HalRequestIpi(i);
          }
+#endif
        }
     }
     if (TargetSet & CurrentPrcb->SetMember)
index 145e6b6..f49054c 100644 (file)
@@ -885,7 +885,9 @@ KeInitializeThread(PKPROCESS Process,
     Thread->UserAffinity = Process->Affinity;
     Thread->DisableBoost = Process->DisableBoost;
     Thread->AutoAlignment = Process->AutoAlignment;
+#ifdef _M_IX86
     Thread->Iopl = Process->Iopl;
+#endif
 
     /* Set the Thread to initalized */
     Thread->State = Initialized;
index 01cfd81..d76371f 100644 (file)
@@ -18,7 +18,6 @@
 
 #define BUILD_OSCSDVERSION(major, minor) (((major & 0xFF) << 8) | (minor & 0xFF))
 
-
 ULONG NtMajorVersion = 5;
 ULONG NtMinorVersion = 0;
 ULONG NtOSCSDVersion = BUILD_OSCSDVERSION(4, 0);
index 8631d2f..faa1f06 100644 (file)
@@ -133,7 +133,9 @@ KeInitializeProcess(PKPROCESS Process,
     Process->QuantumReset = 6;
     Process->DirectoryTableBase = DirectoryTableBase;
     Process->AutoAlignment = TRUE;
+#ifdef _M_IX86
     Process->IopmOffset = 0xFFFF;
+#endif
     Process->State = ProcessInMemory;
 
     /* Initialize the Thread List */
@@ -176,8 +178,10 @@ NTAPI
 KiSwapProcess(PKPROCESS NewProcess,
               PKPROCESS OldProcess)
 {
+#ifdef _M_IX86
     DPRINT("Switching CR3 to: %x\n", NewProcess->DirectoryTableBase.u.LowPart);
     Ke386SetPageTableDirectory(NewProcess->DirectoryTableBase.u.LowPart);
+#endif
 }
 
 /*
index 1ebea23..787d078 100644 (file)
@@ -226,6 +226,7 @@ KiParseProfileList(IN PKTRAP_FRAME TrapFrame,
                    IN KPROFILE_SOURCE Source,
                    IN PLIST_ENTRY ListHead)
 {
+#ifdef _M_IX86
     PULONG BucketValue;
     PKPROFILE Profile;
 
@@ -248,6 +249,7 @@ KiParseProfileList(IN PKTRAP_FRAME TrapFrame,
         /* Increment the value */
         ++BucketValue;
     }
+#endif
 }
 
 /*
index 26f72f8..084fa79 100644 (file)
@@ -548,6 +548,7 @@ MmDumpToPagingFile(ULONG BugCode,
    Headers->Type = MmCoreDumpType;
    if (TrapFrame != NULL)
    {
+#ifdef _M_IX86
       if (!(TrapFrame->EFlags & (1 << 17)))
       {
          memcpy(&Headers->TrapFrame, TrapFrame,
@@ -555,8 +556,11 @@ MmDumpToPagingFile(ULONG BugCode,
       }
       else
       {
+#endif
          memcpy(&Headers->TrapFrame, TrapFrame, sizeof(KTRAP_FRAME));
+#ifdef _M_IX86
       }
+#endif
    }
    Headers->BugCheckCode = BugCode;
    Headers->BugCheckParameters[0] = BugCodeParameter1;
index 6d1ebd1..7bd853f 100644 (file)
@@ -1510,3 +1510,4 @@ wcsspn
 wcsstr
 wcstombs
 wctomb
+KeDumpStackFrames@4
\ No newline at end of file
index 3992b2f..a19bac8 100644 (file)
                                <file>v86m_sup.S</file>
                                <file>vdm.c</file>
                        </directory>
+               </if>
+               <if property="ARCH" value="powerpc">
+                       <directory name="powerpc">
+                               <file first="true">main_asm.S</file>
+                       </directory>
                </if>
                        <file>apc.c</file>
                        <file>bug.c</file>
index c8fbb77..05773f8 100644 (file)
@@ -56,12 +56,14 @@ PspGetOrSetContextKernelRoutine(PKAPC Apc,
     Event = &GetSetContext->Event;
     Mode = GetSetContext->Mode;
 
+#ifdef _M_IX86
     if (TrapFrame->SegCs == KGDT_R0_CODE && Mode != KernelMode)
     {
         GetSetContext->Status = STATUS_ACCESS_DENIED;
     }
     else
     {
+#endif
         /* Check if it's a set or get */
         if (*SystemArgument1) {
             /* Get the Context */
@@ -71,7 +73,9 @@ PspGetOrSetContextKernelRoutine(PKAPC Apc,
             KeContextToTrapFrame(Context, NULL, TrapFrame, Context->ContextFlags, Mode);
         }
         GetSetContext->Status = STATUS_SUCCESS;
+#ifdef _M_IX86
     }
+#endif
 
     /* Notify the Native API that we are done */
     KeSetEvent(Event, IO_NO_INCREMENT, FALSE);
index 2b1d39c..fe43e7b 100644 (file)
@@ -45,7 +45,11 @@ PsIdleThreadMain(PVOID Context)
 
        NtYieldExecution();
 
+#ifdef _M_IX86
        Ke386HaltProcessor();
+#elif defined(_M_PPC)
+       for(;;);
+#endif
      }
 }
 
index d1b32f6..49f52c9 100644 (file)
@@ -199,7 +199,9 @@ PsInitProcessManagment(VOID)
    RtlZeroMemory(PsIdleProcess, sizeof(EPROCESS));
 
    PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
+#ifdef _M_IX86
    PsIdleProcess->Pcb.IopmOffset = 0xffff;
+#endif
    PsIdleProcess->Pcb.BasePriority = PROCESS_PRIORITY_IDLE;
    PsIdleProcess->Pcb.QuantumReset = 6;
    InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead);
@@ -243,7 +245,9 @@ PsInitProcessManagment(VOID)
 #else
    PsInitialSystemProcess->Pcb.Affinity = KeActiveProcessors;
 #endif   
+#ifdef _M_IX86
    PsInitialSystemProcess->Pcb.IopmOffset = 0xffff;
+#endif
    PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIORITY_NORMAL;
    PsInitialSystemProcess->Pcb.QuantumReset = 6;
    InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);