diff --git a/0001-Disable-MMX-and-SSE.patch b/0001-Disable-MMX-and-SSE.patch new file mode 100644 index 0000000..563661b --- /dev/null +++ b/0001-Disable-MMX-and-SSE.patch @@ -0,0 +1,53 @@ +From d703c370c78578b63e7b5e04a3801c7f5fbf0c94 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 31 May 2013 15:00:11 -0400 +Subject: [PATCH] Disable MMX and SSE. + +GCC 4.8.0 adds some optimizations that will use movups/movaps (and use +%xmm* registers) when they're faster, and of course that won't work at +all since UEFI firmwares aren't guaranteed to initialize the mmx/sse +instructions. + +This will be even more annoying, since most UEFI firmwares don't +initialize the #DE or #UD trap handlers, and your backtrace will be a +random path through uninitialized memory, occasionally including +whatever address the IDT has for #UD, but also addresses like "0x4" and +"0x507" that you don't normally expect to see in your call path. +--- + Make.defaults | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Make.defaults b/Make.defaults +index 0585915..ea7513e 100644 +--- a/Make.defaults ++++ b/Make.defaults +@@ -60,7 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH) + ifeq ($(GCCNEWENOUGH),1) + CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 + endif +-CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check ++CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing \ ++ -fno-merge-constants -ffreestanding -fno-stack-protector \ ++ -fno-stack-check + ASFLAGS = $(ARCH3264) + LDFLAGS = -nostdlib --no-undefined + INSTALL = install +@@ -78,13 +80,14 @@ ifeq ($(ARCH),ia64) + endif + + ifeq ($(ARCH), ia32) ++ CFLAGS += -mno-mmx -mno-sse + ifeq ($(HOSTARCH), x86_64) + ARCH3264 = -m32 + endif + endif + + ifeq ($(ARCH), x86_64) +- CFLAGS += -mno-red-zone ++ CFLAGS += -mno-red-zone -mno-mmx -mno-sse + ifeq ($(HOSTARCH), ia32) + ARCH3264 = -m64 + endif +-- +1.8.2.1 + diff --git a/0001-Removes-the-ElfW-macro-usage-from-reloc_ia32.c-and-r.patch b/0001-Removes-the-ElfW-macro-usage-from-reloc_ia32.c-and-r.patch new file mode 100644 index 0000000..0a9e204 --- /dev/null +++ b/0001-Removes-the-ElfW-macro-usage-from-reloc_ia32.c-and-r.patch @@ -0,0 +1,448 @@ +From 52dad0ecd12f938e2dcb9f32c910e580cdf57291 Mon Sep 17 00:00:00 2001 +From: noxorc +Date: Wed, 15 May 2013 15:26:16 -0400 +Subject: [PATCH] - Removes the ElfW() macro usage from reloc_ia32.c and + reloc_x86_64.c. These macros only exist in link.h on Linux. On FreeBSD, the + equivalent macro is __ElfN(). But the macro usage is redundant. You're only + going to compile the ia32 file for IA32 binaries and the x86_64 file for X64 + binaries. If you had just one file built for both cases, then using the macro + might make more sense. + +- Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and +reloc_x86_64.c. + +- Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new +definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined +as: + + typedef int __attribute__((__mode__(__DI__))) int64_t; + typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t; + +This removes the conflict between the host types dragged in by elf.h and the +type definitions in efibind.h that made the #define foo_t efi_foo_t" hack +necessary. Also, int8_t is now defined as signed char instead of just char +(assuming char == signed char is apparently not good enough). + +- Also modifies these files to use stdint.h instead of stdint-gcc.h. It's +unclear if this is completely correct, but stdint-gcc.h is not present with +all GCC installs, and if you use -std=c99 or later you will force this case to +be hit. This also can break clang, which doesn't have a stdint-gcc.h at all. + +- Removes the #include of from reloc_ia32.c and reloc_x86_64.c (since +with the previous changes it's not needed anymore). + +- Places the #include of after #include /#include so +that we know the types will always be defined properly, in case you build on a +system where doesn't automatically pull in the right header files to +define all the needed types. (This actually happens on VxWorks. It's harmless +elsewhere. If you don't care about VxWorks, you can leave this out.) + +- Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to +@function. The clang compiler doesn't like the former. Clang and GCC both like +the latter. + +- Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed +to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former +rather than the latter, which breaks the build. This may also be the case on +some other OSes. There's a way to force uname(1) to return x86_64 as the +machine type, but this way is a little friendlier. + +- Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as +elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just +FreeBSD/amd64. + +- Modifies apps/Makefile to always use +$(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or +64-bit FreeBSD instead of just for the x86_64 case. + +- Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause +linking to fail if there are any unsatisfied symbols when creating foo.so +during any of the app builds, as opposed to just silently succeeding and +producing an unusable binary. + +- Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack- +check. This prevents clang from inserting a call to memset() when compiling +the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards +against the native compiler in some Linux distros from adding in stack +checking code which relies on libc help that isn't present in the EFI runtime +environment. + +This does the following: + +- Cleans up the ia32 and x86-64 relocation code a bit (tries to break the +dependency between the host ELF headers and the EFI runtime environment) +- Avoids the dependency on stdint-gcc.h which may not always be available +- Allows GNU EFI to build out of the box on both FreeBSD/i386 and +FreeBSD/amd64 +- Allows GNU EFI to build out of the box with either GCC or clang on +FreeBSD/i386 and FreeBSD/amd64 9.0 and later. +- Makes things a little easier to port to VxWorks +- Avoids creating un-runable binaries with unresolved symbol definitions +(which can be very confusing to debug) +--- + Make.defaults | 8 +++-- + apps/Makefile | 4 +-- + gnuefi/elf_ia32_fbsd_efi.lds | 75 ++++++++++++++++++++++++++++++++++++++++++++ + gnuefi/reloc_ia32.c | 33 ++++--------------- + gnuefi/reloc_x86_64.c | 34 ++++---------------- + gnuefi/setjmp_ia32.S | 2 +- + gnuefi/setjmp_x86_64.S | 2 +- + inc/ia32/efibind.h | 8 ++--- + inc/ia64/efibind.h | 2 +- + inc/x86_64/efibind.h | 8 ++--- + 10 files changed, 105 insertions(+), 71 deletions(-) + create mode 100644 gnuefi/elf_ia32_fbsd_efi.lds + +diff --git a/Make.defaults b/Make.defaults +index 38da180..0585915 100644 +--- a/Make.defaults ++++ b/Make.defaults +@@ -46,6 +46,10 @@ TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) + + HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,) + ARCH := $(shell uname -m | sed s,i[3456789]86,ia32,) ++# FreeBSD (and possibly others) reports amd64 instead of x86_64 ++ifeq ($(ARCH), amd64) ++ARCH = x86_64 ++endif + OS = $(shell uname -s) + INCDIR = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol + GCCVERSION := $(shell gcc -dumpversion | cut -f1 -d.) +@@ -56,9 +60,9 @@ CPPFLAGS = -DCONFIG_$(ARCH) + ifeq ($(GCCNEWENOUGH),1) + CPPFLAGS += -DGNU_EFI_USE_MS_ABI -maccumulate-outgoing-args --std=c11 + endif +-CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants ++CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -ffreestanding -fno-stack-protector -fno-stack-check + ASFLAGS = $(ARCH3264) +-LDFLAGS = -nostdlib ++LDFLAGS = -nostdlib --no-undefined + INSTALL = install + prefix = /usr/bin/ + +diff --git a/apps/Makefile b/apps/Makefile +index 43db2f1..773bc08 100644 +--- a/apps/Makefile ++++ b/apps/Makefile +@@ -48,10 +48,8 @@ CPPFLAGS += -D__KERNEL__ -I$(LINUX_HEADERS)/include + CRTOBJS = ../gnuefi/crt0-efi-$(ARCH).o + + LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi.lds +-ifeq ($(ARCH),x86_64) +- ifneq (,$(findstring FreeBSD,$(OS))) ++ifneq (,$(findstring FreeBSD,$(OS))) + LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds +- endif + endif + + LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS) +diff --git a/gnuefi/elf_ia32_fbsd_efi.lds b/gnuefi/elf_ia32_fbsd_efi.lds +new file mode 100644 +index 0000000..bc25b1f +--- /dev/null ++++ b/gnuefi/elf_ia32_fbsd_efi.lds +@@ -0,0 +1,75 @@ ++OUTPUT_FORMAT("elf32-i386-freebsd", "elf32-i386-freebsd", "elf32-i386-freebsd") ++OUTPUT_ARCH(i386) ++ENTRY(_start) ++SECTIONS ++{ ++ . = 0; ++ ImageBase = .; ++ .hash : { *(.hash) } /* this MUST come first! */ ++ . = ALIGN(4096); ++ .text : ++ { ++ *(.text) ++ *(.text.*) ++ *(.gnu.linkonce.t.*) ++ } ++ . = ALIGN(4096); ++ .sdata : ++ { ++ *(.got.plt) ++ *(.got) ++ *(.srodata) ++ *(.sdata) ++ *(.sbss) ++ *(.scommon) ++ } ++ . = ALIGN(4096); ++ .data : ++ { ++ *(.rodata*) ++ *(.data) ++ *(.data1) ++ *(.data.*) ++ *(.sdata) ++ *(.got.plt) ++ *(.got) ++ /* the EFI loader doesn't seem to like a .bss section, so we stick ++ it all into .data: */ ++ *(.sbss) ++ *(.scommon) ++ *(.dynbss) ++ *(.bss) ++ *(COMMON) ++ } ++ . = ALIGN(4096); ++ .dynamic : { *(.dynamic) } ++ . = ALIGN(4096); ++ .rel : ++ { ++ *(.rel.data) ++ *(.rel.data.*) ++ *(.rel.got) ++ *(.rel.stab) ++ *(.data.rel.ro.local) ++ *(.data.rel.local) ++ *(.data.rel.ro) ++ *(.data.rel*) ++ } ++ . = ALIGN(4096); ++ .reloc : /* This is the PECOFF .reloc section! */ ++ { ++ *(.reloc) ++ } ++ . = ALIGN(4096); ++ .dynsym : { *(.dynsym) } ++ . = ALIGN(4096); ++ .dynstr : { *(.dynstr) } ++ . = ALIGN(4096); ++ /DISCARD/ : ++ { ++ *(.rel.reloc) ++ *(.eh_frame) ++ *(.note.GNU-stack) ++ } ++ .comment 0 : { *(.comment) } ++} +diff --git a/gnuefi/reloc_ia32.c b/gnuefi/reloc_ia32.c +index be57f4f..8d50a75 100644 +--- a/gnuefi/reloc_ia32.c ++++ b/gnuefi/reloc_ia32.c +@@ -33,43 +33,22 @@ + SUCH DAMAGE. + */ + +-#include +-#include /* get _DYNAMIC decl and ElfW and ELFW macros */ +- +-#undef NULL +-#define uint64_t efi_uint64_t +-#define int64_t efi_int64_t +-#define uint32_t efi_uint32_t +-#define int32_t efi_int32_t +-#define uint16_t efi_uint16_t +-#define int16_t efi_int16_t +-#define uint8_t efi_uint8_t +-#define int8_t efi_int8_t +- +-#undef NULL +-#define uint64_t efi_uint64_t +-#define int64_t efi_int64_t +-#define uint32_t efi_uint32_t +-#define int32_t efi_int32_t +-#define uint16_t efi_uint16_t +-#define int16_t efi_int16_t +-#define uint8_t efi_uint8_t +-#define int8_t efi_int8_t +- + #include + #include + +-EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) ++#include ++ ++EFI_STATUS _relocate (long ldbase, Elf32_Dyn *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + { + long relsz = 0, relent = 0; +- ElfW(Rel) *rel = 0; ++ Elf32_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)*) ++ rel = (Elf32_Rel*) + ((unsigned long)dyn[i].d_un.d_ptr + + ldbase); + break; +@@ -111,7 +90,7 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_ + default: + break; + } +- rel = (ElfW(Rel)*) ((char *) rel + relent); ++ rel = (Elf32_Rel*) ((char *) rel + relent); + relsz -= relent; + } + return EFI_SUCCESS; +diff --git a/gnuefi/reloc_x86_64.c b/gnuefi/reloc_x86_64.c +index 4593125..04b4ddb 100644 +--- a/gnuefi/reloc_x86_64.c ++++ b/gnuefi/reloc_x86_64.c +@@ -35,44 +35,22 @@ + SUCH DAMAGE. + */ + +-#include +-#include /* get _DYNAMIC decl and ElfW and ELFW macros */ +- +- +-#undef NULL +-#define uint64_t efi_uint64_t +-#define int64_t efi_int64_t +-#define uint32_t efi_uint32_t +-#define int32_t efi_int32_t +-#define uint16_t efi_uint16_t +-#define int16_t efi_int16_t +-#define uint8_t efi_uint8_t +-#define int8_t efi_int8_t +- +-#undef NULL +-#define uint64_t efi_uint64_t +-#define int64_t efi_int64_t +-#define uint32_t efi_uint32_t +-#define int32_t efi_int32_t +-#define uint16_t efi_uint16_t +-#define int16_t efi_int16_t +-#define uint8_t efi_uint8_t +-#define int8_t efi_int8_t +- + #include + #include + +-EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) ++#include ++ ++EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + { + long relsz = 0, relent = 0; +- ElfW(Rel) *rel = 0; ++ Elf64_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_RELA: +- rel = (ElfW(Rel)*) ++ rel = (Elf64_Rel*) + ((unsigned long)dyn[i].d_un.d_ptr + + ldbase); + break; +@@ -111,7 +89,7 @@ EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_ + default: + break; + } +- rel = (ElfW(Rel)*) ((char *) rel + relent); ++ rel = (Elf64_Rel*) ((char *) rel + relent); + relsz -= relent; + } + return EFI_SUCCESS; +diff --git a/gnuefi/setjmp_ia32.S b/gnuefi/setjmp_ia32.S +index b22ef02..5f71caf 100644 +--- a/gnuefi/setjmp_ia32.S ++++ b/gnuefi/setjmp_ia32.S +@@ -55,7 +55,7 @@ + */ + + #define EXT_C(sym) sym +-#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x): ++#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x): + + .file "setjmp.S" + +diff --git a/gnuefi/setjmp_x86_64.S b/gnuefi/setjmp_x86_64.S +index b3561e4..6ef9378 100644 +--- a/gnuefi/setjmp_x86_64.S ++++ b/gnuefi/setjmp_x86_64.S +@@ -17,7 +17,7 @@ + */ + + #define EXT_C(sym) sym +-#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x): ++#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), @function ; EXT_C(x): + + .file "setjmp.S" + +diff --git a/inc/ia32/efibind.h b/inc/ia32/efibind.h +index 722542c..deb9d16 100644 +--- a/inc/ia32/efibind.h ++++ b/inc/ia32/efibind.h +@@ -42,14 +42,14 @@ Revision History + typedef unsigned char uint8_t; + typedef char int8_t; + #elif defined(__GNUC__) +- typedef unsigned long long uint64_t __attribute__((aligned (8))); +- typedef long long int64_t __attribute__((aligned (8))); ++ typedef int __attribute__((__mode__(__DI__))) int64_t; ++ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; +- typedef char int8_t; ++ typedef signed char int8_t; + #elif defined(UNIX_LP64) + + /* Use LP64 programming model from C_FLAGS for integer width declarations */ +@@ -76,7 +76,7 @@ Revision History + typedef char int8_t; + #endif + #elif defined(__GNUC__) +- #include ++ #include + #endif + + // +diff --git a/inc/ia64/efibind.h b/inc/ia64/efibind.h +index a1bf3fb..6926876 100644 +--- a/inc/ia64/efibind.h ++++ b/inc/ia64/efibind.h +@@ -63,7 +63,7 @@ Revision History + typedef char int8_t; + #endif + #elif defined(__GNUC__) +- #include ++ #include + #endif + + // +diff --git a/inc/x86_64/efibind.h b/inc/x86_64/efibind.h +index 27c9638..ee620f2 100644 +--- a/inc/x86_64/efibind.h ++++ b/inc/x86_64/efibind.h +@@ -51,14 +51,14 @@ Revision History + typedef unsigned char uint8_t; + typedef char int8_t; + #elif defined(__GNUC__) +- typedef unsigned long long uint64_t __attribute__((aligned (8))); +- typedef long long int64_t __attribute__((aligned (8))); ++ typedef int __attribute__((__mode__(__DI__))) int64_t; ++ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t; + typedef unsigned int uint32_t; + typedef int int32_t; + typedef unsigned short uint16_t; + typedef short int16_t; + typedef unsigned char uint8_t; +- typedef char int8_t; ++ typedef signed char int8_t; + #elif defined(UNIX_LP64) + + /* Use LP64 programming model from C_FLAGS for integer width declarations */ +@@ -85,7 +85,7 @@ Revision History + typedef char int8_t; + #endif + #elif defined(__GNUC__) +- #include ++ #include + #endif + + // +-- +1.8.2.1 + diff --git a/gnu-efi-3.0q-Add-.S-and-.E-rules.patch b/gnu-efi-3.0q-Add-.S-and-.E-rules.patch deleted file mode 100644 index b6fdfaf..0000000 --- a/gnu-efi-3.0q-Add-.S-and-.E-rules.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bb12d86aceb7d9ea6748f45a17f719a8e18c81c8 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 9 Aug 2011 12:30:49 -0400 -Subject: [PATCH 7/7] Add %.S and %.E rules to make debugging easier. - ---- - Make.rules | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/Make.rules b/Make.rules -index eab12d7..65fb612 100644 ---- a/Make.rules -+++ b/Make.rules -@@ -44,3 +44,8 @@ - %.o: %.c - $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ - -+%.S: %.c -+ $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -S $< -o $@ -+ -+%.E: %.c -+ $(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@ --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch b/gnu-efi-3.0q-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch deleted file mode 100644 index ecb5c56..0000000 --- a/gnu-efi-3.0q-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 3f40a425e763edfde77a9a6e05ed09b0676d8fa9 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 3 Oct 2008 14:40:56 -0400 -Subject: [PATCH 1/7] Fix usage of INSTALLROOT, PREFIX, and LIBDIR. - -I screwed it up last time. ---- - Make.defaults | 6 +++--- - inc/Makefile | 16 ++++++++-------- - 2 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/Make.defaults b/Make.defaults -index bf162c5..6278fa7 100644 ---- a/Make.defaults -+++ b/Make.defaults -@@ -38,8 +38,9 @@ - # Where to install the package. GNU-EFI will create and access - # lib and include under the root - # --INSTALLROOT=/usr/local --LIBDIR=lib -+INSTALLROOT:= / -+PREFIX := /usr/local -+LIBDIR := ${PREFIX}/lib - - TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) - -@@ -73,7 +74,6 @@ endif - - ifeq ($(ARCH), x86_64) - CFLAGS += -mno-red-zone -- LIBDIR = lib - ifeq ($(HOSTARCH), ia32) - ARCH3264 = -m64 - endif -diff --git a/inc/Makefile b/inc/Makefile -index 9683be5..71fded5 100644 ---- a/inc/Makefile -+++ b/inc/Makefile -@@ -13,15 +13,15 @@ all: - clean: - - install: -- mkdir -p $(INSTALLROOT)/include/efi -- mkdir -p $(INSTALLROOT)/include/efi/protocol -- mkdir -p $(INSTALLROOT)/include/efi/$(ARCH) -- $(INSTALL) -m 644 *.h $(INSTALLROOT)/include/efi -- $(INSTALL) -m 644 protocol/*.h $(INSTALLROOT)/include/efi/protocol -- $(INSTALL) -m 644 $(ARCH)/*.h $(INSTALLROOT)/include/efi/$(ARCH) -+ mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi -+ mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol -+ mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH) -+ $(INSTALL) -m 644 *.h $(INSTALLROOT)$(PREFIX)/include/efi -+ $(INSTALL) -m 644 protocol/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol -+ $(INSTALL) -m 644 $(ARCH)/*.h $(INSTALLROOT)$(PREFIX)/include/efi/$(ARCH) - ifeq ($(ARCH),ia64) -- mkdir -p $(INSTALLROOT)/include/efi/protocol/ia64 -- $(INSTALL) -m 644 protocol/ia64/*.h $(INSTALLROOT)/include/efi/protocol/ia64 -+ mkdir -p $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64 -+ $(INSTALL) -m 644 protocol/ia64/*.h $(INSTALLROOT)$(PREFIX)/include/efi/protocol/ia64 - endif - - include $(SRCDIR)/../Make.rules --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-handle-uninitialized-gop.patch b/gnu-efi-3.0q-handle-uninitialized-gop.patch deleted file mode 100644 index 450ad8b..0000000 --- a/gnu-efi-3.0q-handle-uninitialized-gop.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0f8b3ac2ec984de7f3437fe6a3b37ab8eb07ae71 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 16 Jun 2011 16:10:27 -0400 -Subject: [PATCH 6/7] Handle un-initialized GOP. - ---- - apps/modelist.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/apps/modelist.c b/apps/modelist.c -index c4a4b1a..8d816d1 100644 ---- a/apps/modelist.c -+++ b/apps/modelist.c -@@ -3,6 +3,26 @@ - - extern EFI_GUID GraphicsOutputProtocol; - -+static int memcmp(const void *s1, const void *s2, UINTN n) -+{ -+ const unsigned char *c1 = s1, *c2 = s2; -+ int d = 0; -+ -+ if (!s1 && !s2) -+ return 0; -+ if (s1 && !s2) -+ return 1; -+ if (!s1 && s2) -+ return -1; -+ -+ while (n--) { -+ d = (int)*c1++ - (int)*c2++; -+ if (d) -+ break; -+ } -+ return d; -+} -+ - static void - print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) - { -@@ -17,6 +37,13 @@ print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) - UINTN SizeOfInfo; - rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, - &info); -+ if (EFI_ERROR(rc) && rc == EFI_NOT_STARTED) { -+ rc = uefi_call_wrapper(gop->SetMode, 2, gop, -+ gop->Mode->Mode); -+ rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, -+ &SizeOfInfo, &info); -+ } -+ - if (EFI_ERROR(rc)) { - CHAR16 Buffer[64]; - StatusToString(Buffer, rc); --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-machine-types.patch b/gnu-efi-3.0q-machine-types.patch deleted file mode 100644 index 8c0aa72..0000000 --- a/gnu-efi-3.0q-machine-types.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 9ab3fefd9b86c567ba6b0ea1429ce932572040c1 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 26 Apr 2011 13:25:26 -0400 -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(+) - -diff --git a/inc/ia32/pe.h b/inc/ia32/pe.h -index 16e40ef..979b936 100644 ---- a/inc/ia32/pe.h -+++ b/inc/ia32/pe.h -@@ -98,8 +98,12 @@ typedef struct _IMAGE_FILE_HEADER { - #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian - #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian - #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb - #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -+#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 - #define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -+#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -+#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 - // - // Directory format. - // -diff --git a/inc/ia64/pe.h b/inc/ia64/pe.h -index f67128d..b1cade2 100644 ---- a/inc/ia64/pe.h -+++ b/inc/ia64/pe.h -@@ -113,8 +113,12 @@ typedef struct _IMAGE_FILE_HEADER { - #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian - #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian - #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb - #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -+#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 - #define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -+#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -+#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 - // - // Directory format. - // -diff --git a/inc/x86_64/pe.h b/inc/x86_64/pe.h -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 { - #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian - #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian - #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP -+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb - #define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC Little-Endian -+#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64 - #define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine -+#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code -+#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64 - // - // Directory format. - // --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-modelist.patch b/gnu-efi-3.0q-modelist.patch deleted file mode 100644 index e176697..0000000 --- a/gnu-efi-3.0q-modelist.patch +++ /dev/null @@ -1,121 +0,0 @@ -From d29825db356c7ea240e62404c5d3422c01c18bd4 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 10 Sep 2010 16:04:38 -0400 -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 deletion(-) - create mode 100644 apps/modelist.c - -diff --git a/apps/Makefile b/apps/Makefile -index 6bda7ea..45bc4ac 100644 ---- a/apps/Makefile -+++ b/apps/Makefile -@@ -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 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) - -diff --git a/apps/modelist.c b/apps/modelist.c -new file mode 100644 -index 0000000..c4a4b1a ---- /dev/null -+++ b/apps/modelist.c -@@ -0,0 +1,87 @@ -+#include -+#include -+ -+extern EFI_GUID GraphicsOutputProtocol; -+ -+static void -+print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) -+{ -+ int i, imax; -+ EFI_STATUS rc; -+ -+ imax = gop->Mode->MaxMode; -+ -+ Print(L"GOP reports MaxMode %d\n", imax); -+ for (i = 0; i < imax; i++) { -+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; -+ UINTN SizeOfInfo; -+ rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo, -+ &info); -+ if (EFI_ERROR(rc)) { -+ CHAR16 Buffer[64]; -+ StatusToString(Buffer, rc); -+ Print(L"%d: Bad response from QueryMode: %s (%d)\n", -+ i, Buffer, rc); -+ continue; -+ } -+ Print(L"%c%d: %dx%d ", memcmp(info,gop->Mode->Info,sizeof(*info)) == 0 ? '*' : ' ', i, -+ info->HorizontalResolution, -+ info->VerticalResolution); -+ switch(info->PixelFormat) { -+ case PixelRedGreenBlueReserved8BitPerColor: -+ Print(L"RGBR"); -+ break; -+ case PixelBlueGreenRedReserved8BitPerColor: -+ Print(L"BGRR"); -+ break; -+ case PixelBitMask: -+ Print(L"R:%08x G:%08x B:%08x X:%08x", -+ info->PixelInformation.RedMask, -+ info->PixelInformation.GreenMask, -+ info->PixelInformation.BlueMask, -+ info->PixelInformation.ReservedMask); -+ break; -+ case PixelBltOnly: -+ Print(L"(blt only)"); -+ break; -+ default: -+ Print(L"(Invalid pixel format)"); -+ break; -+ } -+ Print(L" pitch %d\n", info->PixelsPerScanLine); -+ } -+} -+ -+static EFI_STATUS -+SetWatchdog(UINTN seconds) -+{ -+ EFI_STATUS rc; -+ rc = uefi_call_wrapper(BS->SetWatchdogTimer, 4, seconds, 0x1ffff, -+ 0, NULL); -+ if (EFI_ERROR(rc)) { -+ CHAR16 Buffer[64]; -+ StatusToString(Buffer, rc); -+ Print(L"Bad response from QueryMode: %s (%d)\n", Buffer, rc); -+ } -+ return rc; -+} -+ -+EFI_STATUS -+efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) -+{ -+ EFI_STATUS rc; -+ EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; -+ -+ InitializeLib(image_handle, systab); -+ -+ SetWatchdog(10); -+ -+ rc = LibLocateProtocol(&GraphicsOutputProtocol, (void **)&gop); -+ if (EFI_ERROR(rc)) -+ return rc; -+ -+ print_modes(gop); -+ -+ SetWatchdog(0); -+ return EFI_SUCCESS; -+} --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-route80h-add-cougarpoint.patch b/gnu-efi-3.0q-route80h-add-cougarpoint.patch deleted file mode 100644 index 64c2c71..0000000 --- a/gnu-efi-3.0q-route80h-add-cougarpoint.patch +++ /dev/null @@ -1,49 +0,0 @@ -From b7a088b6f3ffacc5b98e1568bed7dcf225089c20 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 11 Nov 2010 16:42:16 -0500 -Subject: [PATCH 4/7] Add CougarPoint support to route80h.c - -CougarPoint is some other northbridge. Yay! ---- - apps/route80h.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/apps/route80h.c b/apps/route80h.c -index 1a04b5a..30330ab 100644 ---- a/apps/route80h.c -+++ b/apps/route80h.c -@@ -12,6 +12,7 @@ - - #define VENDOR_ID_INTEL 0x8086 - #define DEVICE_ID_LPCIF 0x3a16 -+#define DEVICE_ID_COUGARPOINT_LPCIF 0x1c56 - - static EFI_HANDLE ImageHandle; - -@@ -96,9 +97,22 @@ efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) - EFI_PCI_IO *pciio; - lpcif_t lpcif; - EFI_STATUS rc; -+ struct { -+ uint16_t vendor; -+ uint16_t device; -+ } devices[] = { -+ { VENDOR_ID_INTEL, DEVICE_ID_LPCIF }, -+ { VENDOR_ID_INTEL, DEVICE_ID_COUGARPOINT_LPCIF }, -+ { 0, 0 } -+ }; -+ int i; - - ImageHandle = image_handle; -- rc = find_pci_device(VENDOR_ID_INTEL, DEVICE_ID_LPCIF, &pciio); -+ for (i = 0; devices[i].vendor != 0; i++) { -+ rc = find_pci_device(devices[i].vendor, devices[i].device, &pciio); -+ if (EFI_ERROR(rc)) -+ continue; -+ } - - if (rc == EFI_NOT_FOUND) { - Print(L"Device not found.\n"); --- -1.7.10.4 - diff --git a/gnu-efi-3.0q-route80h.patch b/gnu-efi-3.0q-route80h.patch deleted file mode 100644 index a0ea3f7..0000000 --- a/gnu-efi-3.0q-route80h.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 61b347a766d9e2f85fcbca96b535b9fdffe7fe8b Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 26 Jul 2010 17:04:12 -0400 -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 deletion(-) - create mode 100644 apps/route80h.c - -diff --git a/apps/Makefile b/apps/Makefile -index 1e43821..6bda7ea 100644 ---- a/apps/Makefile -+++ b/apps/Makefile -@@ -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 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..1a04b5a ---- /dev/null -+++ b/apps/route80h.c -@@ -0,0 +1,125 @@ -+#include -+#include -+ -+/* this example program changes the Reserved Page Route (RPR) bit on ICH10's General -+ * Control And Status Register (GCS) from LPC to PCI. In practical terms, it routes -+ * outb to port 80h to the PCI bus. */ -+ -+#define GCS_OFFSET_ADDR 0x3410 -+#define GCS_RPR_SHIFT 2 -+#define GCS_RPR_PCI 1 -+#define GCS_RPR_LPC 0 -+ -+#define VENDOR_ID_INTEL 0x8086 -+#define DEVICE_ID_LPCIF 0x3a16 -+ -+static EFI_HANDLE ImageHandle; -+ -+typedef struct { -+ uint16_t vendor_id; /* 00-01 */ -+ uint16_t device_id; /* 02-03 */ -+ char pad[0xEB]; /* 04-EF */ -+ uint32_t rcba; /* F0-F3 */ -+ uint32_t reserved[3]; /* F4-FF */ -+} lpcif_t; -+ -+static inline void set_bit(volatile uint32_t *flag, int bit, int value) -+{ -+ uint32_t val = *flag; -+ Print(L"current value is 0x%2x\n", val); -+ -+ if (value) { -+ val |= (1 << bit); -+ } else { -+ val &= ~(1 << bit); -+ } -+ Print(L"setting value to 0x%2x\n", val); -+ *flag = val; -+ val = *flag; -+ Print(L"new value is 0x%2x\n", val); -+} -+ -+static inline int configspace_matches_ids(void *config, uint32_t vendor_id, -+ uint32_t device_id) -+{ -+ uint32_t *cfg = config; -+ if (cfg[0] == vendor_id && cfg[1] == device_id) -+ return 1; -+ return 0; -+} -+ -+static int is_device(EFI_PCI_IO *pciio, uint16_t vendor_id, uint16_t device_id) -+{ -+ lpcif_t lpcif; -+ EFI_STATUS rc; -+ -+ rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint16, 0, 2, &lpcif); -+ if (EFI_ERROR(rc)) -+ return 0; -+ -+ if (vendor_id == lpcif.vendor_id && device_id == lpcif.device_id) -+ return 1; -+ return 0; -+} -+ -+static EFI_STATUS find_pci_device(uint16_t vendor_id, uint16_t device_id, -+ EFI_PCI_IO **pciio) -+{ -+ EFI_STATUS rc; -+ EFI_HANDLE *Handles; -+ UINTN NoHandles; -+ int i; -+ -+ rc = LibLocateHandle(ByProtocol, &PciIoProtocol, NULL, &NoHandles, -+ &Handles); -+ if (EFI_ERROR(rc)) -+ return rc; -+ -+ for (i = 0; i < NoHandles; i++) { -+ rc = uefi_call_wrapper(BS->OpenProtocol, 6, Handles[i], -+ &PciIoProtocol, pciio, ImageHandle, -+ NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); -+ if (EFI_ERROR(rc)) -+ continue; -+ if (!is_device(*pciio, vendor_id, device_id)) -+ continue; -+ -+ return EFI_SUCCESS; -+ } -+ return EFI_NOT_FOUND; -+} -+ -+EFI_STATUS -+efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) -+{ -+ InitializeLib(image_handle, systab); -+ EFI_PCI_IO *pciio; -+ lpcif_t lpcif; -+ EFI_STATUS rc; -+ -+ ImageHandle = image_handle; -+ rc = find_pci_device(VENDOR_ID_INTEL, DEVICE_ID_LPCIF, &pciio); -+ -+ if (rc == EFI_NOT_FOUND) { -+ Print(L"Device not found.\n"); -+ return rc; -+ } else if (EFI_ERROR(rc)) { -+ return rc; -+ } -+ -+ rc = uefi_call_wrapper(pciio->Pci.Read, 5, pciio, EfiPciIoWidthUint32, -+ EFI_FIELD_OFFSET(lpcif_t, rcba), 1, &lpcif.rcba); -+ if (EFI_ERROR(rc)) -+ return rc; -+ if (!(lpcif.rcba & 1)) { -+ Print(L"rcrb is not mapped, cannot route port 80h\n"); -+ return EFI_UNSUPPORTED; -+ } -+ lpcif.rcba &= ~1UL; -+ -+ Print(L"rcba: 0x%8x\n", lpcif.rcba, lpcif.rcba); -+ set_bit((uint32_t *)(lpcif.rcba + GCS_OFFSET_ADDR), -+ GCS_RPR_SHIFT, GCS_RPR_PCI); -+ -+ return EFI_SUCCESS; -+} --- -1.7.10.4 - diff --git a/gnu-efi.spec b/gnu-efi.spec index f870cff..76e87ae 100644 --- a/gnu-efi.spec +++ b/gnu-efi.spec @@ -1,19 +1,14 @@ Summary: Development Libraries and headers for EFI Name: gnu-efi -Version: 3.0s -Release: 2%{?dist} +Version: 3.0t +Release: 0.1%{?dist} Group: Development/System License: BSD URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi_%{version}.orig.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) +Patch01: 0001-Removes-the-ElfW-macro-usage-from-reloc_ia32.c-and-r.patch +Patch02: 0001-Disable-MMX-and-SSE.patch ExclusiveArch: i686 x86_64 ia64 BuildRequires: git @@ -62,6 +57,10 @@ rm -rf %{buildroot} %attr(0644,root,root) /boot/efi/EFI/redhat/*.efi %changelog +* Fri Jun 07 2013 Peter Jones - 3.0t-0.1 +- Update to 3.0t +- Don't allow use of mmx or sse registers. + * Thu May 16 2013 Peter Jones - 3.0s-2 - Update to 3.0s Related: rhbz#963359 diff --git a/sources b/sources index d133db0..065691d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -11f63d52071f7382f56c9e81d0aece91 gnu-efi_3.0s.orig.tar.gz +95916208cf543699799230ac1ea14272 gnu-efi_3.0t.orig.tar.gz