Update to current upstream

- License change - GPLv2+ to BSD
This commit is contained in:
Matthew Garrett 2012-07-27 22:41:24 -04:00
parent 53c181b797
commit 76e9368fa8
29 changed files with 62 additions and 3816 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
clog
gnu-efi-3.0e.tar.bz2
/gnu-efi-3.0q.tar.gz

View File

@ -1,518 +0,0 @@
diff -urpN /dev/null gnu-efi-3.0d/gnuefi/callwrap_ia32.c
--- /dev/null 2008-04-24 00:20:49.271011245 -0400
+++ gnu-efi-3.0d/gnuefi/callwrap_ia32.c 2008-04-29 15:40:43.000000000 -0400
@@ -0,0 +1,103 @@
+
+typedef unsigned long EFI_STATUS;
+
+typedef EFI_STATUS (*func0)(void);
+typedef EFI_STATUS (*func1)(unsigned long);
+typedef EFI_STATUS (*func2)(unsigned long, unsigned long);
+typedef EFI_STATUS (*func3)(unsigned long, unsigned long, unsigned long);
+typedef EFI_STATUS (*func4)(unsigned long, unsigned long, unsigned long,
+ unsigned long);
+typedef EFI_STATUS (*func5)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long);
+typedef EFI_STATUS (*func6)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long);
+typedef EFI_STATUS (*func7)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long,
+ unsigned long);
+typedef EFI_STATUS (*func8)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long);
+typedef EFI_STATUS (*func9)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long);
+typedef EFI_STATUS (*func10)(unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long,
+ unsigned long, unsigned long, unsigned long,
+ unsigned long);
+
+EFI_STATUS gnuefi_call0 (unsigned long func)
+{
+ return ((func0)func)();
+}
+
+EFI_STATUS gnuefi_call1 (unsigned long func, unsigned long a)
+{
+ return ((func1)func)(a);
+}
+
+EFI_STATUS gnuefi_call2 (unsigned long func, unsigned long a, unsigned long b)
+{
+ return ((func2)func)(a, b);
+}
+
+EFI_STATUS gnuefi_call3 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c)
+{
+ return ((func3)func)(a, b, c);
+}
+
+EFI_STATUS gnuefi_call4 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c, unsigned long d)
+{
+ return ((func4)func)(a, b, c, d);
+}
+
+EFI_STATUS gnuefi_call5 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e)
+{
+ return ((func5)func)(a, b, c, d, e);
+}
+
+EFI_STATUS gnuefi_call6 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e, unsigned long f)
+{
+ return ((func6)func)(a, b, c, d, e, f);
+}
+
+EFI_STATUS gnuefi_call7 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e,
+ unsigned long f, unsigned long g)
+{
+ return ((func7)func)(a, b, c, d, e, f, g);
+}
+
+EFI_STATUS gnuefi_call8 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e,
+ unsigned long f, unsigned long g,
+ unsigned long h)
+{
+ return ((func8)func)(a, b, c, d, e, f, g, h);
+}
+
+EFI_STATUS gnuefi_call9 (unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e,
+ unsigned long f, unsigned long g,
+ unsigned long h, unsigned long i)
+{
+ return ((func9)func)(a, b, c, d, e, f, g, h, i);
+}
+
+EFI_STATUS gnuefi_call10(unsigned long func, unsigned long a,
+ unsigned long b, unsigned long c,
+ unsigned long d, unsigned long e,
+ unsigned long f, unsigned long g,
+ unsigned long h, unsigned long i,
+ unsigned long j)
+{
+ return ((func10)func)(a, b, c, d, e, f, g, h, i, j);
+}
diff -urpN /dev/null gnu-efi-3.0d/gnuefi/callwrap_x86_64.c
--- /dev/null 2008-04-24 00:20:49.271011245 -0400
+++ gnu-efi-3.0d/gnuefi/callwrap_x86_64.c 2008-04-29 15:40:07.000000000 -0400
@@ -0,0 +1,395 @@
+/*
+ * 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.
+ *
+ */
+
+#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 */
+extern unsigned long long gnuefi_call0(void *func);
+extern unsigned long long gnuefi_call1(void *func, unsigned long long arg1);
+extern unsigned long long gnuefi_call2(void *func, unsigned long long arg1, unsigned long long arg2);
+extern unsigned long long gnuefi_call3(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3);
+extern unsigned long long gnuefi_call4(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4);
+extern unsigned long long gnuefi_call5(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5);
+extern unsigned long long gnuefi_call6(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6);
+extern unsigned long long gnuefi_call7(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7);
+extern unsigned long long gnuefi_call8(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8);
+extern unsigned long long gnuefi_call9(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8,
+ unsigned long long arg9);
+extern unsigned long long gnuefi_call10(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8,
+ unsigned long long arg9,
+ unsigned long long arg10);
+
+
+unsigned long long gnuefi_call0(void *func)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8");
+ register unsigned long long r9 __asm__("r9");
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call1(void *func, unsigned long long arg1)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8");
+ register unsigned long long r9 __asm__("r9");
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call2(void *func, unsigned long long arg1, unsigned long long arg2)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8");
+ register unsigned long long r9 __asm__("r9");
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call3(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9");
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call4(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call5(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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;
+}
+
+unsigned long long gnuefi_call6(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6),
+ [fptr] "r" (func));
+ return ret;
+}
+
+unsigned long long gnuefi_call7(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6),
+ [rarg7] "r" ((unsigned long long)arg7), [fptr] "r" (func));
+ return ret;
+}
+
+unsigned long long gnuefi_call8(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6),
+ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8),
+ [fptr] "r" (func));
+ return ret;
+}
+
+unsigned long long gnuefi_call9(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8,
+ unsigned long long arg9)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6),
+ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8),
+ [rarg9] "r" ((unsigned long long)arg9), [fptr] "r" (func));
+ return ret;
+}
+
+unsigned long long gnuefi_call10(
+ void *func,
+ unsigned long long arg1,
+ unsigned long long arg2,
+ unsigned long long arg3,
+ unsigned long long arg4,
+ unsigned long long arg5,
+ unsigned long long arg6,
+ unsigned long long arg7,
+ unsigned long long arg8,
+ unsigned long long arg9,
+ unsigned long long arg10)
+{
+ unsigned long long ret, dummy;
+ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3;
+ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4;
+ register unsigned long long r10 __asm__("r10");
+ register unsigned long long 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"
+ "movq %[rarg10], " lin2win_win_arg(10,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" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6),
+ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8),
+ [rarg9] "r" ((unsigned long long)arg9), [rarg10] "r" ((unsigned long long)arg10),
+ [fptr] "r" (func));
+ return ret;
+}
+
diff -urpN gnu-efi-3.0d/gnuefi/Makefile.callwrap gnu-efi-3.0d/gnuefi/Makefile
--- gnu-efi-3.0d/gnuefi/Makefile.callwrap 2008-04-29 15:40:07.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/Makefile 2008-04-29 15:40:07.000000000 -0400
@@ -23,7 +23,7 @@
include ../Make.defaults
CDIR=$(TOPDIR)/..
-FILES = reloc_$(ARCH) setjmp_$(ARCH)
+FILES = reloc_$(ARCH) setjmp_$(ARCH) callwrap_$(ARCH)
OBJS = $(FILES:%=%.o)

View File

@ -1,238 +0,0 @@
diff -up gnu-efi-3.0d/lib/ia64/palproc.h.license gnu-efi-3.0d/lib/ia64/palproc.h
--- gnu-efi-3.0d/lib/ia64/palproc.h.license 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/ia64/palproc.h 2008-07-28 12:00:28.000000000 -0400
@@ -1,60 +0,0 @@
-//
-//
-// Copyright (c) 1996-99 Intel Corp.
-// All Rights Reserved
-//
-// INTEL CORPORATION PROPRIETARY INFORMATION
-//
-// This software is supplied under the terms of a license
-// agreement or nondisclosure agreement with Intel Corpo-
-// ration and may not be copied or disclosed except in
-// accordance with the terms of that agreement.
-//
-//
-//
-//Module Name:
-//
-// palproc.h
-//
-//Abstract:
-//
-// This module contains generic macros for an IA64 assembly writer.
-//
-//
-//Revision History
-//
-
-#ifndef _PALPROC_H
-#define _PALPROC_H
-
-#define PROCEDURE_ENTRY(name) .##text; \
- .##type name, @function; \
- .##global name; \
- .##proc name; \
-name:
-
-#define PROCEDURE_EXIT(name) .##endp name
-
-// Note: use of NESTED_SETUP requires number of locals (l) >= 3
-
-#define NESTED_SETUP(i,l,o,r) \
- alloc loc1=ar##.##pfs,i,l,o,r ;\
- mov loc0=b0
-
-#define NESTED_RETURN \
- mov b0=loc0 ;\
- mov ar##.##pfs=loc1 ;;\
- br##.##ret##.##dpnt b0;;
-
-
-// defines needed in palproc.s
-
-#define PAL_MC_CLEAR_LOG 0x0015
-#define PAL_MC_DRAIN 0x0016
-#define PAL_MC_EXPECTED 0x0017
-#define PAL_MC_DYNAMIC_STATE 0x0018
-#define PAL_MC_ERROR_INFO 0x0019
-#define PAL_MC_RESUME 0x001a
-#define PAL_MC_REGISTER_MEM 0x001b
-
-#endif // _PALPROC_H
diff -up gnu-efi-3.0d/lib/ia64/palproc.S.license gnu-efi-3.0d/lib/ia64/palproc.S
--- gnu-efi-3.0d/lib/ia64/palproc.S.license 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/ia64/palproc.S 2008-07-28 12:00:30.000000000 -0400
@@ -1,170 +0,0 @@
-//++
-// Copyright (c) 1996-99 Intel Corp.
-// All Rights Reserved
-//
-// INTEL CORPORATION PROPRIETARY INFORMATION
-//
-// This software is supplied under the terms of a license
-// agreement or nondisclosure agreement with Intel Corpo-
-// ration and may not be copied or disclosed except in
-// accordance with the terms of that agreement.
-//
-//
-//
-// Module Name:
-//
-// palproc.s
-//
-// Abstract:
-//
-// Contains an implementation for making PAL PROC calls on
-// IA-64 architecture.
-//
-//
-//
-// Revision History:
-//
-//--
-
- .file "palproc.s"
-
-#include "palproc.h"
-
-
-//-----------------------------------------------------------------------------
-//++
-// MakeStaticPALCall
-//
-// This routine is called whenever an architected static calling convention
-// based PAL call is to be made. This call does use RSE actually, but our policy
-// in making static PAL calls before memory is available is to make sure that
-// we do not nest too deep and allocate beyond 96 banked registers. In other
-// words we carefully code calls and control flow before memory is available.
-//
-// Arguments : All parameters set up to do static PAL call.
-//
-// On Entry :
-//
-// Return Value:
-//
-// As per static calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY(MakeStaticPALCall)
-
- NESTED_SETUP (5,8,0,0)
- mov loc3 = b5
- mov loc4 = r2
- mov loc7 = r1;;
-
- movl loc6 = PAL_MC_CLEAR_LOG
- mov r2 = psr;;
- mov loc5 = r2
-
- cmp.eq p6,p7 = r28,loc6;;
- (p7)movl loc6 = PAL_MC_DYNAMIC_STATE;;
- (p7)cmp.eq p6,p7 = r28,loc6;;
-
- (p7)movl loc6 = PAL_MC_ERROR_INFO;;
- (p7)cmp.eq p6,p7 = r28,loc6;;
-
- (p7)movl loc6 = PAL_MC_RESUME;;
- (p7)cmp.eq p6,p7 = r28,loc6
-
- mov loc6 = 0x1;;
- (p7)dep r2 = loc6,r2,13,1;; // psr.ic = 1
-
-// p6 will be true, if it is one of the MCHK calls. There has been lots of debate
-// on psr.ic for these values. For now, do not do any thing to psr.ic
-
-// (p6)dep r2 = r0,r2,13,1;; // psr.ic = 0
- dep r2 = r0,r2,14,1;; // psr.i = 0
-
- mov psr.l = r2
- srlz.d;; // Needs data serailization.
- srlz.i;; // Needs instruction serailization.
-
-StaticGetPALLocalIP:
- mov loc2 = ip;;
- add loc2 = StaticComeBackFromPALCall - StaticGetPALLocalIP,loc2;;
- mov b0 = loc2 // return address after Pal call
- mov r28 = in1 // get the input parameters to PAL call
- mov r29 = in2
- mov r30 = in3;;
- mov r31 = in4
- mov b5 = in0;; // get the PalProcEntrypt from input
- br.sptk b5 // Take the plunge.
-
-StaticComeBackFromPALCall:
-
- mov psr.l = loc5;;
- srlz.d;; // Needs data serailization.
- srlz.i;; // Needs instruction serailization.
-
- mov b5 = loc3
- mov r2 = loc4
- mov r1 = loc7
-
- NESTED_RETURN
-
-PROCEDURE_EXIT(MakeStaticPALCall)
-
-
-//-----------------------------------------------------------------------------
-//++
-// MakeStackedPALCall
-//
-// This routine is called whenever an architected stacked calling convention
-// based PAL call is to be made. This call is made after memory is available.
-// Although stacked calls could be made directly from 'C', there is a PAL
-// requirement which forces the index to be in GR28 and hence this stub is
-// needed
-//
-// Arguments : All parameters set up to do stacted PAL call.
-//
-// On Entry :
-// in0: PAL_PROC entrypoint
-// in1-in4 : PAL_PROC arguments
-//
-// Return Value:
-//
-// As per stacked calling conventions.
-//
-//--
-//---------------------------------------------------------------------------
-PROCEDURE_ENTRY(MakeStackedPALCall)
-
- NESTED_SETUP (5,8,4,0)
- mov loc3 = b5
- mov loc4 = r2
- mov loc7 = r1
- mov r2 = psr;;
- mov loc5 = r2;;
- dep r2 = r0,r2,14,1;; // psr.i = 0
- mov psr.l = r2
- srlz.d;; // Needs data serailization.
- srlz.i;; // Needs instruction serailization.
-
-StackedGetPALLocalIP:
- mov r28 = in1 // get the input parameters to PAL call
- mov out0 = in1
- mov out1 = in2;;
- mov out2 = in3
- mov out3 = in4
- mov b5 = in0;; // get the PalProcEntrypt from input
- br.call.dpnt b0=b5;; // Take the plunge.
-
-StackedComeBackFromPALCall:
-
- mov psr.l = loc5;;
- srlz.d;; // Needs data serailization.
- srlz.i;; // Needs instruction serailization.
- mov b5 = loc3
- mov r2 = loc4
- mov r1 = loc7
-
- NESTED_RETURN
-
-PROCEDURE_EXIT(MakeStackedPALCall)
-

View File

@ -1,255 +0,0 @@
diff -up gnu-efi-3.0d/lib/ia32/math.c.pragma gnu-efi-3.0d/lib/ia32/math.c
--- gnu-efi-3.0d/lib/ia32/math.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/ia32/math.c 2008-07-16 13:42:50.000000000 -0400
@@ -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/ia64/math.c.pragma gnu-efi-3.0d/lib/ia64/math.c
--- gnu-efi-3.0d/lib/ia64/math.c.pragma 2008-07-16 13:44:31.000000000 -0400
+++ gnu-efi-3.0d/lib/ia64/math.c 2008-07-16 13:44:34.000000000 -0400
@@ -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/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 2008-07-16 13:42:50.000000000 -0400
@@ -23,6 +23,7 @@ Revision History
//
#ifdef RUNTIME_CODE
+#ifndef __GNUC__
#pragma RUNTIME_CODE(DbgPrint)
// For debugging..
@@ -39,6 +40,7 @@ Revision History
#pragma RUNTIME_CODE(TimeToString)
*/
+#endif /* !defined(__GNUC__) */
#endif
//
diff -up gnu-efi-3.0d/lib/runtime/efirtlib.c.pragma gnu-efi-3.0d/lib/runtime/efirtlib.c
--- gnu-efi-3.0d/lib/runtime/efirtlib.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/runtime/efirtlib.c 2008-07-16 13:42:50.000000000 -0400
@@ -20,7 +20,9 @@ Revision History
#include "efilib.h"
#include "efirtlib.h"
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtZeroMem)
+#endif
VOID
RUNTIMEFUNCTION
RtZeroMem (
@@ -36,7 +38,9 @@ RtZeroMem (
}
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtSetMem)
+#endif
VOID
RUNTIMEFUNCTION
RtSetMem (
@@ -53,7 +57,9 @@ RtSetMem (
}
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtCopyMem)
+#endif
VOID
RUNTIMEFUNCTION
RtCopyMem (
@@ -71,7 +77,9 @@ RtCopyMem (
}
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtCompareMem)
+#endif
INTN
RUNTIMEFUNCTION
RtCompareMem (
@@ -96,7 +104,9 @@ RtCompareMem (
return 0;
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtCompareGuid)
+#endif
INTN
RUNTIMEFUNCTION
RtCompareGuid (
diff -up gnu-efi-3.0d/lib/runtime/rtdata.c.pragma gnu-efi-3.0d/lib/runtime/rtdata.c
--- gnu-efi-3.0d/lib/runtime/rtdata.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/runtime/rtdata.c 2008-07-16 13:42:50.000000000 -0400
@@ -26,7 +26,9 @@ Revision History
// right data section if it is explicitly initialized..
//
+#ifndef __GNUC__
#pragma BEGIN_RUNTIME_DATA()
+#endif
//
// RT - pointer to the runtime table
diff -up gnu-efi-3.0d/lib/runtime/rtlock.c.pragma gnu-efi-3.0d/lib/runtime/rtlock.c
--- gnu-efi-3.0d/lib/runtime/rtlock.c.pragma 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0d/lib/runtime/rtlock.c 2008-07-16 13:42:50.000000000 -0400
@@ -21,7 +21,9 @@ Revision History
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtAcquireLock)
+#endif
VOID
RtAcquireLock (
IN FLOCK *Lock
@@ -58,7 +60,9 @@ Returns:
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtAcquireLock)
+#endif
VOID
RtReleaseLock (
IN FLOCK *Lock
diff -up gnu-efi-3.0d/lib/runtime/rtstr.c.pragma gnu-efi-3.0d/lib/runtime/rtstr.c
--- gnu-efi-3.0d/lib/runtime/rtstr.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/runtime/rtstr.c 2008-07-16 13:42:50.000000000 -0400
@@ -17,7 +17,9 @@ Revision History
#include "lib.h"
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtAcquireLock)
+#endif
INTN
RUNTIMEFUNCTION
RtStrCmp (
@@ -38,7 +40,9 @@ RtStrCmp (
return *s1 - *s2;
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtStrCpy)
+#endif
VOID
RUNTIMEFUNCTION
RtStrCpy (
@@ -53,7 +57,9 @@ RtStrCpy (
*Dest = 0;
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtStrCat)
+#endif
VOID
RUNTIMEFUNCTION
RtStrCat (
@@ -64,7 +70,9 @@ RtStrCat (
RtStrCpy(Dest+StrLen(Dest), Src);
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtStrLen)
+#endif
UINTN
RUNTIMEFUNCTION
RtStrLen (
@@ -78,7 +86,9 @@ RtStrLen (
return len;
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtStrSize)
+#endif
UINTN
RUNTIMEFUNCTION
RtStrSize (
@@ -92,7 +102,9 @@ RtStrSize (
return (len + 1) * sizeof(CHAR16);
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtBCDtoDecimal)
+#endif
UINT8
RUNTIMEFUNCTION
RtBCDtoDecimal(
@@ -108,7 +120,9 @@ RtBCDtoDecimal(
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtDecimaltoBCD)
+#endif
UINT8
RUNTIMEFUNCTION
RtDecimaltoBCD (
diff -up gnu-efi-3.0d/lib/runtime/vm.c.pragma gnu-efi-3.0d/lib/runtime/vm.c
--- gnu-efi-3.0d/lib/runtime/vm.c.pragma 2007-05-09 14:37:27.000000000 -0400
+++ gnu-efi-3.0d/lib/runtime/vm.c 2008-07-16 13:42:50.000000000 -0400
@@ -24,7 +24,9 @@ Revision History
#include "lib.h"
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtLibEnableVirtualMappings)
+#endif
VOID
RUNTIMEFUNCTION
RtLibEnableVirtualMappings (
@@ -64,7 +66,9 @@ RtLibEnableVirtualMappings (
}
+#ifndef __GNUC__
#pragma RUNTIME_CODE(RtConvertList)
+#endif
VOID
RUNTIMEFUNCTION
RtConvertList (
diff -up gnu-efi-3.0d/lib/x86_64/math.c.pragma gnu-efi-3.0d/lib/x86_64/math.c
--- gnu-efi-3.0d/lib/x86_64/math.c.pragma 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0d/lib/x86_64/math.c 2008-07-16 13:42:50.000000000 -0400
@@ -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
//
//

View File

@ -1,173 +0,0 @@
diff -urpN gnu-efi-3.0d/gnuefi/reloc_ia32.c.unify gnu-efi-3.0d/gnuefi/reloc_ia32.c
--- gnu-efi-3.0d/gnuefi/reloc_ia32.c.unify 2008-04-29 13:35:17.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/reloc_ia32.c 2008-04-29 13:34:44.000000000 -0400
@@ -45,56 +45,54 @@
#include <efi.h>
#include <efilib.h>
-int
-_relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
+EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
- extern EFI_STATUS efi_main (EFI_HANDLE, EFI_SYSTEM_TABLE *);
long relsz = 0, relent = 0;
ElfW(Rel) *rel = 0;
+ unsigned long *addr;
int i;
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
- case DT_REL:
- rel = (ElfW(Rel)*) ((long) dyn[i].d_un.d_ptr + ldbase);
- break;
-
- case DT_RELSZ:
- relsz = dyn[i].d_un.d_val;
- break;
-
- case DT_RELENT:
- relent = dyn[i].d_un.d_val;
- break;
+ case DT_REL:
+ rel = (ElfW(Rel)*)
+ ((unsigned long)dyn[i].d_un.d_ptr
+ + ldbase);
+ break;
+
+ case DT_RELSZ:
+ relsz = dyn[i].d_un.d_val;
+ break;
+
+ case DT_RELENT:
+ relent = dyn[i].d_un.d_val;
+ break;
- case DT_RELA:
- break;
+ case DT_RELA:
+ break;
- default:
- break;
+ default:
+ break;
}
}
- while (relsz > 0) {
- if (!rel || relent == 0)
- return EFI_LOAD_ERROR;
+ if (!rel || relent == 0)
+ return EFI_LOAD_ERROR;
+ while (relsz > 0) {
/* apply the relocs */
switch (ELF32_R_TYPE (rel->r_info)) {
- case R_386_NONE:
- break;
-
- case R_386_RELATIVE:
- {
- long *addr;
-
- addr = (long *) (ldbase + rel->r_offset);
- *addr += ldbase;
- break;
- }
+ case R_386_NONE:
+ break;
+
+ case R_386_RELATIVE:
+ addr = (unsigned long *)
+ (ldbase + rel->r_offset);
+ *addr += ldbase;
+ break;
- default:
- return EFI_LOAD_ERROR;
+ default:
+ break;
}
rel = (ElfW(Rel)*) ((char *) rel + relent);
relsz -= relent;
diff -urpN gnu-efi-3.0d/gnuefi/reloc_x86_64.c.unify gnu-efi-3.0d/gnuefi/reloc_x86_64.c
--- gnu-efi-3.0d/gnuefi/reloc_x86_64.c.unify 2008-04-29 13:35:10.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/reloc_x86_64.c 2008-04-29 13:34:44.000000000 -0400
@@ -50,7 +50,6 @@
EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
- //extern EFI_STATUS efi_main (EFI_HANDLE, EFI_SYSTEM_TABLE *);
long relsz = 0, relent = 0;
ElfW(Rel) *rel = 0;
unsigned long *addr;
@@ -58,43 +57,45 @@ EFI_STATUS _relocate (long ldbase, ElfW(
for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
switch (dyn[i].d_tag) {
- case DT_RELA:
- rel = (ElfW(Rel)*) ((long) dyn[i].d_un.d_ptr + ldbase);
- break;
-
- case DT_RELASZ:
- relsz = dyn[i].d_un.d_val;
- break;
-
- case DT_RELAENT:
- relent = dyn[i].d_un.d_val;
- break;
+ case DT_RELA:
+ rel = (ElfW(Rel)*)
+ ((unsigned long)dyn[i].d_un.d_ptr
+ + ldbase);
+ break;
+
+ case DT_RELASZ:
+ relsz = dyn[i].d_un.d_val;
+ break;
+
+ case DT_RELAENT:
+ relent = dyn[i].d_un.d_val;
+ break;
- default:
- break;
+ default:
+ break;
}
}
- if (!rel || relent == 0){
+ if (!rel || relent == 0)
return EFI_LOAD_ERROR;
- }
+
while (relsz > 0) {
/* apply the relocs */
switch (ELF64_R_TYPE (rel->r_info)) {
- case R_X86_64_NONE:
- break;
+ case R_X86_64_NONE:
+ break;
- case R_X86_64_RELATIVE:
- addr = (unsigned long *) (ldbase + rel->r_offset);
- *addr += ldbase;
- break;
+ case R_X86_64_RELATIVE:
+ addr = (unsigned long *)
+ (ldbase + rel->r_offset);
+ *addr += ldbase;
+ break;
- default:
- break;
+ default:
+ break;
}
rel = (ElfW(Rel)*) ((char *) rel + relent);
relsz -= relent;
}
return EFI_SUCCESS;
}
-

View File

@ -1,52 +0,0 @@
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

View File

@ -1,12 +0,0 @@
diff -urpN gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S.attribs gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S
--- gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S.attribs 2008-04-29 13:56:27.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S 2008-04-29 13:56:29.000000000 -0400
@@ -56,7 +56,7 @@ _start:
dummy: .long 0
#define IMAGE_REL_ABSOLUTE 0
- .section .reloc, "a"
+ .section .reloc
.long dummy // Page RVA
.long 10 // Block Size (2*4+2)
.word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy

View File

@ -1,170 +0,0 @@
diff -urpN gnu-efi-3.0d/gnuefi/Makefile.setjmp gnu-efi-3.0d/gnuefi/Makefile
--- gnu-efi-3.0d/gnuefi/Makefile.setjmp 2008-04-29 13:18:19.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/Makefile 2008-04-29 13:18:43.000000000 -0400
@@ -23,7 +23,7 @@
include ../Make.defaults
CDIR=$(TOPDIR)/..
-FILES = reloc_$(ARCH)
+FILES = reloc_$(ARCH) setjmp_$(ARCH)
OBJS = $(FILES:%=%.o)
diff -urpN gnu-efi-3.0d/gnuefi/setjmp_ia32.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_ia32.S
--- gnu-efi-3.0d/gnuefi/setjmp_ia32.S.setjmp 2008-04-29 13:13:05.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/setjmp_ia32.S 2008-04-29 13:22:04.000000000 -0400
@@ -0,0 +1,87 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2000 Free Software Foundation, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* This is stolen from libc/x86/setjmp.S in the OSKit */
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ * C library -- _setjmp, _longjmp
+ *
+ * _longjmp(a,v)
+ * will generate a "return(v)" from
+ * the last call to
+ * _setjmp(a)
+ * by restoring registers from the stack,
+ * The previous signal state is NOT restored.
+ *
+ */
+
+#define EXT_C(sym) sym
+#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
+
+ .file "setjmp.S"
+
+ .text
+
+FUNCTION(setjmp)
+ movl 4(%esp), %ecx /* fetch buffer */
+ movl %ebx, 0(%ecx)
+ movl %esi, 4(%ecx)
+ movl %edi, 8(%ecx)
+ movl %ebp, 12(%ecx) /* save frame pointer of caller */
+ popl %edx
+ movl %esp, 16(%ecx) /* save stack pointer of caller */
+ movl %edx, 20(%ecx) /* save pc of caller */
+ xorl %eax, %eax
+ jmp *%edx
+
+FUNCTION(longjmp)
+ movl 8(%esp), %eax /* return(v) */
+ movl 4(%esp), %ecx /* fetch buffer */
+ movl 0(%ecx), %ebx
+ movl 4(%ecx), %esi
+ movl 8(%ecx), %edi
+ movl 12(%ecx), %ebp
+ movl 16(%ecx), %esp
+ orl %eax, %eax
+ jnz 0f
+ incl %eax
+0: jmp *20(%ecx) /* done, return.... */
diff -urpN gnu-efi-3.0d/gnuefi/setjmp_ia64.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_ia64.S
--- gnu-efi-3.0d/gnuefi/setjmp_ia64.S.setjmp 2008-04-29 13:19:34.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/setjmp_ia64.S 2008-04-29 13:19:44.000000000 -0400
@@ -0,0 +1,2 @@
+
+#warning not implemented
diff -urpN gnu-efi-3.0d/gnuefi/setjmp_x86_64.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_x86_64.S
--- gnu-efi-3.0d/gnuefi/setjmp_x86_64.S.setjmp 2008-04-29 13:18:12.000000000 -0400
+++ gnu-efi-3.0d/gnuefi/setjmp_x86_64.S 2008-04-29 13:22:04.000000000 -0400
@@ -0,0 +1,56 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2003 Free Software Foundation, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define EXT_C(sym) sym
+#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x):
+
+ .file "setjmp.S"
+
+ .text
+
+/*
+ * int setjmp (jmp_buf env)
+ */
+FUNCTION(setjmp)
+ pop %rsi /* Return address, and adjust the stack */
+ xor %rax, %rax
+ movq %rbx, 0(%rdi) /* RBX */
+ movq %rsp, 8(%rdi) /* RSP */
+ push %rsi
+ movq %rbp, 16(%rdi) /* RBP */
+ movq %r12, 24(%rdi) /* R12 */
+ movq %r13, 32(%rdi) /* R13 */
+ movq %r14, 40(%rdi) /* R14 */
+ movq %r15, 48(%rdi) /* R15 */
+ movq %rsi, 56(%rdi) /* RSI */
+ ret
+
+/*
+ * int longjmp (jmp_buf env, int val)
+ */
+FUNCTION(longjmp)
+ movl %esi, %eax
+ movq (%rdi), %rbx
+ movq 8(%rdi), %rsp
+ movq 16(%rdi), %rbp
+ movq 24(%rdi), %r12
+ movq 32(%rdi), %r13
+ movq 40(%rdi), %r14
+ movq 48(%rdi), %r15
+ jmp *56(%rdi)
+
diff -urpN gnu-efi-3.0d/Make.rules.setjmp gnu-efi-3.0d/Make.rules

View File

@ -1,504 +0,0 @@
diff -urpN gnu-efi-3.0d/lib/x86_64/callwrap.c.uefi_wrap gnu-efi-3.0d/lib/x86_64/callwrap.c
--- gnu-efi-3.0d/lib/x86_64/callwrap.c.uefi_wrap 2007-05-11 13:03:05.000000000 -0400
+++ gnu-efi-3.0d/lib/x86_64/callwrap.c 2008-01-11 16:02:40.000000000 -0500
@@ -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;
+ }
}
diff -urpN gnu-efi-3.0d/inc/x86_64/efibind.h.uefi_wrap gnu-efi-3.0d/inc/x86_64/efibind.h
--- gnu-efi-3.0d/inc/x86_64/efibind.h.uefi_wrap 2008-01-11 16:02:58.000000000 -0500
+++ gnu-efi-3.0d/inc/x86_64/efibind.h 2008-01-11 16:03:21.000000000 -0500
@@ -257,12 +257,7 @@ typedef uint64_t UINTN;
#endif
#endif
-/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
-#ifdef EFI_FUNCTION_WRAPPER
UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...);
-#else
-#error "EFI_FUNCTION_WRAPPER must be defined for x86_64 architecture"
-#endif
#if _MSC_EXTENSIONS
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP

View File

@ -1,12 +0,0 @@
diff -up gnu-efi-3.0d/lib/x86_64/callwrap.c.call10 gnu-efi-3.0d/lib/x86_64/callwrap.c
--- gnu-efi-3.0d/lib/x86_64/callwrap.c.call10 2008-03-27 13:37:37.000000000 -0400
+++ gnu-efi-3.0d/lib/x86_64/callwrap.c 2008-03-27 13:38:08.000000000 -0400
@@ -307,6 +307,7 @@ static UINT64 LIN2WIN10(
"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"
+ "movq %[rarg10], " lin2win_win_arg(10,10) "\n\t"
alloc_win_stack_frame(10)
"call *%[fptr]\n\t"
free_win_stack_frame(10)
diff -up gnu-efi-3.0d/inc/x86_64/efibind.h.call10 gnu-efi-3.0d/inc/x86_64/efibind.h

View File

@ -1,26 +0,0 @@
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,484 +0,0 @@
From 6ae2cc94566550e2e27c791485319bd5791cc861 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 9 Aug 2011 13:46:53 -0400
Subject: [PATCH] Add tcc.efi to test our calling convention shananagans.
Add a test case to actually make sure we've got stack alignment and
calling conventions set up correctly.
---
apps/Makefile | 3 +-
apps/tcc.c | 442 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 444 insertions(+), 1 deletions(-)
create mode 100644 apps/tcc.c
diff --git a/apps/Makefile b/apps/Makefile
index 6b50e4f..71e738d 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -32,13 +32,14 @@ TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
LINUX_HEADERS = /usr/src/sys/build
CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include
+#CFLAGS += -ggdb
CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
FORMAT = efi-app-$(ARCH)
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi modelist.efi
+TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi modelist.efi tcc.efi
all: $(TARGETS)
diff --git a/apps/tcc.c b/apps/tcc.c
new file mode 100644
index 0000000..546df92
--- /dev/null
+++ b/apps/tcc.c
@@ -0,0 +1,442 @@
+/*
+ * Test if our calling convention gymnastics actually work
+ */
+
+#include <efi.h>
+#include <efilib.h>
+
+#ifdef __x86_64__
+#include <x86_64/pe.h>
+#include <x86_64/efibind.h>
+#endif
+
+#if 0
+ asm volatile("out %0,%1" : : "a" ((uint8_t)a), "dN" (0x80));
+
+extern void dump_stack(void);
+asm( ".globl dump_stack\n"
+ "dump_stack:\n"
+ " movq %rsp, %rdi\n"
+ " jmp *dump_stack_helper@GOTPCREL(%rip)\n"
+ ".size dump_stack, .-dump_stack");
+
+void dump_stack_helper(unsigned long rsp_val)
+{
+ uint64_t *rsp = (unsigned long *)rsp_val;
+ int x;
+
+ Print(L"%%rsp: 0x%08x%08x stack:\r\n",
+ (rsp_val & 0xffffffff00000000) >>32,
+ rsp_val & 0xffffffff);
+ for (x = 0; x < 8; x++) {
+ Print(L"%08x: ", ((uint64_t)rsp) & 0xffffffff);
+ Print(L"%016x ", *rsp++);
+ Print(L"%016x ", *rsp++);
+ Print(L"%016x ", *rsp++);
+ Print(L"%016x\r\n", *rsp++);
+ }
+}
+#endif
+
+EFI_STATUS EFI_FUNCTION test_failure_callback(void)
+{
+ return EFI_UNSUPPORTED;
+}
+
+EFI_STATUS test_failure(void)
+{
+ return uefi_call_wrapper(test_failure_callback, 0);
+}
+
+EFI_STATUS EFI_FUNCTION test_call0_callback(void)
+{
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call0(void)
+{
+ return uefi_call_wrapper(test_call0_callback, 0);
+}
+
+EFI_STATUS EFI_FUNCTION test_call1_callback(UINT32 a)
+{
+ if (a != 0x12345678) {
+ return EFI_LOAD_ERROR;
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call1(void)
+{
+ return uefi_call_wrapper(test_call1_callback, 1,0x12345678);
+}
+
+EFI_STATUS EFI_FUNCTION test_call2_callback(UINT32 a, UINT32 b)
+{
+ if (a != 0x12345678) {
+ return EFI_LOAD_ERROR;
+ }
+ if (b != 0x23456789) {
+ return EFI_INVALID_PARAMETER;
+ }
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call2(void)
+{
+ return uefi_call_wrapper(test_call2_callback, 2,
+ 0x12345678, 0x23456789);
+}
+
+EFI_STATUS EFI_FUNCTION test_call3_callback(UINT32 a, UINT32 b,
+ UINT32 c)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call3(void)
+{
+ return uefi_call_wrapper(test_call3_callback, 3,
+ 0x12345678, 0x23456789, 0x3456789a);
+}
+
+EFI_STATUS EFI_FUNCTION test_call4_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call4(void)
+{
+ return uefi_call_wrapper(test_call4_callback, 4,
+ 0x12345678, 0x23456789, 0x3456789a, 0x456789ab);
+}
+
+EFI_STATUS EFI_FUNCTION test_call5_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call5(void)
+{
+ return uefi_call_wrapper(test_call5_callback, 5,
+ 0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc);
+}
+
+EFI_STATUS EFI_FUNCTION test_call6_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e, UINT32 f)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+ if (f != 0x6789abcd)
+ return EFI_NOT_READY;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call6(void)
+{
+ return uefi_call_wrapper(test_call6_callback, 6,
+ 0x12345678, 0x23456789, 0x3456789a, 0x456789ab, 0x56789abc,
+ 0x6789abcd);
+}
+
+EFI_STATUS EFI_FUNCTION test_call7_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+ if (f != 0x6789abcd)
+ return EFI_NOT_READY;
+ if (g != 0x789abcde)
+ return EFI_DEVICE_ERROR;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call7(void)
+{
+ return uefi_call_wrapper(test_call7_callback, 7,
+ 0x12345678, 0x23456789, 0x3456789a, 0x456789ab,
+ 0x56789abc, 0x6789abcd, 0x789abcde);
+}
+
+EFI_STATUS EFI_FUNCTION test_call8_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+ if (f != 0x6789abcd)
+ return EFI_NOT_READY;
+ if (g != 0x789abcde)
+ return EFI_DEVICE_ERROR;
+ if (h != 0x89abcdef)
+ return EFI_WRITE_PROTECTED;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call8(void)
+{
+ return uefi_call_wrapper(test_call8_callback, 8,
+ 0x12345678,
+ 0x23456789,
+ 0x3456789a,
+ 0x456789ab,
+ 0x56789abc,
+ 0x6789abcd,
+ 0x789abcde,
+ 0x89abcdef);
+}
+
+EFI_STATUS EFI_FUNCTION test_call9_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+ if (f != 0x6789abcd)
+ return EFI_NOT_READY;
+ if (g != 0x789abcde)
+ return EFI_DEVICE_ERROR;
+ if (h != 0x89abcdef)
+ return EFI_WRITE_PROTECTED;
+ if (i != 0x9abcdef0)
+ return EFI_OUT_OF_RESOURCES;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call9(void)
+{
+ return uefi_call_wrapper(test_call9_callback, 9,
+ 0x12345678,
+ 0x23456789,
+ 0x3456789a,
+ 0x456789ab,
+ 0x56789abc,
+ 0x6789abcd,
+ 0x789abcde,
+ 0x89abcdef,
+ 0x9abcdef0);
+}
+
+extern EFI_STATUS test_call10(void);
+EFI_STATUS EFI_FUNCTION test_call10_callback(UINT32 a, UINT32 b,
+ UINT32 c, UINT32 d, UINT32 e, UINT32 f, UINT32 g, UINT32 h, UINT32 i,
+ UINT32 j)
+{
+ if (a != 0x12345678)
+ return EFI_LOAD_ERROR;
+ if (b != 0x23456789)
+ return EFI_INVALID_PARAMETER;
+ if (c != 0x3456789a)
+ return EFI_UNSUPPORTED;
+ if (d != 0x456789ab)
+ return EFI_BAD_BUFFER_SIZE;
+ if (e != 0x56789abc)
+ return EFI_BUFFER_TOO_SMALL;
+ if (f != 0x6789abcd)
+ return EFI_NOT_READY;
+ if (g != 0x789abcde)
+ return EFI_DEVICE_ERROR;
+ if (h != 0x89abcdef)
+ return EFI_WRITE_PROTECTED;
+ if (i != 0x9abcdef0)
+ return EFI_OUT_OF_RESOURCES;
+ if (j != 0xabcdef01)
+ return EFI_VOLUME_CORRUPTED;
+
+ return EFI_SUCCESS;
+}
+
+EFI_STATUS test_call10(void)
+{
+ return uefi_call_wrapper(test_call10_callback, 10,
+ 0x12345678,
+ 0x23456789,
+ 0x3456789a,
+ 0x456789ab,
+ 0x56789abc,
+ 0x6789abcd,
+ 0x789abcde,
+ 0x89abcdef,
+ 0x9abcdef0,
+ 0xabcdef01);
+}
+
+EFI_STATUS
+efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
+{
+ EFI_STATUS rc = EFI_SUCCESS;
+
+ InitializeLib(image, systab);
+ PoolAllocationType = 2; /* klooj */
+
+#ifndef __x86_64__
+ uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut,
+ L"This test is only valid on x86_64\n");
+ return EFI_UNSUPPORTED;
+#endif
+
+ asm volatile("out %0,%1" : : "a" ((uint8_t)0x14), "dN" (0x80));
+
+ Print(L"Hello\r\n");
+ rc = test_failure();
+ if (EFI_ERROR(rc)) {
+ Print(L"Returning Failure works\n");
+ } else {
+ Print(L"Returning failure doesn't work.\r\n");
+ Print(L"%%rax was 0x%016x, should have been 0x%016x\n",
+ rc, EFI_UNSUPPORTED);
+ return EFI_INVALID_PARAMETER;
+ }
+
+ rc = test_call0();
+ if (!EFI_ERROR(rc)) {
+ Print(L"0 args works just fine here.\r\n");
+ } else {
+ Print(L"0 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call1();
+ if (!EFI_ERROR(rc)) {
+ Print(L"1 arg works just fine here.\r\n");
+ } else {
+ Print(L"1 arg failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call2();
+ if (!EFI_ERROR(rc)) {
+ Print(L"2 args works just fine here.\r\n");
+ } else {
+ Print(L"2 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call3();
+ if (!EFI_ERROR(rc)) {
+ Print(L"3 args works just fine here.\r\n");
+ } else {
+ Print(L"3 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call4();
+ if (!EFI_ERROR(rc)) {
+ Print(L"4 args works just fine here.\r\n");
+ } else {
+ Print(L"4 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call5();
+ if (!EFI_ERROR(rc)) {
+ Print(L"5 args works just fine here.\r\n");
+ } else {
+ Print(L"5 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call6();
+ if (!EFI_ERROR(rc)) {
+ Print(L"6 args works just fine here.\r\n");
+ } else {
+ Print(L"6 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call7();
+ if (!EFI_ERROR(rc)) {
+ Print(L"7 args works just fine here.\r\n");
+ } else {
+ Print(L"7 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call8();
+ if (!EFI_ERROR(rc)) {
+ Print(L"8 args works just fine here.\r\n");
+ } else {
+ Print(L"8 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call9();
+ if (!EFI_ERROR(rc)) {
+ Print(L"9 args works just fine here.\r\n");
+ } else {
+ Print(L"9 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ rc = test_call10();
+ if (!EFI_ERROR(rc)) {
+ Print(L"10 args works just fine here.\r\n");
+ } else {
+ Print(L"10 args failed: 0x%016x\n", rc);
+ return rc;
+ }
+
+ return rc;
+}
--
1.7.6

View File

@ -1,141 +0,0 @@
From 3f693b16c4f9992247e11c1f15cf0e06bbf69a93 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 26 Jul 2010 17:04:12 -0400
Subject: [PATCH] Add the routines to make callbacks work.
GCC on x86_64 now provides a function attribute "ms_abi" to generate
functions using the Windows x86_64 calling conventions. These can be
used to write callback functions to be called from UEFI.
---
Make.defaults | 2 +-
inc/ia32/efibind.h | 18 +++++++++++++++++-
inc/ia64/efibind.h | 19 ++++++++++++++++++-
inc/x86_64/efibind.h | 22 +++++++++++++++++-----
4 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/Make.defaults b/Make.defaults
index 529d58c..2a981a1 100644
--- a/Make.defaults
+++ b/Make.defaults
@@ -59,7 +59,7 @@ ifeq ($(ARCH), ia32)
endif
ifeq ($(ARCH), x86_64)
- CFLAGS += -DEFI_FUNCTION_WRAPPER -mno-red-zone
+ CFLAGS += -mno-red-zone
ifeq ($(HOSTARCH), ia32)
ARCH3264 = -m64
endif
diff --git a/inc/ia32/efibind.h b/inc/ia32/efibind.h
index 647a63e..0201ca1 100644
--- a/inc/ia32/efibind.h
+++ b/inc/ia32/efibind.h
@@ -234,7 +234,22 @@ typedef uint32_t UINTN;
// one big module.
//
- #define EFI_DRIVER_ENTRY_POINT(InitFunction)
+ #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ InitializeDriver ( \
+ VOID *ImageHandle, \
+ VOID *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, \
+ SystemTable); \
+ } \
+ \
+ EFI_STATUS efi_main( \
+ EFI_HANDLE image, \
+ EFI_SYSTEM_TABLE *systab \
+ ) __attribute__((weak, \
+ alias ("InitializeDriver")));
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
(_if)->LoadInternal(type, name, entry)
@@ -259,6 +274,7 @@ typedef uint32_t UINTN;
/* No efi call wrapper for IA32 architecture */
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+#define EFI_FUNCTION
#ifdef _MSC_EXTENSIONS
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
diff --git a/inc/ia64/efibind.h b/inc/ia64/efibind.h
index 83ca529..aac83b3 100644
--- a/inc/ia64/efibind.h
+++ b/inc/ia64/efibind.h
@@ -182,7 +182,22 @@ void __mf (void);
// one big module.
//
-#define EFI_DRIVER_ENTRY_POINT(InitFunction)
+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ InitializeDriver ( \
+ VOID *ImageHandle, \
+ VOID *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, \
+ SystemTable); \
+ } \
+ \
+ EFI_STATUS efi_main( \
+ EFI_HANDLE image, \
+ EFI_SYSTEM_TABLE *systab \
+ ) __attribute__((weak, \
+ alias ("InitializeDriver")));
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
(_if)->LoadInternal(type, name, entry)
@@ -205,3 +220,4 @@ void __mf (void);
/* No efi call wrapper for IA32 architecture */
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+#define EFI_FUNCTION
diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h
index 1f8e735..9250973 100644
--- a/inc/x86_64/efibind.h
+++ b/inc/x86_64/efibind.h
@@ -234,7 +234,22 @@ typedef uint64_t UINTN;
// one big module.
//
- #define EFI_DRIVER_ENTRY_POINT(InitFunction)
+ #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ InitializeDriver ( \
+ VOID *ImageHandle, \
+ VOID *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, \
+ SystemTable); \
+ } \
+ \
+ EFI_STATUS efi_main( \
+ EFI_HANDLE image, \
+ EFI_SYSTEM_TABLE *systab \
+ ) __attribute__((weak, \
+ alias ("InitializeDriver")));
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
(_if)->LoadInternal(type, name, entry)
@@ -258,11 +273,8 @@ typedef uint64_t UINTN;
#endif
/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
-#ifdef EFI_FUNCTION_WRAPPER
UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...);
-#else
-#error "EFI_FUNCTION_WRAPPER must be defined for x86_64 architecture"
-#endif
+#define EFI_FUNCTION __attribute__((ms_abi))
#ifdef _MSC_EXTENSIONS
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
--
1.7.6

View File

@ -1,331 +0,0 @@
From 1c5d58b7ce7df3a68fec248f7b8f2de943eb6ffd Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 1 Aug 2011 16:00:35 -0400
Subject: [PATCH] Guarantee 16-byte stack alignment on x86_64 efi_callN()
The Windows ABI requires 16-byte stack alignment, but the ELF/SysV ABI
only guarantees 8-byte alignment. This causes some machines to present
undefined behavior. To solve this, add some padding to the stack and store
our pad amount in the padding.
This (along with another patch) fixes Red Hat bugzillas 669765 and
677468 .
---
lib/x86_64/efi_stub.S | 213 ++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 176 insertions(+), 37 deletions(-)
diff --git a/lib/x86_64/efi_stub.S b/lib/x86_64/efi_stub.S
index f9e70d4..5607779 100644
--- a/lib/x86_64/efi_stub.S
+++ b/lib/x86_64/efi_stub.S
@@ -6,133 +6,270 @@
* Huang Ying <ying.huang@intel.com>
*/
+/*
+ * EFI calling conventions are documented at:
+ * http://msdn.microsoft.com/en-us/library/ms235286%28v=vs.80%29.aspx
+ * ELF calling conventions are documented at:
+ * http://www.x86-64.org/documentation/abi.pdf
+ *
+ * Basically here are the conversion rules:
+ * a) our function pointer is in %rdi
+ * b) ELF gives us 8-byte aligned %rsp, so we need to pad out to 16-byte
+ * alignment.
+ * c) inside each call thunker, we can only adjust the stack by
+ * multiples of 16 bytes. "offset" below refers to however much
+ * we allocate inside a thunker.
+ * d) rsi through r8 (elf) aka rcx through r9 (ms) require stack space
+ * on the MS side even though it's not getting used at all.
+ * e) arguments are as follows: (elf -> ms)
+ * 1) rdi -> rcx (32 saved)
+ * 2) rsi -> rdx (32 saved)
+ * 3) rdx -> r8 ( 32 saved)
+ * 4) rcx -> r9 (32 saved)
+ * 5) r8 -> 32(%rsp) (48 saved)
+ * 6) r9 -> 40(%rsp) (48 saved)
+ * 7) pad+offset+0(%rsp) -> 48(%rsp) (64 saved)
+ * 8) pad+offset+8(%rsp) -> 56(%rsp) (64 saved)
+ * 9) pad+offset+16(%rsp) -> 64(%rsp) (80 saved)
+ * 10) pad+offset+24(%rsp) -> 72(%rsp) (80 saved)
+ * 11) pad+offset+32(%rsp) -> 80(%rsp) (96 saved)
+ * 12) pad+offset+40(%rsp) -> 88(%rsp) (96 saved)
+ * f) because the first argument we recieve in a thunker is actually the
+ * function to be called, arguments are offset as such:
+ * 0) rdi -> caller
+ * 1) rsi -> rcx (32 saved)
+ * 2) rdx -> rdx (32 saved)
+ * 3) rcx -> r8 (32 saved)
+ * 4) r8 -> r9 (32 saved)
+ * 5) r9 -> 32(%rsp) (48 saved)
+ * 6) pad+offset+0(%rsp) -> 40(%rsp) (48 saved)
+ * 7) pad+offset+8(%rsp) -> 48(%rsp) (64 saved)
+ * 8) pad+offset+16(%rsp) -> 56(%rsp) (64 saved)
+ * 9) pad+offset+24(%rsp) -> 64(%rsp) (80 saved)
+ * 10) pad+offset+32(%rsp) -> 72(%rsp) (80 saved)
+ * 11) pad+offset+40(%rsp) -> 80(%rsp) (96 saved)
+ * 12) pad+offset+48(%rsp) -> 88(%rsp) (96 saved)
+ * e) arguments need to be moved in opposite order to avoid clobbering
+ * f) pad_stack leaves the amount of padding it added in %r11 for functions
+ * to use
+ * g) efi -> elf calls don't need to pad the stack, because the 16-byte
+ * alignment is also always 8-byte aligned.
+ */
+
#define ENTRY(name) \
.globl name; \
name:
+#define out(val) \
+ push %rax ; \
+ mov val, %rax ; \
+ out %al, $128 ; \
+ pop %rax
+
+#define pad_stack \
+ subq $8, %rsp ; /* must be a multiple of 16 - sizeof(%rip) */ \
+ /* stash some handy integers */ \
+ mov $0x8, %rax ; \
+ mov $0x10, %r10 ; \
+ mov $0xf, %r11 ; \
+ /* see if we need padding */ \
+ and %rsp, %rax ; \
+ /* store the pad amount in %r11 */ \
+ cmovnz %rax, %r11 ; \
+ cmovz %r10, %r11 ; \
+ /* insert the padding */ \
+ subq %r11, %rsp ; \
+ /* add the $8 we saved above in %r11 */ \
+ addq $8, %r11 ; \
+ /* store the pad amount */ \
+ mov %r11, (%rsp) ; \
+ /* compensate for %rip being stored on the stack by call */ \
+ addq $8, %r11
+
+#define unpad_stack \
+ /* fetch the pad amount we saved (%r11 has been clobbered) */ \
+ mov (%rsp), %r11 ; \
+ /* remove the padding */ \
+ addq %r11, %rsp
+
ENTRY(efi_call0)
- subq $40, %rsp
+ pad_stack
+ subq $32, %rsp
call *%rdi
- addq $40, %rsp
+ addq $32, %rsp
+ unpad_stack
ret
ENTRY(efi_call1)
- subq $40, %rsp
+ pad_stack
+ subq $32, %rsp
mov %rsi, %rcx
call *%rdi
- addq $40, %rsp
+ addq $32, %rsp
+ unpad_stack
ret
ENTRY(efi_call2)
- subq $40, %rsp
+ pad_stack
+ subq $32, %rsp
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $40, %rsp
+ addq $32, %rsp
+ unpad_stack
ret
ENTRY(efi_call3)
- subq $40, %rsp
+ pad_stack
+ subq $32, %rsp
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $40, %rsp
+ addq $32, %rsp
+ unpad_stack
ret
ENTRY(efi_call4)
- subq $40, %rsp
+ pad_stack
+ subq $32, %rsp
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $40, %rsp
+ addq $32, %rsp
+ unpad_stack
ret
ENTRY(efi_call5)
- subq $40, %rsp
+ pad_stack
+ subq $48, %rsp
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $40, %rsp
+ addq $48, %rsp
+ unpad_stack
ret
ENTRY(efi_call6)
- subq $56, %rsp
- mov 56+8(%rsp), %rax
+ pad_stack
+ subq $48, %rsp
+ addq $48, %r11
+ addq %rsp, %r11
+ mov (%r11), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $56, %rsp
+ addq $48, %rsp
+ unpad_stack
ret
ENTRY(efi_call7)
- subq $56, %rsp
- mov 56+16(%rsp), %rax
+ pad_stack
+ subq $64, %rsp
+ addq $64, %r11
+ addq $8, %r11
+ addq %rsp, %r11
+ mov (%r11), %rax
mov %rax, 48(%rsp)
- mov 56+8(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $56, %rsp
+ addq $64, %rsp
+ unpad_stack
ret
ENTRY(efi_call8)
- subq $72, %rsp
- mov 72+24(%rsp), %rax
+ pad_stack
+ subq $64, %rsp
+ addq $64, %r11
+ addq $16, %r11
+ addq %rsp, %r11
+ mov (%r11), %rax
mov %rax, 56(%rsp)
- mov 72+16(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 48(%rsp)
- mov 72+8(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $72, %rsp
+ addq $64, %rsp
+ unpad_stack
ret
ENTRY(efi_call9)
- subq $72, %rsp
- mov 72+32(%rsp), %rax
+ pad_stack
+ subq $80, %rsp
+ addq $80, %r11
+ addq $24, %r11
+ addq %rsp, %r11
+ mov (%r11), %rax
mov %rax, 64(%rsp)
- mov 72+24(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 56(%rsp)
- mov 72+16(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 48(%rsp)
- mov 72+8(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $72, %rsp
+ addq $80, %rsp
+ unpad_stack
ret
ENTRY(efi_call10)
- subq $88, %rsp
- mov 88+40(%rsp), %rax
+ pad_stack
+ subq $80, %rsp
+ addq $80, %r11
+ addq $32, %r11
+ addq %rsp, %r11
+ mov (%r11), %rax
mov %rax, 72(%rsp)
- mov 88+32(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 64(%rsp)
- mov 88+24(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 56(%rsp)
- mov 88+16(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 48(%rsp)
- mov 88+8(%rsp), %rax
+ subq $8, %r11
+ mov (%r11), %rax
mov %rax, 40(%rsp)
mov %r9, 32(%rsp)
mov %r8, %r9
mov %rcx, %r8
+ /* mov %rdx, %rdx */
mov %rsi, %rcx
call *%rdi
- addq $88, %rsp
+ addq $80, %rsp
+ unpad_stack
ret
--
1.7.6

View File

@ -1,277 +0,0 @@
From 4547a096f10ea8b2164f895a10f2dbe9e1269c22 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 26 Jul 2010 14:25:47 -0400
Subject: [PATCH] Add headers for PciIo .
---
inc/efi.h | 1 +
inc/efilib.h | 1 +
inc/efipciio.h | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
lib/data.c | 1 +
4 files changed, 222 insertions(+), 0 deletions(-)
create mode 100644 inc/efipciio.h
diff --git a/inc/efi.h b/inc/efi.h
index 4cdb12b..e9de37b 100644
--- a/inc/efi.h
+++ b/inc/efi.h
@@ -35,6 +35,7 @@ Revision History
#include "efibind.h"
#include "efidef.h"
#include "efidevp.h"
+#include "efipciio.h"
#include "efiprot.h"
#include "eficon.h"
#include "efiser.h"
diff --git a/inc/efilib.h b/inc/efilib.h
index 82c332a..740c2ff 100644
--- a/inc/efilib.h
+++ b/inc/efilib.h
@@ -58,6 +58,7 @@ extern EFI_GUID PxeCallbackProtocol;
extern EFI_GUID NetworkInterfaceIdentifierProtocol;
extern EFI_GUID UiProtocol;
extern EFI_GUID InternalShellProtocol;
+extern EFI_GUID PciIoProtocol;
extern EFI_GUID EfiGlobalVariable;
extern EFI_GUID GenericFileInfo;
diff --git a/inc/efipciio.h b/inc/efipciio.h
new file mode 100644
index 0000000..0724f95
--- /dev/null
+++ b/inc/efipciio.h
@@ -0,0 +1,219 @@
+#ifndef _EFI_PCI_IO_H
+#define _EFI_PCI_IO_H
+
+#define EFI_PCI_IO_PROTOCOL \
+ { 0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a} }
+
+INTERFACE_DECL(_EFI_PCI_IO);
+
+typedef enum {
+ EfiPciIoWidthUint8,
+ EfiPciIoWidthUint16,
+ EfiPciIoWidthUint32,
+ EfiPciIoWidthUint64,
+ EfiPciIoWidthFifoUint8,
+ EfiPciIoWidthFifoUint16,
+ EfiPciIoWidthFifoUint32,
+ EfiPciIoWidthFifoUint64,
+ EfiPciIoWidthFillUint8,
+ EfiPciIoWidthFillUint16,
+ EfiPciIoWidthFillUint32,
+ EfiPciIoWidthFillUint64,
+ EfiPciIoWidthMaximum
+} EFI_PCI_IO_PROTOCOL_WIDTH;
+
+#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_POLL_IO_MEM) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN UINT8 BarIndex,
+ IN UINT64 Offset,
+ IN UINT64 Mask,
+ IN UINT64 Value,
+ IN UINT64 Delay,
+ OUT UINT64 *Result
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_IO_MEM) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN UINT8 BarIndex,
+ IN UINT64 Offset,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+);
+
+typedef struct {
+ EFI_PCI_IO_PROTOCOL_IO_MEM Read;
+ EFI_PCI_IO_PROTOCOL_IO_MEM Write;
+} EFI_PCI_IO_PROTOCOL_ACCESS;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_CONFIG) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN UINT32 Offset,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
+);
+
+typedef struct {
+ EFI_PCI_IO_PROTOCOL_CONFIG Read;
+ EFI_PCI_IO_PROTOCOL_CONFIG Write;
+} EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_COPY_MEM) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_WIDTH Width,
+ IN UINT8 DestBarIndex,
+ IN UINT64 DestOffset,
+ IN UINT8 SrcBarIndex,
+ IN UINT64 SrcOffset,
+ IN UINTN Count
+ );
+
+typedef enum {
+ EfiPciIoOperationBusMasterRead,
+ EfiPciIoOperationBusMasterWrite,
+ EfiPciIoOperationBusMasterCommonBuffer,
+ EfiPciIoOperationMaximum
+} EFI_PCI_IO_PROTOCOL_OPERATION;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_MAP) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,
+ IN VOID *HostAddress,
+ IN OUT UINTN *NumberOfBytes,
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
+ OUT VOID **Mapping
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_UNMAP) (
+ IN struct _EFI_PCI_IO *This,
+ IN VOID *Mapping
+);
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT VOID **HostAddress,
+ IN UINT64 Attributes
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_FREE_BUFFER) (
+ IN struct _EFI_PCI_IO *This,
+ IN UINTN Pages,
+ IN VOID *HostAddress
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_FLUSH) (
+ IN struct _EFI_PCI_IO *This
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_LOCATION) (
+ IN struct _EFI_PCI_IO *This,
+ OUT UINTN *SegmentNumber,
+ OUT UINTN *BusNumber,
+ OUT UINTN *DeviceNumber,
+ OUT UINTN *FunctionNumber
+ );
+
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004
+#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010
+#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020
+#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080
+#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200
+#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED 0x0800
+#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000
+#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000
+#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000
+#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 0x10000
+#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 0x20000
+#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 0x40000
+
+typedef enum {
+ EfiPciIoAttributeOperationGet,
+ EfiPciIoAttributeOperationSet,
+ EfiPciIoAttributeOperationEnable,
+ EfiPciIoAttributeOperationDisable,
+ EfiPciIoAttributeOperationSupported,
+ EfiPciIoAttributeOperationMaximum
+} EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_ATTRIBUTES) (
+ IN struct _EFI_PCI_IO *This,
+ IN EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION Operation,
+ IN UINT64 Attributes,
+ OUT UINT64 *Result OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES) (
+ IN struct _EFI_PCI_IO *This,
+ IN UINT8 BarIndex,
+ OUT UINT64 *Supports OPTIONAL,
+ OUT VOID **Resources OPTIONAL
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES) (
+ IN struct _EFI_PCI_IO *This,
+ IN UINT64 Attributes,
+ IN UINT8 BarIndex,
+ IN OUT UINT64 *Offset,
+ IN OUT UINT64 *Length
+ );
+
+typedef struct _EFI_PCI_IO {
+ EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollMem;
+ EFI_PCI_IO_PROTOCOL_POLL_IO_MEM PollIo;
+ EFI_PCI_IO_PROTOCOL_ACCESS Mem;
+ EFI_PCI_IO_PROTOCOL_ACCESS Io;
+ EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS Pci;
+ EFI_PCI_IO_PROTOCOL_COPY_MEM CopyMem;
+ EFI_PCI_IO_PROTOCOL_MAP Map;
+ EFI_PCI_IO_PROTOCOL_UNMAP Unmap;
+ EFI_PCI_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
+ EFI_PCI_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
+ EFI_PCI_IO_PROTOCOL_FLUSH Flush;
+ EFI_PCI_IO_PROTOCOL_GET_LOCATION GetLocation;
+ EFI_PCI_IO_PROTOCOL_ATTRIBUTES Attributes;
+ EFI_PCI_IO_PROTOCOL_GET_BAR_ATTRIBUTES GetBarAttributes;
+ EFI_PCI_IO_PROTOCOL_SET_BAR_ATTRIBUTES SetBarAttributes;
+ UINT64 RomSize;
+ VOID *RomImage;
+} EFI_PCI_IO;
+
+#endif /* _EFI_PCI_IO_H */
diff --git a/lib/data.c b/lib/data.c
index 402c54d..bcb2d67 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -103,6 +103,7 @@ EFI_GUID PxeBaseCodeProtocol = EFI_PXE_BASE_CODE_PROTOCOL;
EFI_GUID PxeCallbackProtocol = EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL;
EFI_GUID NetworkInterfaceIdentifierProtocol = EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL;
EFI_GUID UiProtocol = EFI_UI_PROTOCOL;
+EFI_GUID PciIoProtocol = EFI_PCI_IO_PROTOCOL;
//
// File system information IDs
//
--
1.7.1.1

View File

@ -1,218 +0,0 @@
From 05b13861f78a9f20e5902fc37cac4564d430fd35 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 23 Jul 2010 16:07:13 -0400
Subject: [PATCH] Add the UEFI 2.x bits for EFI_BOOT_SERVICES
---
inc/efiapi.h | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 175 insertions(+), 6 deletions(-)
diff --git a/inc/efiapi.h b/inc/efiapi.h
index 888e052..5e47324 100644
--- a/inc/efiapi.h
+++ b/inc/efiapi.h
@@ -412,6 +412,147 @@ EFI_STATUS
IN CHAR16 *WatchdogData OPTIONAL
);
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CONNECT_CONTROLLER) (
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE *DriverImageHandle OPTIONAL,
+ IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL,
+ IN BOOLEAN Recursive
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_DISCONNECT_CONTROLLER) (
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE DriverImageHandle OPTIONAL,
+ IN EFI_HANDLE ChildHandle OPTIONAL
+ );
+
+#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
+#define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
+#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
+#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
+#define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
+#define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL) (
+ IN EFI_HANDLE Handle,
+ IN EFI_GUID *Protocol,
+ OUT VOID **Interface OPTIONAL,
+ IN EFI_HANDLE AgentHandle,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINT32 Attributes
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CLOSE_PROTOCOL) (
+ IN EFI_HANDLE Handle,
+ IN EFI_GUID *Protocol,
+ IN EFI_HANDLE AgentHandle,
+ IN EFI_HANDLE ControllerHandle
+ );
+
+typedef struct {
+ EFI_HANDLE AgentHandle;
+ EFI_HANDLE ControllerHandle;
+ UINT32 Attributes;
+ UINT32 OpenCount;
+} EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
+ IN EFI_HANDLE Handle,
+ IN EFI_GUID *Protocol,
+ OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+ OUT UINTN *EntryCount
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
+ IN EFI_HANDLE Handle,
+ OUT EFI_GUID ***ProtocolBuffer,
+ OUT UINTN *ProtocolBufferCount
+ );
+
+typedef enum {
+ AllHandles,
+ ByRegisterNotify,
+ ByProtocol
+} EFI_LOCATE_SEARCH_TYPE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,
+ IN EFI_GUID *Protocol OPTIONAL,
+ IN VOID *SearchKey OPTIONAL,
+ IN OUT UINTN *NoHandles,
+ OUT EFI_HANDLE **Buffer
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_LOCATE_PROTOCOL) (
+ IN EFI_GUID *Protocol,
+ IN VOID *Registration OPTIONAL,
+ OUT VOID **Interface
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+ IN OUT EFI_HANDLE *Handle,
+ ...
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
+ IN OUT EFI_HANDLE Handle,
+ ...
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CALCULATE_CRC32) (
+ IN VOID *Data,
+ IN UINTN DataSize,
+ OUT UINT32 *Crc32
+ );
+
+typedef
+VOID
+(EFIAPI *EFI_COPY_MEM) (
+ IN VOID *Destination,
+ IN VOID *Source,
+ IN UINTN Length
+ );
+
+typedef
+VOID
+(EFIAPI *EFI_SET_MEM) (
+ IN VOID *Buffer,
+ IN UINTN Size,
+ IN UINT8 Value
+ );
+
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_CREATE_EVENT_EX) (
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
+ IN const VOID *NotifyContext OPTIONAL,
+ IN const EFI_GUID EventGroup OPTIONAL,
+ OUT EFI_EVENT *Event
+ );
typedef enum {
EfiResetCold,
@@ -491,12 +632,6 @@ EFI_STATUS
OUT VOID **Registration
);
-typedef enum {
- AllHandles,
- ByRegisterNotify,
- ByProtocol
-} EFI_LOCATE_SEARCH_TYPE;
-
typedef
EFI_STATUS
(EFIAPI *EFI_LOCATE_HANDLE) (
@@ -655,6 +790,40 @@ typedef struct _EFI_BOOT_SERVICES {
EFI_STALL Stall;
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
+ //
+ // DriverSupport Services
+ //
+
+ EFI_CONNECT_CONTROLLER ConnectController;
+ EFI_DISCONNECT_CONTROLLER DisconnectController;
+
+ //
+ // Open and Close Protocol Services
+ //
+ EFI_OPEN_PROTOCOL OpenProtocol;
+ EFI_CLOSE_PROTOCOL CloseProtocol;
+ EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
+
+ //
+ // Library Services
+ //
+ EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
+ EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
+ EFI_LOCATE_PROTOCOL LocateProtocol;
+ EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
+ EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
+
+ //
+ // 32-bit CRC Services
+ //
+ EFI_CALCULATE_CRC32 CalculateCrc32;
+
+ //
+ // Misc Services
+ //
+ EFI_COPY_MEM CopyMem;
+ EFI_SET_MEM SetMem;
+ EFI_CREATE_EVENT_EX CreateEventEx;
} EFI_BOOT_SERVICES;
--
1.7.1.1

View File

@ -1,34 +0,0 @@
From b1e7f6b21c4269de87c626a7e4792ccdeed1a3c5 Mon Sep 17 00:00:00 2001
From: Matt Fleming <matt.fleming@intel.com>
Date: Mon, 23 Apr 2012 11:19:58 +0100
Subject: [PATCH] Align the .reloc section for x86-64
Like the linker scripts for other architectures, the .reloc section
needs to be aligned for x86-64. Use a 4096-byte boundary because that
seems to be the convention used everywhere else in the linker scripts.
Without this patch the .reloc section will not adhere to the alignment
value in the FileAlignment field (512 bytes by default) of the PE/COFF
header. This results in a signed executable failing to boot in a
secure boot environment.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
---
gnuefi/elf_x86_64_efi.lds | 1 +
1 file changed, 1 insertion(+)
diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x86_64_efi.lds
index d188aee..32cf687 100644
--- a/gnuefi/elf_x86_64_efi.lds
+++ b/gnuefi/elf_x86_64_efi.lds
@@ -17,6 +17,7 @@ SECTIONS
{
*(.text)
}
+ . = ALIGN(4096);
.reloc :
{
*(.reloc)
--
1.7.10

View File

@ -1,30 +0,0 @@
From 364351b4448ff20730250e89ad09088d6aeafc72 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@cutlet.install.bos.redhat.com>
Date: Fri, 3 Oct 2008 14:40:56 -0400
Subject: [PATCH] Add an ignore for .note.GNU-stack section in the linker map.
diff --git a/gnuefi/elf_ia32_efi.lds b/gnuefi/elf_ia32_efi.lds
index bc29799..b15b36d 100644
--- a/gnuefi/elf_ia32_efi.lds
+++ b/gnuefi/elf_ia32_efi.lds
@@ -58,5 +58,7 @@ SECTIONS
{
*(.rel.reloc)
*(.eh_frame)
+ *(.note.GNU-stack)
}
+ .comment 0 : { *(.comment) }
}
diff --git a/gnuefi/elf_x86_64_efi.lds b/gnuefi/elf_x86_64_efi.lds
index 9c0a9f8..d0ae5f0 100644
--- a/gnuefi/elf_x86_64_efi.lds
+++ b/gnuefi/elf_x86_64_efi.lds
@@ -54,5 +54,8 @@ SECTIONS
.ignored.reloc :
{
*(.rela.reloc)
+ *(.eh_frame)
+ *(.note.GNU-stack)
}
+ .comment 0 : { *(.comment) }
}

View File

@ -1,33 +0,0 @@
From 364351b4448ff20730250e89ad09088d6aeafc72 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@cutlet.install.bos.redhat.com>
Date: Fri, 3 Oct 2008 14:40:56 -0400
Subject: [PATCH] Fix the case where there are no relocations.
diff --git a/gnuefi/reloc_ia32.c b/gnuefi/reloc_ia32.c
index 9bf4a8d..0b461cf 100644
--- a/gnuefi/reloc_ia32.c
+++ b/gnuefi/reloc_ia32.c
@@ -76,6 +76,9 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_
}
}
+ if (!rel && relent == 0)
+ return EFI_SUCCESS;
+
if (!rel || relent == 0)
return EFI_LOAD_ERROR;
diff --git a/gnuefi/reloc_x86_64.c b/gnuefi/reloc_x86_64.c
index 9906084..3f94f47 100644
--- a/gnuefi/reloc_x86_64.c
+++ b/gnuefi/reloc_x86_64.c
@@ -76,6 +76,9 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_
}
}
+ if (!rel && relent == 0)
+ return EFI_SUCCESS;
+
if (!rel || relent == 0)
return EFI_LOAD_ERROR;

View File

@ -1,243 +0,0 @@
diff -urpN gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds
--- gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500
+++ gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds 2009-02-13 16:07:45.000000000 -0500
@@ -5,17 +5,23 @@ SECTIONS
{
. = 0;
ImageBase = .;
- .hash : { *(.hash) } /* this MUST come first! */
+ .hash : /* this MUST come first! */
+ {
+ *(.hash)
+ LONG(0)
+ }
. = ALIGN(4096);
.text :
{
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
+ LONG(0)
}
.reloc :
{
*(.reloc)
+ LONG(0)
}
. = ALIGN(4096);
.data :
@@ -34,25 +40,39 @@ SECTIONS
*(.dynbss)
*(.bss)
*(COMMON)
+ LONG(0)
}
. = ALIGN(4096);
- .dynamic : { *(.dynamic) }
+ .dynamic :
+ {
+ *(.dynamic)
+ LONG(0)
+ }
. = ALIGN(4096);
.rel :
{
- *(.rel.data)
- *(.rel.data.*)
- *(.rel.got)
- *(.rel.stab)
- *(.data.rel.ro.local)
- *(.data.rel.local)
- *(.data.rel.ro)
- *(.data.rel*)
+ *(.rel.data)
+ *(.rel.data.*)
+ *(.rel.got)
+ *(.rel.stab)
+ *(.data.rel.ro.local)
+ *(.data.rel.local)
+ *(.data.rel.ro)
+ *(.data.rel*)
+ LONG(0)
}
. = ALIGN(4096);
- .dynsym : { *(.dynsym) }
+ .dynsym :
+ {
+ *(.dynsym)
+ LONG(0)
+ }
. = ALIGN(4096);
- .dynstr : { *(.dynstr) }
+ .dynstr :
+ {
+ *(.dynstr)
+ LONG(0)
+ }
. = ALIGN(4096);
/DISCARD/ :
{
diff -urpN gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds
--- gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500
+++ gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds 2009-02-13 16:07:45.000000000 -0500
@@ -5,13 +5,18 @@ SECTIONS
{
. = 0;
ImageBase = .;
- .hash : { *(.hash) } /* this MUST come first! */
+ .hash : /* this MUST come first! */
+ {
+ *(.hash)
+ LONG(0)
+ }
. = ALIGN(4096);
.text :
{
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
+ LONG(0)
}
. = ALIGN(4096);
__gp = ALIGN (8) + 0x200000;
@@ -23,6 +28,7 @@ SECTIONS
*(.sdata)
*(.sbss)
*(.scommon)
+ LONG(0)
}
. = ALIGN(4096);
.data :
@@ -37,29 +43,44 @@ SECTIONS
*(.dynbss)
*(.bss)
*(COMMON)
+ LONG(0)
}
. = ALIGN(4096);
- .dynamic : { *(.dynamic) }
+ .dynamic :
+ {
+ *(.dynamic)
+ LONG(0)
+ }
. = ALIGN(4096);
.rela :
{
- *(.rela.text)
- *(.rela.data*)
- *(.rela.sdata)
- *(.rela.got)
- *(.rela.gnu.linkonce.d*)
- *(.rela.stab)
- *(.rela.ctors)
+ *(.rela.text)
+ *(.rela.data*)
+ *(.rela.sdata)
+ *(.rela.got)
+ *(.rela.gnu.linkonce.d*)
+ *(.rela.stab)
+ *(.rela.ctors)
+ LONG(0)
}
. = ALIGN(4096);
.reloc : /* This is the PECOFF .reloc section! */
{
*(.reloc)
+ LONG(0)
}
. = ALIGN(4096);
- .dynsym : { *(.dynsym) }
+ .dynsym :
+ {
+ *(.dynsym)
+ LONG(0)
+ }
. = ALIGN(4096);
- .dynstr : { *(.dynstr) }
+ .dynstr :
+ {
+ *(.dynstr)
+ LONG(0)
+ }
/DISCARD/ :
{
*(.rela.plabel)
diff -urpN gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds
--- gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500
+++ gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds 2009-02-13 16:07:45.000000000 -0500
@@ -5,20 +5,27 @@ SECTIONS
{
. = 0;
ImageBase = .;
- .hash : { *(.hash) } /* this MUST come first! */
+ .hash : /* this MUST come first! */
+ {
+ *(.hash)
+ LONG(0)
+ }
. = ALIGN(4096);
.eh_frame :
{
*(.eh_frame)
+ LONG(0)
}
. = ALIGN(4096);
.text :
{
*(.text)
+ LONG(0)
}
.reloc :
{
*(.reloc)
+ LONG(0)
}
. = ALIGN(4096);
.data :
@@ -36,23 +43,38 @@ SECTIONS
*(.bss)
*(COMMON)
*(.rel.local)
+ LONG(0)
}
. = ALIGN(4096);
- .dynamic : { *(.dynamic) }
+ .dynamic :
+ {
+ *(.dynamic)
+ LONG(0)
+ }
. = ALIGN(4096);
.rela :
{
- *(.rela.data*)
- *(.rela.got)
- *(.rela.stab)
+ *(.rela.data*)
+ *(.rela.got)
+ *(.rela.stab)
+ LONG(0)
}
. = ALIGN(4096);
- .dynsym : { *(.dynsym) }
+ .dynsym :
+ {
+ *(.dynsym)
+ LONG(0)
+ }
. = ALIGN(4096);
- .dynstr : { *(.dynstr) }
+ .dynstr :
+ {
+ *(.dynstr)
+ LONG(0)
+ }
. = ALIGN(4096);
.ignored.reloc :
{
- *(.rela.reloc)
+ *(.rela.reloc)
+ LONG(0)
}
}

View File

@ -1,17 +1,17 @@
From 44e7c2b928b8c71dfe189208e35ca49ab210f058 Mon Sep 17 00:00:00 2001
From bb12d86aceb7d9ea6748f45a17f719a8e18c81c8 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 9 Aug 2011 12:30:49 -0400
Subject: [PATCH] Add %.S and %.E rules to make debugging easier.
Subject: [PATCH 7/7] Add %.S and %.E rules to make debugging easier.
---
Make.rules | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
1 file changed, 5 insertions(+)
diff --git a/Make.rules b/Make.rules
index 1f24ebd..cb029c3 100644
index eab12d7..65fb612 100644
--- a/Make.rules
+++ b/Make.rules
@@ -31,3 +31,8 @@
@@ -44,3 +44,8 @@
%.o: %.c
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
@ -21,5 +21,5 @@ index 1f24ebd..cb029c3 100644
+%.E: %.c
+ $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@
--
1.7.6
1.7.10.4

View File

@ -1,7 +1,7 @@
From 364351b4448ff20730250e89ad09088d6aeafc72 Mon Sep 17 00:00:00 2001
From 3f40a425e763edfde77a9a6e05ed09b0676d8fa9 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@cutlet.install.bos.redhat.com>
Date: Fri, 3 Oct 2008 14:40:56 -0400
Subject: [PATCH] Fix usage of INSTALLROOT, PREFIX, and LIBDIR.
Subject: [PATCH 1/7] Fix usage of INSTALLROOT, PREFIX, and LIBDIR.
I screwed it up last time.
---
@ -10,10 +10,10 @@ I screwed it up last time.
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/Make.defaults b/Make.defaults
index 4ad6480..de72d9b 100644
index bf162c5..6278fa7 100644
--- a/Make.defaults
+++ b/Make.defaults
@@ -25,8 +25,9 @@
@@ -38,8 +38,9 @@
# Where to install the package. GNU-EFI will create and access
# lib and include under the root
#
@ -25,10 +25,10 @@ index 4ad6480..de72d9b 100644
TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
@@ -59,7 +60,6 @@ endif
@@ -73,7 +74,6 @@ endif
ifeq ($(ARCH), x86_64)
CFLAGS += -DEFI_FUNCTION_WRAPPER -mno-red-zone
CFLAGS += -mno-red-zone
- LIBDIR = lib
ifeq ($(HOSTARCH), ia32)
ARCH3264 = -m64
@ -62,5 +62,5 @@ index 9683be5..71fded5 100644
include $(SRCDIR)/../Make.rules
--
1.5.4.5
1.7.10.4

View File

@ -1,11 +1,11 @@
From c261b8de0504fd37af99c61cdda248f312124034 Mon Sep 17 00:00:00 2001
From 0f8b3ac2ec984de7f3437fe6a3b37ab8eb07ae71 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 16 Jun 2011 16:10:27 -0400
Subject: [PATCH] Handle un-initialized GOP.
Subject: [PATCH 6/7] Handle un-initialized GOP.
---
apps/modelist.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
1 file changed, 27 insertions(+)
diff --git a/apps/modelist.c b/apps/modelist.c
index c4a4b1a..8d816d1 100644
@ -53,5 +53,5 @@ index c4a4b1a..8d816d1 100644
CHAR16 Buffer[64];
StatusToString(Buffer, rc);
--
1.7.4.4
1.7.10.4

View File

@ -1,17 +1,17 @@
From eb2e79305e8363b1340afc24387a7b6967b5874b Mon Sep 17 00:00:00 2001
From 9ab3fefd9b86c567ba6b0ea1429ce932572040c1 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 26 Apr 2011 13:25:26 -0400
Subject: [PATCH] Add more machine type defines.
Subject: [PATCH 5/7] Add more machine type defines.
Add machine type defines for i386, arm/thumb, ia64, ebc, and x86_64.
---
inc/ia32/pe.h | 4 ++++
inc/ia64/pe.h | 4 ++++
inc/x86_64/pe.h | 4 ++++
3 files changed, 12 insertions(+), 0 deletions(-)
3 files changed, 12 insertions(+)
diff --git a/inc/ia32/pe.h b/inc/ia32/pe.h
index c492606..85d6981 100644
index 16e40ef..979b936 100644
--- a/inc/ia32/pe.h
+++ b/inc/ia32/pe.h
@@ -98,8 +98,12 @@ typedef struct _IMAGE_FILE_HEADER {
@ -28,7 +28,7 @@ index c492606..85d6981 100644
// Directory format.
//
diff --git a/inc/ia64/pe.h b/inc/ia64/pe.h
index 618d59f..226e49d 100644
index f67128d..b1cade2 100644
--- a/inc/ia64/pe.h
+++ b/inc/ia64/pe.h
@@ -113,8 +113,12 @@ typedef struct _IMAGE_FILE_HEADER {
@ -45,7 +45,7 @@ index 618d59f..226e49d 100644
// Directory format.
//
diff --git a/inc/x86_64/pe.h b/inc/x86_64/pe.h
index f0a1fd0..4f5f469 100644
index 16e40ef..979b936 100644
--- a/inc/x86_64/pe.h
+++ b/inc/x86_64/pe.h
@@ -98,8 +98,12 @@ typedef struct _IMAGE_FILE_HEADER {
@ -62,5 +62,5 @@ index f0a1fd0..4f5f469 100644
// Directory format.
//
--
1.7.3.1
1.7.10.4

View File

@ -1,25 +1,25 @@
From b9bc87d00d55891a443c8a276842abdcd6df9482 Mon Sep 17 00:00:00 2001
From d29825db356c7ea240e62404c5d3422c01c18bd4 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Fri, 10 Sep 2010 16:04:38 -0400
Subject: [PATCH] Add "modelist" test app.
Subject: [PATCH 3/7] Add "modelist" test app.
This lists video modes the GOP driver is showing us.
---
apps/Makefile | 2 +-
apps/modelist.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 1 deletions(-)
2 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 apps/modelist.c
diff --git a/apps/Makefile b/apps/Makefile
index c063d9a..0919bf3 100644
index 6bda7ea..45bc4ac 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -45,7 +45,7 @@ LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
@@ -58,7 +58,7 @@ LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
FORMAT = efi-app-$(ARCH)
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi
+TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi modelist.efi
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi route80h.efi
+TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi route80h.efi modelist.efi
all: $(TARGETS)
@ -117,5 +117,5 @@ index 0000000..c4a4b1a
+ return EFI_SUCCESS;
+}
--
1.7.2.2
1.7.10.4

View File

@ -1,12 +1,12 @@
From 628dbd2ecce3793850f7c7d789b0adcab6746809 Mon Sep 17 00:00:00 2001
From b7a088b6f3ffacc5b98e1568bed7dcf225089c20 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 11 Nov 2010 16:42:16 -0500
Subject: [PATCH] Add CougarPoint support to route80h.c
Subject: [PATCH 4/7] Add CougarPoint support to route80h.c
CougarPoint is some other northbridge. Yay!
---
apps/route80h.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/apps/route80h.c b/apps/route80h.c
index 1a04b5a..30330ab 100644
@ -45,5 +45,5 @@ index 1a04b5a..30330ab 100644
if (rc == EFI_NOT_FOUND) {
Print(L"Device not found.\n");
--
1.7.2.2
1.7.10.4

View File

@ -1,31 +1,31 @@
From 796ce7f03ed606a801b6a23384e8cf4a13c46fc6 Mon Sep 17 00:00:00 2001
From 61b347a766d9e2f85fcbca96b535b9fdffe7fe8b Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 26 Jul 2010 17:04:12 -0400
Subject: [PATCH] Add the "route80h.efi" test program.
Subject: [PATCH 2/7] Add the "route80h.efi" test program.
This is a test program for PciIo. It routes port80h on ICH10 to PCI.
---
apps/Makefile | 2 +-
apps/route80h.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 126 insertions(+), 1 deletions(-)
2 files changed, 126 insertions(+), 1 deletion(-)
create mode 100644 apps/route80h.c
diff --git a/apps/Makefile b/apps/Makefile
index 44122ad..2baf64d 100644
index 1e43821..6bda7ea 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -38,7 +38,7 @@ LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
@@ -58,7 +58,7 @@ LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
FORMAT = efi-app-$(ARCH)
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi
+TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi route80h.efi
-TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi
+TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi route80h.efi
all: $(TARGETS)
diff --git a/apps/route80h.c b/apps/route80h.c
new file mode 100644
index 0000000..05cc883
index 0000000..1a04b5a
--- /dev/null
+++ b/apps/route80h.c
@@ -0,0 +1,125 @@
@ -155,5 +155,5 @@ index 0000000..05cc883
+ return EFI_SUCCESS;
+}
--
1.7.1.1
1.7.10.4

View File

@ -1,26 +1,18 @@
Summary: Development Libraries and headers for EFI
Name: gnu-efi
Version: 3.0e
Release: 18%{?dist}
Version: 3.0q
Release: 1%{?dist}
Group: Development/System
License: GPLv2+
License: BSD
URL: ftp://ftp.hpl.hp.com/pub/linux-ia64
Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi-%{version}.tar.bz2
Patch0: gnu-efi-3.0e-no-relocations.patch
Patch1: gnu-efi-3.0e-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch
Patch2: gnu-efi-3.0e-ignore-gnu-stack.patch
Patch3: gnu-efi-3.0e-add-uefi-2.x-boot-services.patch
Patch4: gnu-efi-3.0e-add-pciio.patch
Patch5: gnu-efi-3.0e-route80h.patch
Patch6: gnu-efi-3.0e-modelist.patch
Patch7: gnu-efi-3.0e-route80h-add-cougarpoint.patch
Patch8: gnu-efi-3.0e-machine-types.patch
Patch9: gnu-efi-3.0e-handle-uninitialized-gop.patch
Patch10: gnu-efi-3.0e-Add-.S-and-.E-rules.patch
Patch11: gnu-efi-3.0e-Guarantee-16-byte-stack-alignment-on-x86_64-efi_call.patch
Patch12: gnu-efi-3.0e-Add-the-routines-to-make-callbacks-work.patch
Patch13: gnu-efi-3.0e-Add-tcc.efi-to-test-our-calling-convention-shananaga.patch
Patch14: gnu-efi-3.0e-align-reloc-section.patch
Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi-%{version}.tar.gz
Patch0: gnu-efi-3.0q-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch
Patch1: gnu-efi-3.0q-route80h.patch
Patch2: gnu-efi-3.0q-modelist.patch
Patch3: gnu-efi-3.0q-route80h-add-cougarpoint.patch
Patch4: gnu-efi-3.0q-machine-types.patch
Patch5: gnu-efi-3.0q-handle-uninitialized-gop.patch
Patch6: gnu-efi-3.0q-Add-.S-and-.E-rules.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
ExclusiveArch: i686 x86_64 ia64
BuildRequires: git
@ -70,6 +62,10 @@ rm -rf %{buildroot}
%attr(0644,root,root) /boot/efi/EFI/redhat/*.efi
%changelog
* Fri Jul 27 2012 Matthew Garrett <mjg@redhat.com> - 3.0q-1
- Update to current upstream
- License change - GPLv2+ to BSD
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0e-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

View File

@ -1 +1 @@
e915989bc79249d167d3102aa9bd792b gnu-efi-3.0e.tar.bz2
9c3a873b364aa58c057f829c83463925 gnu-efi-3.0q.tar.gz