summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/X64/SwitchStack.S
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-12 03:01:34 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2011-07-12 03:01:34 +0000
commitbab427db7d91689247914608b975e629ccb34d7e (patch)
treeca2404c89e0956d8172c165fd31600507ea48950 /MdePkg/Library/BaseLib/X64/SwitchStack.S
parent271d2c7f99612aae7b487cdad9c391373384e19b (diff)
downloadedk2-platforms-bab427db7d91689247914608b975e629ccb34d7e.tar.xz
MdePkg: Fix X64 clang compile issues.
Fixed issues with X64 clang, and also make StackSwitch push a zero on the new stack to prevent a stack unwind into memory that is no longer valid. signed-off-by: andrewfish reviewed-by: lgao4 reviewed-by: mdkinney git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12007 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseLib/X64/SwitchStack.S')
-rw-r--r--MdePkg/Library/BaseLib/X64/SwitchStack.S8
1 files changed, 6 insertions, 2 deletions
diff --git a/MdePkg/Library/BaseLib/X64/SwitchStack.S b/MdePkg/Library/BaseLib/X64/SwitchStack.S
index 76c3eb5226..dc8d80e40b 100644
--- a/MdePkg/Library/BaseLib/X64/SwitchStack.S
+++ b/MdePkg/Library/BaseLib/X64/SwitchStack.S
@@ -37,7 +37,10 @@
#------------------------------------------------------------------------------
ASM_GLOBAL ASM_PFX(InternalSwitchStack)
ASM_PFX(InternalSwitchStack):
- mov %rcx, %rax
+ pushq %rbp
+ movq %rsp, %rbp
+
+ mov %rcx, %rax // Shift registers for new call
mov %rdx, %rcx
mov %r8, %rdx
#
@@ -45,4 +48,5 @@ ASM_PFX(InternalSwitchStack):
# in case the callee wishes to spill them.
#
lea -0x20(%r9), %rsp
- call *%rax
+ pushq $0 // stop gdb stack unwind
+ jmp *%rax // call EntryPoint ()