]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.asm
Use RLE (Run Length Encoding) to improve debugging performance.
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / Ia32 / AsmFuncs.asm
index 2d2fa5fc7a571642295dcad42a682f50112be921..377ade7c3b3ed1aae423e5c092e7a9388d4dcae9 100644 (file)
@@ -1,6 +1,6 @@
 ;------------------------------------------------------------------------------\r
 ;\r
-; Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+; Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
 ; This program and the accompanying materials\r
 ; are licensed and made available under the terms and conditions of the BSD License\r
 ; which accompanies this distribution.  The full text of the license may be found at\r
@@ -32,114 +32,138 @@ InterruptProcess                 PROTO   C
 \r
 public    Exception0Handle, TimerInterruptHandle, ExceptionStubHeaderSize\r
 \r
+AGENT_HANDLER_SIGNATURE  MACRO\r
+  db   41h, 47h, 54h, 48h       ; SIGNATURE_32('A','G','T','H')\r
+ENDM\r
+\r
 .data\r
 \r
-ExceptionStubHeaderSize   DW    Exception1Handle - Exception0Handle\r
+ExceptionStubHeaderSize   DD    Exception1Handle - Exception0Handle\r
 CommonEntryAddr           DD    CommonEntry\r
 \r
 .code\r
 \r
+AGENT_HANDLER_SIGNATURE\r
 Exception0Handle:\r
     cli\r
     push    eax\r
     mov     eax, 0\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception1Handle:\r
     cli\r
     push    eax\r
     mov     eax, 1\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception2Handle:\r
     cli\r
     push    eax\r
     mov     eax, 2\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception3Handle:\r
     cli\r
     push    eax\r
     mov     eax, 3\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception4Handle:\r
     cli\r
     push    eax\r
     mov     eax, 4\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception5Handle:\r
     cli\r
     push    eax\r
     mov     eax, 5\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception6Handle:\r
     cli\r
     push    eax\r
     mov     eax, 6\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception7Handle:\r
     cli\r
     push    eax\r
     mov     eax, 7\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception8Handle:\r
     cli\r
     push    eax\r
     mov     eax, 8\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception9Handle:\r
     cli\r
     push    eax\r
     mov     eax, 9\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception10Handle:\r
     cli\r
     push    eax\r
     mov     eax, 10\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception11Handle:\r
     cli\r
     push    eax\r
     mov     eax, 11\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception12Handle:\r
     cli\r
     push    eax\r
     mov     eax, 12\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception13Handle:\r
     cli\r
     push    eax\r
     mov     eax, 13\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception14Handle:\r
     cli\r
     push    eax\r
     mov     eax, 14\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception15Handle:\r
     cli\r
     push    eax\r
     mov     eax, 15\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception16Handle:\r
     cli\r
     push    eax\r
     mov     eax, 16\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception17Handle:\r
     cli\r
     push    eax\r
     mov     eax, 17\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception18Handle:\r
     cli\r
     push    eax\r
     mov     eax, 18\r
     jmp     dword ptr [CommonEntryAddr]\r
+AGENT_HANDLER_SIGNATURE\r
 Exception19Handle:\r
     cli\r
     push    eax\r
     mov     eax, 19\r
     jmp     dword ptr [CommonEntryAddr]\r
-\r
+AGENT_HANDLER_SIGNATURE\r
 TimerInterruptHandle:\r
     cli\r
     push    eax\r
@@ -259,7 +283,7 @@ NoExtrPush:
 \r
     ;; clear Dr7 while executing debugger itself\r
     xor     eax, eax\r
;; mov     dr7, eax\r
   mov     dr7, eax\r
 \r
     ;; Dr6\r
     mov     eax, dr6\r
@@ -278,22 +302,33 @@ NoExtrPush:
     mov     eax, dr0\r
     push    eax\r
 \r
+    ;; Clear Direction Flag\r
+    cld\r
+\r
     ;; FX_SAVE_STATE_IA32 FxSaveState;\r
-    sub esp, 512\r
-    mov edi, esp\r
+    sub     esp, 512\r
+    mov     edi, esp\r
+    ;; Clear the buffer\r
+    xor     eax, eax\r
+    mov     ecx, 128 ;= 512 / 4\r
+    rep     stosd\r
+    mov     edi, esp\r
     db 0fh, 0aeh, 00000111y ;fxsave [edi]\r
 \r
-    ;; Clear Direction Flag\r
-    cld\r
-       \r
+    ;; save the exception data\r
+    push    dword ptr [ebp + 8]\r
+\r
     ; call the C interrupt process function\r
     push    esp     ; Structure\r
     push    ebx     ; vector\r
     call    InterruptProcess\r
     add     esp, 8\r
 \r
+    ; skip the exception data\r
+    add     esp, 4\r
+\r
     ;; FX_SAVE_STATE_IA32 FxSaveState;\r
-    mov esi, esp\r
+    mov     esi, esp\r
     db 0fh, 0aeh, 00001110y ; fxrstor [esi]\r
     add esp, 512\r
 \r