diff --git a/reactos/hal/halx86/generic/v86.s b/reactos/hal/halx86/generic/v86.s index 5dc6d8090ed..55d5f0a93ea 100644 --- a/reactos/hal/halx86/generic/v86.s +++ b/reactos/hal/halx86/generic/v86.s @@ -34,8 +34,14 @@ _HalpSavedEsp: .long 0 +_InvalidMsg: + .asciz "HAL: An invalid V86 opcode was encountered at address %x:%x\n" + +_InvalidGpfMsg: + .asciz "HAL: Trap0D while not in V86 mode\n" + _UnhandledMsg: - .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx!!!\n" + .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx [%s]!!!\n" /* FUNCTIONS *****************************************************************/ @@ -143,8 +149,15 @@ _HalpRealModeEnd: .func HalpOpcodeInvalid@0 _HalpOpcodeInvalid@0: - /* Unhandled */ - UNHANDLED_PATH + /* This should never happen -- is the IOPM damaged? */ + push [esi+HALP_BIOS_FRAME_EIP] + push [esi+HALP_BIOS_FRAME_CS] + push offset _InvalidMsg + call _DbgPrint + add esp, 12 + + /* Break */ + int 3 /* Nothing to return */ xor eax, eax @@ -376,7 +389,7 @@ _Ki16BitStackException: add esp, [eax+KTHREAD_INITIAL_STACK] /* Switch to good stack segment */ - UNHANDLED_PATH + UNHANDLED_PATH "16-Bit Stack" .endfunc .globl _HalpTrap0D@0 @@ -391,8 +404,13 @@ _HalpTrap0D@0: test dword ptr [ebp+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK jnz DoDispatch - /* Unhandled */ - UNHANDLED_PATH + /* This is weird -- but might happen during an NMI */ + push offset _InvalidGpfMsg + call _DbgPrint + add esp, 4 + + /* Loop forever */ + jmp $ DoDispatch: /* Handle the opcode */ diff --git a/reactos/ntoskrnl/include/internal/i386/asmmacro.S b/reactos/ntoskrnl/include/internal/i386/asmmacro.S index e445ca46262..fff9d4bd122 100644 --- a/reactos/ntoskrnl/include/internal/i386/asmmacro.S +++ b/reactos/ntoskrnl/include/internal/i386/asmmacro.S @@ -87,19 +87,48 @@ // // @name UNHANDLED_PATH // -// This macro TODO +// This macro prints out that the current code path is not expected yet // // @param None // // @remark None. // -.macro UNHANDLED_PATH +.macro UNHANDLED_PATH Reason + + /* Push reason */ + push offset 1f + /* Get EIP */ call $+5 /* Print debug message */ push offset _UnhandledMsg call _DbgPrint + add esp, 12 + + /* Loop indefinitely */ + jmp $ + +1: + .asciz \Reason +.endm + +// +// @name UNHANDLED_V86_PATH +// +// This macro prints out that the current code path is for unhandled VDM support +// +// @param None +// +// @remark None. +// +.macro UNHANDLED_V86_PATH + /* Get EIP */ + call $+5 + + /* Print debug message */ + push offset _V86UnhandledMsg + call _DbgPrint add esp, 8 /* Loop indefinitely */ diff --git a/reactos/ntoskrnl/ke/i386/trap.s b/reactos/ntoskrnl/ke/i386/trap.s index c8458c387ed..0f53d39ce15 100644 --- a/reactos/ntoskrnl/ke/i386/trap.s +++ b/reactos/ntoskrnl/ke/i386/trap.s @@ -91,8 +91,11 @@ _KiUnexpectedEntrySize: _UnexpectedMsg: .asciz "\n\x7\x7!!! Unexpected Interrupt %02lx !!!\n" +_V86UnhandledMsg: + .asciz "\n\x7\x7!!! Unhandled V8086 (VDM) support at line: %lx!!!\n" + _UnhandledMsg: - .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx!!!\n" + .asciz "\n\x7\x7!!! Unhandled or Unexpected Code at line: %lx [%s]!!!\n" _IsrTimeoutMsg: .asciz "\n*** ISR at %lx took over .5 second\n" @@ -133,7 +136,7 @@ _KiTrapIoTable: _KiGetTickCount: _KiCallbackReturn: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "TickCount/Callback Interrupts\n" .func KiSystemService TRAP_FIXUPS kss_a, kss_t, DoNotFixupV86, DoNotFixupAbios @@ -458,7 +461,7 @@ V86_Exit: AbiosExit: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "ABIOS Exit" .func KiRaiseAssertion TRAP_FIXUPS kira_a, kira_t, DoFixupV86, DoFixupAbios @@ -697,7 +700,7 @@ _DispatchTwoParam: _KiFixupFrame: /* TODO: Routine to fixup a KTRAP_FRAME when faulting from a syscall. */ - UNHANDLED_PATH + UNHANDLED_PATH "Trap Frame Fixup" .endfunc .func KiTrap0 @@ -738,7 +741,7 @@ VdmCheck: /* We don't support this yet! */ V86Int0: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .func KiTrap1 @@ -781,7 +784,7 @@ V86Int1: jz EnableInterrupts /* We don't support VDM! */ - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .globl _KiTrap2 @@ -847,7 +850,7 @@ V86Int3: jz EnableInterrupts3 /* We don't support VDM! */ - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .func KiTrap4 @@ -888,7 +891,7 @@ VdmCheck4: /* We don't support this yet! */ V86Int4: - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .func KiTrap5 @@ -933,7 +936,7 @@ VdmCheck5: /* We don't support this yet! */ V86Int5: - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .func KiTrap6 @@ -949,7 +952,7 @@ _KiTrap6: VdmOpCodeFault: /* Not yet supported (Invalid OPCODE from V86) */ - UNHANDLED_PATH + UNHANDLED_V86_PATH NotV86UD: /* Push error code */ @@ -1025,7 +1028,7 @@ LockCrash: IsVdmOpcode: /* Unhandled yet */ - UNHANDLED_PATH + UNHANDLED_V86_PATH /* Return to caller */ jmp _Kei386EoiHelper@0 @@ -1332,7 +1335,7 @@ V86Npx: jz HandleUserNpx /* V86 NPX not handled */ - UNHANDLED_PATH + UNHANDLED_V86_PATH EmulationEnabled: /* Did this come from kernel-mode? */ @@ -1499,7 +1502,7 @@ RaiseIrql: jnz NoReflect /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_V86_PATH NoReflect: @@ -1540,7 +1543,7 @@ NotV86: jae KmodeGpf /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "Double GPF" /* Get the opcode and trap frame */ KmodeGpf: @@ -1629,7 +1632,7 @@ TrapCopy: MsrCheck: /* FIXME: Handle RDMSR/WRMSR */ - UNHANDLED_PATH + UNHANDLED_PATH "RDMSR/WRMSR" NotIretGpf: @@ -1913,7 +1916,7 @@ SetException: DispatchV86Gpf: /* FIXME */ - UNHANDLED_PATH + UNHANDLED_V86_PATH .endfunc .func KiTrap14 @@ -2003,12 +2006,12 @@ AccessFail: jnz CheckVdmPf /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "SYSENTER Fault" jmp _Kei386EoiHelper@0 SysCallCopyFault: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "SYSENTER Fault" jmp _Kei386EoiHelper@0 /* Check if the fault occured in a V86 mode */ @@ -2033,7 +2036,7 @@ CheckVdmPf: VdmPF: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_V86_PATH /* Save EIP and check what kind of status failure we got */ CheckStatus: @@ -2067,7 +2070,7 @@ SpecialCode: SlistFault: /* FIXME: TODO */ - UNHANDLED_PATH + UNHANDLED_PATH "SLIST Fault" IllegalState: @@ -2083,7 +2086,7 @@ IllegalState: VdmAlertGpf: /* FIXME: NOT SUPPORTED */ - UNHANDLED_PATH + UNHANDLED_V86_PATH HandleLockErrata: @@ -2328,7 +2331,7 @@ VdmXmmi: V86Xmmi: /* V86 XMMI not handled */ - UNHANDLED_PATH + UNHANDLED_V86_PATH KernelXmmi: /* Another weird situation */ @@ -2394,7 +2397,7 @@ _Ki16BitStackException: add esp, [eax+KTHREAD_INITIAL_STACK] /* Switch to good stack segment */ - UNHANDLED_PATH + UNHANDLED_PATH "16-Bit Stack" .endfunc /* UNEXPECTED INTERRUPT HANDLERS **********************************************/