[SPEC2DEF] Add support for ARM asm stub generation
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 5 Sep 2014 20:07:53 +0000 (20:07 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Fri, 5 Sep 2014 20:07:53 +0000 (20:07 +0000)
[HALARM] Add a dummy CMakeLists.txt
[BOOTVID] Fix ARM compilation

svn path=/trunk/; revision=64039

reactos/drivers/base/bootvid/precomp.h
reactos/hal/CMakeLists.txt
reactos/hal/halarm/CMakeLists.txt [new file with mode: 0644]
reactos/include/crt/crtdefs.h
reactos/tools/spec2def/spec2def.c

index be6aef5..33fb58c 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _BOOTVID_PCH_
 #define _BOOTVID_PCH_
 
-#include <wdm.h>
+#include <ntddk.h>
 #include <drivers/bootvid/bootvid.h>
 
 /* Define if FontData has upside down characters */
index 965a08d..f11bad8 100644 (file)
@@ -3,7 +3,7 @@ project(HAL)
 if((ARCH STREQUAL "i386") OR (ARCH STREQUAL "amd64"))
     add_subdirectory(halx86)
 elseif(ARCH STREQUAL "arm")
-#    add_subdirectory(halarm)
+    add_subdirectory(halarm)
 elseif(ARCH STREQUAL "powerpc")
 #    add_subdirectory(halppc)
 endif()
diff --git a/reactos/hal/halarm/CMakeLists.txt b/reactos/hal/halarm/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c04c824
--- /dev/null
@@ -0,0 +1,17 @@
+
+spec2def(hal.dll ../hal.spec ADD_IMPORTLIB)
+
+add_definitions(
+    -D_NTHALDLL_
+    -D_NTHAL_)
+
+include_directories(
+    include
+    ${REACTOS_SOURCE_DIR}/ntoskrnl/include)
+
+list(APPEND SOURCES
+    omap3/halinit_up.c
+    omap3/halup.rc)
+
+add_library(hal SHARED
+    ${SOURCES})
index b76dbf5..d2934f9 100644 (file)
 #endif
 
 #ifndef UNALIGNED
-#if defined(__ia64__) || defined(__x86_64)
+#if defined(__ia64__) || defined(__x86_64) || defined(__arm__)
 #define UNALIGNED __unaligned
 #else
 #define UNALIGNED
index 11a7862..a878e3d 100644 (file)
@@ -259,57 +259,83 @@ OutputHeader_asmstub(FILE *file, char *libname)
 
     if (giArch == ARCH_X86)
     {
-        fprintf(file, ".586\n.model flat\n");
+        fprintf(file, ".586\n.model flat\n.code\n");
+    }
+    else if (giArch == ARCH_AMD64)
+    {
+        fprintf(file, ".code\n");
     }
     else if (giArch == ARCH_ARM)
     {
-        fprintf(file, "#include <kxarm.h>\n        TEXTAREA\n");
+        fprintf(file,
+                "    AREA |.text|,ALIGN=2,CODE,READONLY\n\n");
     }
+}
 
-    fprintf(file, ".code\n");
+void
+Output_symbol(FILE *fileDest, char* pszSymbolName)
+{
+    if (giArch == ARCH_ARM)
+    {
+        fprintf(fileDest,
+                "      EXPORT %s [FUNC]\n%s\n",
+                pszSymbolName,
+                pszSymbolName);
+    }
+    else
+    {
+        fprintf(fileDest,
+                "PUBLIC %s\n%s: nop\n",
+                pszSymbolName,
+                pszSymbolName);
+    }
 }
 
 int
 OutputLine_asmstub(FILE *fileDest, EXPORT *pexp)
 {
+    char szNameBuffer[128];
+
     /* Handle autoname */
     if (pexp->strName.len == 1 && pexp->strName.buf[0] == '@')
     {
-        fprintf(fileDest, "PUBLIC %sordinal%d\n%sordinal%d: nop\n",
+        sprintf(szNameBuffer, "%sordinal%d\n%sordinal%d: nop\n",
                 gpszUnderscore, pexp->nOrdinal, gpszUnderscore, pexp->nOrdinal);
     }
     else if (giArch != ARCH_X86)
     {
-        fprintf(fileDest, "PUBLIC _stub_%.*s\n_stub_%.*s: nop\n",
+        sprintf(szNameBuffer, "_stub_%.*s",
                 pexp->strName.len, pexp->strName.buf,
                 pexp->strName.len, pexp->strName.buf);
     }
     else if (pexp->nCallingConvention == CC_STDCALL)
     {
-        fprintf(fileDest, "PUBLIC __stub_%.*s@%d\n__stub_%.*s@%d: nop\n",
+        sprintf(szNameBuffer, "__stub_%.*s@%d",
                 pexp->strName.len, pexp->strName.buf, pexp->nStackBytes,
                 pexp->strName.len, pexp->strName.buf, pexp->nStackBytes);
     }
     else if (pexp->nCallingConvention == CC_FASTCALL)
     {
-        fprintf(fileDest, "PUBLIC @_stub_%.*s@%d\n@_stub_%.*s@%d: nop\n",
+        sprintf(szNameBuffer, "@_stub_%.*s@%d",
                 pexp->strName.len, pexp->strName.buf, pexp->nStackBytes,
                 pexp->strName.len, pexp->strName.buf, pexp->nStackBytes);
     }
     else if (pexp->nCallingConvention == CC_CDECL ||
              pexp->nCallingConvention == CC_STUB)
     {
-        fprintf(fileDest, "PUBLIC __stub_%.*s\n__stub_%.*s: nop\n",
+        sprintf(szNameBuffer, "__stub_%.*s",
                 pexp->strName.len, pexp->strName.buf,
                 pexp->strName.len, pexp->strName.buf);
     }
     else if (pexp->nCallingConvention == CC_EXTERN)
     {
-        fprintf(fileDest, "PUBLIC __stub_%.*s\n__stub_%.*s:\n",
+        sprintf(szNameBuffer, "__stub_%.*s",
                 pexp->strName.len, pexp->strName.buf,
                 pexp->strName.len, pexp->strName.buf);
     }
 
+    Output_symbol(fileDest, szNameBuffer);
+
     return 1;
 }
 
@@ -1038,7 +1064,7 @@ int main(int argc, char *argv[])
 
         OutputHeader_asmstub(file, pszDllName);
         result = ParseFile(pszSource, file, OutputLine_asmstub);
-        fprintf(file, "\nEND\n");
+        fprintf(file, "\n    END\n");
         fclose(file);
     }