[FREELDR]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 8 Jul 2012 18:45:34 +0000 (18:45 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 8 Jul 2012 18:45:34 +0000 (18:45 +0000)
- Make sure freeldr is not compiled with SSE instructions (default for VS 11+)
- Print trap number and instruction stream on bugcheck
- Fix assembly code for ML

svn path=/trunk/; revision=56857

reactos/boot/freeldr/freeldr/CMakeLists.txt
reactos/boot/freeldr/freeldr/arch/i386/i386bug.c
reactos/boot/freeldr/freeldr/arch/i386/i386trap.S

index 4fef61d..bae27a4 100644 (file)
@@ -32,6 +32,11 @@ if(ARCH MATCHES arm)
     endif()
 endif()
 
+# for VS 2012 we need to explicitly disable SSE
+if (MSVC_VERSION GREATER 1699 AND ARCH MATCHES i386)
+        add_definitions(/arch:IA32)
+endif ()
+
 list(APPEND FREELDR_COMMON_SOURCE
     cmdline.c
     debug.c
index e9740e2..260e39d 100644 (file)
@@ -102,6 +102,8 @@ void
 NTAPI
 i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGISTERS Special)
 {
+       PUCHAR InstructionPointer;
+
        MachVideoClearScreen(SCREEN_ATTR);
        i386_ScreenPosX = 0;
        i386_ScreenPosY = 0;
@@ -109,7 +111,7 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
     PrintText("An error occured in FreeLoader\n"
               VERSION"\n"
                  "Report this error to the ReactOS Development mailing list <ros-dev@reactos.org>\n\n"
-              "%s\n", i386ExceptionDescriptionText[TrapIndex]);
+              "0x%02lx: %s\n", TrapIndex, i386ExceptionDescriptionText[TrapIndex]);
 #ifdef _M_IX86
     PrintText("EAX: %.8lx        ESP: %.8lx        CR0: %.8lx        DR0: %.8lx\n",
               TrapFrame->Eax, TrapFrame->HardwareEsp, Special->Cr0, TrapFrame->Dr0);
@@ -137,6 +139,7 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
               TrapFrame->HardwareSegSs, Special->Ldtr, Special->Idtr.Limit);
 
        i386PrintFrames(TrapFrame);                                             // Display frames
+       InstructionPointer = (PUCHAR)TrapFrame->Eip;
 #else
     PrintText("RAX: %.8lx        R8:  %.8lx        R12: %.8lx        RSI: %.8lx\n",
               TrapFrame->Rax, TrapFrame->R8, 0, TrapFrame->Rsi);
@@ -159,7 +162,13 @@ i386PrintExceptionText(ULONG TrapIndex, PKTRAP_FRAME TrapFrame, PKSPECIAL_REGIST
               TrapFrame->SegGs, Special->Idtr.Base, Special->Idtr.Limit);
     PrintText("SS: %.4lx        LDTR: %.4lx TR: %.4lx\n\n",
               TrapFrame->SegSs, Special->Ldtr, Special->Idtr.Limit);
+       InstructionPointer = (PUCHAR)TrapFrame->Rip;
 #endif
+    PrintText("\nInstructionstream: %.2x %.2x %.2x %.2x %.2x %.2x %.2x %.2x \n",
+              InstructionPointer[0], InstructionPointer[1],
+              InstructionPointer[2], InstructionPointer[3],
+              InstructionPointer[4], InstructionPointer[5],
+              InstructionPointer[6], InstructionPointer[7]);
 }
 
 char *BugCodeStrings[] =
index c579cb9..8eb601a 100644 (file)
@@ -97,7 +97,7 @@ i386CommonExceptionHandler:
     lea eax, [esp + (21 * 4)] // KTRAP_FRAME
     push esp // KSPECIAL_REGISTERS
     push eax
-    push i386ExceptionIndex
+    push dword ptr ds:[i386ExceptionIndex]
     call _i386PrintExceptionText@12
 
        cli
@@ -109,24 +109,16 @@ i386ExceptionHandlerHang:
 
 MACRO(TRAP_STUB, function, index)
     PUBLIC VAL(function)
-#ifdef _USE_ML
-    function:
-#else
-    \function:
-#endif
+    &function:
     push 0 // Fake error code
-       mov dword ptr i386ExceptionIndex, VAL(index)
+       mov dword ptr ds:[i386ExceptionIndex], VAL(index)
        jmp i386CommonExceptionHandler
 ENDM
 
 MACRO(TRAP_STUB2, function, index)
     PUBLIC VAL(function)
-#ifdef _USE_ML
-    function:
-#else
-    \function:
-#endif
-       mov dword ptr i386ExceptionIndex, VAL(index)
+    &function:
+       mov dword ptr ds:[i386ExceptionIndex], VAL(index)
        jmp i386CommonExceptionHandler
 ENDM