Revision: 15086
          http://sourceforge.net/p/edk2/code/15086
Author:   vanjeff
Date:     2014-01-10 02:48:49 +0000 (Fri, 10 Jan 2014)
Log Message:
-----------
Fix bug when reserve stack space to fill exception context.

Signed-off-by: Jeff Fan <[email protected]>
Reviewed-by: Feng Tian <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
    
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm

Modified: 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
===================================================================
--- 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S  
    2014-01-10 02:44:43 UTC (rev 15085)
+++ 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S  
    2014-01-10 02:48:49 UTC (rev 15086)
@@ -1,5 +1,5 @@
 
#------------------------------------------------------------------------------ 
;
-# Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
 # which accompanies this distribution.  The full text of the license may be 
found at
@@ -269,15 +269,15 @@
 ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
 ASM_PFX(HookAfterStubHeaderEnd):
     movq    %rsp, %rax
-    subq    $8, %rsp
-    andl    $0x0fffffff0, %esp
+    andl    $0x0fffffff0, %esp  # make sure 16-byte aligned for exception 
context
+    subq    $0x18, %rsp         # reserve room for filling exception data later
     pushq   %rcx
     movq    8(%rax), %rcx
     pushq   %rax
     movabsl ASM_PFX(mErrorCodeFlag), %eax
     bt      %ecx, %eax
     popq    %rax
-    jc      NoErrorData
+    jnc     NoErrorData
     pushq   (%rsp)            # push additional rcx to make stack alignment
 NoErrorData:
     xchgq   (%rsp), %rcx      # restore rcx, save Exception Number in stack

Modified: 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
===================================================================
--- 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
    2014-01-10 02:44:43 UTC (rev 15085)
+++ 
trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.asm
    2014-01-10 02:48:49 UTC (rev 15086)
@@ -1,5 +1,5 @@
 
;------------------------------------------------------------------------------ 
;
-; Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2012 - 2014, Intel Corporation. All rights reserved.<BR>
 ; This program and the accompanying materials
 ; are licensed and made available under the terms and conditions of the BSD 
License
 ; which accompanies this distribution.  The full text of the license may be 
found at
@@ -53,12 +53,12 @@
     jmp     rax
 HookAfterStubHeaderEnd:
     mov     rax, rsp
-    sub     rsp, 8h
-    and     sp, 0fff0h
+    and     sp,  0fff0h        ; make sure 16-byte aligned for exception 
context
+    sub     rsp, 18h           ; reserve room for filling exception data later
     push    rcx
     mov     rcx, [rax + 8]
     bt      mErrorCodeFlag, ecx
-    jc      @F
+    jnc     @F
     push    [rsp]             ; push additional rcx to make stack alignment
 @@:
     xchg    rcx, [rsp]        ; restore rcx, save Exception Number in stack

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to