]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/X64/CpuAsm.asm
A complement fix for revision 11664 to update GCC assembly files : clear the directio...
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / X64 / CpuAsm.asm
index 05d9bca119ddf4079945fc517b62d8ca846256c7..68fcd3f404657451a50caf5e0d5c99963a3e2867 100644 (file)
@@ -1,8 +1,8 @@
       TITLE   CpuAsm.asm: \r
 ;------------------------------------------------------------------------------\r
 ;*\r
-;*   Copyright 2008 - 2009, Intel Corporation                                                         \r
-;*   All rights reserved. This program and the accompanying materials                          \r
+;*   Copyright (c) 2008 - 2011, 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
 ;*   http://opensource.org/licenses/bsd-license.php                                            \r
@@ -207,16 +207,8 @@ NoErrorCode:
 ;; UINT64  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
     mov     rax, dr7\r
     push    rax\r
-;; clear Dr7 while executing debugger itself\r
-    xor     rax, rax\r
-    mov     dr7, rax\r
-\r
     mov     rax, dr6\r
     push    rax\r
-;; insure all status bits in dr6 are clear...\r
-    xor     rax, rax\r
-    mov     dr6, rax\r
-\r
     mov     rax, dr3\r
     push    rax\r
     mov     rax, dr2\r
@@ -231,6 +223,9 @@ NoErrorCode:
     mov rdi, rsp\r
     db 0fh, 0aeh, 07h ;fxsave [rdi]\r
 \r
+;; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear\r
+    cld\r
+\r
 ;; UINT32  ExceptionData;\r
     push    qword ptr [rbp + 16]\r
 \r
@@ -265,18 +260,9 @@ nonNullValue:
     add rsp, 512\r
 \r
 ;; UINT64  Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;\r
-    pop     rax\r
-    mov     dr0, rax\r
-    pop     rax\r
-    mov     dr1, rax\r
-    pop     rax\r
-    mov     dr2, rax\r
-    pop     rax\r
-    mov     dr3, rax\r
-;; skip restore of dr6.  We cleared dr6 during the context save.\r
-    add     rsp, 8\r
-    pop     rax\r
-    mov     dr7, rax\r
+;; Skip restoration of DRx registers to support in-circuit emualators\r
+;; or debuggers set breakpoint in interrupt/exception context\r
+    add     rsp, 8 * 6\r
 \r
 ;; UINT64  Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;\r
     pop     rax\r