InOsEmuPkg/Sec: Update assembly code when calling EFIAPI functions

For X64 the stack should be 16-byte aligned before calling a
function, and a register spill area should be reserved.

Signed-off-by: jljusten

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11651 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jljusten 2011-05-15 17:23:17 +00:00
parent 0ede3853bc
commit e5dc7e714f
1 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------
#
# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
# Portitions copyright (c) 2011, Apple Inc. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@ -43,8 +43,10 @@ ASM_PFX(SecTemporaryRamSupport):
// %rcx, %rdx, %r8
movq %r8, %rcx // Shift arguments
movq %r9, %r8
subq $0x28, %rsp // Allocate register spill area & 16-byte align stack
call ASM_PFX(CopyMem)
// Temp mem stack now copied to permanent location. %esp still in temp memory
addq $0x28, %rsp
popq %r9 // CopySize (old stack)
popq %r8 // PermanentMemoryBase (old stack)
@ -59,7 +61,9 @@ ASM_PFX(SecTemporaryRamSupport):
// ZeroMem (TemporaryMemoryBase /* rcx */, CopySize /* rdx */);
movq %rdx, %rcx
movq %r9, %rdx
subq $0x28, %rsp // Allocate register spill area & 16-byte align stack
call ASM_PFX(ZeroMem)
addq $0x28, %rsp
// This data comes off the NEW stack
popq %rbp