summaryrefslogtreecommitdiff
path: root/UnixPkg/Sec/X64
diff options
context:
space:
mode:
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-22 21:21:38 +0000
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>2010-07-22 21:21:38 +0000
commitb9c8e50e2054fc21c2029db309f813d03ccd6082 (patch)
tree63828888a832dc738d34a430be7e592baf4ee65d /UnixPkg/Sec/X64
parent92a4f6f3c7898c4d4bc54cdd0fa6734b1a352269 (diff)
downloadedk2-platforms-b9c8e50e2054fc21c2029db309f813d03ccd6082.tar.xz
Port UnixPkg to also support X64. Currently only supports Unix x86_64 ABI. In the future we can make Sec support x86_64 ABI and the rest of the code support X64 EFI ABI. This will require assembly gaskets to fix the calling convention differences. I currently have noop gaskets in place for x86_64 ABI. This has only been tested on OS X 10.6.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10685 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg/Sec/X64')
-rw-r--r--UnixPkg/Sec/X64/Gasket.S158
-rw-r--r--UnixPkg/Sec/X64/GasketTemplate.c153
2 files changed, 254 insertions, 57 deletions
diff --git a/UnixPkg/Sec/X64/Gasket.S b/UnixPkg/Sec/X64/Gasket.S
index f912d400b2..fc8166fae5 100644
--- a/UnixPkg/Sec/X64/Gasket.S
+++ b/UnixPkg/Sec/X64/Gasket.S
@@ -27,10 +27,10 @@ LCFI4:
subq $32, %rsp
LCFI5:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
+ movq %rsi, -32(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -28(%rbp), %edi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
@@ -43,15 +43,15 @@ LFB4:
LCFI6:
movq %rsp, %rbp
LCFI7:
- subq $32, %rsp
+ subq $48, %rsp
LCFI8:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movl %edx, -32(%rbp)
+ movq %rsi, -32(%rbp)
+ movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -32(%rbp), %esi
- movl -28(%rbp), %edi
+ movq -40(%rbp), %rsi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
@@ -67,14 +67,14 @@ LCFI10:
subq $48, %rsp
LCFI11:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movl %edx, -32(%rbp)
- movl %ecx, -36(%rbp)
+ movq %rsi, -32(%rbp)
+ movq %rdx, -40(%rbp)
+ movq %rcx, -48(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -36(%rbp), %edx
- movl -32(%rbp), %esi
- movl -28(%rbp), %edi
+ movq -48(%rbp), %rdx
+ movq -40(%rbp), %rsi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
@@ -87,19 +87,19 @@ LFB6:
LCFI12:
movq %rsp, %rbp
LCFI13:
- subq $48, %rsp
+ subq $64, %rsp
LCFI14:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movl %edx, -32(%rbp)
- movl %ecx, -36(%rbp)
- movl %r8d, -40(%rbp)
+ movq %rsi, -32(%rbp)
+ movq %rdx, -40(%rbp)
+ movq %rcx, -48(%rbp)
+ movq %r8, -56(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -40(%rbp), %ecx
- movl -36(%rbp), %edx
- movl -32(%rbp), %esi
- movl -28(%rbp), %edi
+ movq -56(%rbp), %rcx
+ movq -48(%rbp), %rdx
+ movq -40(%rbp), %rsi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
@@ -112,35 +112,35 @@ LFB7:
LCFI15:
movq %rsp, %rbp
LCFI16:
- subq $80, %rsp
+ subq $96, %rsp
LCFI17:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movl %edx, -32(%rbp)
- movl %ecx, -36(%rbp)
- movl %r8d, -40(%rbp)
- movl %r9d, -44(%rbp)
+ movq %rsi, -32(%rbp)
+ movq %rdx, -40(%rbp)
+ movq %rcx, -48(%rbp)
+ movq %r8, -56(%rbp)
+ movq %r9, -64(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -44(%rbp), %edx
- movl -40(%rbp), %ecx
- movl -36(%rbp), %esi
- movl -32(%rbp), %edi
- movl -28(%rbp), %r10d
- movl 48(%rbp), %eax
- movl %eax, 24(%rsp)
- movl 40(%rbp), %eax
- movl %eax, 16(%rsp)
- movl 32(%rbp), %eax
- movl %eax, 8(%rsp)
- movl 24(%rbp), %eax
- movl %eax, (%rsp)
+ movq -64(%rbp), %rdx
+ movq -56(%rbp), %rcx
+ movq -48(%rbp), %rsi
+ movq -40(%rbp), %rdi
+ movq -32(%rbp), %r10
+ movq 48(%rbp), %rax
+ movq %rax, 24(%rsp)
+ movq 40(%rbp), %rax
+ movq %rax, 16(%rsp)
+ movq 32(%rbp), %rax
+ movq %rax, 8(%rsp)
+ movq 24(%rbp), %rax
+ movq %rax, (%rsp)
movq -8(%rbp), %rax
- movl 16(%rbp), %r9d
- movl %edx, %r8d
- movl %esi, %edx
- movl %edi, %esi
- movl %r10d, %edi
+ movq 16(%rbp), %r9
+ movq %rdx, %r8
+ movq %rsi, %rdx
+ movq %rdi, %rsi
+ movq %r10, %rdi
call *%rax
leave
ret
@@ -156,10 +156,10 @@ LCFI19:
LCFI20:
movq %rdi, -24(%rbp)
movq %rsi, -32(%rbp)
- movl %edx, -36(%rbp)
+ movq %rdx, -40(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -36(%rbp), %esi
+ movq -40(%rbp), %rsi
movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
@@ -176,14 +176,14 @@ LCFI22:
subq $48, %rsp
LCFI23:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
+ movq %rsi, -32(%rbp)
movq %rdx, -40(%rbp)
- movl %ecx, -44(%rbp)
+ movq %rcx, -48(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movl -44(%rbp), %edx
+ movq -48(%rbp), %rdx
movq -40(%rbp), %rsi
- movl -28(%rbp), %edi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
@@ -196,20 +196,39 @@ LFB10:
LCFI24:
movq %rsp, %rbp
LCFI25:
- subq $32, %rsp
+ subq $48, %rsp
LCFI26:
movq %rdi, -24(%rbp)
- movl %esi, -28(%rbp)
- movw %dx, -32(%rbp)
+ movq %rsi, -32(%rbp)
+ movw %dx, -36(%rbp)
movq -24(%rbp), %rax
movq %rax, -8(%rbp)
- movzwl -32(%rbp), %esi
- movl -28(%rbp), %edi
+ movzwl -36(%rbp), %esi
+ movq -32(%rbp), %rdi
movq -8(%rbp), %rax
call *%rax
leave
ret
LFE10:
+.globl _ReverseGasketUint64
+_ReverseGasketUint64:
+LFB11:
+ pushq %rbp
+LCFI27:
+ movq %rsp, %rbp
+LCFI28:
+ subq $32, %rsp
+LCFI29:
+ movq %rdi, -24(%rbp)
+ movq %rsi, -32(%rbp)
+ movq -24(%rbp), %rax
+ movq %rax, -8(%rbp)
+ movq -32(%rbp), %rdi
+ movq -8(%rbp), %rax
+ call *%rax
+ leave
+ ret
+LFE11:
.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
EH_frame1:
.set L$set$0,LECIE1-LSCIE1
@@ -455,4 +474,29 @@ LASFDE17:
.byte 0x6
.align 3
LEFDE17:
+.globl _ReverseGasketUint64.eh
+_ReverseGasketUint64.eh:
+LSFDE19:
+ .set L$set$37,LEFDE19-LASFDE19
+ .long L$set$37
+LASFDE19:
+ .long LASFDE19-EH_frame1
+ .quad LFB11-.
+ .set L$set$38,LFE11-LFB11
+ .quad L$set$38
+ .byte 0x0
+ .byte 0x4
+ .set L$set$39,LCFI27-LFB11
+ .long L$set$39
+ .byte 0xe
+ .byte 0x10
+ .byte 0x86
+ .byte 0x2
+ .byte 0x4
+ .set L$set$40,LCFI28-LCFI27
+ .long L$set$40
+ .byte 0xd
+ .byte 0x6
+ .align 3
+LEFDE19:
.subsections_via_symbols
diff --git a/UnixPkg/Sec/X64/GasketTemplate.c b/UnixPkg/Sec/X64/GasketTemplate.c
new file mode 100644
index 0000000000..f9f2785524
--- /dev/null
+++ b/UnixPkg/Sec/X64/GasketTemplate.c
@@ -0,0 +1,153 @@
+/** @file
+ Template file used to create Gasket.S
+
+ This file is built on the command line via gcc GasketTemplate.c -S
+ and it will create GasketTemplate.s and this was used to create
+ Gasket.S. This builds code for Unix ABI on both sides. To convert
+ to EFI ABI will require changing the code by hand
+
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
+Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+
+#include <stdint.h>
+#include <sys/stat.h>
+
+typedef int8_t INT8;
+typedef uint8_t UINT8;
+typedef int16_t INT16;
+typedef uint16_t UINT16;
+typedef int32_t INT32;
+typedef uint32_t UINT32;
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+typedef UINT64 UINTN;
+
+
+typedef UINTN (*GASKET_VOID) ();
+typedef UINTN (*GASKET_UINTN) (UINTN);
+typedef UINTN (*GASKET_UINTN_UINTN) (UINTN, UINTN);
+typedef UINTN (*GASKET_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN);
+typedef UINTN (*GASKET_UINTN_UINTN_UINTN_UINTN) (UINTN, UINTN, UINTN, UINTN);
+typedef UINTN (*GASKET_UINTN_10ARGS) (UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN, UINTN);
+typedef UINTN (*GASKET_UINT64_UINTN) (UINT64, UINTN);
+typedef UINT64 (*GASKET_UINTN_UINT64_UINTN) (UINTN, UINT64, UINTN);
+typedef UINTN (*GASKET_UINTN_UINT16) (UINTN, UINT16);
+
+UINTN GasketVoid (void *api);
+UINTN GasketUintn (void *api, UINTN a);
+UINTN GasketUintnUintn (void *api, UINTN a, UINTN b);
+UINTN GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c);
+UINTN GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d);
+UINTN GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j);
+UINTN GasketUint64Uintn (void *api, UINT64 a, UINTN b);
+UINT64 GasketUintnUiny64Uintn (void *api, UINTN a, UINT64 b, UINTN c);
+UINTN GasketUintnUint16 (void *api, UINTN a, UINT16 b);
+
+
+
+UINTN
+GasketVoid (void *api)
+{
+ GASKET_VOID func;
+
+ func = (GASKET_VOID)api;
+ return func ();
+}
+
+UINTN
+GasketUintn (void *api, UINTN a)
+{
+ GASKET_UINTN func;
+
+ func = (GASKET_UINTN)api;
+ return func (a);
+}
+
+UINTN
+GasketUintnUintn (void *api, UINTN a, UINTN b)
+{
+ GASKET_UINTN_UINTN func;
+
+ func = (GASKET_UINTN_UINTN)api;
+ return func (a, b);
+}
+
+
+UINTN
+GasketUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c)
+{
+ GASKET_UINTN_UINTN_UINTN func;
+
+ func = (GASKET_UINTN_UINTN_UINTN)api;
+ return func (a, b, c);
+}
+
+UINTN
+GasketUintnUintnUintnUintn (void *api, UINTN a, UINTN b, UINTN c, UINTN d)
+{
+ GASKET_UINTN_UINTN_UINTN_UINTN func;
+
+ func = (GASKET_UINTN_UINTN_UINTN_UINTN)api;
+ return func (a, b, c, d);
+}
+
+UINTN
+GasketUintn10Args (void *api, UINTN a, UINTN b, UINTN c, UINTN d, UINTN e, UINTN f, UINTN g, UINTN h, UINTN i, UINTN j)
+{
+ GASKET_UINTN_10ARGS func;
+
+ func = (GASKET_UINTN_10ARGS)api;
+ return func (a, b, c, d, e, f, g, h, i, j);
+}
+
+
+UINTN
+GasketUint64Uintn (void *api, UINT64 a, UINTN b)
+{
+ GASKET_UINT64_UINTN func;
+
+ func = (GASKET_UINT64_UINTN)api;
+ return func (a, b);
+}
+
+UINT64
+GasketUintnUint64Uintn (void *api, UINTN a, UINT64 b, UINTN c)
+{
+ GASKET_UINTN_UINT64_UINTN func;
+
+ func = (GASKET_UINTN_UINT64_UINTN)api;
+ return func (a, b, c);
+}
+
+UINTN
+GasketUintnUint16 (void *api, UINTN a, UINT16 b)
+{
+ GASKET_UINTN_UINT16 func;
+
+ func = (GASKET_UINTN_UINT16)api;
+ return func (a, b);
+}
+
+void
+ReverseGasketUint64 (void *api, UINT64 a)
+{
+ GASKET_UINTN func;
+
+ func = (GASKET_UINTN)api;
+ func (a);
+ return;
+}
+
+
+
+