Better support for non X86 systems

svn path=/trunk/; revision=25264
This commit is contained in:
Hervé Poussineau 2007-01-01 14:50:16 +00:00
parent 4afb3f0181
commit f9b6e910f9
12 changed files with 64 additions and 50 deletions

View file

@ -68,13 +68,15 @@
<file>pixel.c</file> <file>pixel.c</file>
<file>video.c</file> <file>video.c</file>
</directory> </directory>
<directory name="windows"> <if property="ARCH" value="i386">
<file>conversion.c</file> <directory name="windows">
<file>peloader.c</file> <file>conversion.c</file>
<file>winldr.c</file> <file>peloader.c</file>
<file>wlmemory.c</file> <file>winldr.c</file>
<file>wlregistry.c</file> <file>wlmemory.c</file>
</directory> <file>wlregistry.c</file>
</directory>
</if>
<file>freeldr.c</file> <file>freeldr.c</file>
<file>debug.c</file> <file>debug.c</file>
<file>version.c</file> <file>version.c</file>

View file

@ -5219,6 +5219,31 @@ typedef struct _KFLOATING_SAVE {
ULONG Spare1; ULONG Spare1;
} KFLOATING_SAVE, *PKFLOATING_SAVE; } 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_SIZE 0x1000
#define PAGE_SHIFT 12L #define PAGE_SHIFT 12L
@ -5296,30 +5321,6 @@ DDKAPI
KeGetCurrentIrql( KeGetCurrentIrql(
VOID); 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) #if !defined(__INTERLOCKED_DECLARED)
#define __INTERLOCKED_DECLARED #define __INTERLOCKED_DECLARED
@ -5416,8 +5417,6 @@ KfReleaseSpinLock(
#define KeGetDcacheFillSize() 1L #define KeGetDcacheFillSize() 1L
#endif /* _X86_ */
/* /*
@ -10579,13 +10578,13 @@ DbgBreakPointWithStatus(
IN ULONG Status); IN ULONG Status);
ULONG ULONG
__cdecl DDKCDECLAPI
DbgPrint( DbgPrint(
IN PCCH Format, IN PCCH Format,
IN ...); IN ...);
ULONG ULONG
__cdecl DDKCDECLAPI
DbgPrintEx( DbgPrintEx(
IN ULONG ComponentId, IN ULONG ComponentId,
IN ULONG Level, IN ULONG Level,

View file

@ -34,7 +34,7 @@ Author:
// //
// Sanity checks for Paging Macros // Sanity checks for Paging Macros
// //
#ifndef __GNUC__ #ifdef C_ASSERT
C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT)); C_ASSERT(PAGE_SIZE == (1 << PAGE_SHIFT));
C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT)); C_ASSERT(MM_ALLOCATION_GRANULARITY == (1 << MM_ALLOCATION_GRANULARITY_SHIFT));
C_ASSERT(MM_ALLOCATION_GRANULARITY && C_ASSERT(MM_ALLOCATION_GRANULARITY &&

View file

@ -229,6 +229,7 @@ NtCreateThread(
); );
#ifndef NTOS_MODE_USER #ifndef NTOS_MODE_USER
#if defined(_M_IX86)
FORCEINLINE FORCEINLINE
PTEB PTEB
NtCurrentTeb(VOID) NtCurrentTeb(VOID)
@ -248,6 +249,9 @@ NtCurrentTeb(VOID)
#endif #endif
} }
#endif #endif
#else
struct _TEB * NtCurrentTeb(void);
#endif
NTSYSCALLAPI NTSYSCALLAPI
NTSTATUS NTSTATUS

View file

@ -1216,7 +1216,7 @@ typedef struct _EPROCESS
#endif #endif
union union
{ {
HARDWARE_PTE_X86 PagedirectoryPte; HARDWARE_PTE PagedirectoryPte;
ULONGLONG Filler; ULONGLONG Filler;
}; };
ULONG Session; ULONG Session;

View file

@ -138,7 +138,7 @@ Author:
HEAP_CREATE_ALIGN_16 | \ HEAP_CREATE_ALIGN_16 | \
HEAP_CREATE_ENABLE_TRACING | \ HEAP_CREATE_ENABLE_TRACING | \
HEAP_CREATE_ENABLE_EXECUTE) HEAP_CREATE_ENABLE_EXECUTE)
#ifndef __GNUC__ #ifdef C_ASSERT
C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF); C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF);
#endif #endif

View file

@ -29,6 +29,7 @@ unsigned int __cpu_features = 0;
void __cpu_features_init (void) void __cpu_features_init (void)
{ {
#ifdef __i386__
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
/* Try to change the value of CPUID bit (bit 21) in EFLAGS. /* Try to change the value of CPUID bit (bit 21) in EFLAGS.
If the bit can be toggled, CPUID is supported. */ If the bit can be toggled, CPUID is supported. */
@ -75,8 +76,7 @@ void __cpu_features_init (void)
__cpu_features |= _CRT_3DNOW; __cpu_features |= _CRT_3DNOW;
if (edx & EDX_3DNOWP) if (edx & EDX_3DNOWP)
__cpu_features |= _CRT_3DNOWP; __cpu_features |= _CRT_3DNOWP;
#endif
return;
} }
#ifdef TEST #ifdef TEST

View file

@ -218,7 +218,11 @@ __mingw_wCRTStartup (void)
/* Align the stack to 16 bytes for the sake of SSE ops in main /* Align the stack to 16 bytes for the sake of SSE ops in main
or in functions inlined into main. */ or in functions inlined into main. */
#if defined(__i386__)
asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
#else
#error Unsupported architecture
#endif
/* /*
* Call the main function. If the user does not supply one * Call the main function. If the user does not supply one

View file

@ -1,8 +1,10 @@
<module name="pseh" type="staticlibrary"> <module name="pseh" type="staticlibrary">
<define name="__USE_W32API" /> <define name="__USE_W32API" />
<directory name="i386"> <if property="ARCH" value="i386">
<file>framebased.asm</file> <directory name="i386">
<file>setjmp.asm</file> <file>framebased.asm</file>
</directory> <file>setjmp.asm</file>
</directory>
</if>
<file>framebased.c</file> <file>framebased.c</file>
</module> </module>

View file

@ -104,7 +104,6 @@ RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo,
if (RosSymInfo->Symbols == NULL || RosSymInfo->SymbolsCount == 0 || if (RosSymInfo->Symbols == NULL || RosSymInfo->SymbolsCount == 0 ||
RosSymInfo->Strings == NULL || RosSymInfo->StringsLength == 0) RosSymInfo->Strings == NULL || RosSymInfo->StringsLength == 0)
{ {
__asm__("int $3\n");
DPRINT1("Uninitialized RosSymInfo\n"); DPRINT1("Uninitialized RosSymInfo\n");
return FALSE; return FALSE;
} }

View file

@ -35,7 +35,7 @@
<file>rtlmem.s</file> <file>rtlmem.s</file>
<file>pow_asm.s</file> <file>pow_asm.s</file>
<file>res_asm.s</file> <file>res_asm.s</file>
<file>seh.s</file> <file>seh.s</file>
<file>sin_asm.s</file> <file>sin_asm.s</file>
<file>sqrt_asm.s</file> <file>sqrt_asm.s</file>
<file>tan_asm.s</file> <file>tan_asm.s</file>
@ -46,10 +46,10 @@
<file>tree.c</file> <file>tree.c</file>
</directory> </directory>
<ifnot property="ARCH" value="i386"> <ifnot property="ARCH" value="i386">
<file>memgen.c</file> <file>memgen.c</file>
<file>mem.c</file> <file>mem.c</file>
</ifnot> </ifnot>
<file>access.c</file> <file>access.c</file>
<file>acl.c</file> <file>acl.c</file>

View file

@ -858,6 +858,10 @@ IopInitializeBuiltinDriver(
{ {
FileNameWithoutPath = ModuleName->Buffer; FileNameWithoutPath = ModuleName->Buffer;
} }
else
{
FileNameWithoutPath++;
}
/* /*
* Load the module * Load the module