]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.asm
MdeModulePkg/UDF: Fix creation of UDF logical partition
[mirror_edk2.git] / MdeModulePkg / Universal / DebugSupportDxe / X64 / AsmFuncs.asm
index 6b047066ca3d0b0295b0895e271d5f91ac8c09bd..bce49ef76208638a75f00645e295e1c8150e90b1 100644 (file)
@@ -1,8 +1,8 @@
 ;/** @file\r
 ;  Low level x64 routines used by the debug support driver.\r
 ;\r
-;  Copyright (c) 2007 - 2008, Intel Corporation.\r
-;  All rights reserved. This program and the accompanying materials\r
+;  Copyright (c) 2007 - 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
@@ -296,10 +296,10 @@ ExtraPushDone:
                 mov     rax, [rsp + 24]\r
                 mov     DebugRsp, rax\r
                 mov     rax, AppRsp\r
-                add     rax, 40\r
+                mov     rax, QWORD PTR [rax + 24]\r
                 ; application stack has ss, rsp, rflags, cs, & rip, so\r
-                ; last actual application stack entry is\r
-                ; 40 bytes into the application stack.\r
+                ; last actual application stack entry is saved at offset\r
+                ; 24 bytes from stack top.\r
                 mov     [rsp + 24], rax\r
 \r
 ;; continue building context record\r
@@ -393,6 +393,9 @@ ExtraPushDone:
                 ; They MUST be.  If they are not, a GP fault will occur.\r
                 FXSTOR_RDI\r
 \r
+;; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear\r
+                cld\r
+\r
 ;; UINT64  ExceptionData;\r
                 mov     rax, ExceptData\r
                 push    rax\r
@@ -482,7 +485,7 @@ ExtraPushDone:
 \r
                 mov     rbx, [rsp + 24]  ; move the potentially modified AppRsp into rbx\r
                 mov     rax, AppRsp\r
-                add     rax, 40\r
+                mov     rax, QWORD PTR [rax + 24]\r
                 cmp     rbx, rax\r
                 je      NoAppStackMove\r
 \r