Better support for non X86 systems
authorHervé Poussineau <hpoussin@reactos.org>
Mon, 1 Jan 2007 14:50:16 +0000 (14:50 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Mon, 1 Jan 2007 14:50:16 +0000 (14:50 +0000)
svn path=/trunk/; revision=25264

12 files changed:
reactos/boot/freeldr/freeldr/freeldr_base.rbuild
reactos/include/ddk/winddk.h
reactos/include/ndk/i386/mmtypes.h
reactos/include/ndk/psfuncs.h
reactos/include/ndk/pstypes.h
reactos/include/ndk/rtltypes.h
reactos/lib/mingw/cpu_features.c
reactos/lib/mingw/wcrt1.c
reactos/lib/pseh/pseh.rbuild
reactos/lib/rossym/find.c
reactos/lib/rtl/rtl.rbuild
reactos/ntoskrnl/io/iomgr/driver.c

index fe4cf46..c23c5b5 100644 (file)
                <file>pixel.c</file>
                <file>video.c</file>
        </directory>
-       <directory name="windows">
-               <file>conversion.c</file>
-               <file>peloader.c</file>
-               <file>winldr.c</file>
-               <file>wlmemory.c</file>
-               <file>wlregistry.c</file>
-       </directory>
+       <if property="ARCH" value="i386">
+               <directory name="windows">
+                       <file>conversion.c</file>
+                       <file>peloader.c</file>
+                       <file>winldr.c</file>
+                       <file>wlmemory.c</file>
+                       <file>wlregistry.c</file>
+               </directory>
+       </if>
        <file>freeldr.c</file>
        <file>debug.c</file>
        <file>version.c</file>
index 64446fb..2b0bc98 100644 (file)
@@ -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,
index d49250c..3810dfd 100644 (file)
@@ -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 &&
index b47f533..a439bdb 100644 (file)
@@ -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
index 9985ffa..e500bf4 100644 (file)
@@ -1216,7 +1216,7 @@ typedef struct _EPROCESS
 #endif
     union
     {
-        HARDWARE_PTE_X86 PagedirectoryPte;
+        HARDWARE_PTE PagedirectoryPte;
         ULONGLONG Filler;
     };
     ULONG Session;
index 4f1e533..9aa41d9 100644 (file)
@@ -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
 
index 0eccfbf..b730cc1 100644 (file)
@@ -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
index 2f3aea1..8312587 100644 (file)
@@ -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
index 15e9642..80ba2b7 100644 (file)
@@ -1,8 +1,10 @@
 <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>
        <file>framebased.c</file>
 </module>
index 6f18c35..ad91356 100644 (file)
@@ -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;
     }
index 29f568e..4ddf39a 100644 (file)
@@ -35,7 +35,7 @@
                        <file>rtlmem.s</file>
                        <file>pow_asm.s</file>
                        <file>res_asm.s</file>
-            <file>seh.s</file>
+                       <file>seh.s</file>
                        <file>sin_asm.s</file>
                        <file>sqrt_asm.s</file>
                        <file>tan_asm.s</file>
                <file>tree.c</file>
        </directory>
 
-      <ifnot property="ARCH" value="i386">
-             <file>memgen.c</file>
-             <file>mem.c</file> 
-      </ifnot>
+       <ifnot property="ARCH" value="i386">
+               <file>memgen.c</file>
+               <file>mem.c</file> 
+       </ifnot>
 
        <file>access.c</file>
        <file>acl.c</file>
index 02c3c22..a3ebe19 100644 (file)
@@ -858,6 +858,10 @@ IopInitializeBuiltinDriver(
    {
       FileNameWithoutPath = ModuleName->Buffer;
    }
+   else
+   {
+      FileNameWithoutPath++;
+   }
 
    /*
     * Load the module