[KERNEL32/KSECDD/GDI32/BMFD/DBGHELP/HALARM/SETUPLDR]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 14 May 2015 22:32:35 +0000 (22:32 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Thu, 14 May 2015 22:32:35 +0000 (22:32 +0000)
Fix ARM build

svn path=/trunk/; revision=67736

reactos/boot/freeldr/freeldr/CMakeLists.txt
reactos/dll/win32/dbghelp/cpu_arm.c
reactos/dll/win32/kernel32/CMakeLists.txt
reactos/dll/win32/kernel32/client/except.c
reactos/dll/win32/kernel32/client/utils.c
reactos/drivers/crypto/ksecdd/ksecdd.h
reactos/drivers/crypto/ksecdd/random.c
reactos/hal/halarm/CMakeLists.txt
reactos/win32ss/drivers/font/bmfd/bmfd.h
reactos/win32ss/gdi/gdi32/wine/gdi_private.h
reactos/win32ss/gdi/gdi32/wine/rosglue.c

index f072a1a..70a058f 100644 (file)
@@ -243,11 +243,17 @@ endif()
 add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)
 add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB NOT_IN_HYBRIDCD FOR livecd hybridcd NAME_ON_CD setupldr.sys)
 
-concatenate_files(
-    ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys
-    ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
-    ${_freeldr_pe_output_file})
+if(NOT ARCH STREQUAL "arm")
+
+    concatenate_files(
+        ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys
+        ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin
+        ${_freeldr_pe_output_file})
+
+    add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)
+else()
+    add_custom_target(setupldr ALL DEPENDS ${_freeldr_pe_output_file})
+endif()
 
-add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys)
 add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR bootcd regtest)
 
index 31b1926..f58cf02 100644 (file)
@@ -33,7 +33,7 @@ static BOOL arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
 #ifdef __arm__
     case cpu_addr_pc:    addr->Offset = ctx->Pc; return TRUE;
     case cpu_addr_stack: addr->Offset = ctx->Sp; return TRUE;
-    case cpu_addr_frame: addr->Offset = ctx->Fp; return TRUE;
+    case cpu_addr_frame: addr->Offset = ctx->Fpscr; return TRUE;
 #endif
     default: addr->Mode = -1;
         return FALSE;
@@ -116,7 +116,7 @@ static BOOL arm_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CON
     /* set frame information */
     frame->AddrStack.Offset = context->Sp;
     frame->AddrReturn.Offset = context->Lr;
-    frame->AddrFrame.Offset = context->Fp;
+    frame->AddrFrame.Offset = context->Fpscr;
     frame->AddrPC.Offset = context->Pc;
 
     frame->Far = TRUE;
@@ -169,8 +169,8 @@ static void* arm_fetch_context_reg(CONTEXT* ctx, unsigned regno, unsigned* size)
     case CV_ARM_R0 +  8: *size = sizeof(ctx->R8); return &ctx->R8;
     case CV_ARM_R0 +  9: *size = sizeof(ctx->R9); return &ctx->R9;
     case CV_ARM_R0 + 10: *size = sizeof(ctx->R10); return &ctx->R10;
-    case CV_ARM_R0 + 11: *size = sizeof(ctx->Fp); return &ctx->Fp;
-    case CV_ARM_R0 + 12: *size = sizeof(ctx->Ip); return &ctx->Ip;
+    case CV_ARM_R0 + 11: *size = sizeof(ctx->Fpscr); return &ctx->Fpscr;
+    //case CV_ARM_R0 + 12: *size = sizeof(ctx->Ip); return &ctx->Ip;
 
     case CV_ARM_SP: *size = sizeof(ctx->Sp); return &ctx->Sp;
     case CV_ARM_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
index 711182a..16eb4ca 100644 (file)
@@ -90,6 +90,10 @@ elseif(ARCH STREQUAL "amd64")
     list(APPEND ASM_SOURCE
         client/amd64/fiber.S
         client/amd64/thread.S)
+elseif(ARCH STREQUAL "arm")
+    list(APPEND ASM_SOURCE
+        client/arm/fiber.S
+        client/arm/thread.S)
 endif()
 
 add_asm_files(kernel32_asm ${ASM_SOURCE})
index 276f5f2..53d962d 100644 (file)
@@ -62,8 +62,14 @@ _dump_context(PCONTEXT pc)
    DbgPrint("R8: %I64x   R9: %I64x   R10: %I64x   R11: %I64x\n", pc->R8, pc->R9, pc->R10, pc->R11);
    DbgPrint("R12: %I64x   R13: %I64x   R14: %I64x   R15: %I64x\n", pc->R12, pc->R13, pc->R14, pc->R15);
    DbgPrint("EFLAGS: %.8x\n", pc->EFlags);
+#elif defined(_M_ARM)
+   DbgPrint("PC:  %08lx   LR:  %08lx   SP:  %08lx\n", pc->Pc);
+   DbgPrint("R0:  %08lx   R1:  %08lx   R2:  %08lx   R3:  %08lx\n", pc->R0, pc->R1, pc->R2, pc->R3);
+   DbgPrint("R4:  %08lx   R5:  %08lx   R6:  %08lx   R7:  %08lx\n", pc->R4, pc->R5, pc->R6, pc->R7);
+   DbgPrint("R8:  %08lx   R9:  %08lx   R10: %08lx   R11: %08lx\n", pc->R8, pc->R9, pc->R10, pc->R11);
+   DbgPrint("R12: %08lx   CPSR: %08lx  FPSCR: %08lx\n", pc->R12, pc->Cpsr, pc->R1, pc->Fpscr, pc->R3);
 #else
-#warning Unknown architecture
+#error "Unknown architecture"
 #endif
 }
 
index f82437f..8b39f5d 100644 (file)
@@ -606,6 +606,33 @@ BaseInitializeContext(IN PCONTEXT Context,
 
     /* Give it some room for the Parameter */
     Context->Rsp -= sizeof(PVOID);
+#elif defined(_M_ARM)
+    DPRINT("BaseInitializeContext: %p\n", Context);
+
+    // FIXME: check if this is correct!
+    /* Setup the Initial Win32 Thread Context */
+    Context->R0 = (ULONG_PTR)StartAddress;
+    Context->R1 = (ULONG_PTR)Parameter;
+    Context->Sp = (ULONG_PTR)StackAddress;
+
+    if (ContextType == 1)      /* For Threads */
+    {
+        Context->Pc = (ULONG_PTR)BaseThreadStartupThunk;
+    }
+    else if (ContextType == 2) /* For Fibers */
+    {
+        Context->Pc = (ULONG_PTR)BaseFiberStartup;
+    }
+    else                       /* For first thread in a Process */
+    {
+        Context->Pc = (ULONG_PTR)BaseProcessStartThunk;
+    }
+
+    /* Set the Context Flags */
+    Context->ContextFlags = CONTEXT_FULL;
+
+    /* Give it some room for the Parameter */
+    Context->Sp -= sizeof(PVOID);
 #else
 #warning Unknown architecture
     UNIMPLEMENTED;
@@ -907,7 +934,7 @@ BasepCheckWinSaferRestrictions(IN HANDLE UserToken,
                                OUT PHANDLE JobHandle)
 {
     NTSTATUS Status;
-    
+
     /* Validate that there's a name */
     if ((ApplicationName) && *(ApplicationName))
     {
index b9f571e..c7761cb 100644 (file)
@@ -43,8 +43,13 @@ typedef struct _KSEC_MACHINE_SPECIFIC_COUNTERS
     ULONG64 Ctr0;
     ULONG64 Ctr1;
 } KSEC_MACHINE_SPECIFIC_COUNTERS, *PKSEC_MACHINE_SPECIFIC_COUNTERS;
+#elif defined(_M_ARM)
+typedef struct _KSEC_MACHINE_SPECIFIC_COUNTERS
+{
+    ULONG Ccr;
+} KSEC_MACHINE_SPECIFIC_COUNTERS, *PKSEC_MACHINE_SPECIFIC_COUNTERS;
 #else
-typedef ULONG KSEC_MACHINE_SPECIFIC_COUNTERS;
+typedef ULONG KSEC_MACHINE_SPECIFIC_COUNTERS, *PKSEC_MACHINE_SPECIFIC_COUNTERS;
 #endif
 
 typedef struct _KSEC_ENTROPY_DATA
index 0dc1b59..cdcd273 100644 (file)
@@ -76,6 +76,11 @@ KsecReadMachineSpecificCounters(
         MachineSpecificCounters->Pmc1 = __readpmc(1);
     }
 #endif
+#elif defined(_M_ARM)
+/* FIXME: this should go into a public header (from ksarm.h) */
+#define CP15_PMCCNTR           15, 0,  9, 13, 0
+    /* Read the Cycle Counter Register */
+    MachineSpecificCounters->Ccr = _MoveFromCoprocessor(CP15_PMCCNTR);
 #else
     #error Implement me!
 #endif
index c04c824..90ef164 100644 (file)
@@ -15,3 +15,5 @@ list(APPEND SOURCES
 
 add_library(hal SHARED
     ${SOURCES})
+
+set_module_type(hal kerneldll ENTRYPOINT 0)
index e117de8..58aedb2 100644 (file)
@@ -19,8 +19,8 @@
 #else
 // FIXME: BE
 #define GETVAL(x) \
-    sizeof(x) == 1 ? (x) : \
-    sizeof(x) == 2 ? (((PCHAR)&(x))[0] + (((PCHAR)&(x))[1] << 8)) : \
+    (sizeof(x) == 1) ? (x) : \
+    (sizeof(x) == 2) ? (((PCHAR)&(x))[0] + (((PCHAR)&(x))[1] << 8)) : \
     (((PCHAR)&(x))[0] + (((PCHAR)&(x))[1] << 8) + (((PCHAR)&(x))[2] << 16) + \
      (((PCHAR)&(x))[3] << 24))
 
@@ -121,13 +121,13 @@ typedef struct _FONTDIRENTRY
 } FONTDIRENTRY, *PFONTDIRENTRY;
 
 typedef struct _DIRENTRY
-{ 
+{
     WORD fontOrdinal;
     FONTDIRENTRY fde;
 } DIRENTRY, *PDIRENTRY;
 
 typedef struct _FONTGROUPHDR
-{ 
+{
   WORD NumberOfFonts;
   DIRENTRY ade[1];
 } FONTGROUPHDR, *PFONTGROUPHDR;
index 5d9390e..710824d 100644 (file)
@@ -138,8 +138,14 @@ extern void push_dc_driver_ros(PHYSDEV *dev, PHYSDEV physdev, const struct gdi_d
 BOOL WINAPI SetWorldTransformForMetafile(HDC hdc, const XFORM *pxform);
 #define SetWorldTransform SetWorldTransformForMetafile
 
+#ifdef _M_ARM
+#define DbgRaiseAssertionFailure() __emit(0xdefc)
+#else
+#define DbgRaiseAssertionFailure() __int2c()
+#endif // _M_ARM
+
 #undef ASSERT
-#define ASSERT(x) if (!(x)) __int2c()
+#define ASSERT(x) if (!(x)) DbgRaiseAssertionFailure()
 
 #endif /* __WINE_GDI_PRIVATE_H */
 
index 499b397..157977a 100644 (file)
@@ -516,7 +516,7 @@ _assert (
     const char *file,
     unsigned line)
 {
-    __int2c();
+    DbgRaiseAssertionFailure();
 }
 
 double