Update to 3.0d

This commit is contained in:
Peter Jones 2007-12-19 20:18:49 +00:00
parent 948f1ba265
commit 3708703eb3
8 changed files with 615 additions and 1481 deletions

View File

@ -1,2 +1 @@
gnu-efi-3.0a.tar.gz gnu-efi-3.0d.tar.gz
gnu-efi-3.0c.tar.gz

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
diff -up gnu-efi-3.0c/lib/runtime/rtdata.c.pragma gnu-efi-3.0c/lib/runtime/rtdata.c diff -up gnu-efi-3.0d/lib/runtime/rtdata.c.pragma gnu-efi-3.0d/lib/runtime/rtdata.c
--- gnu-efi-3.0c/lib/runtime/rtdata.c.pragma 2007-12-19 13:29:42.000000000 -0500 --- gnu-efi-3.0d/lib/runtime/rtdata.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0c/lib/runtime/rtdata.c 2007-12-19 13:29:59.000000000 -0500 +++ gnu-efi-3.0d/lib/runtime/rtdata.c 2007-12-19 15:00:21.000000000 -0500
@@ -26,7 +26,9 @@ Revision History @@ -26,7 +26,9 @@ Revision History
// right data section if it is explicitly initialized.. // right data section if it is explicitly initialized..
// //
@ -11,9 +11,9 @@ diff -up gnu-efi-3.0c/lib/runtime/rtdata.c.pragma gnu-efi-3.0c/lib/runtime/rtdat
// //
// RT - pointer to the runtime table // RT - pointer to the runtime table
diff -up gnu-efi-3.0c/lib/runtime/vm.c.pragma gnu-efi-3.0c/lib/runtime/vm.c diff -up gnu-efi-3.0d/lib/runtime/vm.c.pragma gnu-efi-3.0d/lib/runtime/vm.c
--- gnu-efi-3.0c/lib/runtime/vm.c.pragma 2007-12-19 13:28:58.000000000 -0500 --- gnu-efi-3.0d/lib/runtime/vm.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0c/lib/runtime/vm.c 2007-12-19 13:29:10.000000000 -0500 +++ gnu-efi-3.0d/lib/runtime/vm.c 2007-12-19 15:00:21.000000000 -0500
@@ -24,7 +24,9 @@ Revision History @@ -24,7 +24,9 @@ Revision History
#include "lib.h" #include "lib.h"
@ -34,9 +34,9 @@ diff -up gnu-efi-3.0c/lib/runtime/vm.c.pragma gnu-efi-3.0c/lib/runtime/vm.c
VOID VOID
RUNTIMEFUNCTION RUNTIMEFUNCTION
RtConvertList ( RtConvertList (
diff -up gnu-efi-3.0c/lib/runtime/efirtlib.c.pragma gnu-efi-3.0c/lib/runtime/efirtlib.c diff -up gnu-efi-3.0d/lib/runtime/efirtlib.c.pragma gnu-efi-3.0d/lib/runtime/efirtlib.c
--- gnu-efi-3.0c/lib/runtime/efirtlib.c.pragma 2007-12-19 13:27:39.000000000 -0500 --- gnu-efi-3.0d/lib/runtime/efirtlib.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0c/lib/runtime/efirtlib.c 2007-12-19 13:28:02.000000000 -0500 +++ gnu-efi-3.0d/lib/runtime/efirtlib.c 2007-12-19 15:00:21.000000000 -0500
@@ -20,7 +20,9 @@ Revision History @@ -20,7 +20,9 @@ Revision History
#include "efilib.h" #include "efilib.h"
#include "efirtlib.h" #include "efirtlib.h"
@ -87,9 +87,9 @@ diff -up gnu-efi-3.0c/lib/runtime/efirtlib.c.pragma gnu-efi-3.0c/lib/runtime/efi
INTN INTN
RUNTIMEFUNCTION RUNTIMEFUNCTION
RtCompareGuid ( RtCompareGuid (
diff -up gnu-efi-3.0c/lib/runtime/rtlock.c.pragma gnu-efi-3.0c/lib/runtime/rtlock.c diff -up gnu-efi-3.0d/lib/runtime/rtlock.c.pragma gnu-efi-3.0d/lib/runtime/rtlock.c
--- gnu-efi-3.0c/lib/runtime/rtlock.c.pragma 2007-12-19 13:26:56.000000000 -0500 --- gnu-efi-3.0d/lib/runtime/rtlock.c.pragma 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0c/lib/runtime/rtlock.c 2007-12-19 13:27:18.000000000 -0500 +++ gnu-efi-3.0d/lib/runtime/rtlock.c 2007-12-19 15:00:21.000000000 -0500
@@ -21,7 +21,9 @@ Revision History @@ -21,7 +21,9 @@ Revision History
@ -110,9 +110,9 @@ diff -up gnu-efi-3.0c/lib/runtime/rtlock.c.pragma gnu-efi-3.0c/lib/runtime/rtloc
VOID VOID
RtReleaseLock ( RtReleaseLock (
IN FLOCK *Lock IN FLOCK *Lock
diff -up gnu-efi-3.0c/lib/runtime/rtstr.c.pragma gnu-efi-3.0c/lib/runtime/rtstr.c diff -up gnu-efi-3.0d/lib/runtime/rtstr.c.pragma gnu-efi-3.0d/lib/runtime/rtstr.c
--- gnu-efi-3.0c/lib/runtime/rtstr.c.pragma 2007-12-19 13:28:15.000000000 -0500 --- gnu-efi-3.0d/lib/runtime/rtstr.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0c/lib/runtime/rtstr.c 2007-12-19 13:28:48.000000000 -0500 +++ gnu-efi-3.0d/lib/runtime/rtstr.c 2007-12-19 15:00:21.000000000 -0500
@@ -17,7 +17,9 @@ Revision History @@ -17,7 +17,9 @@ Revision History
#include "lib.h" #include "lib.h"
@ -183,9 +183,27 @@ diff -up gnu-efi-3.0c/lib/runtime/rtstr.c.pragma gnu-efi-3.0c/lib/runtime/rtstr.
UINT8 UINT8
RUNTIMEFUNCTION RUNTIMEFUNCTION
RtDecimaltoBCD ( RtDecimaltoBCD (
diff -up gnu-efi-3.0c/lib/print.c.pragma gnu-efi-3.0c/lib/print.c diff -up gnu-efi-3.0d/lib/x86_64/math.c.pragma gnu-efi-3.0d/lib/x86_64/math.c
--- gnu-efi-3.0c/lib/print.c.pragma 2007-12-19 13:25:51.000000000 -0500 --- gnu-efi-3.0d/lib/x86_64/math.c.pragma 2007-12-19 15:00:46.000000000 -0500
+++ gnu-efi-3.0c/lib/print.c 2007-12-19 13:26:18.000000000 -0500 +++ gnu-efi-3.0d/lib/x86_64/math.c 2007-12-19 15:01:07.000000000 -0500
@@ -23,11 +23,13 @@ Revision History
//
#ifdef RUNTIME_CODE
+#ifndef __GNUC__
#pragma RUNTIME_CODE(LShiftU64)
#pragma RUNTIME_CODE(RShiftU64)
#pragma RUNTIME_CODE(MultU64x32)
#pragma RUNTIME_CODE(DivU64x32)
#endif
+#endif
//
//
diff -up gnu-efi-3.0d/lib/x86_64/callwrap.c.pragma gnu-efi-3.0d/lib/x86_64/callwrap.c
diff -up gnu-efi-3.0d/lib/print.c.pragma gnu-efi-3.0d/lib/print.c
--- gnu-efi-3.0d/lib/print.c.pragma 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0d/lib/print.c 2007-12-19 15:00:21.000000000 -0500
@@ -23,6 +23,7 @@ Revision History @@ -23,6 +23,7 @@ Revision History
// //

52
gnu-efi-3.0d-rpm.patch Normal file
View File

@ -0,0 +1,52 @@
diff -up gnu-efi-3.0d/apps/Makefile.rpm gnu-efi-3.0d/apps/Makefile
diff -up gnu-efi-3.0d/Make.defaults.rpm gnu-efi-3.0d/Make.defaults
--- gnu-efi-3.0d/Make.defaults.rpm 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0d/Make.defaults 2007-12-19 15:08:35.000000000 -0500
@@ -26,6 +26,7 @@
# lib and include under the root
#
INSTALLROOT=/usr/local
+LIBDIR=lib
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
@@ -78,9 +79,9 @@ else
LD = $(prefix)ld
AR = $(prefix)ar
RANLIB = $(prefix)ranlib
-# OBJCOPY of binutils with x86_64 support
- OBJCOPY = /usr/local/bin/objcopy
+ OBJCOPY = $(prefix)objcopy
CFLAGS += -DEFI_FUNCTION_WRAPPER
+ LIBDIR = lib64
endif
endif
diff -up gnu-efi-3.0d/gnuefi/Makefile.rpm gnu-efi-3.0d/gnuefi/Makefile
--- gnu-efi-3.0d/gnuefi/Makefile.rpm 2007-12-19 15:09:29.000000000 -0500
+++ gnu-efi-3.0d/gnuefi/Makefile 2007-12-19 15:09:41.000000000 -0500
@@ -37,8 +37,8 @@ clean:
rm -f $(TARGETS) *~ *.o $(OBJS)
install:
- mkdir -p $(INSTALLROOT)/lib
- $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)/lib
- $(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/lib
+ mkdir -p $(INSTALLROOT)/$(LIBDIR)
+ $(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)/$(LIBDIR)
+ $(INSTALL) -m 644 elf_$(ARCH)_efi.lds $(INSTALLROOT)/$(LIBDIR)
include ../Make.rules
diff -up gnu-efi-3.0d/lib/Makefile.rpm gnu-efi-3.0d/lib/Makefile
--- gnu-efi-3.0d/lib/Makefile.rpm 2007-12-19 15:07:48.000000000 -0500
+++ gnu-efi-3.0d/lib/Makefile 2007-12-19 15:08:43.000000000 -0500
@@ -45,7 +45,7 @@ clean:
rm -f libefi.a *~ $(OBJS) */*.o
install: libefi.a
- mkdir -p $(INSTALLROOT)/lib
- $(INSTALL) -m 644 libefi.a $(INSTALLROOT)/lib/
+ mkdir -p $(INSTALLROOT)/$(LIBDIR)
+ $(INSTALL) -m 644 libefi.a $(INSTALLROOT)/$(LIBDIR)/
include ../Make.rules

488
gnu-efi-3.0d-uefi_wrap.patch Executable file
View File

@ -0,0 +1,488 @@
diff -urNp ../gnu-efi-3.0d/lib/x86_64/callwrap.c gnu-efi-3.0d_mod/lib/x86_64/callwrap.c
--- ../gnu-efi-3.0d/lib/x86_64/callwrap.c 2007-05-11 10:03:05.000000000 -0700
+++ gnu-efi-3.0d_mod/lib/x86_64/callwrap.c 2007-06-06 17:39:12.000000000 -0700
@@ -1,28 +1,328 @@
-/*++
-
-Copyright (c) 2006 Intel Corporation
-
-Module Name:
-
- hw.c
-
-Abstract:
+/*
+ * Copyright (C) 2006 Giridhar Pemmasani
+ * Copyright (C) 2007-2010 Intel Corp
+ * Contributed by Chandramouli Narayanan<mouli@linux.intel.com>
+ * Adapted wrapper macros for Linux to windows calls from
+ * NDIS wrapper project (http:/ndiswrapper.sourceforge.net)
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#include "efi.h"
+#include "efistdarg.h"
- Debug library functions for Hardware IO access
+#define EFI_ARG_NUM_MAX 10
+#define alloc_win_stack_frame(argc) \
+ "subq $" #argc "*8, %%rsp\n\t"
+#define free_win_stack_frame(argc) \
+ "addq $" #argc "*8, %%rsp\n\t"
+
+/* m is index of Windows arg required, n is total number of args to
+ * function Windows arg 1 should be at 0(%rsp), arg 2 at 8(%rsp) and
+ * so on, after stack frame is allocated, which starts at -n*8(%rsp)
+ * when stack frame is allocated. 4 > m >= n.
+*/
+
+#define lin2win_win_arg(m,n) "(" #m "-1-" #n ")*8(%%rsp)"
+
+/* volatile args for Windows function must be in clobber / output list */
+
+static UINT64 LIN2WIN0(void *func)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8");
+ register UINT64 r9 __asm__("r9");
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ alloc_win_stack_frame(4)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(4)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN1(void *func, UINT64 arg1)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8");
+ register UINT64 r9 __asm__("r9");
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ alloc_win_stack_frame(4)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(4)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1),
+ [fptr] "r" (func));
+ return ret;
+}
-Revision History
+static UINT64 LIN2WIN2(void *func, UINT64 arg1, UINT64 arg2)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8");
+ register UINT64 r9 __asm__("r9");
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ alloc_win_stack_frame(4)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(4)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2),
+ [fptr] "r" (func));
+ return ret;
+}
---*/
-#include "efi.h"
-#include "efistdarg.h"
+static UINT64 LIN2WIN3(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9");
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ alloc_win_stack_frame(4)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(4)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8),
+ [fptr] "r" (func));
+ return ret;
+}
-#define EFI_ARG_NUM_MAX 10
-#define EFI_REG_ARG_NUM 4
+static UINT64 LIN2WIN4(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ alloc_win_stack_frame(4)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(4)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [fptr] "r" (func));
+ return ret;
+}
-/* Convert SysV calling convention to EFI x86_64 calling convention */
+static UINT64 LIN2WIN5(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "mov %[rarg5], " lin2win_win_arg(5,6) "\n\t"
+ alloc_win_stack_frame(6)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(6)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((unsigned long long)arg5),
+ [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN6(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5,
+ UINT64 arg6)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "movq %[rarg5], " lin2win_win_arg(5,6) "\n\t"
+ "movq %[rarg6], " lin2win_win_arg(6,6) "\n\t"
+ alloc_win_stack_frame(6)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(6)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((UINT64)arg5), [rarg6] "r" ((UINT64)arg6),
+ [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN7(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5,
+ UINT64 arg6,
+ UINT64 arg7)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "movq %[rarg5], " lin2win_win_arg(5,7) "\n\t"
+ "movq %[rarg6], " lin2win_win_arg(6,7) "\n\t"
+ "movq %[rarg7], " lin2win_win_arg(7,7) "\n\t"
+ alloc_win_stack_frame(7)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(7)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((UINT64)arg5), [rarg6] "r" ((UINT64)arg6),
+ [rarg7] "r" ((UINT64)arg7), [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN8(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5,
+ UINT64 arg6,
+ UINT64 arg7,
+ UINT64 arg8)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "movq %[rarg5], " lin2win_win_arg(5,8) "\n\t"
+ "movq %[rarg6], " lin2win_win_arg(6,8) "\n\t"
+ "movq %[rarg7], " lin2win_win_arg(7,8) "\n\t"
+ "movq %[rarg8], " lin2win_win_arg(8,8) "\n\t"
+ alloc_win_stack_frame(8)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(8)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((UINT64)arg5), [rarg6] "r" ((UINT64)arg6),
+ [rarg7] "r" ((UINT64)arg7), [rarg8] "r" ((UINT64)arg8),
+ [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN9(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5,
+ UINT64 arg6,
+ UINT64 arg7,
+ UINT64 arg8,
+ UINT64 arg9)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "movq %[rarg5], " lin2win_win_arg(5,9) "\n\t"
+ "movq %[rarg6], " lin2win_win_arg(6,9) "\n\t"
+ "movq %[rarg7], " lin2win_win_arg(7,9) "\n\t"
+ "movq %[rarg8], " lin2win_win_arg(8,9) "\n\t"
+ "movq %[rarg9], " lin2win_win_arg(9,9) "\n\t"
+ alloc_win_stack_frame(9)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(9)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((UINT64)arg5), [rarg6] "r" ((UINT64)arg6),
+ [rarg7] "r" ((UINT64)arg7), [rarg8] "r" ((UINT64)arg8),
+ [rarg9] "r" ((UINT64)arg9), [fptr] "r" (func));
+ return ret;
+}
+static UINT64 LIN2WIN10(
+ void *func,
+ UINT64 arg1,
+ UINT64 arg2,
+ UINT64 arg3,
+ UINT64 arg4,
+ UINT64 arg5,
+ UINT64 arg6,
+ UINT64 arg7,
+ UINT64 arg8,
+ UINT64 arg9,
+ UINT64 arg10)
+{
+ UINT64 ret, dummy;
+ register UINT64 r8 __asm__("r8") = (UINT64)arg3;
+ register UINT64 r9 __asm__("r9") = (UINT64)arg4;
+ register UINT64 r10 __asm__("r10");
+ register UINT64 r11 __asm__("r11");
+ __asm__ __volatile__(
+ "movq %[rarg5], " lin2win_win_arg(5,10) "\n\t"
+ "movq %[rarg6], " lin2win_win_arg(6,10) "\n\t"
+ "movq %[rarg7], " lin2win_win_arg(7,10) "\n\t"
+ "movq %[rarg8], " lin2win_win_arg(8,10) "\n\t"
+ "movq %[rarg9], " lin2win_win_arg(9,10) "\n\t"
+ alloc_win_stack_frame(10)
+ "call *%[fptr]\n\t"
+ free_win_stack_frame(10)
+ : "=a" (ret), "=c" (dummy), "=d" (dummy),
+ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11)
+ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9),
+ [rarg5] "r" ((UINT64)arg5), [rarg6] "r" ((UINT64)arg6),
+ [rarg7] "r" ((UINT64)arg7), [rarg8] "r" ((UINT64)arg8),
+ [rarg9] "r" ((UINT64)arg9), [rarg10] "r" ((UINT64)arg10),
+ [fptr] "r" (func));
+ return ret;
+}
+/* New wrapper using NDIS */
+/* This wrapper merely calls LIN2WINxx functions to swizzle the
+ * args as per UEFI convention
+ */
EFI_STATUS uefi_call_wrapper(void *fp, unsigned long va_num, ...)
{
va_list ap;
@@ -31,92 +331,56 @@ EFI_STATUS uefi_call_wrapper(void *fp, u
unsigned int arg_size,stack_adjust_size;
EFI_STATUS status;
- if (va_num > EFI_ARG_NUM_MAX || va_num<0) {
+ if (va_num > EFI_ARG_NUM_MAX || va_num < 0) {
return EFI_LOAD_ERROR;
}
- if (va_num==0)
- /* There is no need to convert arguments for void argument. */
- __asm__ __volatile__("call *%0;ret;"::"r"(fp));
-
- /* The EFI arguments is stored in an array. Then later on it will be
- * pushed into stack or passed to registers according to MS ABI.
- */
va_start(ap, va_num);
for (i = 0; i < va_num; i++) {
- args[i] = va_arg(ap, unsigned long);
+ args[i] = va_arg(ap, UINT64);
}
va_end(ap);
- arg_size = va_num*8;
- stack_adjust_size = (va_num > EFI_REG_ARG_NUM? EFI_REG_ARG_NUM : va_num)*8;
-
- /* Starting from here, assembly code makes sure all registers used are
- * under controlled by our code itself instead of by gcc.
- */
- /* Start converting SysV calling convention to MS calling convention. */
- __asm__ __volatile__(
- /* 0. Save preserved registers. EFI call may clobbered them. */
- " pushq %%rbp;pushq %%rbx;pushq %%r12;"
- " pushq %%r13;pushq %%r14;pushq %%r15;"
- /* 1. Push arguments passed by stack into stack. */
- " mov %1, %%r12;"
- " mov %3, %%r13;"
- " mov %1, %%rax;"
- " dec %%rax;"
- " mov $8, %%bl;"
- " mul %%bl;"
- " add %%rax, %%r13;"
- "lstack:"
- " cmp $4, %%r12;"
- " jle lregister;"
- " pushq (%%r13);"
- " sub $8, %%r13;"
- " dec %%r12;"
- " jmp lstack;"
- /* 2. Move arguments passed by registers into registers.
- * rdi->rcx, rsi->rdx, rdx->r8, rcx->r9.
- */
- "lregister:"
- " mov %3, %%r14;"
- " mov $0, %%r12;"
- "lloadregister:"
- " cmp %1, %%r12;"
- " jge lcall;"
- " mov (%%r14), %%rcx;"
- " inc %%r12;"
- " cmp %1, %%r12;"
- " jge lcall;"
- " mov 8(%%r14), %%rdx;"
- " inc %%r12;"
- " cmp %1, %%r12;"
- " jge lcall;"
- " mov 0x10(%%r14), %%r8;"
- " inc %%r12;"
- " cmp %1, %%r12;"
- " jge lcall;"
- " mov 0x18(%%r14), %%r9;"
- /* 3. Save stack space for those register arguments. */
- "lcall: "
- " sub %2, %%rsp;"
- /* 4. Save arg_size to r12 which is preserved in EFI call. */
- " mov %4, %%r12;"
- /* 5. Call EFI function. */
- " call *%5;"
- /* This code was not there before */
- " mov %%rax, %0;"
- /* 6. Restore stack space reserved for those register
- * arguments.
- */
- " add %%r12, %%rsp;"
- /* 7. Restore preserved registers. */
- " popq %%r15;popq %%r14;popq %%r13;"
- " popq %%r12;popq %%rbx;popq %%rbp;"
- :"=r"(status)
- :"r"((unsigned long)va_num),
- "r"((unsigned long)stack_adjust_size),
- "r"(args),
- "r"((unsigned long)arg_size),
- "r"(fp)
- :"rsp","rbx","rax","r11","r12","r13","r14","rcx","rdx","r8","r9"
- );
- return status;
+ /* As the number of args grows extend it appropriately */
+ switch (va_num) {
+ case 0:
+ return LIN2WIN0(fp);
+ case 1:
+ return LIN2WIN1(fp, args[0]);
+ case 2:
+ return LIN2WIN2(fp,
+ args[0], args[1]);
+ case 3:
+ return LIN2WIN3(fp,
+ args[0], args[1], args[2]);
+ case 4:
+ return LIN2WIN4(fp,
+ args[0], args[1], args[2], args[3]);
+ case 5:
+ return LIN2WIN5(fp,
+ args[0], args[1], args[2], args[3],
+ args[4]);
+ case 6:
+ return LIN2WIN6(fp,
+ args[0], args[1], args[2], args[3],
+ args[4], args[5]);
+ case 7:
+ return LIN2WIN7(fp,
+ args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6]);
+ case 8:
+ return LIN2WIN8(fp,
+ args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7]);
+ case 9:
+ return LIN2WIN9(fp,
+ args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8]);
+ case 10:
+ return LIN2WIN10(fp,
+ args[0], args[1], args[2], args[3],
+ args[4], args[5], args[6], args[7],
+ args[8], args[9]);
+ default:
+ return EFI_LOAD_ERROR;
+ }
}

26
gnu-efi-3.0d-x86_64.patch Normal file
View File

@ -0,0 +1,26 @@
diff -up gnu-efi-3.0d/lib/smbios.c.x86_64 gnu-efi-3.0d/lib/smbios.c
--- gnu-efi-3.0d/lib/smbios.c.x86_64 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/smbios.c 2007-12-19 15:04:27.000000000 -0500
@@ -34,8 +34,8 @@ LibGetSmbiosSystemGuidAndSerialNumber (
return EFI_NOT_FOUND;
}
- Smbios.Hdr = (SMBIOS_HEADER *)SmbiosTable->TableAddress;
- SmbiosEnd.Raw = (UINT8 *)(SmbiosTable->TableAddress + SmbiosTable->TableLength);
+ Smbios.Hdr = (SMBIOS_HEADER *)(unsigned long)SmbiosTable->TableAddress;
+ SmbiosEnd.Raw = (UINT8 *)(unsigned long)(SmbiosTable->TableAddress + SmbiosTable->TableLength);
for (Index = 0; Index < SmbiosTable->TableLength ; Index++) {
if (Smbios.Hdr->Type == 1) {
if (Smbios.Hdr->Length < 0x19) {
diff -up gnu-efi-3.0d/lib/x86_64/callwrap.c.x86_64 gnu-efi-3.0d/lib/x86_64/callwrap.c
--- gnu-efi-3.0d/lib/x86_64/callwrap.c.x86_64 2007-12-19 15:04:44.000000000 -0500
+++ gnu-efi-3.0d/lib/x86_64/callwrap.c 2007-12-19 15:04:58.000000000 -0500
@@ -328,8 +328,6 @@ EFI_STATUS uefi_call_wrapper(void *fp, u
va_list ap;
int i;
unsigned long args[EFI_ARG_NUM_MAX];
- unsigned int arg_size,stack_adjust_size;
- EFI_STATUS status;
if (va_num > EFI_ARG_NUM_MAX || va_num < 0) {
return EFI_LOAD_ERROR;

View File

@ -1,13 +1,15 @@
Summary: Development Libraries and headers for EFI Summary: Development Libraries and headers for EFI
Name: gnu-efi Name: gnu-efi
Version: 3.0c Version: 3.0d
Release: 3%{?dist} Release: 1%{?dist}
Group: Development/System Group: Development/System
License: GPL License: GPL
URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 URL: ftp://ftp.hpl.hp.com/pub/linux-ia64
Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi-%{version}.tar.gz Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi-%{version}.tar.gz
Patch0: gnu-efi-3.0c-pragma.patch Patch0: gnu-efi-3.0d-pragma.patch
Patch1: gnu-efi-3.0c-x64.patch Patch1: gnu-efi-3.0d-uefi_wrap.patch
Patch2: gnu-efi-3.0d-x86_64.patch
Patch3: gnu-efi-3.0d-rpm.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExclusiveArch: ia64 i386 x86_64 ExclusiveArch: ia64 i386 x86_64
@ -18,7 +20,9 @@ applications that run under EFI (Extensible Firmware Interface).
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .pragma %patch0 -p1 -b .pragma
%patch1 -p1 -b .x64 %patch1 -p1 -b .uefi_wrap
%patch2 -p1 -b .x86_64
%patch3 -p1 -b .rpm
%build %build
# Package cannot build with %{?_smp_mflags}. # Package cannot build with %{?_smp_mflags}.
@ -46,8 +50,8 @@ rm -rf %{buildroot}
%{_libdir}/* %{_libdir}/*
%changelog %changelog
* Wed Dec 19 2007 Peter Jones <pjones@redhat.com> - 3.0c-3 * Wed Dec 19 2007 Peter Jones <pjones@redhat.com> - 3.0d-1
- Add support for x86_64 . - Update to 3.0d
* Tue Jun 12 2007 Chris Lumens <clumens@redhat.com> - 3.0c-2 * Tue Jun 12 2007 Chris Lumens <clumens@redhat.com> - 3.0c-2
- Fixes for package review (#225846). - Fixes for package review (#225846).

View File

@ -1 +1 @@
823e5f04d1c0a7b88831f91fbf12d470 gnu-efi-3.0c.tar.gz 29013d3cd15009942fb855ba3e1a8096 gnu-efi-3.0d.tar.gz