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