From f9b6e910f965f4fb7beef6570075d55918724aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Mon, 1 Jan 2007 14:50:16 +0000 Subject: [PATCH] Better support for non X86 systems svn path=/trunk/; revision=25264 --- .../boot/freeldr/freeldr/freeldr_base.rbuild | 16 +++--- reactos/include/ddk/winddk.h | 55 +++++++++---------- reactos/include/ndk/i386/mmtypes.h | 2 +- reactos/include/ndk/psfuncs.h | 4 ++ reactos/include/ndk/pstypes.h | 2 +- reactos/include/ndk/rtltypes.h | 2 +- reactos/lib/mingw/cpu_features.c | 4 +- reactos/lib/mingw/wcrt1.c | 4 ++ reactos/lib/pseh/pseh.rbuild | 10 ++-- reactos/lib/rossym/find.c | 1 - reactos/lib/rtl/rtl.rbuild | 10 ++-- reactos/ntoskrnl/io/iomgr/driver.c | 4 ++ 12 files changed, 64 insertions(+), 50 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/freeldr_base.rbuild b/reactos/boot/freeldr/freeldr/freeldr_base.rbuild index fe4cf462b15..c23c5b580bf 100644 --- a/reactos/boot/freeldr/freeldr/freeldr_base.rbuild +++ b/reactos/boot/freeldr/freeldr/freeldr_base.rbuild @@ -68,13 +68,15 @@ pixel.c video.c - - conversion.c - peloader.c - winldr.c - wlmemory.c - wlregistry.c - + + + conversion.c + peloader.c + winldr.c + wlmemory.c + wlregistry.c + + freeldr.c debug.c version.c diff --git a/reactos/include/ddk/winddk.h b/reactos/include/ddk/winddk.h index 64446fb8a0d..2b0bc988300 100644 --- a/reactos/include/ddk/winddk.h +++ b/reactos/include/ddk/winddk.h @@ -5219,6 +5219,31 @@ typedef struct _KFLOATING_SAVE { ULONG Spare1; } KFLOATING_SAVE, *PKFLOATING_SAVE; +static __inline +ULONG +DDKAPI +KeGetCurrentProcessorNumber(VOID) +{ +#if defined(__GNUC__) + ULONG ret; + __asm__ __volatile__ ( + "movl %%fs:%c1, %0\n" + : "=r" (ret) + : "i" (FIELD_OFFSET(KPCR, Number)) + ); + return ret; +#elif defined(_MSC_VER) +#if _MSC_FULL_VER >= 13012035 + return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number)); +#else + __asm { movzx eax, _PCR KPCR.Number } +#endif +#else +#error Unknown compiler +#endif +} +#endif /* _X86_ */ + #define PAGE_SIZE 0x1000 #define PAGE_SHIFT 12L @@ -5296,30 +5321,6 @@ DDKAPI KeGetCurrentIrql( VOID); -static __inline -ULONG -DDKAPI -KeGetCurrentProcessorNumber(VOID) -{ -#if defined(__GNUC__) - ULONG ret; - __asm__ __volatile__ ( - "movl %%fs:%c1, %0\n" - : "=r" (ret) - : "i" (FIELD_OFFSET(KPCR, Number)) - ); - return ret; -#elif defined(_MSC_VER) -#if _MSC_FULL_VER >= 13012035 - return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number)); -#else - __asm { movzx eax, _PCR KPCR.Number } -#endif -#else -#error Unknown compiler -#endif -} - #if !defined(__INTERLOCKED_DECLARED) #define __INTERLOCKED_DECLARED @@ -5416,8 +5417,6 @@ KfReleaseSpinLock( #define KeGetDcacheFillSize() 1L -#endif /* _X86_ */ - /* @@ -10579,13 +10578,13 @@ DbgBreakPointWithStatus( IN ULONG Status); ULONG -__cdecl +DDKCDECLAPI DbgPrint( IN PCCH Format, IN ...); ULONG -__cdecl +DDKCDECLAPI DbgPrintEx( IN ULONG ComponentId, IN ULONG Level, diff --git a/reactos/include/ndk/i386/mmtypes.h b/reactos/include/ndk/i386/mmtypes.h index d49250cee57..3810dfde482 100644 --- a/reactos/include/ndk/i386/mmtypes.h +++ b/reactos/include/ndk/i386/mmtypes.h @@ -34,7 +34,7 @@ Author: // // Sanity checks for Paging Macros // -#ifndef __GNUC__ +#ifdef C_ASSERT C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT)); C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT)); C_ASSERT(MM_ALLOCATION_GRANULARITY && diff --git a/reactos/include/ndk/psfuncs.h b/reactos/include/ndk/psfuncs.h index b47f5339846..a439bdb921f 100644 --- a/reactos/include/ndk/psfuncs.h +++ b/reactos/include/ndk/psfuncs.h @@ -229,6 +229,7 @@ NtCreateThread( ); #ifndef NTOS_MODE_USER +#if defined(_M_IX86) FORCEINLINE PTEB NtCurrentTeb(VOID) @@ -248,6 +249,9 @@ NtCurrentTeb(VOID) #endif } #endif +#else +struct _TEB * NtCurrentTeb(void); +#endif NTSYSCALLAPI NTSTATUS diff --git a/reactos/include/ndk/pstypes.h b/reactos/include/ndk/pstypes.h index 9985ffa8071..e500bf49955 100644 --- a/reactos/include/ndk/pstypes.h +++ b/reactos/include/ndk/pstypes.h @@ -1216,7 +1216,7 @@ typedef struct _EPROCESS #endif union { - HARDWARE_PTE_X86 PagedirectoryPte; + HARDWARE_PTE PagedirectoryPte; ULONGLONG Filler; }; ULONG Session; diff --git a/reactos/include/ndk/rtltypes.h b/reactos/include/ndk/rtltypes.h index 4f1e5338da1..9aa41d95e5e 100644 --- a/reactos/include/ndk/rtltypes.h +++ b/reactos/include/ndk/rtltypes.h @@ -138,7 +138,7 @@ Author: HEAP_CREATE_ALIGN_16 | \ HEAP_CREATE_ENABLE_TRACING | \ HEAP_CREATE_ENABLE_EXECUTE) -#ifndef __GNUC__ +#ifdef C_ASSERT C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF); #endif diff --git a/reactos/lib/mingw/cpu_features.c b/reactos/lib/mingw/cpu_features.c index 0eccfbfe3c6..b730cc11a9a 100644 --- a/reactos/lib/mingw/cpu_features.c +++ b/reactos/lib/mingw/cpu_features.c @@ -29,6 +29,7 @@ unsigned int __cpu_features = 0; void __cpu_features_init (void) { +#ifdef __i386__ unsigned int eax, ebx, ecx, edx; /* Try to change the value of CPUID bit (bit 21) in EFLAGS. If the bit can be toggled, CPUID is supported. */ @@ -75,8 +76,7 @@ void __cpu_features_init (void) __cpu_features |= _CRT_3DNOW; if (edx & EDX_3DNOWP) __cpu_features |= _CRT_3DNOWP; - - return; +#endif } #ifdef TEST diff --git a/reactos/lib/mingw/wcrt1.c b/reactos/lib/mingw/wcrt1.c index 2f3aea1bbea..8312587bd7c 100644 --- a/reactos/lib/mingw/wcrt1.c +++ b/reactos/lib/mingw/wcrt1.c @@ -218,7 +218,11 @@ __mingw_wCRTStartup (void) /* Align the stack to 16 bytes for the sake of SSE ops in main or in functions inlined into main. */ +#if defined(__i386__) asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); +#else +#error Unsupported architecture +#endif /* * Call the main function. If the user does not supply one diff --git a/reactos/lib/pseh/pseh.rbuild b/reactos/lib/pseh/pseh.rbuild index 15e96420ebe..80ba2b706a1 100644 --- a/reactos/lib/pseh/pseh.rbuild +++ b/reactos/lib/pseh/pseh.rbuild @@ -1,8 +1,10 @@ - - framebased.asm - setjmp.asm - + + + framebased.asm + setjmp.asm + + framebased.c diff --git a/reactos/lib/rossym/find.c b/reactos/lib/rossym/find.c index 6f18c356248..ad913564896 100644 --- a/reactos/lib/rossym/find.c +++ b/reactos/lib/rossym/find.c @@ -104,7 +104,6 @@ RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, if (RosSymInfo->Symbols == NULL || RosSymInfo->SymbolsCount == 0 || RosSymInfo->Strings == NULL || RosSymInfo->StringsLength == 0) { -__asm__("int $3\n"); DPRINT1("Uninitialized RosSymInfo\n"); return FALSE; } diff --git a/reactos/lib/rtl/rtl.rbuild b/reactos/lib/rtl/rtl.rbuild index 29f568e05d4..4ddf39a7afa 100644 --- a/reactos/lib/rtl/rtl.rbuild +++ b/reactos/lib/rtl/rtl.rbuild @@ -35,7 +35,7 @@ rtlmem.s pow_asm.s res_asm.s - seh.s + seh.s sin_asm.s sqrt_asm.s tan_asm.s @@ -46,10 +46,10 @@ tree.c - - memgen.c - mem.c - + + memgen.c + mem.c + access.c acl.c diff --git a/reactos/ntoskrnl/io/iomgr/driver.c b/reactos/ntoskrnl/io/iomgr/driver.c index 02c3c22d8d2..a3ebe199a4a 100644 --- a/reactos/ntoskrnl/io/iomgr/driver.c +++ b/reactos/ntoskrnl/io/iomgr/driver.c @@ -858,6 +858,10 @@ IopInitializeBuiltinDriver( { FileNameWithoutPath = ModuleName->Buffer; } + else + { + FileNameWithoutPath++; + } /* * Load the module