summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-22 09:19:59 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2009-09-22 09:19:59 +0000
commit82dae5efb31a4865f3f30be41a28c83d98c1d4ed (patch)
treec45b3c12d454dde75e4e3732fdfc46dd1dba930f
parent60bd4ccd45aa4077a0192364a7b97f9066192e58 (diff)
downloadedk2-platforms-82dae5efb31a4865f3f30be41a28c83d98c1d4ed.tar.xz
Fix bug that home addresses for register parameters must be allocated for calling C function from X64 assembly code to follow x64 calling convention.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9303 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/X86LocalApicTimerInitialize.asm2
-rw-r--r--OvmfPkg/Sec/X64/SecEntry.S1
-rw-r--r--OvmfPkg/Sec/X64/SecEntry.asm1
3 files changed, 4 insertions, 0 deletions
diff --git a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/X86LocalApicTimerInitialize.asm b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/X86LocalApicTimerInitialize.asm
index c15b7208da..005b55b7e1 100644
--- a/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/X86LocalApicTimerInitialize.asm
+++ b/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseTimerLibLocalApic/X64/X86LocalApicTimerInitialize.asm
@@ -31,7 +31,9 @@ EXTERNDEF InternalX86GetApicBase:PROC
; );
;------------------------------------------------------------------------------
CpuInitLocalApicTimer PROC
+ sub rsp, 28h ;Reserve home addresses and make RSP 16-byte aligned
call InternalX86GetApicBase
+ add rsp, 28h
mov dword ptr [rax + 3e0h], 0ah
bts dword ptr [rax + 320h], 17
mov dword ptr [rax + 380h], -1
diff --git a/OvmfPkg/Sec/X64/SecEntry.S b/OvmfPkg/Sec/X64/SecEntry.S
index 9855ea9d81..a1de5e674b 100644
--- a/OvmfPkg/Sec/X64/SecEntry.S
+++ b/OvmfPkg/Sec/X64/SecEntry.S
@@ -55,5 +55,6 @@ ASM_PFX(_ModuleEntryPoint):
movq %rsi, %rdx
movq %rdi, %r8
movq %rsp, %r9
+ subq $0x20, %rsp
call ASM_PFX(SecCoreStartupWithStack)
diff --git a/OvmfPkg/Sec/X64/SecEntry.asm b/OvmfPkg/Sec/X64/SecEntry.asm
index 8b836de62e..fb38548be3 100644
--- a/OvmfPkg/Sec/X64/SecEntry.asm
+++ b/OvmfPkg/Sec/X64/SecEntry.asm
@@ -54,6 +54,7 @@ _ModuleEntryPoint PROC PUBLIC
mov rdx, rsi
mov r8, rdi
mov r9, rsp
+ sub rsp, 20h
call SecCoreStartupWithStack
_ModuleEntryPoint ENDP