Simplify and correct KiDebugService

svn path=/trunk/; revision=14802
This commit is contained in:
Alex Ionescu 2005-04-25 16:17:35 +00:00
parent 3ebd40dd0f
commit 6f666f0ad4

View file

@ -401,20 +401,40 @@ _KiServiceExit2:
.intel_syntax noprefix .intel_syntax noprefix
_KiDebugService: _KiDebugService:
/* Save the user context */
/* Create the Trap Frame */
push 0
push ebp push ebp
push eax
push ecx
push edx
push ebx push ebx
push esi push esi
push edi push edi
push fs
/* Switch to correct FS */
mov bx, PCR_SELECTOR
mov fs, bx
/* Save Exception List */
push fs:[KPCR_EXCEPTION_LIST]
/* Use Old Previous Mode */
mov ebx, fs:[KPCR_CURRENT_THREAD]
push [ebx+KTHREAD_PREVIOUS_MODE]
/* Continue building the Trap Frame */
push eax
push ecx
push edx
push ds push ds
push es push es
push fs
push gs push gs
sub esp, 112 /* FloatSave */
/* Switch Segments to Kernel */
mov bx, KERNEL_DS
mov ds, bx
mov es, bx
/* Save Debug Registers */
mov ebx, eax mov ebx, eax
mov eax, dr7 mov eax, dr7
push eax push eax
@ -429,16 +449,9 @@ _KiDebugService:
mov eax, dr0 mov eax, dr0
push eax push eax
mov eax, ebx mov eax, ebx
push 0 /* ContextFlags */ /* Skip useless debug data */
sub esp, 0x18
/* Set ES to kernel segment */
mov bx, KERNEL_DS
mov es, bx
/* FIXME: check to see if SS is valid/inrange */
mov ds, bx /* DS is now also kernel segment */
/* Call debug service dispatcher */ /* Call debug service dispatcher */
push edx push edx
@ -446,31 +459,5 @@ _KiDebugService:
push eax push eax
call _KdpServiceDispatcher@12 call _KdpServiceDispatcher@12
/* Restore the user context */ /* Exit through common routine */
add esp, 4 /* UserContext */ jmp _KiServiceExit2
pop eax
mov dr0, eax
pop eax
mov dr1, eax
pop eax
mov dr2, eax
pop eax
mov dr3, eax
pop eax
mov dr6, eax
pop eax
mov dr7, eax
add esp, 112 /* FloatingSave */
pop gs
pop fs
pop es
pop ds
pop edi
pop esi
pop ebx
pop edx
pop ecx
add esp, 4 /* Eax Not restored */
pop ebp
iretd