Author: arty Date: Sun Jun 25 01:34:12 2006 New Revision: 22592
URL: http://svn.reactos.org/svn/reactos?rev=22592&view=rev Log: ReactOS PowerPC WIP. This will be edited and merged, and likely shrunk. Hacks will be removed and indeed your favorite assembly snippet will eventually not be just 'blr', so please *don't panic*.
Modified: branches/powerpc/reactos/Makefile branches/powerpc/reactos/ReactOS-ppc.rbuild branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c branches/powerpc/reactos/boot/freeldr/freeldr/drivemap.c branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h branches/powerpc/reactos/hal/hal/hal.c branches/powerpc/reactos/include/ddk/ndis.h branches/powerpc/reactos/include/ddk/winddk.h branches/powerpc/reactos/include/ndk/mmtypes.h branches/powerpc/reactos/include/ndk/powerpc/ketypes.h branches/powerpc/reactos/include/ndk/pstypes.h branches/powerpc/reactos/include/reactos/debug.h branches/powerpc/reactos/include/reactos/elf/machine.h branches/powerpc/reactos/include/reactos/libs/pseh/setjmp.h branches/powerpc/reactos/include/reactos/probe.h branches/powerpc/reactos/include/winnt.h branches/powerpc/reactos/lib/kjs/ksrc/longjmp.S branches/powerpc/reactos/lib/kjs/ksrc/setjmp.S branches/powerpc/reactos/lib/pseh/pseh.rbuild branches/powerpc/reactos/lib/rossym/find.c branches/powerpc/reactos/lib/rtl/heap.c branches/powerpc/reactos/lib/rtl/nls.c branches/powerpc/reactos/ntoskrnl/ex/init.c branches/powerpc/reactos/ntoskrnl/ex/power.c branches/powerpc/reactos/ntoskrnl/ex/sysinfo.c branches/powerpc/reactos/ntoskrnl/include/internal/arch/ke.h branches/powerpc/reactos/ntoskrnl/include/internal/arch/mm.h branches/powerpc/reactos/ntoskrnl/include/internal/arch/ps.h branches/powerpc/reactos/ntoskrnl/include/internal/ex.h branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h branches/powerpc/reactos/ntoskrnl/include/internal/powerpc/ke.h branches/powerpc/reactos/ntoskrnl/io/pnpmgr.c branches/powerpc/reactos/ntoskrnl/kd/kdmain.c branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c branches/powerpc/reactos/ntoskrnl/ke/apc.c branches/powerpc/reactos/ntoskrnl/ke/bug.c branches/powerpc/reactos/ntoskrnl/ke/clock.c branches/powerpc/reactos/ntoskrnl/ke/dpc.c branches/powerpc/reactos/ntoskrnl/ke/ipi.c branches/powerpc/reactos/ntoskrnl/ke/kthread.c branches/powerpc/reactos/ntoskrnl/ke/main.c branches/powerpc/reactos/ntoskrnl/ke/process.c branches/powerpc/reactos/ntoskrnl/ke/profile.c branches/powerpc/reactos/ntoskrnl/mm/pagefile.c branches/powerpc/reactos/ntoskrnl/ntoskrnl.def branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild branches/powerpc/reactos/ntoskrnl/ps/debug.c branches/powerpc/reactos/ntoskrnl/ps/idle.c branches/powerpc/reactos/ntoskrnl/ps/psmgr.c
Modified: branches/powerpc/reactos/Makefile URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/Makefile?rev=225... ============================================================================== --- branches/powerpc/reactos/Makefile (original) +++ branches/powerpc/reactos/Makefile Sun Jun 25 01:34:12 2006 @@ -376,7 +376,13 @@ $(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 \
Modified: branches/powerpc/reactos/ReactOS-ppc.rbuild URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ReactOS-ppc.rbui... ============================================================================== --- branches/powerpc/reactos/ReactOS-ppc.rbuild (original) +++ branches/powerpc/reactos/ReactOS-ppc.rbuild Sun Jun 25 01:34:12 2006 @@ -18,14 +18,14 @@ <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> @@ -41,18 +41,15 @@ <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" />
Modified: branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/boo... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s (original) +++ branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s Sun Jun 25 01:34:12 2006 @@ -6,6 +6,7 @@ .long 0 .long 0 + .globl _begin _begin: sync isync @@ -19,16 +20,18 @@ 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 @@ lis %r3,call_ofw@ha addi %r3,%r3,call_ofw - _start - b call_freeldr + blr
/* * lifted from ppc/boot/openfirmware/misc.S
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Sun Jun 25 01:34:12 2006 @@ -11,6 +11,11 @@
#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 @@ 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) {
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/drivemap.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/drivemap.c (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/drivemap.c Sun Jun 25 01:34:12 2006 @@ -171,6 +171,7 @@
VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap) { +#ifdef _M_IX86 ULONG* RealModeIVT = (ULONG*)0x00000000; USHORT* BiosLowMemorySize = (USHORT*)0x00000413;
@@ -202,6 +203,7 @@ RealModeIVT[0x13] = DriveMapHandlerSegOff;
CacheInvalidateCacheData(); +#endif DriveMapInstalled = TRUE; }
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fre... ============================================================================== --- branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h (original) +++ branches/powerpc/reactos/boot/freeldr/freeldr/include/freeldr.h Sun Jun 25 01:34:12 2006 @@ -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>
Modified: branches/powerpc/reactos/hal/hal/hal.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/hal/hal/hal.c?re... ============================================================================== --- branches/powerpc/reactos/hal/hal/hal.c (original) +++ branches/powerpc/reactos/hal/hal/hal.c Sun Jun 25 01:34:12 2006 @@ -836,13 +836,14 @@ }
#undef KeRaiseIrql -VOID -NTAPI +NTOSAPI +KIRQL +DDKAPI KeRaiseIrql( - KIRQL NewIrql, - PKIRQL OldIrql) -{ - UNIMPLEMENTED; + IN KIRQL NewIrql) +{ + UNIMPLEMENTED; + return 0; }
Modified: branches/powerpc/reactos/include/ddk/ndis.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ddk/ndis... ============================================================================== --- branches/powerpc/reactos/include/ddk/ndis.h (original) +++ branches/powerpc/reactos/include/ddk/ndis.h Sun Jun 25 01:34:12 2006 @@ -4125,7 +4125,6 @@ BOOLEAN Removing; KEVENT DpcsCompletedEvent; } NDIS_INTERRUPT, *PNDIS_INTERRUPT; -
typedef enum _NDIS_WORK_ITEM_TYPE { NdisWorkItemRequest,
Modified: branches/powerpc/reactos/include/ddk/winddk.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ddk/wind... ============================================================================== --- branches/powerpc/reactos/include/ddk/winddk.h (original) +++ branches/powerpc/reactos/include/ddk/winddk.h Sun Jun 25 01:34:12 2006 @@ -5268,9 +5268,189 @@
#define KeGetDcacheFillSize() 1L
+#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 @@ #endif }
+#elif defined(_PPC_) + +static __inline +VOID +KeMemoryBarrier( + VOID) +{ +} + #endif
NTOSAPI @@ -8931,6 +9120,35 @@ IN PLARGE_INTEGER Timeout OPTIONAL);
#if defined(_X86_) + +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) + +#elif defined(_PPC_)
NTHALAPI VOID
Modified: branches/powerpc/reactos/include/ndk/mmtypes.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ndk/mmty... ============================================================================== --- branches/powerpc/reactos/include/ndk/mmtypes.h (original) +++ branches/powerpc/reactos/include/ndk/mmtypes.h Sun Jun 25 01:34:12 2006 @@ -207,6 +207,7 @@ // // PTE Structures // +#ifndef _M_PPC typedef struct _MMPTE { union @@ -221,6 +222,12 @@ MMPTE_LIST List; }; } MMPTE, *PMMPTE; +#else +typedef struct _MMPTE +{ + ULONG Long; +} MMPTE, *PMMPTE; +#endif
// // Section Information structure
Modified: branches/powerpc/reactos/include/ndk/powerpc/ketypes.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ndk/powe... ============================================================================== --- branches/powerpc/reactos/include/ndk/powerpc/ketypes.h (original) +++ branches/powerpc/reactos/include/ndk/powerpc/ketypes.h Sun Jun 25 01:34:12 2006 @@ -31,6 +31,45 @@ #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 @@ UCHAR PreviousMode; UCHAR SavedApcStateIndex; UCHAR SavedKernelApcDisable; - UCHAR ExceptionRecord[ROUND_UP(sizeof(EXCEPTION_RECORD), ULONGLONG]; + UCHAR ExceptionRecord[ROUND_UP(sizeof(EXCEPTION_RECORD), sizeof(ULONGLONG))]; ULONG FILL2; ULONG Gpr0; ULONG Gpr1; @@ -403,7 +442,8 @@ // // TSS Definition // -typedef struct _KTSS, KTSS, *PKTSS; +typedef struct _KTSS { +} KTSS, *PKTSS;
// // PowerPC Exception Frame
Modified: branches/powerpc/reactos/include/ndk/pstypes.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/ndk/psty... ============================================================================== --- branches/powerpc/reactos/include/ndk/pstypes.h (original) +++ branches/powerpc/reactos/include/ndk/pstypes.h Sun Jun 25 01:34:12 2006 @@ -1117,7 +1117,11 @@ #endif union { +#ifdef _M_IX86 HARDWARE_PTE_X86 PagedirectoryPte; +#else + HARDWARE_PTE_PPC PagedirectoryPte; +#endif ULONGLONG Filler; }; ULONG Session;
Modified: branches/powerpc/reactos/include/reactos/debug.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/debug.h (original) +++ branches/powerpc/reactos/include/reactos/debug.h Sun Jun 25 01:34:12 2006 @@ -125,7 +125,7 @@ #elif defined(_M_MIPS) #define ASM_BREAKPOINT "\nbreak\n" #else -#error Unsupported architecture. +#define ASM_BREAKPOINT "\ntwi 1\n" #endif
#ifndef KEBUGCHECK
Modified: branches/powerpc/reactos/include/reactos/elf/machine.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/elf/machine.h (original) +++ branches/powerpc/reactos/include/reactos/elf/machine.h Sun Jun 25 01:34:12 2006 @@ -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
Modified: branches/powerpc/reactos/include/reactos/libs/pseh/setjmp.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/libs/pseh/setjmp.h (original) +++ branches/powerpc/reactos/include/reactos/libs/pseh/setjmp.h Sun Jun 25 01:34:12 2006 @@ -34,6 +34,13 @@ 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
Modified: branches/powerpc/reactos/include/reactos/probe.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/reactos/... ============================================================================== --- branches/powerpc/reactos/include/reactos/probe.h (original) +++ branches/powerpc/reactos/include/reactos/probe.h Sun Jun 25 01:34:12 2006 @@ -3,6 +3,10 @@
#if ! defined(_NTOSKRNL_) && ! defined(_WIN32K_) #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};
Modified: branches/powerpc/reactos/include/winnt.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/include/winnt.h?... ============================================================================== --- branches/powerpc/reactos/include/winnt.h (original) +++ branches/powerpc/reactos/include/winnt.h Sun Jun 25 01:34:12 2006 @@ -1838,6 +1838,9 @@ 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 @@
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 @@ );
return ret; +#elif defined(_PPC_) + return NULL; +#endif }
#elif defined(__WATCOMC__) @@ -3778,13 +3789,14 @@ 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 @@ 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)
Modified: branches/powerpc/reactos/lib/kjs/ksrc/longjmp.S URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/kjs/ksrc/lon... ============================================================================== --- branches/powerpc/reactos/lib/kjs/ksrc/longjmp.S (original) +++ branches/powerpc/reactos/lib/kjs/ksrc/longjmp.S Sun Jun 25 01:34:12 2006 @@ -38,7 +38,8 @@ * return PC */
-.globl _longjmp +#ifdef _M_IX86 + .globl _longjmp _longjmp: pushl %ebp movl %esp,%ebp @@ -69,4 +70,8 @@ */
jmpl *20(%ecx) - +#else + .globl _longjmp +_longjmp: + blr +#endif
Modified: branches/powerpc/reactos/lib/kjs/ksrc/setjmp.S URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/kjs/ksrc/set... ============================================================================== --- branches/powerpc/reactos/lib/kjs/ksrc/setjmp.S (original) +++ branches/powerpc/reactos/lib/kjs/ksrc/setjmp.S Sun Jun 25 01:34:12 2006 @@ -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 @@ xorl %eax,%eax /* return 0 the first time */ leave ret - +#else + .globl _setjmp +_setjmp: + blr +#endif
Modified: branches/powerpc/reactos/lib/pseh/pseh.rbuild URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/pseh/pseh.rb... ============================================================================== --- branches/powerpc/reactos/lib/pseh/pseh.rbuild (original) +++ branches/powerpc/reactos/lib/pseh/pseh.rbuild Sun Jun 25 01:34:12 2006 @@ -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>
Modified: branches/powerpc/reactos/lib/rossym/find.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/rossym/find.... ============================================================================== --- branches/powerpc/reactos/lib/rossym/find.c (original) +++ branches/powerpc/reactos/lib/rossym/find.c Sun Jun 25 01:34:12 2006 @@ -104,7 +104,11 @@ 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; }
Modified: branches/powerpc/reactos/lib/rtl/heap.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/rtl/heap.c?r... ============================================================================== --- branches/powerpc/reactos/lib/rtl/heap.c (original) +++ branches/powerpc/reactos/lib/rtl/heap.c Sun Jun 25 01:34:12 2006 @@ -962,6 +962,7 @@
void DumpStackFrames ( PULONG Frame, ULONG FrameCount ) { +#ifdef _M_IX86 ULONG i=0;
DbgPrint("Frames: "); @@ -983,6 +984,7 @@ DbgPrint(" "); } DbgPrint("\n"); +#endif }
/***********************************************************************
Modified: branches/powerpc/reactos/lib/rtl/nls.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/rtl/nls.c?re... ============================================================================== --- branches/powerpc/reactos/lib/rtl/nls.c (original) +++ branches/powerpc/reactos/lib/rtl/nls.c Sun Jun 25 01:34:12 2006 @@ -365,7 +365,7 @@ 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 @@ 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);
Modified: branches/powerpc/reactos/ntoskrnl/ex/init.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ex/init... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ex/init.c (original) +++ branches/powerpc/reactos/ntoskrnl/ex/init.c Sun Jun 25 01:34:12 2006 @@ -73,7 +73,9 @@ * 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 @@ 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 @@ 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
Modified: branches/powerpc/reactos/ntoskrnl/ex/power.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ex/powe... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ex/power.c (original) +++ branches/powerpc/reactos/ntoskrnl/ex/power.c Sun Jun 25 01:34:12 2006 @@ -36,7 +36,9 @@ while (TRUE) { KfRaiseIrql(SYNCH_LEVEL); +#ifdef _M_IX86 Ke386HaltProcessor(); +#endif } }
Modified: branches/powerpc/reactos/ntoskrnl/ex/sysinfo.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ex/sysi... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ex/sysinfo.c (original) +++ branches/powerpc/reactos/ntoskrnl/ex/sysinfo.c Sun Jun 25 01:34:12 2006 @@ -1646,8 +1646,9 @@ ) { PAGED_CODE(); - +#ifdef _M_IX86 __asm__("wbinvd\n"); +#endif return STATUS_SUCCESS; }
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/arch/ke.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/arch/ke.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/arch/ke.h Sun Jun 25 01:34:12 2006 @@ -21,6 +21,8 @@
#ifdef _M_IX86 #include "../i386/ke.h" +#elif defined(_M_PPC) +#include "../powerpc/ke.h" #else #error "Unknown processor" #endif
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/arch/mm.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/arch/mm.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/arch/mm.h Sun Jun 25 01:34:12 2006 @@ -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
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/arch/ps.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/arch/ps.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/arch/ps.h Sun Jun 25 01:34:12 2006 @@ -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
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/ex.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/ex.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/ex.h Sun Jun 25 01:34:12 2006 @@ -16,6 +16,7 @@ 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 @@ #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 *************************************************/
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/ntoskrnl.h Sun Jun 25 01:34:12 2006 @@ -12,9 +12,15 @@ #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 @@ /* 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
Modified: branches/powerpc/reactos/ntoskrnl/include/internal/powerpc/ke.h URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/include... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/include/internal/powerpc/ke.h (original) +++ branches/powerpc/reactos/ntoskrnl/include/internal/powerpc/ke.h Sun Jun 25 01:34:12 2006 @@ -126,10 +126,52 @@
#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 */
Modified: branches/powerpc/reactos/ntoskrnl/io/pnpmgr.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/io/pnpm... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/io/pnpmgr.c (original) +++ branches/powerpc/reactos/ntoskrnl/io/pnpmgr.c Sun Jun 25 01:34:12 2006 @@ -775,6 +775,7 @@ return Status; }
+ULONG TreeTraverse = 0;
NTSTATUS IopTraverseDeviceTreeNode(PDEVICETREE_TRAVERSE_CONTEXT Context) @@ -782,6 +783,10 @@ 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 @@ return Status; }
+ TreeTraverse++; + /* Traversal of all children nodes */ for (ChildDeviceNode = ParentDeviceNode->Child; ChildDeviceNode != NULL; @@ -804,10 +811,19 @@ 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; }
Modified: branches/powerpc/reactos/ntoskrnl/kd/kdmain.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/kd/kdma... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/kd/kdmain.c (original) +++ branches/powerpc/reactos/ntoskrnl/kd/kdmain.c Sun Jun 25 01:34:12 2006 @@ -198,7 +198,11 @@ KdEnteredDebugger = TRUE;
/* Halt the CPU */ +#ifdef _M_IX86 for (;;) Ke386HaltProcessor(); +#elif defined(_M_PPC) + for (;;); +#endif }
/*
Modified: branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/kd/wrap... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c (original) +++ branches/powerpc/reactos/ntoskrnl/kd/wrappers/gdbstub.c Sun Jun 25 01:34:12 2006 @@ -129,6 +129,7 @@
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 @@ { 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 @@ 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 @@ 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,6 +1340,7 @@ 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) @@ -1339,6 +1348,9 @@ #else #error Unknown compiler for inline assembler #endif +#elif defined(_M_PPC) + /* XXX arty fixme */ +#endif
GspUnloadBreakpoints(TrapFrame);
@@ -1373,6 +1385,7 @@ 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 @@ *ptr++ = ':'; ptr = GspMem2Hex((PCHAR) &TrapFrame->Eip, ptr, 4, 0); /* PC */ *ptr++ = ';'; +#endif
*ptr = '\0';
@@ -1558,12 +1572,16 @@ 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 @@ } } 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)
Modified: branches/powerpc/reactos/ntoskrnl/ke/apc.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/apc.... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/apc.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/apc.c Sun Jun 25 01:34:12 2006 @@ -908,8 +908,10 @@ 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 @@ &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;
Modified: branches/powerpc/reactos/ntoskrnl/ke/bug.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/bug.... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/bug.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/bug.c Sun Jun 25 01:34:12 2006 @@ -35,7 +35,9 @@ 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 @@ ULONG BugCheckParameter4, PKTRAP_FRAME Tf) { +#ifdef _M_IX86 KIRQL OldIrql; BOOLEAN GotExtendedCrashInfo = FALSE; PVOID Address = 0; @@ -469,6 +472,9 @@
/* Halt this CPU now */ for (;;) Ke386HaltProcessor(); +#elif defined(_M_PPC) + for (;;); +#endif }
/*
Modified: branches/powerpc/reactos/ntoskrnl/ke/clock.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/cloc... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/clock.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/clock.c Sun Jun 25 01:34:12 2006 @@ -260,6 +260,7 @@ 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 @@ Prcb->KernelTime++; } } +#endif
#if 0 DpcLastCount = Prcb->DpcLastCount; @@ -341,6 +343,7 @@ * FUNCTION: Handles a timer interrupt */ { +#ifdef _M_IX86 LARGE_INTEGER Time;
ASSERT(KeGetCurrentIrql() == PROFILE_LEVEL); @@ -378,6 +381,7 @@ * Queue a DPC that will expire timers */ KeInsertQueueDpc(&KiExpireTimerDpc, (PVOID)TrapFrame->Eip, 0); +#endif }
/*
Modified: branches/powerpc/reactos/ntoskrnl/ke/dpc.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/dpc.... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/dpc.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/dpc.c Sun Jun 25 01:34:12 2006 @@ -441,7 +441,7 @@ /* Set DPC Event if requested */ if (Prcb->DpcSetEventRequest) { - KeSetEvent(&Prcb->DpcEvent, 0, 0); + KeSetEvent((void *)&Prcb->DpcEvent, 0, 0); }
/* Check if Quantum expired */
Modified: branches/powerpc/reactos/ntoskrnl/ke/ipi.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/ipi.... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/ipi.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/ipi.c Sun Jun 25 01:34:12 2006 @@ -33,7 +33,9 @@ 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 @@ IN PVOID ExceptionFrame) { #ifdef DBG +#ifdef _M_IX86 LARGE_INTEGER StartTime, CurrentTime, Frequency; ULONG Count = 5; +#endif #endif PKPRCB Prcb;
@@ -59,6 +63,7 @@
Prcb = KeGetCurrentPrcb();
+#ifdef _M_IX86 if (Ke386TestAndClearBit(IPI_APC, &Prcb->IpiFrozen)) { HalRequestSoftwareInterrupt(APC_LEVEL); @@ -111,6 +116,7 @@ } (void)InterlockedExchangePointer(&Prcb->SignalDone, NULL); } +#endif DPRINT("KiIpiServiceRoutine done\n"); return TRUE; } @@ -140,11 +146,13 @@ { 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)
Modified: branches/powerpc/reactos/ntoskrnl/ke/kthread.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/kthr... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/kthread.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/kthread.c Sun Jun 25 01:34:12 2006 @@ -885,7 +885,9 @@ 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;
Modified: branches/powerpc/reactos/ntoskrnl/ke/main.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/main... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/main.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/main.c Sun Jun 25 01:34:12 2006 @@ -17,7 +17,6 @@ /* GLOBALS *******************************************************************/
#define BUILD_OSCSDVERSION(major, minor) (((major & 0xFF) << 8) | (minor & 0xFF)) -
ULONG NtMajorVersion = 5; ULONG NtMinorVersion = 0;
Modified: branches/powerpc/reactos/ntoskrnl/ke/process.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/proc... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/process.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/process.c Sun Jun 25 01:34:12 2006 @@ -133,7 +133,9 @@ 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 @@ KiSwapProcess(PKPROCESS NewProcess, PKPROCESS OldProcess) { +#ifdef _M_IX86 DPRINT("Switching CR3 to: %x\n", NewProcess->DirectoryTableBase.u.LowPart); Ke386SetPageTableDirectory(NewProcess->DirectoryTableBase.u.LowPart); +#endif }
/*
Modified: branches/powerpc/reactos/ntoskrnl/ke/profile.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/prof... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ke/profile.c (original) +++ branches/powerpc/reactos/ntoskrnl/ke/profile.c Sun Jun 25 01:34:12 2006 @@ -226,6 +226,7 @@ IN KPROFILE_SOURCE Source, IN PLIST_ENTRY ListHead) { +#ifdef _M_IX86 PULONG BucketValue; PKPROFILE Profile;
@@ -248,6 +249,7 @@ /* Increment the value */ ++BucketValue; } +#endif }
/*
Modified: branches/powerpc/reactos/ntoskrnl/mm/pagefile.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/mm/page... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/mm/pagefile.c (original) +++ branches/powerpc/reactos/ntoskrnl/mm/pagefile.c Sun Jun 25 01:34:12 2006 @@ -548,6 +548,7 @@ Headers->Type = MmCoreDumpType; if (TrapFrame != NULL) { +#ifdef _M_IX86 if (!(TrapFrame->EFlags & (1 << 17))) { memcpy(&Headers->TrapFrame, TrapFrame, @@ -555,8 +556,11 @@ } else { +#endif memcpy(&Headers->TrapFrame, TrapFrame, sizeof(KTRAP_FRAME)); - } +#ifdef _M_IX86 + } +#endif } Headers->BugCheckCode = BugCode; Headers->BugCheckParameters[0] = BugCodeParameter1;
Modified: branches/powerpc/reactos/ntoskrnl/ntoskrnl.def URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ntoskrn... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ntoskrnl.def (original) +++ branches/powerpc/reactos/ntoskrnl/ntoskrnl.def Sun Jun 25 01:34:12 2006 @@ -1510,3 +1510,4 @@ wcsstr wcstombs wctomb +KeDumpStackFrames@4
Modified: branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ntoskrn... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild (original) +++ branches/powerpc/reactos/ntoskrnl/ntoskrnl.rbuild Sun Jun 25 01:34:12 2006 @@ -43,6 +43,11 @@ <file>v86m.c</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>
Modified: branches/powerpc/reactos/ntoskrnl/ps/debug.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ps/debu... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ps/debug.c (original) +++ branches/powerpc/reactos/ntoskrnl/ps/debug.c Sun Jun 25 01:34:12 2006 @@ -56,12 +56,14 @@ 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 @@ 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);
Modified: branches/powerpc/reactos/ntoskrnl/ps/idle.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ps/idle... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ps/idle.c (original) +++ branches/powerpc/reactos/ntoskrnl/ps/idle.c Sun Jun 25 01:34:12 2006 @@ -45,7 +45,11 @@
NtYieldExecution();
+#ifdef _M_IX86 Ke386HaltProcessor(); +#elif defined(_M_PPC) + for(;;); +#endif } }
Modified: branches/powerpc/reactos/ntoskrnl/ps/psmgr.c URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ps/psmg... ============================================================================== --- branches/powerpc/reactos/ntoskrnl/ps/psmgr.c (original) +++ branches/powerpc/reactos/ntoskrnl/ps/psmgr.c Sun Jun 25 01:34:12 2006 @@ -199,7 +199,9 @@ 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 @@ #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);