summaryrefslogtreecommitdiff
path: root/InOsEmuPkg
diff options
context:
space:
mode:
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-05-15 17:23:17 +0000
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>2011-05-15 17:23:17 +0000
commite5dc7e714f31170f4872bbef099d431b5441acf9 (patch)
treea1997fe7bf4a65b062ad5bbd9d51c89e2eac1fc1 /InOsEmuPkg
parent0ede3853bcc042f4b1897a8783995d71888addbb (diff)
downloadedk2-platforms-e5dc7e714f31170f4872bbef099d431b5441acf9.tar.xz
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
Diffstat (limited to 'InOsEmuPkg')
-rw-r--r--InOsEmuPkg/Sec/X64/SwitchRam.S10
1 files changed, 7 insertions, 3 deletions
diff --git a/InOsEmuPkg/Sec/X64/SwitchRam.S b/InOsEmuPkg/Sec/X64/SwitchRam.S
index 6bb2857ff0..a7219bf21f 100644
--- a/InOsEmuPkg/Sec/X64/SwitchRam.S
+++ b/InOsEmuPkg/Sec/X64/SwitchRam.S
@@ -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
@@ -35,7 +35,7 @@ ASM_PFX(SecTemporaryRamSupport):
pushq %rdx // Save TemporaryMemoryBase
pushq %r8 // Save PermanentMemoryBase
pushq %r9 // Save CopySize
-
+
//
// Copy all of temp RAM to permanent memory, including stack
//
@@ -43,9 +43,11 @@ 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)
popq %rdx // TemporaryMemoryBase (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