Fix bug when reserve stack space to fill exception context.

Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>












git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15086 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jeff Fan 2014-01-10 02:48:49 +00:00 committed by vanjeff
parent 1d13123720
commit 554dddfcd9
2 changed files with 8 additions and 8 deletions

View File

@ -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 @@ VectorNum:
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

View File

@ -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 @@ HookAfterStubHeaderBegin:
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