summaryrefslogtreecommitdiff
path: root/UnixPkg/Library/UnixBaseLib/X64
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-08-18 20:24:08 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-08-18 20:24:08 +0000
commitbb111c2346bef02c18b30acced3f7b0311bbfe21 (patch)
tree496916a37849ea45a4083848501de061a2b98732 /UnixPkg/Library/UnixBaseLib/X64
parent6989af71680fc69024e68a0ab6d8284f0c4909fc (diff)
downloadedk2-platforms-bb111c2346bef02c18b30acced3f7b0311bbfe21.tar.xz
Added support for an EFI X64 ABI compatible UnixPkg. With an internal only compiler I've been able to run checked in X64 EFI shell binary! We are hoping to get the open source LLVM compiler working for this... Since the SEC has to be UNIX ABI to make the POSIX calls it is compiled using a different compiler and the rest of the UnixPkg is compiled with UNIXPKG tool. You just need to point UNIXPKG at your EFI X64 ABI compiler of choice, it should work like MYTOOLS. Some one may want to port this to Linux at some point. To build cd into UnixPkg and ./build64.sh
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10806 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg/Library/UnixBaseLib/X64')
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/LongJump.S42
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SetJump.S33
-rw-r--r--UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S42
3 files changed, 13 insertions, 104 deletions
diff --git a/UnixPkg/Library/UnixBaseLib/X64/LongJump.S b/UnixPkg/Library/UnixBaseLib/X64/LongJump.S
index d17592cf37..f20446fcf0 100644
--- a/UnixPkg/Library/UnixBaseLib/X64/LongJump.S
+++ b/UnixPkg/Library/UnixBaseLib/X64/LongJump.S
@@ -23,12 +23,12 @@
# VOID
# EFIAPI
# InternalLongJump (
-# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // %rcx
-# IN UINTN Value // %rdx
+# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
+# IN UINTN Value
# );
#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(EfiInternalLongJump)
-ASM_PFX(EfiInternalLongJump):
+ASM_GLOBAL ASM_PFX(InternalLongJump)
+ASM_PFX(InternalLongJump):
mov (%rcx), %rbx
mov 0x8(%rcx), %rsp
mov 0x10(%rcx), %rbp
@@ -52,37 +52,3 @@ ASM_PFX(EfiInternalLongJump):
movdqu 0xE8(%rcx), %xmm15
mov %rdx, %rax # set return value
jmp *0x48(%rcx)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# UnixInternalLongJump (
-# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // %rdi
-# IN UINTN Value // %rsi
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalLongJump)
-ASM_PFX(InternalLongJump):
- mov (%rdi), %rbx
- mov 0x8(%rdi), %rsp
- mov 0x10(%rdi), %rbp
- mov 0x18(%rdi), %rdi
- mov 0x20(%rdi), %rsi
- mov 0x28(%rdi), %r12
- mov 0x30(%rdi), %r13
- mov 0x38(%rdi), %r14
- mov 0x40(%rdi), %r15
- # load non-volatile fp registers
- ldmxcsr 0x50(%rdi)
- movdqu 0x58(%rdi), %xmm6
- movdqu 0x68(%rdi), %xmm7
- movdqu 0x78(%rdi), %xmm8
- movdqu 0x88(%rdi), %xmm9
- movdqu 0x98(%rdi), %xmm10
- movdqu 0xA8(%rdi), %xmm11
- movdqu 0xB8(%rdi), %xmm12
- movdqu 0xC8(%rdi), %xmm13
- movdqu 0xD8(%rdi), %xmm14
- movdqu 0xE8(%rdi), %xmm15
- mov %rsi, %rax # set return value
- jmp *0x48(%rdi)
diff --git a/UnixPkg/Library/UnixBaseLib/X64/SetJump.S b/UnixPkg/Library/UnixBaseLib/X64/SetJump.S
index b5fd38ab6a..ea9e225a93 100644
--- a/UnixPkg/Library/UnixBaseLib/X64/SetJump.S
+++ b/UnixPkg/Library/UnixBaseLib/X64/SetJump.S
@@ -19,8 +19,8 @@
#
#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(EfiSetJump)
-ASM_PFX(EfiSetJump):
+ASM_GLOBAL ASM_PFX(SetJump)
+ASM_PFX(SetJump):
push %rcx
add $0xffffffffffffffe0,%rsp
call ASM_PFX(InternalAssertJumpBuffer)
@@ -51,32 +51,3 @@ ASM_PFX(EfiSetJump):
movdqu %xmm15, 0xE8(%rcx)
xor %rax,%rax
jmpq *%rdx
-
-
-ASM_GLOBAL ASM_PFX(SetJump)
-ASM_PFX(SetJump):
- pop %rdx
- mov %rbx,(%rdi) # Rbx
- mov %rsp,0x8(%rdi)
- mov %rbp,0x10(%rdi)
- mov %rcx,0x18(%rdi)
- mov %rsi,0x20(%rdi)
- mov %r12,0x28(%rdi)
- mov %r13,0x30(%rdi)
- mov %r14,0x38(%rdi)
- mov %r15,0x40(%rdi)
- mov %rdx,0x48(%rdi)
- # save non-volatile fp registers
- stmxcsr 0x50(%rdi)
- movdqu %xmm6, 0x58(%rdi)
- movdqu %xmm7, 0x68(%rdi)
- movdqu %xmm8, 0x78(%rdi)
- movdqu %xmm9, 0x88(%rdi)
- movdqu %xmm10, 0x98(%rdi)
- movdqu %xmm11, 0xA8(%rdi)
- movdqu %xmm12, 0xB8(%rdi)
- movdqu %xmm13, 0xC8(%rdi)
- movdqu %xmm14, 0xD8(%rdi)
- movdqu %xmm15, 0xE8(%rdi)
- xor %rax,%rax
- jmpq *%rdx
diff --git a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S b/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S
index b6dff5ed77..3a84b0d22f 100644
--- a/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S
+++ b/UnixPkg/Library/UnixBaseLib/X64/SwitchStack.S
@@ -35,45 +35,17 @@
# None
#
#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(EfiInternalSwitchStack)
-ASM_PFX(EfiInternalSwitchStack):
- mov %rcx, %rax
- mov %rdx, %rcx
- mov %r8, %rdx
- #
- # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
- # in case the callee wishes to spill them.
- #
- lea -0x20(%r9), %rsp
- call *%rax
-
-
-
-#------------------------------------------------------------------------------
-# Routine Description:
-#
-# Routine for switching stacks with 2 parameters (Unix ABI)
-#
-# Arguments:
-#
-# (rdi) EntryPoint - Entry point with new stack.
-# (rsi) Context1 - Parameter1 for entry point.
-# (rdx) Context2 - Parameter2 for entry point.
-# (rcx) NewStack - The pointer to new stack.
-#
-# Returns:
-#
-# None
-#
-#------------------------------------------------------------------------------
ASM_GLOBAL ASM_PFX(InternalSwitchStack)
ASM_PFX(InternalSwitchStack):
- mov %rdi, %rax
- mov %rsi, %rdi
- mov %rdx, %rsi
+ movq %rcx, %rax
+ movq %rdx, %rcx
+ movq %r8, %rdx
+ movq %r9, %rsp
+
#
# Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
# in case the callee wishes to spill them.
#
- lea -0x20(%rcx), %rsp
+ subq $40, %rsp // 32-byte shadow space plus alignment pad
+
call *%rax