Add X64 support for DebugSupport driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2067 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2
2006-12-07 08:31:19 +00:00
parent b2b5e78fbb
commit 5fd59c656c
10 changed files with 2051 additions and 217 deletions

View File

@ -79,16 +79,16 @@ OrigVector dd 66666666h ; ?
;;
;; For reference, the context structure looks like this:
;; struct {
;; UINT32 ExceptionData;
;; FX_SAVE_STATE FxSaveState; // 512 bytes, must be 16 byte aligned
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
;; UINT32 Ldtr, Tr;
;; UINT64 Gdtr, Idtr;
;; UINT32 EFlags;
;; UINT32 Eip;
;; UINT32 SegGs, SegFs, SegEs, SegDs, SegCs, SegSs;
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
;; UINT32 ExceptionData;
;; FX_SAVE_STATE_IA32 FxSaveState; // 512 bytes, must be 16 byte aligned
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
;; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
;; UINT32 EFlags;
;; UINT32 Ldtr, Tr;
;; UINT32 Gdtr[2], Idtr[2];
;; UINT32 Eip;
;; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
;; } SYSTEM_CONTEXT_IA32; // 32 bit system context record
@ -208,11 +208,11 @@ Vect2Desc ENDP
; copied and fixed up once for each IDT entry that is hooked.
;
InterruptEntryStub::
mov AppEsp, esp ; save stack top
mov AppEsp, esp ; save stack top
mov esp, offset DebugStackBegin ; switch to debugger stack
push 0 ; push vector number - will be modified before installed
db 0e9h ; jump rel32
dd 0 ; fixed up to relative address of CommonIdtEntry
push 0 ; push vector number - will be modified before installed
db 0e9h ; jump rel32
dd 0 ; fixed up to relative address of CommonIdtEntry
InterruptEntryStubEnd:
@ -251,16 +251,16 @@ CommonIdtEntry::
;;
;; typedef
;; struct {
;; UINT32 ExceptionData;
;; FX_SAVE_STATE FxSaveState;
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
;; UINT32 Cr0, Cr2, Cr3, Cr4;
;; UINT32 Ldtr, Tr;
;; UINT64 Gdtr, Idtr;
;; UINT32 EFlags;
;; UINT32 Eip;
;; UINT32 SegGs, SegFs, SegEs, SegDs, SegCs, SegSs;
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
;; UINT32 ExceptionData;
;; FX_SAVE_STATE_IA32 FxSaveState;
;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
;; UINT32 Cr0, Cr2, Cr3, Cr4;
;; UINT32 EFlags;
;; UINT32 Ldtr, Tr;
;; UINT32 Gdtr[2], Idtr[2];
;; UINT32 Eip;
;; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
;; } SYSTEM_CONTEXT_IA32; // 32 bit system context record
;; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
@ -340,7 +340,7 @@ CommonIdtEntry::
mov eax, AppEsp
push dword ptr [eax]
;; UINT64 Gdtr, Idtr;
;; UINT32 Gdtr[2], Idtr[2];
push 0
push 0
sidt fword ptr [esp]
@ -397,7 +397,7 @@ CommonIdtEntry::
mov eax, dr0
push eax
;; FX_SAVE_STATE FxSaveState;
;; FX_SAVE_STATE_IA32 FxSaveState;
sub esp, 512
mov edi, esp
; IMPORTANT!! The debug stack has been carefully constructed to
@ -422,7 +422,7 @@ CommonIdtEntry::
;; UINT32 ExceptionData;
add esp, 4
;; FX_SAVE_STATE FxSaveState;
;; FX_SAVE_STATE_IA32 FxSaveState;
mov esi, esp
FXRSTOR_ESI
add esp, 512
@ -456,8 +456,8 @@ CommonIdtEntry::
mov eax, AppEsp
pop dword ptr [eax + 8]
;; UINT16 Ldtr, Tr;
;; UINT64 Gdtr, Idtr;
;; UINT32 Ldtr, Tr;
;; UINT32 Gdtr[2], Idtr[2];
;; Best not let anyone mess with these particular registers...
add esp, 24
@ -478,7 +478,7 @@ CommonIdtEntry::
pop ss
;; The next stuff to restore is the general purpose registers that were pushed
;; using the pushad instruction.
;; using the "pushad" instruction.
;;
;; The value of ESP as stored in the context record is the application ESP
;; including the 3 entries on the application stack caused by the exception
@ -505,7 +505,7 @@ CommonIdtEntry::
mov AppEsp, eax
NoAppStackMove:
mov eax, DebugEsp ; restore the DebugEsp on the debug stack
; so our popad will not cause a stack switch
; so our "popad" will not cause a stack switch
mov [esp + 12], eax
cmp ExceptionNumber, 068h