Don't use hack for trap frames anymore, read TempEsp and TempSegSs for kernel-mode traps during debugging. Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s _____
Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h --- trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-04-23 19:23:00 UTC (rev 14789) +++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-04-23 20:02:39 UTC (rev 14790) @@ -27,8 +27,8 @@
#define KTRAP_FRAME_DEBUGEIP (0x4) #define KTRAP_FRAME_DEBUGARGMARK (0x8) #define KTRAP_FRAME_DEBUGPOINTER (0xC) -#define KTRAP_FRAME_TEMPCS (0x10) -#define KTRAP_FRAME_TEMPEIP (0x14) +#define KTRAP_FRAME_TEMPSS (0x10) +#define KTRAP_FRAME_TEMPESP (0x14) #define KTRAP_FRAME_DR0 (0x18) #define KTRAP_FRAME_DR1 (0x1C) #define KTRAP_FRAME_DR2 (0x20) @@ -117,8 +117,8 @@ PVOID DebugEip; PVOID DebugArgMark; PVOID DebugPointer; - PVOID TempCs; - PVOID TempEip; + PVOID TempSegSs; + PVOID TempEsp; ULONG Dr0; ULONG Dr1; ULONG Dr2; _____
Modified: trunk/reactos/ntoskrnl/kdbg/kdb_cli.c --- trunk/reactos/ntoskrnl/kdbg/kdb_cli.c 2005-04-23 19:23:00 UTC (rev 14789) +++ trunk/reactos/ntoskrnl/kdbg/kdb_cli.c 2005-04-23 20:02:39 UTC (rev 14790) @@ -374,6 +374,19 @@
if (Argv[0][0] == 'r') /* regs */ { + ULONG Esp; + USHORT Ss; + + if (!(Tf->Cs & 1)) + { + Esp = (ULONG)Tf->TempEsp; + Ss = (USHORT)((ULONG)Tf->TempSegSs & 0xFFFF); + } + else + { + Esp = Tf->Esp; + Ss = Tf->Ss; + } KdbpPrint("CS:EIP 0x%04x:0x%08x\n" "SS:ESP 0x%04x:0x%08x\n" " EAX 0x%08x EBX 0x%08x\n" @@ -381,7 +394,7 @@ " ESI 0x%08x EDI 0x%08x\n" " EBP 0x%08x\n", Tf->Cs & 0xFFFF, Tf->Eip, - Tf->Ss, Tf->Esp, + Ss, Esp, Tf->Eax, Tf->Ebx, Tf->Ecx, Tf->Edx, Tf->Esi, Tf->Edi, _____
Modified: trunk/reactos/ntoskrnl/ke/i386/trap.s --- trunk/reactos/ntoskrnl/ke/i386/trap.s 2005-04-23 19:23:00 UTC (rev 14789) +++ trunk/reactos/ntoskrnl/ke/i386/trap.s 2005-04-23 20:02:39 UTC (rev 14790) @@ -76,29 +76,6 @@
popl %edi popl %esi popl %ebx - -#ifdef KDBG - /* - * Cleanup the stack which was used to setup a trapframe with SS:ESP when called - * from kmode. - */ - movw 0xC(%esp), %bp /* Get CS from trapframe */ - cmpw $KERNEL_CS, %bp - jne 0f - - /* Copy EBP, CS:EIP and EFLAGS from the trapframe back onto the top of our stack. */ - movl 0x00(%esp), %ebp /* EBP */ - movl %ebp, 0x24(%esp) - movl 0x08(%esp), %ebp /* EIP */ - movl %ebp, 0x2C(%esp) - movl 0x0C(%esp), %ebp /* CS */ - movl %ebp, 0x30(%esp) - movl 0x10(%esp), %ebp /* EFLAGS */ - movl %ebp, 0x34(%esp) - - addl $0x24, %esp -0: -#endif /* DBG */ popl %ebp addl $0x4, %esp /* Ignore error code */ @@ -106,28 +83,7 @@
.globl _KiTrapProlog _KiTrapProlog: -#ifdef KDBG - /* - * If we were called from kmode we start setting up a new trapframe (with SS:ESP at the end) - */ - movw 0x14(%esp), %bx /* Get old CS */ - cmpw $KERNEL_CS, %bx - - jne 0f
- leal 0x1C(%esp), %ebp - pushl %ss /* Old SS */ - pushl %ebp /* Old ESP */ - pushl 0x20(%esp) /* Old EFLAGS */ - pushl 0x20(%esp) /* Old CS */ - pushl 0x20(%esp) /* Old EIP */ - pushl 0x20(%esp) /* ErrorCode */ - pushl 0x20(%esp) /* Ebp */ - pushl 0x20(%esp) /* Ebx */ - pushl 0x20(%esp) /* Esi */ -0: -#endif /* DBG */ - pushl %edi pushl %fs
@@ -191,8 +147,9 @@ pushl %eax /* Dr1 */ movl %dr0, %eax pushl %eax /* Dr0 */ - pushl $0 /* XXX: TempESP */ - pushl $0 /* XXX: TempCS */ + leal 0x64(%esp), %eax + pushl %eax /* XXX: TempESP */ + pushl %ss /* XXX: TempSS */ pushl $0 /* XXX: DebugPointer */ pushl $0 /* XXX: DebugArgMark */ movl 0x60(%esp), %ebx