Compare commits

...

509 Commits

Author SHA1 Message Date
Nigel Croxon
5ea320f0f0
Merge pull request #50 from gmbr3/v4_0
Align CRT0 exit function naming
2024-11-04 09:42:14 -05:00
Callum Farmer
be2888790f
Align CRT0 exit function naming
Align it to .L_exit
Also more useful as a local symbol than a non descriptive local label

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-11-03 15:41:33 +00:00
Nigel Croxon
9276df8219
Merge pull request #49 from gmbr3/v4_0
Fixes for segment mapping error
2024-10-31 08:30:54 -04:00
Callum Farmer
aa58dc8ff1
Remove label1
No longer needed

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-10-30 11:13:49 +00:00
Callum Farmer
03bfe2f5ce
Push .reloc after .data
Seems GNU ld is a bit stupid in this regard
Apply to all archs incase this is repeated so far
only seen on ARM64

Fixes ncroxon/gnu-efi#47

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-10-28 15:52:57 +00:00
Callum Farmer
882df4e732
ia32 local: Remove accidental rela
REL not RELA

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-10-24 12:33:00 +01:00
Callum Farmer
40b0203116
ia32 local: Rename reloc to areloc
* Similar to ARM32, this triggers a GNU AS section parameters warning if called reloc
* This breaks IA32 objcopy due to .reloc lookup

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-10-24 12:33:00 +01:00
Callum Farmer
ae94e383a3
Make our dummy .reloc sections not depend on section order.
Currently on x64 we manually build a dummy .reloc table entry by using a
symbol in .text and subtracting its address from another symbol that's
inside the .reloc section.  On ia32 we just use its location.  In either
case, if the linker puts either section in a location we're not
expecting, the .reloc table winds up having invalid values, and the PE
loader will fail to load the binary.

This changes it to be two symbols that are both in .text, making the
result unrelated to the section order or location.

It's not clear to me that these .reloc entries are actually necessary at
all, but I'm going to leave them in place for now, in case they are.

Ref: rhboot/gnu-efi@9fb55dee2b
Co-authored-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-10-24 12:33:00 +01:00
Nigel Croxon
70b1421107
Merge pull request #45 from gmbr3/v4_0
Docs change + Fix some CRT0 symbols
2024-10-10 08:20:30 -04:00
Callum Farmer
57e8966b5d
Add packaging guide
Files have been ending up in differing places between distros - this is an attempt to fix this

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-28 18:10:11 +01:00
Callum Farmer
aa2ad0329b
Fix calling of gnuefi install with local lds
* Local lds wasn't being installed on RISC-V

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 14:24:03 +01:00
Callum Farmer
21ea877a01
IA32 local: Fix up crt0 symbols
* This should use a fully split version of the CRT0 not the old ARM un-split version

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:41 +01:00
Callum Farmer
e9b6ac7126
ARM64 local: Remove NR_SECTIONS
* NR_SECTIONS is part of the crt0 generator for fwupd-efi
* This isn't implemented here

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:41 +01:00
Callum Farmer
24a4cd0e56
ARM32: Split headers and code
* Force code to be at known dest of 4096
* Move _start into .text
* Load the _start symbol address and then minus 4096 to get the load
  address

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:41 +01:00
Callum Farmer
57d2e370d8
Add more detail to ABI notice
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:41 +01:00
Callum Farmer
aa8151c3d2
Add more notes to GitHub release info
* Just to ensure GitHub doesn't run anyway with the hills

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:41 +01:00
Callum Farmer
b5a7f60a6b
Clarify CompareGuid change
* Update guid.c to display correct output code in description
* Add warning about failure in ABI README

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:40 +01:00
Callum Farmer
e5b75c4482
Remove unused files
* tpause wasn't included in Makefile and is very basic
(also removed from VS references)
* trivial.S doesn't actually use gnu-efi and wasn't built
* Remove make stuff likely intended for Intel make??

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-24 13:28:32 +01:00
Nigel Croxon
c0c9fbb198
Merge pull request #42 from sertonix/usr-bin-env
Replace /bin/env with /usr/bin/env
2024-09-19 07:49:04 -04:00
Nigel Croxon
e5f21388a4
Merge pull request #44 from gmbr3/v4_0
Repo clean up
2024-09-19 07:48:23 -04:00
Callum Farmer
ae2ca1e051
lib: Avoid install dependency on build target
install was depending on libefi.a which can sometimes trigger a project rebuild if make variables change

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-18 17:59:00 +01:00
Callum Farmer
860132349f
Add notice about new subdirectories
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-18 12:52:37 +01:00
Callum Farmer
48c7e47771
Clarify current compiler requirements
Clang+lld now works, looks like MSVC does aswell so update the text

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-18 12:41:02 +01:00
Callum Farmer
79eb20b5d1
Move docs to Markdown
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 16:07:23 +01:00
Callum Farmer
c9edd83549
Update release details for GitHub
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 16:06:44 +01:00
Callum Farmer
34c694069c
Add shared objects to gitignore
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:19 +01:00
Callum Farmer
9ec31629f5
Remove old ChangeLog
Hasn't been updated in ages and isn't required

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:18 +01:00
Callum Farmer
632b6b45e3
Move non-main README to separate folder
Create docs subdirectory

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:18 +01:00
Callum Farmer
618037c0cb
Update GPL-2.0 SPDX notation
GPL-2.0+ is now GPL-2.0-or-later

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:18 +01:00
Callum Farmer
3e9899b233
Setup Dependabot for GH Actions
Requires 'Dependabot version updates' be enabled on GitHub
2024-09-16 15:37:18 +01:00
Callum Farmer
68101114ce
Add security policy
Requires 'Private vulnerability reporting' be enabled on GitHub
2024-09-16 15:37:18 +01:00
Callum Farmer
dfc27f3416
Re-format README
* Make it look right in Markdown format
* Fix PE32+ spec link

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:17 +01:00
Callum Farmer
2a3244d2e5
Sort licenses and the main README
* Set main license to GPL-2.0-or-later (seems to be generally)
* Denote efilib license as a license
* Add edk2 license due to files using it

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:17 +01:00
Callum Farmer
189cf4ec73
Add missed CompareGuid fixup
Missed from ncroxon/gnu-efi@c14705b746

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:17 +01:00
Callum Farmer
86239d7bdf
Add notice section on the .rodata change
Change made in ncroxon/gnu-efi@262c1f4604

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:37:17 +01:00
Callum Farmer
7bf718da57
Add notice about functional changes
* As this may break compilation and cause runtime errors, supply a notice on how to fix it

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-09-16 15:36:12 +01:00
Sertonix
5a36c05277 Replace /bin/env with /usr/bin/env
The correct path for the env binary on systems without a usr-merge is /usr/bin/env

Signed-off-by: Sertonix <sertonix@posteo.net>
2024-09-09 00:25:46 +02:00
Callum Farmer
5aaf99b474
Update some things for v4
* Create macro to detect v4
* Update section info text
* Set version to 4.0.0

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-23 11:46:35 +01:00
Callum Farmer
f505aa71e6
Add missed clean-up for FreeBSD
Missed from ncroxon/gnu-efi@13c46e46a6

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-19 14:00:13 +01:00
Nigel Croxon
5560e57038
Merge pull request #41 from NotsoanoNimus/NotsoanoNimus/feature/add-mp-support
Add MP Services Protocol Support
2024-08-09 09:05:47 -04:00
Zack Puhl
7b409340e4 Add MP Services Protocol Support 2024-08-08 08:31:26 -04:00
Nigel Croxon
b4cde1c031
Merge pull request #40 from gmbr3/v4_0
FreeBSD update + CompareGuid ABI change
2024-08-05 06:56:40 -04:00
Callum Farmer
88f0e1cca8
Update old_ABI test for CompareGuid
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-04 19:23:50 +01:00
Callum Farmer
b23462d47c
Add single option to revert to old ABI
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-04 19:13:32 +01:00
Callum Farmer
81321deb03
Move STATIC to efidef.h
* Allows use in legacy.h

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-03 16:21:38 +01:00
Callum Farmer
c14705b746
Fix up for new CompareGuid
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-03 16:21:38 +01:00
Callum Farmer
a093fe0378
Make CompareGuid match EDK2 ABI
* return BOOLEAN instead of INTN
* Use EFIAPI
* Opposite return codes

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-03 16:21:38 +01:00
Callum Farmer
13c46e46a6
Sync FreeBSD
* Always use objcopy -O (--target doesn't make sense)
  and isn't available on freebsd
* No efi-bsdrv target (but has efi-app)(bug in binutils??)
* Sync linker scripts (all features are supported)
* Use clang as HOSTCC (there is no default gcc)

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-03 16:21:00 +01:00
Callum Farmer
3398bf0dd9
Align REL(A) def with GLIBC
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-28 15:43:37 +01:00
Callum Farmer
939dffb06f
Allow forcefully ignoring glibc headers on Linux
* Sometimes it may not be available so allow use of the substitute version

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-28 15:43:32 +01:00
Nigel Croxon
a5e8881923
Merge pull request #38 from gmbr3/v4_0
Add ix86 and ARM32 MacOS (embedded ELF) CI/CD
2024-07-18 06:57:21 -04:00
Callum Farmer
06320f8fb3
Don't edit the riscv subsystem if using objcopy
* Only needed in binary mode

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
e092a94869
Add non-objcopy IA32 crt0/lds
* Needed by embedded (MacOS) ELF toolchain

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
644e03821e
Tune for new MacOS toolchains
* Doesn't seem to like nocombreloc
* i686 doesn't have the efi-app-ia32 target (bug in binutils??)
* Set float manually on ARM32 due to generic toolchain
* Ensure _DYNAMIC symbol exists

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
8f5c321507
Better detect the correct MacOS toolchain
* We need ELF not Mach-O

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:52 +01:00
Callum Farmer
5d4ada9352
Add missing parts to elf.h
* Missing LGPL-2.1+ license
* Add missing REL definitions

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:36 +01:00
Callum Farmer
d416122fd8
Add extra archs to MacOS CI/CD
* Add x86, ARM32
* RISC-V won't work until binutils remove the shared library embedded
  ELF blocker

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-16 14:49:20 +01:00
Nigel Croxon
feddb5ad3c
Merge pull request #37 from gmbr3/v4_0
Add macOS support
2024-07-15 07:37:24 -04:00
Callum Farmer
16a913e01c
Disable norelro on macOS
The no platform GNU ELF linker rejects it

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:40 +01:00
Callum Farmer
b6f99c7ac5
Add substitute elf.h for macOS
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:39 +01:00
Callum Farmer
f19216bf87
Add macOS toolchain
Fixes ncroxon/gnu-efi#36

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-14 18:50:17 +01:00
Nigel Croxon
33727c2abe
Merge pull request #34 from gmbr3/riscv
Toolchain fixes + RISCV64 objcopy move + AARCH64 non-objcopy restore
2024-07-06 20:48:55 -04:00
Callum Farmer
2765122e67
X86_64: We use RELA not REL
Weird huh? GNU ld uses RELA but no addends, as soon as
you get an addend from LLD, this code breaks

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:02 +01:00
Callum Farmer
9c953ddf27
Make old ABI func static
Otherwise, LLVM will emit an extern symbol if -O0 is used
which will break the build

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:02 +01:00
Callum Farmer
f77e4e8a8e
Force DWARF 4 on LLVM
Otherwise readelf just throws an absolute blowup :(

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
0c0b91b9f9
PC file missing from clean
The pkgconfig file was not being removed
by clean, add the missing statement

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
21f87c2b1e
Fixup riscv64 objcopy move
Detect new enough objcopy

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
353984bb97
Move riscv64 default to objcopy
Fixes ncroxon/gnu-efi#11

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
23715d6389
Restore non-objcopy ARM64 crt0/lds
* An up-to-date version of it anyways
* Useful for systems without objcopy 2.38+

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:01 +01:00
Callum Farmer
9fb0825a6b
Output ELF data file on Linux CI/CD
* Useful for checking moved/new ELF sections

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:44:00 +01:00
Callum Farmer
771b632092
Add Linux musl-libc toolchain
* Use gcc as compiler and bfd as linker
* Use musl toolchain prefixes
* musl doesn't have any Ubuntu cross toolchains
  so x86_64 only

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:43:42 +01:00
Callum Farmer
16c9eedafb
Add Linux LLVM toolchain
* Use clang as compiler and LLD as linker

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
d9b395ac03
Make CopyMemC call CopyMem
* The last part of this: I hope :)
* ISO C permits overwriting of Src even if it marks Src as CONST
* UEFI marks Src as NON CONST, so forward calls via this function
* Allows us to keep in-line with shim without causing Werror havoc with other downstreams

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
c03d395571
Disable uninitialized error on GCC
Gives error on 'Red' in bltgrid.c which is initialized
by the looks of it?

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
f8ebcfc077
Use char16_t literals
Add char16_t('u') literals
Remove wchar_t('L') literals

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:51 +01:00
Callum Farmer
ce1ec9d27b
Make CHAR8 use unsigned char
* Means we don't have to switch the implementation of char to unsigned char
* Matches the underlying type of char8_t from C++20

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:51 +01:00
Callum Farmer
edfda7c396
Make CHAR16 use uint16_t
musl-libc doesn't like fshort-wchar so remove wchar_t usage
Use uint16_t as char16_t can be up to 32bits
Fixes ncroxon/gnu-efi#16

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-06-24 19:34:18 +01:00
Nigel Croxon
9e479726ed
Merge pull request #33 from pbatard/msvc
Apply stdbool/stdint MSVC fixes
2024-06-04 08:45:42 -04:00
Pete Batard
96e3b8469c
Apply stdbool/stdint MSVC fixes
It seems that while Visual Studio can support the C23 standard, Microsoft didn't get the memo
about no longer requiring stdbool.h for true/false, so add an exception for that.

Also harmonize the inclusion of stdint.h for IA32 and IA64 so that, just like for other archs,
it is not limited to GNU-like compilers only.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-06-03 21:13:41 +01:00
Nigel Croxon
2a44cea3f3
Merge pull request #31 from pbatard/drv0
Fix driver EFI subsystem for VS and RISCV64 and add driver testing
2024-05-28 08:40:32 -04:00
Pete Batard
0248433f2c
Add driver testing to the test list
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:50 +01:00
Pete Batard
eeb0e6a830
Fix RISCV64 not setting the subsystem according to EFI_SUBSYSTEM
The RISCV64 toolchain does not support 16-bit variable relocation from assembly,
and even if it did support relocations, it would not properly set the subsystem
from --defsym. So we add an extra step on RISCV64, post objcopy, to set the field
manually (using dd and /bin/echo to output the relevant byte, as GNU Make's echo
does not support -ne).
Closes ncroxon/gnu-efi#27.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:49 +01:00
Pete Batard
5d0de491f1
Fix drv0 not being properly set to Boot Service Driver for Visual Studio
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-24 10:29:35 +01:00
Nigel Croxon
4ecd540d46
Merge pull request #28 from pbatard/pbatard
Add RISCV64 testing support and default to clean compiler output
2024-05-21 13:29:24 -04:00
Nigel Croxon
dee84a8948
Merge pull request #30 from pbatard/fixes
Fix double reference to route80h.efi in apps
2024-05-21 13:27:58 -04:00
Pete Batard
0cdd5584a0
Fix double reference to route80h.efi in apps
Commit 625bdb6368 reorganized the apps list but
also duplicated route80h.efi so remove the extra one, as having two instances
produces an error when running 'make install'.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 13:55:09 +01:00
Pete Batard
b50b0a0a2c
Add RISCV64 testing support
Requires a recent QEMU (for the pflash0 options) and therefore Ubuntu 24.04.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 11:46:42 +01:00
Pete Batard
2d6d426b8c
Enable silent rules for compiler output
This is similar to using automake's silent rules and, just as with automake,
can be disabled by invoking 'make V=1'.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-21 11:45:20 +01:00
Nigel Croxon
7440e5ebb7
Merge pull request #26 from pbatard/Resolve-Conflicts
Add build time QEMU/UEFI tests
2024-05-20 09:24:38 -04:00
Pete Batard
23c505d548
Merge branch 'master' into Resolve-Conflicts 2024-05-20 15:21:24 +02:00
Nigel Croxon
34754d941f
Merge pull request #25 from gmbr3/RuntimeError
Multiple fixes
2024-05-20 09:02:57 -04:00
Callum Farmer
39681d7a0f
Add test for old ABIs of ReallocatePool and CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:20 +01:00
Callum Farmer
e3c7731bcc
Fixup functions for new ReallocatePool
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:20 +01:00
Callum Farmer
eaa624e71d
Add legacy defines for CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:15:19 +01:00
Callum Farmer
f3656c8800
Move ReallocatePool to EDK2 ABI
Fixes ncroxon/gnu-efi#9

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-20 12:14:01 +01:00
Callum Farmer
1e8900a92b
Switch everything to Unix line endings
I wondered why a patch didn't apply :(

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 14:22:26 +01:00
Callum Farmer
8ad6c33424
PC: Add useful variables
* Add efi_machine_type_name and gnu_efi_arch from fwupd-efi

* Add gnu_efi_default_is_objcopy so downstreams know if the crt0 goes objcopy

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 14:22:11 +01:00
Callum Farmer
c339e077c8
Restore old CopyMem as CopyMemC
CopyMemC cos CONST Src

Reverts 6b9dae0bef

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 13:56:07 +01:00
Pete Batard
46aca420cc
Add build time QEMU UEFI tests
Use OVMF/AVMF and the UEFI Shell in a QEMU environment to validate that the
UEFI executables we build do run and produce the expected output.

The tests to run are flexibly defined is test_list.txt and can be expanded.

At this stage, only x64, ia32, aa64 and arm are run, which rely on the UEFI
firmwares found at https://github.com/pbatard/EfiFs/tree/gh-pages/AAVMF and
https://github.com/pbatard/EfiFs/tree/gh-pages/OVMF as well as Shell builds
from https://github.com/pbatard/UEFI-Shell.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:12:11 +01:00
Pete Batard
da5fe74408
Create GitHub Actions artifacts
This makes the apps/*.efi files available for download and testing after each build.
Also clean up the GitHub Actions workflows a little bit.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:11:25 +01:00
Pete Batard
9e2483ab62
Fix output of test apps to produce CRLF rather than LFCR
LFCR results in unwanted blank lines being added on serial output.
CRLF is what UEFI actually uses.
Also fix unneeded CR added to Print() optput in tcc.c.

These fixes are needed to to use these application for build time tests.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 16:11:13 +01:00
Pete Batard
5dee8b0339
Fix MinGW EFI applications
The EFI subsystem and application entrypoint were not being set for MinGW builds
and we don't need to go through objcopy either, so fix that.
Also make sure that the link options can be understood by the compiler, which
is what we use for linking, and remove the extra GNU_EFI_USE_MS_ABI, that was
already automatically added.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-18 15:37:16 +01:00
Nigel Croxon
52c3c36e34
Merge pull request #24 from pbatard/master
Actually make the apps build with MinGW
2024-05-16 14:44:42 -04:00
Pete Batard
625bdb6368
Actually make the apps build with MinGW
To builds the apps with MinGW, the CRT0 library must be ignored because
it is ELF specific and we don't need to go through ELF relocations.
We also apply the GNU_EFI_USE_MS_ABI (since we have it), remove the -z
flags, that are invalid in MinGW, and clean up the apps Makefile.

Note that setjump and debughook are excluded from MinGW builds as they
use constructs that are not available there.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-16 17:50:10 +01:00
Nigel Croxon
ccfe18558c
Merge pull request #23 from pbatard/master
Actually define STATIC as static
2024-05-16 08:55:38 -04:00
Pete Batard
f719f7d838
Actually define STATIC as static
Should be the same as EDK2, per:
https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h#L264

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-16 13:01:13 +01:00
Nigel Croxon
e1024aba22
Merge pull request #22 from pbatard/master
Fix exception on ARM32 with VS2022 when Print() is invoked
2024-05-14 16:20:26 -04:00
Pete Batard
0c7af72ba8
Fix exception on ARM32 with VS2022 when Print() is invoked
On ARM32 only, it appears that whenever Visual Studio inlines the FloatToString()
call (which it does for Release builds), the resulting executable produces an
"Undefined OpCode Exception" on Print() invocation, regardless of whether there
is an actual float to string conversion occurring there.

To work around this, add an explicit clause to prevent inlining, and do so on all
platform just in case.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-14 13:56:03 +01:00
Pete Batard
f2f17bfb16
Add a new EFI_NOINLINE macro and clean up eficompiler.h
Guard the macros by the compilers they should explicitly apply to and
add a #error in case the compiler has no alignment directive defined,
as ignoring alignment is likely to produce runtime errors.
Also prefer _MSC_VER to _MSC_EXTENSIONS, as _MSC_EXTENSIONS may not
always be defined by the MSVC compiler.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-14 13:55:59 +01:00
Nigel Croxon
9bd6d4ad54
Merge pull request #21 from pbatard/master
Fix a copy/paste error with the SMBIOS3TableGuid definition
2024-05-13 06:44:04 -04:00
Pete Batard
e2499f758a
Fix a copy/paste error with the SMBIOS3TableGuid definition
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-13 11:30:26 +01:00
Nigel Croxon
50772688f0
Merge pull request #20 from pbatard/MinGW
Add MinGW workflow builds
2024-05-09 10:18:01 -04:00
Pete Batard
08f9ea33dc
Add MinGW workflow builds for Linux and Windows
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:59:13 +01:00
Pete Batard
b74c52f8ba
Fix detection of Ubuntu/MinGW version
For downright incomprehensible reasons the Ubuntu/MinGW folks have decided that MinGW on
Ubuntu should no longer report the compiler's version as '<major>.<minor>', but instead as
'<major>-win32', which of course breaks any script that attempts to read version numbers.

This results in MinGW compilation of gnu-efi on Ubuntu producing the error:
  /bin/sh: 1: [: Illegal number: 10-win32

Fix this by replacing any '-win32' in the -dumpversion report with '.0' so that we get an
approximate version number back again.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:58:00 +01:00
Pete Batard
630ea144cb
Fix MinGW compilation
Per binutils/docs/as/Section.html, COFF assembly, which is what MinGW uses, does not
allow @type/%type, which is an ELF-only thing. As a result, trying to assemble the
recently modified ctor.S with MinGW produces the error:
  Error: junk at end of line, first unrecognized character is `,'
Fix this by making sure ELF-specifics are only added within ELF-guarded sections.

Note: This fixes the now deleted https://sourceforge.net/p/gnu-efi/bugs/38/

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:56:57 +01:00
Pete Batard
36d3313805
Clean up Linux/gcc and Windows/VS2022 workflow files
Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:55:44 +01:00
Pete Batard
399313e148
Allow UEFI shorthands to be specified for the arch
The UEFI shorthands, as used in /efi/boot/boot###.efi, can now be used to specify the arch.
This basically adds 'x64' and 'mips64' as valid arch specifiers.

Signed-off-by: Pete Batard <pete@akeo.ie>
2024-05-09 12:54:49 +01:00
Nigel Croxon
0f2bee2834
Merge pull request #19 from pbatard/master
Fix ‘asm’ undeclared error for MIPS builds
2024-05-08 08:59:57 -04:00
Pete Batard
91cb708816 Fix ‘asm’ undeclared error for MIPS builds
As explained at https://stackoverflow.com/a/49830956/1069307, 'asm' is a GNU
extension that will produce an error when using a non GNU standard like -std=c11.
With recent commit 9b1e06cd0c having fixed our use
of -std=c11, the MIPS build failed with the error above.

With this sorted, we also re-enable the MIPS gcc build in GitHub Actions.
2024-05-08 13:54:10 +01:00
Nigel Croxon
a77c70718d
Merge pull request #18 from pbatard/master
Add GitHub Actions Linux/gcc and Windows/VS2022 CI builds
2024-05-08 08:05:08 -04:00
Nigel Croxon
1cf29645c6
Merge pull request #8 from hughsie/hughsie/Copright
Replace 'Copright' with 'Copyright' in file headers
2024-05-08 08:01:56 -04:00
Pete Batard
c30d23da8f Add GitHub Actions builds 2024-05-08 13:00:08 +01:00
Pete Batard
18fe24f01f Add Visual Studio 2022 solution files
* setjmp is not added as an app as it relies on non MSVC compatible assembly.
2024-05-08 12:16:56 +01:00
Pete Batard
130ebd8f04 Fix MSVC sample compilation 2024-05-08 10:51:58 +01:00
Pete Batard
ac8d6944c2 Use EDK2 compatible names for SMBIOS and AsciiStr functions and GUIDs 2024-05-08 10:51:43 +01:00
Richard Hughes
8272cd905e
Replace 'Copright' with 'Copyright' in file headers
This was hopefully just a typo that has been cargo-culted around the codebase.

It certainly confuses the Red Hat license checker and makes the code copyright
clear.
2024-05-07 13:03:52 +01:00
Nigel Croxon
bfaaec428b
Merge pull request #6 from gmbr3/RuntimeError
Align RTLIB CopyMem/SetMem with normal versions
2024-04-30 07:15:32 -04:00
Nigel Croxon
145c056b83
Merge pull request #5 from gmbr3/fixes
Disable RELRO
2024-04-30 07:14:16 -04:00
Callum Farmer
6b9dae0bef
Fixup string functions for new CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-04-27 18:26:21 +01:00
Callum Farmer
f5bb548df5
Align RTLIB CopyMem/SetMem with normal versions
Looks like 699e452654 broke rEFInd
(189e405630/)
2024-04-25 15:27:26 +01:00
Callum Farmer
a0111e0df1
Disable RELRO
No point having PT_GNU_RELRO as ELF data won't exist when merging into PE32+ file

Unbreaks lld usage which complains about linker script
Fixes ncroxon/gnu-efi#4
2024-04-24 12:04:48 +01:00
Nigel Croxon
4dc70fdf45
Merge pull request #3 from gmbr3/eh_frame_hdr
lds: Add eh_frame_hdr section
2024-04-01 11:35:32 -04:00
Callum Farmer
c7ee41c6c4
lds: Add eh_frame_hdr section
A new section has appeared, move it to the correct place
Copy of fwupd/fwupd-efi#59

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-04-01 16:04:02 +01:00
Nigel Croxon
2b0c490219 Bump revision to VERSION = 3.0.18 2024-03-22 10:24:28 -04:00
Peter Jones
31913f8489 Make: make TOPDIR actually work and get rid of unused CDIR
Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:28 -04:00
Peter Jones
95dbde278c make: Make "make clean" use @ and rm -v everywhere
This makes our "make clean" commands show what they've /removed/, rather
than what the shell code that will be run is.

Signed-off-by: Richard Hughes <richard@hughsie.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:28 -04:00
Soop
13ac2e8b3f Make apps link against the local gnuefi and crt objects
Signed-off-by: Richard Hughes <richard@hughsie.com>
2024-03-22 10:24:28 -04:00
Callum Farmer
e2355ed7fb Remove 64k gap on ARM32
While binutils 2.25 incorrectly changed the page size
to 64K, the second part of that fix prevents the bug
anyways

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:28 -04:00
Callum Farmer
792715e5e9 arm64 lds: move 64K gap to reloc
The PE32 header means code ends at end of text, unlike
ELF where its mostly dynamic

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:28 -04:00
Callum Farmer
419e257f34 ctors.S: Align with linker scripts
Remove end padding
Change start padding to 16

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
e5b1a35303 add non-executable GNU stack marking on ELF-linux
Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
feedeaa339 Make loongarch64 use efi-app-loongarch64
Binutils 2.41 now supports efi-app-loongarch64, so to use this we must add a
dummy reloc section and remove the PE header definition from crt0 as this will
conflict with the version added by objcopy

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2024-03-22 10:24:23 -04:00
Xiaotian Wu
fe31748c87 Add some definitions for LoongArch
Added CHAR8, CHAR16, WCHAR and VOID type definitions for LoongArch
2024-03-22 10:24:23 -04:00
Callum Farmer
d27431f679 Add EFI_NORETURN for declspec
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
593e13f670 Rename ALIGN to EFI_ALIGN
Avoid conflict with other libraries

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
2c47753ad3 Update OS Indications to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
86b8b5ea78 Update memory types to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
30bf99b81e Update error/warning codes to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
b084081593 Update table revisions to 2.10
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:23 -04:00
Callum Farmer
fb58e92621 ARM32: Only use 4K pages
Turns out some linkers have set page size to 64K on ARM32 aswell
so apply the same fix as ARM64

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:24:19 -04:00
Peter Jones
5df47d3527 Add missing EFI_VARIABLE_... definition.
This adds the definition for EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS.

Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:16 -04:00
Peter Jones
27477ba983 Add some missing definitions for system table revisions
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:12 -04:00
Peter Jones
699e452654 Make CopyMem() and SetMem() be EFIAPI
For wildly unknown reasons, EFI Boot Services includes CopyMem() and
SetMem() functions, and they are marked as EFIAPI functions.

This patch marks gnu-efi's CopyMem() and SetMem() as EFIAPI functions,
and makes their exposed API match the misguided nonsense in the EFI
spec, so that they can be used there in a test environment.

Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:09 -04:00
Peter Jones
06574e4ecd Add EFI_MEMORY_ATTRIBUTE_PROTOCOL
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:24:05 -04:00
Peter Jones
907bf6ce94 Fix some EFI_MEMORY_FOO definitions
Signed-off-by: Peter Jones <pjones@redhat.com>
2024-03-22 10:23:56 -04:00
Nigel Croxon
3b137d634d remove superfluous -fno-stack-check
Signed-off-by: David Müller <d.mueller@elsoft.ch>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2024-03-22 10:23:50 -04:00
Callum Farmer
7f8e2d44ed Move OPTNONE macro to eficompiler.h
This is also useful in downstream projects so add it
to public header

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:23:44 -04:00
Nigel Croxon
eab878741a Tail calls break ctors/dtors
Add macro EFI_NO_TAIL_CALL which disables tail call
optimization on a per-function basis

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2024-03-22 10:23:15 -04:00
Callum Farmer
fb3b3f4c66 riscv64: ignore unknown relocs
Sometimes ld emits relocs such as R_RISCV_64 for unwind symbols
these don't need to be handled yet so just can be skipped otherwise
the binary will never load

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:08:37 -04:00
Callum Farmer
4cdcf2a37b riscv64: fix image
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
  (un-needed in PE)
- Correct section & file alignment
- Correct image size

Builds correctly but untested

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:08:24 -04:00
Callum Farmer
eadee98bf0 ARM32: fix image
- Make it actually work
- Split text/data/reloc/rodata sections
- Move hash sections to past end of image
  (un-needed in PE)
- Correct section & file alignment
- Correct image size
- rename .reloc to .areloc within ELF
  as only on ARM32 does this name cause
  it to be marked as REL and subsequently
  mistakenly added to RELSZ

Builds correctly & tested working in QEMU

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:56 -04:00
Callum Farmer
0bb329b0bf Merge .plt into .text
ld writes .plt immediately after .text
which corrupts the alignment of .reloc

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:53 -04:00
Callum Farmer
262c1f4604 Split out rodata
rodata should be split for security

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:49 -04:00
Callum Farmer
136697dd49 .dynsym not required
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:07:44 -04:00
Callum Farmer
0209271936 Clean up size symbols
Tells ld to define them after their markers

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
9e47db1193 Add C++ extern C header markers
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
bbb501833d X86_64: fix clang
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
db870d96d6 Mark _start as function
Currently marked as NOTYPE

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
18d53408ff ARM32: _start must be global
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
2dcebec0ce Add full Data Directories table
Microsoft dumpbin doesn't like the binary if
the full table doesn't exist

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
bfa3cead95 ARM32: fix L_DYNAMIC
L_DYNAMIC must be 32bits to be PCREL

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
f26e5a6eea ctors.S: Fix section definitions
Using @ doesn't work on ARM32

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
dd82a45499 riscv: Use new ctors _entry func as entry point
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
6c142a6df4 riscv64 lds: fix ctors/dtors
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -04:00
Callum Farmer
a68997b11e riscv: Avoid TEXTREL
Use expression instead of variable for _data_size

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:38 -04:00
Callum Farmer
6f0648992a Avoid processor dependent sizes in assembly
.word -> .2byte
.short -> .2byte
.long -> .4byte
.quad -> .8byte

Reference: b83f0845b5
Fixes: https://sourceforge.net/p/gnu-efi/bugs/37/

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:05:31 -04:00
b'Nigel Croxon
20d8d8adc7 Merge /u/moodyhunter/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/52/
2023-05-18 14:14:54 +00:00
b'Nigel Croxon
9835e11ebe Merge /u/gmbr3/gnu-efi/ branch ia32 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/51/
2023-05-16 13:06:32 +00:00
Nigel Croxon
bbc2b528e0 Revert "Make ELF constructors/destructors work"
This reverts commit fe76d597a9.
2023-05-16 09:05:00 -04:00
Nigel Croxon
fe76d597a9 Make ELF constructors/destructors work
Since commit [4f8b339fac]
Simple EFI tools like for example t.c from the apps directory crash.

The reason seems to be a wrong null-pointer check in the
ctors()/dtors() functions in lib/entry.c.
sourceforge.net/u/davemueller

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2023-05-16 08:34:07 -04:00
Moody Liu
1de5094978 riscv64: adjust type definitions
CHAR8 needs to be defined while BOOLEAN should be removed
here to prevent typedef conflicts

Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
2023-05-13 17:57:24 +01:00
Callum Farmer
99730f29b2 Structs with no linkage
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-11 15:12:36 +01:00
Callum Farmer
ba150f34d6 Add test for ctors & dtors with a priority
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
e1efa4d70a No clean
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
7dac18443f Re-write entry.c/ctors.S to work better
* Make entry.c work correctly in reverse order
* Remove incorrectly sized (on non-32bit) NULLs from ctors.S

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
4c6962457f entry.c: fini_array is run backwards
fini_array is 65535 to 0 but stored 0 to 65535

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:20 +01:00
Callum Farmer
9dbfe1c365 Align all ctors/dtors start to 16
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:19 +01:00
Callum Farmer
74b7b5e92c entry.c: Fix null pointer exception
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-07 16:43:09 +01:00
Callum Farmer
9c5403e1e6 Copy marker names from binutils for init/fini
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:47 +01:00
Callum Farmer
b3cc412aad entry.c: .ctors is run backwards
Store forwards, run backwards (65535 to 0)
Ref: 5a8e7e1332/ld/scripttempl/elf.sc (L310)
Ref: https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:47 +01:00
Callum Farmer
e2aa099738 lds: Support ctors/dtors with a priority
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 14:29:36 +01:00
Callum Farmer
4c938fac30 Merge ctors/dtors rela sections
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
486b1c20c1 Enforce nocombreloc
It is needed to avoid ELF reloc (rela) issues and
to find un-merged reloc sections

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
97499a0cf2 ctors.S: Use LSB defined section perms
Seems to not be correct at the moment, causes errors.

error: expected the entry size
.section .fini_array, "aM", @fini_array

Change per
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/specialsections.html

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Callum Farmer
9b1e06cd0c Use -std instead of --std
--std isn't standardised. lol.

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-05-04 13:59:02 +01:00
Nigel Croxon
24c80efc1a Bump revision to VERSION = 3.0.17 2023-05-02 07:51:45 -04:00
Callum Farmer
bf6fd0405d ia32: No sdata section
There is no small data section on ia32,
this ends up being created as ld puts .got/.got.plt
here due to first declaration

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-21 13:38:17 +01:00
Callum Farmer
fd3d975161 ia32 GNUC: Use __asm__ instead of asm
Causes an error when using strict ISO modes as
then asm isn't defined

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-21 13:30:00 +01:00
Nigel Croxon
ebd55c4a66 Bump revision to VERSION = 3.0.16 2023-04-17 07:43:00 -04:00
b'Nigel Croxon
bc46fbdc84 Merge /u/gmbr3/gnu-efi/ branch TRUEFALSE into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/49/
2023-04-17 11:39:01 +00:00
b'Nigel Croxon
dcced03469 Merge /u/gmbr3/gnu-efi/ branch CHAR16 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/48/
2023-04-17 11:38:41 +00:00
b'Nigel Croxon
d9275e2a70 Merge /u/gmbr3/gnu-efi/ branch unsigned-char into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/47/
2023-04-17 11:38:06 +00:00
b'Nigel Croxon
362ef3db04 Merge /u/gmbr3/gnu-efi/ branch nullptr into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/46/
2023-04-17 11:37:07 +00:00
b'Nigel Croxon
e0e1f53ce2 Merge /u/gmbr3/gnu-efi/ branch pkgconf2 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/45/
2023-04-17 11:36:22 +00:00
b'Nigel Croxon
7219aba42c Merge /u/yetist/gnu-efi/ branch dev-master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/33/
2023-04-17 11:35:08 +00:00
Callum Farmer
2a599ea133 Make TRUE/FALSE compatible with C23/C++
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-15 14:45:19 +01:00
Callum Farmer
056bdaa53e Make VOID a typedef
'void' is a type so VOID can be typedef instead of
 a '#define' to improve compiler output

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-13 14:32:37 +01:00
Callum Farmer
189200d0b0 Make WCHAR and CHAR16 identical
And actually use wchar_t
gnu-efi already uses L string literals which are of type
wchar_t

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-08 20:07:13 +01:00
Callum Farmer
e398748032 ISO-Latin-1 requires unsigned char
It has characters from 0 to 256 so this requires
an unsigned 8 bit value

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-08 19:16:26 +01:00
Callum Farmer
d0900861c2 Make NULL compatible with C23/C++
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-07 14:13:43 +01:00
Callum Farmer
63a9a4d4c0 Add pkgconfig file
Also add EXEC_PREFIX and INCLUDEDIR variables

This was requested by fwupd-efi, to be able
to retrieve the version number of gnu-efi
so we can detect features

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-07 13:51:28 +01:00
b'Nigel Croxon
b6a6472874 Merge /u/gmbr3/gnu-efi/ branch boolean into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/43/
2023-04-04 13:32:29 +00:00
Richard Hughes
7c89273dbe make: Fix shell exit status handling
Right now whenever we have shell commands with loops, errors in the
middle are accidentally ignored, and make continues to process commands.

This adds 'set -e' to all of those, so they'll propagate back up.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-04-04 09:28:42 -04:00
Peter Jones
98ef7f9f5f Use CFLAGS with "gcc -print-libgcc-file-name" to get the right one.
This makes us use CFLAGS when trying to find libgcc, so we don't get the
one with the wrong endian or float ABI.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-04-04 09:28:42 -04:00
Peter Jones
4ee8cf5610 Make: make "make DESTDIR=../foo install" work right.
This makes the normal DESTDIR= variable work on the command line, and
makes relative paths always relative to the top-level directory.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-04-04 09:28:42 -04:00
Peter Jones
4b5db35e9d Implement Print(L"%p", ptr);
Signed-off-by: Peter Jones <pjones@redhat.com>
2023-04-04 09:28:42 -04:00
Callum Farmer
8efd8cde75 Use C/C++ boolean when available
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-04-04 14:20:31 +01:00
Peter Jones
4f8b339fac Make ELF constructors and destructors work
This makes setup and teardown functions defined with
__attribute__((__constructor__) and __attribute__((__destructor__)) work
in normal circumstances in EFI binaries.

A couple of notes:
- it implements both the old-style .ctors/.dtors methods and the newer
  style .init_array/.fini_array ELF constructor and destructor arrays,
  processed in the order:
    .init_array[]
    .ctors[]
    efi_main()
    .dtors[]
    .fini_array[]
- Destructors will only be called if efi_main() exits using "return";
  any call to Exit() will still longjmp() past them.
- InitializeLib() has already been called before constructors run, so
  they don't need to call it (and neither does anything else.)  For
  compatibility, it has been altered so calling it more than once is
  safe.
- No attempt is made to handle any constructor or destructor with a
  prototype other than "void func(void);", but note that InitializeLib
  has been called, so LibImageHandle, ST, BS, and RT are set.
- The init_array/ctor/dtor/fini_array lists aren't the using the GNU
  "CONSTRUCTOR" output section command, so they don't start with a size.
- The lists are individually sorted during the link stage via
  SORT_BY_NAME() in the linker script.
- The default (empty) init_array/ctor/dtor/fini_array lists are padded
  out to 8-byte alignment with ".p2align 3, 0", and each list always has
  at least one ".long 0" at the end of it (even if it's completely
  empty).  As a result, they can have NULLs that need to be skipped.
  The sections they're in are mergeable, so the NULLs don't have to be
  exclusively at the end.
- The ia64 and mips64el arches have not been tested.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:59:41 -04:00
Peter Jones
14899d899b Make CHAR8 and similar be defined the same way edk2 does it.
Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:39:26 -04:00
Peter Jones
b9c4b23d90 CFLAGS: add -Wno-pointer-sign
Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:39:19 -04:00
Peter Jones
f7bf4302e4 Semi-asciibetize _Print()'s formatters.
This is ascii order but with upper and lower case letters mixed, so
things like 'X' and 'x' that use fallthrough still stay together.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:39:09 -04:00
Peter Jones
368cdf1265 Switch to -fPIE
Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:38:58 -04:00
Peter Jones
cc4ef911ee Remove the accidentally created lib/Makefile.orig
This was added in dae0b4b0b0.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:38:46 -04:00
Peter Jones
1b94cff100 Fix a minor coverity complaint in some apps
Coverity added a new kind of check, and it noticed some minor errors
with some types in two of the apps here, both of the same form:

1. gnu-efi-3.0.6/apps/lfbgrid.c:91: overflow_before_widen: Potentially
overflowing expression "info->VerticalResolution *
info->PixelsPerScanLine" with type "unsigned int" (32 bits, unsigned) is
evaluated using 32-bit arithmetic, and then used in a context that
expects an expression of type "UINTN" (64 bits, unsigned).

1. gnu-efi-3.0.6/apps/bltgrid.c:67: overflow_before_widen: Potentially
overflowing expression "info->VerticalResolution *
info->HorizontalResolution" with type "unsigned int" (32 bits, unsigned)
is evaluated using 32-bit arithmetic, and then used in a context that
expects an expression of type "UINTN" (64 bits, unsigned).

This resolves both issues.

Signed-off-by: Peter Jones <pjones@redhat.com>
2023-03-28 08:38:37 -04:00
Peter Jones
3d82853ffe lfbgrid: Make pointer size testing not arch name dependent 2023-03-28 07:58:51 -04:00
b'Nigel Croxon
5e2444d115 Merge /u/gmbr3/gnu-efi/ branch gc-sections into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/42/
2023-03-23 14:17:28 +00:00
Callum Farmer
bc233a7a4b Prevent deletion of .reloc by gc-sections
Add keyword KEEP to prevent .reloc being removed
when using --gc-sections with GNU ld

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-03-22 15:32:24 +00:00
Callum Farmer
7ad75d9162 Ensure objcopy sections are aligned
Ensure the main sections are page aligned:
 - .text
 - .reloc
 - .dynamic
 - .data
 - .rel
 - .rel.plt

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-03-09 19:52:44 +00:00
bmeng@tinylab.org
0f9c15fe4f riscv: Update SPDX license identifiers
The whole gnu-efi project is licensed under BSD license, see [1].
However some of the RISC-V codes have conflict license identifiers:

- Some mention GPL-2.0+ in the SPDX license part, but the long license
  header indicates it's actually BSD and GPL-2.0+ dual-licensed
- Some mention GPL-2.0+ in the SPDX license part only
- Some do not have any license indication

To have a matching license with the whole project, this commit updates
all RISC-V codes to have the correct SPDX license identifiers
(GPL-2.0+ or BSD dual-license).

Link: https://sourceforge.net/p/gnu-efi/ [1]
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2023-03-08 10:32:49 -05:00
Callum Farmer
1a10c66182 Un-merge .rel.plt section
Merging this section causes an incorrect RELASZ value
2023-03-07 22:47:37 +00:00
b'Nigel Croxon
75e4ef25ad Merge /u/gmbr3/gnu-efi/ branch fix-apps into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/39/
2023-03-07 13:46:37 +00:00
b'Nigel Croxon
330c88aa0c Merge /u/gmbr3/gnu-efi/ branch function-sections into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/38/
2023-03-07 13:45:45 +00:00
Callum Farmer
3f9a656929 apps: Fix Makefile install and ordering
Create a new directory called $APPSDIR
which is the default install location of
these examples. apps must be ordered after
gnuefi target.

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-03-06 13:36:27 +00:00
Callum Farmer
02f96e8a26 *.efi.lds: Add .rel.dyn section
LLVM LLD always calls it .rel[a].dyn no matter what
so add this to the .rel[a] section

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-03-04 17:57:39 +00:00
Callum Farmer
15f10734e7 Add some COMDAT sections
When using function/data sections option from
gcc, some additional un-packed sections get created
move these to there correct placement if not already
included

sections seen on x86/x86_64/aarch64:
.gcc_except_table.efi_main
.bss.debugging

.gcc_except_table.* only appears on objcopy archs

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-03-03 21:00:32 +00:00
b'Nigel Croxon
d78b78cb2e Merge /u/gmbr3/gnu-efi/ branch merge-rela2 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/37/
2023-02-22 13:42:44 +00:00
Callum Farmer
eea6d31a22 *.efi.lds: Merge all rela sections into one
Objcopy sometimes generates .rela.plt and .rela.data
sections for which their names are longer than the 8
characters limit of PE32

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-21 11:57:47 +00:00
Nigel Croxon
637b3bdb9b Author: Callum Farmer <gmbr3@opensuse.org>
Date:   Tue Feb 7 21:48:27 2023 +0000

    ARM32/x86_64 lds: Force data segment align to 4KiB

    Some newer versions of binutils can set invalid COMMONPAGESIZE
    and MAXPAGESIZE values on these architectures

    git fetch git.code.sf.net/u/gmbr3/gnu-efi arm-pagesize
    git merge 89d55b364d

    Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-08 09:25:01 -05:00
Callum Farmer
89d55b364d ARM32/x86_64 lds: Force data segment align to 4KiB
Some newer versions of binutils can set invalid COMMONPAGESIZE
and MAXPAGESIZE values on these architectures

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-07 21:53:29 +00:00
Callum Farmer
04e6df709d Make.defaults: Force 4K page size on ARM64
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-07 21:18:41 +00:00
Callum Farmer
1e00550694 aarch64 lds: Force data segment align to 64KiB
Required by UEFI 2.10 AArch64 specification
https://uefi.org/specs/UEFI/2.10/02_Overview.html#aarch64-platforms

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-07 21:18:23 +00:00
Callum Farmer
a90c2f16fa Make.defaults: Enable objcopy on aarch64
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-02-07 16:38:05 +00:00
b'Nigel Croxon
f7b2e1ff6d Merge /u/gmbr3/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/34/
2023-01-20 12:41:14 +00:00
Callum Farmer
593e13937c Make aarch64 crt0/lds more like x86_64
Binutils 2.38 now supports efi-app-aarch64 so
to use this we must add a dummy reloc section
and remove the PE header definition from crt0
as this will conflict with the version added
by objcopy

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-01-19 17:22:19 +00:00
Callum Farmer
231c7632c0 *.efi.lds: Use proper data segment placement
Use ld commands DATA_SEGMENT_ALIGN and DATA_SEGMENT_END

Fixes binutils 2.39 warning:
/usr/bin/ld: warning: efi/fwup.so has a LOAD segment with RWX
permissions

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2023-01-19 17:22:13 +00:00
Xiaotian Wu
1ba13fdfd0 Add PE machine type definitions for the LoongArch
See https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types

Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
2023-01-04 10:31:26 +08:00
b'Nigel Croxon
c2102ae059 Merge /u/mingtaoxt/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/29/
2022-11-16 20:56:17 +00:00
b'Nigel Croxon
156d50d2de Merge /u/fantasquex/gnu-efi/ branch makefile-1 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/30/
2022-11-16 20:54:10 +00:00
Letu Ren
98f1250742 riscv: Fix ld RWX warning
The current ld script places .dynamic section right after .text, which
results in that one LOAD segment contains both data and code. Binutils
2.39 and later will throw a warning if RWX segments exist. Code and
data should be placed in different LOAD segments with different
permissions. This patch adds a gap between data and code sections which
is taken from the default ld script in riscv64.

Co-developed-by: Moody Liu <mooodyhunter@outlook.com>
Signed-off-by: Moody Liu <mooodyhunter@outlook.com>
Signed-off-by: Letu Ren <fantasquex@gmail.com>
2022-10-10 11:03:20 +02:00
Letu Ren
c26275184c Makefile: Change default target to all
According to README.gnuefi,

To build the sample EFI applications provided in subdirectory "apps",
simply invoke "make" in the toplevel directory (the directory
containing this README file).  This should build lib/libefi.a and
gnuefi/libgnuefi.a first and then all the EFI applications such as a
apps/t6.efi.

The default target of top directory Makefile should be all instead of
gnuefi.

Signed-off-by: Letu Ren <fantasquex@gmail.com>
2022-10-09 18:31:38 +02:00
Dwight Engen
4a566dd746 aarch64: fix setjmp overrun
The assembly code uses fixed offsets into the jmp_buf and leaves an 8 byte
gap between the GPRs and the FPRs, but the jmp_buf structure was not laid
out to account for this so the code would overrun the jmp_buf by 8 bytes.

Found-by: Oskar Engen <oskar.engen@gmail.com>
Signed-off-by: Dwight Engen <dwight.engen@gmail.com>
2022-09-28 12:01:29 -04:00
Nigel Croxon
8b018e6721 Bump revision to VERSION = 3.0.15 2022-08-08 11:38:33 -04:00
Sergei Trofimovich
803b49c40b */*.S: add non-executable GNU stack marking on ELF-linux
binutils-2.39 enabed a few warning by default
(https://sourceware.org/pipermail/binutils/2022-August/122246.html):

> The ELF linker will now generate a warning message if the stack is made executable.

Let's suppress the warnings in assembly files by adding non-executables
stack markings. This fixes at least systemd build which uses '-Wl,--fatal-warnings':

    https://github.com/systemd/systemd/issues/24226
2022-08-08 11:35:10 -04:00
Sergei Trofimovich
2ed6486834 lib/Makefile: add .o file dependency on libsubdirs targets
Without the change there is no guarantee that .o files will be built
after directories are created for them and build fails as:

    gcc -I/build/gnu-efi-code//lib ... -c lib/runtime/rtstr.c -o runtime/rtstr.o
    Assembler messages:
    Fatal error: can't create runtime/rtstr.o: No such file or directory
2022-07-25 10:39:43 -04:00
Fabrice Fontaine
6b28563584 Handle __mips64
Handle __mips64 to avoid a build failure since
b1c7a1c5f2

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-07-25 10:36:14 -04:00
zhoumingtao
5849eacdce use jr instead of jirl
jirl -> jr
2022-07-07 15:16:10 +08:00
zhoumingtao
e7db4418b1 Add support for LoongArch64 architecture 2021-12-30 15:39:47 +08:00
Nigel Croxon
af773c779d Bump revision to VERSION = 3.0.14 2021-08-19 12:25:25 -04:00
Pete Batard
b136460925 riscv64: finalize efibind.h
There's little reason not to derive the RISCV64 version of efibind.h
from the AARCH64 version, especially as the current version is missing
required macros such as EFI_DRIVER_ENTRY_POINT() which breaks the
compilation of some drivers.

The only major difference we introduce from AARCH64 is to consider
that any toolchain that supports RISCV64 is modern enough to support
<stdint.h>. Also, as we preserve the added definition for BOOLEAN,
we guard it with an ifndef in anticipation of MSVC RISCV64 support.

We validated these changes by confirming that they now allow gnu-efi
to be used to compile a set of UEFI drivers for RISCV64.
2021-08-19 12:21:14 -04:00
Alfonso Sánchez-Beato
31a6aab44c Set NumberOfSymbols to zero
Acoording to what the spec says about the number of sybols [1]:

"This value should be zero for an image because COFF debugging
information is deprecated."

Changing as if not zero it causes problems to llvm-objcopy. This
affects only the architectures where COFF is not supported by objcopy
and where we build the PE header via assembly code.

[1] https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
2021-07-29 11:38:16 +02:00
b'Nigel Croxon
269ef9dbc7 Merge /u/abeato/gnu-efi/ branch add-guids into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/26/
2021-07-16 16:48:28 +00:00
Pete Batard
4ef183353c Fix VS2019 Code Analysis warnings
When compiling for x64, Visual Studio 2019's Code Analysis produces the following warnings:

C:\Projects\gnu-efi\lib\print.c(1380): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).
C:\Projects\gnu-efi\lib\smbios.c(47): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).
C:\Projects\gnu-efi\lib\str.c(289): warning C26451: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).

Fix these by adding an explicit cast to UINTN.
2021-07-16 12:43:24 -04:00
Alfonso Sánchez-Beato
fbbbf47e5c Add definitions for the EFI device tree table
Add definitions for the EFI device tree table, as specified in UEFI
specification 2.9 (March 2021).

Signed-off-by: Alfonso Sánchez-Beato <alfonso.sanchez-beato@canonical.com>
2021-07-16 16:36:46 +02:00
b'Nigel Croxon
40160210a7 Merge /u/xypron/gnu-efi/ branch misc_fixes into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/25/
2021-06-24 12:16:12 +00:00
Heinrich Schuchardt
4fe83e1026 apps: memory leak in draw_boxes()
Free the buffer allocated to draw boxes.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 23:22:41 +02:00
Heinrich Schuchardt
58124a7fea apps: define FrameBufferAddr for riscv64
The size of FrameBufferAddr is architecture dependent. Add the missing
definition for the riscv64 architecture.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:56:29 +02:00
Heinrich Schuchardt
df31239ac5 riscv64: provide efisetjmp_arch.h
efisetjmp_arch.h is required for 'make apps'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:56:29 +02:00
Heinrich Schuchardt
b5f98d40fe riscv64: missing EFI_FUNCTION
Add missing definition. It is needed for 'make apps'.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:56:29 +02:00
Heinrich Schuchardt
01a8d3bb00 apps: simplify logical constraints
EFI_ERROR(EFI_NOT_STARTED) is true. So we can simplify

    (EFI_ERROR(rc) && rc == EFI_NOT_STARTED)

to

    (rc == EFI_NOT_STARTED)

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-23 22:53:26 +02:00
b'Nigel Croxon
2a7829c50b Merge /u/xypron/gnu-efi/ branch misc_fixes into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/22/
2021-06-23 15:18:12 +00:00
Nigel Croxon
860b1c8cbe efiapi.h: add RISC-V machine type definitions
These values are from the UEFI specification version 2.9.

Signed-off-by: David Michael <fedora.dm0@...>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2021-06-23 09:37:54 -04:00
Heinrich Schuchardt
e2fc15ae0e lib/str: simplify Atoi()
Checking that str is non-zero is superfluous in

	(*str && *str == ' ')

0x20 is always non-zero.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-22 00:17:00 +02:00
Heinrich Schuchardt
500c10f191 lib/misc: avoid NULL dereference in LibInsertToTailOfBootOrder
AllocatePool() may return NULL. We must check the return value before
dereferencing it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-22 00:17:00 +02:00
Heinrich Schuchardt
70402aa91d lib/hand: missing va_end() in LibReinstallProtocolInterfaces()
For each va_start() there must be a call to va_end().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-06-22 00:17:00 +02:00
b'Nigel Croxon
9e7e6822b7 Merge /u/xypron/gnu-efi/ branch GCC_visibility into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/20/
2021-05-17 14:20:24 +00:00
Ard Biesheuvel
fa506bd242 ARM: hide 'hidden' pragma for hosted build
The hidden visibility #pragma in inc/arm/efibind.h was meant to inform
the compiler that symbols with external linkage are never exported from
shared libraries [and thus never preempted] when executing in UEFI context
(since UEFI does not support shared libraries). This allows the compiler to
generate relative symbol references instead of GOT entries, which is much more
efficient since the latter need to be relocated before invoking the entry
point of the UEFI app.

However, as it turns out, this pragma is leaking into other code that does
not run in UEFI context, but simply needs to access data structures that
UEFI defines. So make the pragma dependent on whether we are building with
-ffreestanding, which is only used for bare metal code such as UEFI.

Last-Update: 2018-08-24

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Elder versions of sbsigntool failed to build on armhf without the patch,
cf. https://launchpad.net/ubuntu/+source/gnu-efi/3.0.8-0ubuntu1~16.04.1
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-05-08 11:40:21 +00:00
Peter Jones
69df7422b1 Add EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID.
Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-05-08 11:07:25 +00:00
Marvin Häuser
b916d1e54e Fix dummy relocation block alignment
As per the PE format specification, relocation blocks must be aligned on 32-bit boundaries. Fix the dummy relocations to obey the alignment constraints.
2021-04-06 22:35:03 +02:00
b'Nigel Croxon
3676bc353c Merge /u/xypron/gnu-efi/ branch riscv64 into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/17/
2021-04-05 14:13:03 +00:00
b'Nigel Croxon
ea4c77ffc5 Merge /u/xypron/gnu-efi/ branch va_args into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/16/
2021-04-05 14:12:39 +00:00
b'Nigel Croxon
e686743ba6 Merge /u/xypron/gnu-efi/ branch xtoi into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/15/
2021-04-05 14:11:53 +00:00
b'Nigel Croxon
2a1200f36f Merge /u/kagurazakakotor/gnu-efi/ branch shell-protocol into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/13/
2021-04-05 14:11:15 +00:00
b'Nigel Croxon
2cdf05814d Merge /u/kagurazakakotor/gnu-efi/ branch protocol-header into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/12/
2021-04-05 14:10:15 +00:00
Heinrich Schuchardt
0ec661b389 lib/hand: missing va_end
For each va_start() there must be a va_end().

Correct LibInstallProtocolInterfaces() and
LibUninstallProtocolInterfaces().

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-04 11:06:05 +02:00
Heinrich Schuchardt
1771b6e779 lisb/str.c: simplify xtoi()
If str == ' ', str has to be non-zero. No extra check is needed.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-04 10:51:08 +02:00
Heinrich Schuchardt
b95f138fa1 Initial support for RISCV64
Add the RISCV64 architecture

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-04-01 17:17:33 +02:00
Heinrich Schuchardt
dfdcd7eff3 Undefined Status in LibGetVariableAndSize()
GrowBuffer() expects that parameter Status is initialized.
LibGetVariableAndSize() currently passes random data from the stack.

Initialize variable Status.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2021-03-19 17:14:48 +01:00
Nigel Croxon
59fd1e9d1d Bump revision to VERSION = 3.0.13 2021-03-08 15:05:36 -05:00
Pete Batard
b39be0d5a9 Define UnicodeSPrint/UnicodeVSPrint as our main SPrint/VSPrint calls
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h
those are the names used by EDK2, so make these our official names as well.

For compatibility with older gnu-efi versions, also keep SPrint and VSPrint defined.
2021-03-08 15:00:14 -05:00
Pete Batard
2458595367 Use EFI_FILE_SYSTEM_VOLUME_LABEL rather than EFI_FILE_SYSTEM_VOLUME_LABEL_INFO
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Guid/FileSystemVolumeLabelInfo.h
the EDK2 uses EFI_FILE_SYSTEM_VOLUME_LABEL and EFI_FILE_SYSTEM_VOLUME_LABEL_ID rather
than EFI_FILE_SYSTEM_VOLUME_LABEL_INFO and EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID.

We redefine those to the proper EDK2 names, while also adding defines for compatibility.
2021-03-08 14:59:46 -05:00
Pete Batard
6c77f27793 Define BASE_CR as a duplicate of the _CR macro
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Base.h#L867
the EDK2 uses BASE_CR and not _CR, so make sure gnu-efi defines it too.
2021-03-08 14:59:02 -05:00
Pete Batard
41e4d11d11 Fix CopyMem() not handling overlaps
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/BaseMemoryLib.h
"(CopyMem) must handle the case where SourceBuffer overlaps DestinationBuffer".

Having the gnu-efi version of CopyMem differ from the EDK2 version can lead to
extremely hard to troubleshoot issues as well as very unexpected results. So
make sure our version follows the same guidelines.
2021-03-08 14:58:21 -05:00
Pete Batard
b1c7a1c5f2 Remove the need for other include paths besides <gnu-efi>/inc
Having to add specific arch include paths and then <gnu-efi>/lib
to be able to use gnu-efi in an application is annoying.

This patch ensures that the library itself takes care of including
the relevant headers, and that one needs only to add <gnu-efi>/inc
in their include path to be able to use gnu-efi.
2021-02-18 10:15:22 -05:00
Pete Batard
70bced02ed Always define HAVE_USE_MS_ABI for MSVC compilers
Obviously, it makes little sense not to have it unconditionally defined there.
2021-02-18 10:13:46 -05:00
Pete Batard
0247cb7cd4 Add AsciiPrint and AsciiVSPrint
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/PrintLib.h
AsciiPrint() is the official name of APrint() so declare it as such and define
an APrint alias for compatibility.

Also add an AsciiVSPrint() to print a formatted ASCII string to a buffer using
a va_list. AsciiPrint() too is defined in EDK2's PrintLib.h, though our implementation
just invokes the Unicode version and then converts the buffer to ASCII.
2021-02-18 10:11:44 -05:00
Pete Batard
ebdde0bc4b Always prefer the external <stdarg.h> for MSVC compilation
The __builtin_va_###() intrinsics apply only to GCC-like compilers and
MSVC's <stdarg.h> works just fine with gnu-efi.
Without this patch, one has to define GNU_EFI_USE_EXTERNAL_STDARG to
make gnu-efi work with a Microsoft toolchain, which is annoying...
2021-02-18 10:09:07 -05:00
Jiaqing Zhao
6c04004f63
Add EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL definitions
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:26:19 +08:00
Jiaqing Zhao
773f30af29
Move EFI_SHELL_PARAMETERS_PROTOCOL related definitions to efishell.h
As EFI_SHELL_PARAMETERS_PROTOCOL is also defined in UEFI Shell Spec,
put it together with EFI_SHELL_PROTOCOL.

Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:15:18 +08:00
Jiaqing Zhao
2b26c8112f
Add EFI_SHELL_PROTOCOL definitions
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2020-11-15 15:12:25 +08:00
Kagurazaka Kotori
ce0bd62f5c
Add Device Path Utilities Protocol support
Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-23 15:44:12 +08:00
Kagurazaka Kotori
7cc4f3a20c
Replace Pause() macro with new library function
Key input should be consumed to prevent WaitForKey event from being
always triggered and potential buffer overflow.
This fixes issue #26.

Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-22 17:49:07 +08:00
Kagurazaka Kotori
b82e6b6f5b
Add Simple Text Input Ex Protocol support
Signed-off-by: Kagurazaka Kotori <kagurazakakotori@gmail.com>
2020-07-21 16:05:43 +08:00
Nigel Croxon
39137210cb Bump revision to VERSION = 3.0.12 2020-05-11 11:05:20 -04:00
Pete Batard
d857a968f4 Add SMBIOS 3.0 table support
Also fix some small whitespace issues.
2020-05-11 11:03:35 -04:00
Nigel Croxon
9b63de7db6 Re-add back the original symbol, typeo.
Fix breaking code by restoring original typeo in efierr.h
EFI_WARN_UNKOWN_GLYPH definition.

Fixes: commit 5d0d538c25

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2020-01-16 14:35:56 -05:00
Ben Wolsieffer
44267b59d8 Fix ARCH on ARMv6.
Extends the armv7 ARCH sed expression to work correctly on armv6.

Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
2019-12-04 11:47:40 -05:00
Alexander von Gluck IV
6685cd0002 efibind: Fix usage of efi headers from C++ code
* __STDC_VERSION__ is undefined when headers are called from C++
  code resulting in not using stdint.h and efibind.h
  "making a guess" on what they are. extern "C" will not define
  __STDC_VERSION__.
* Always leverage stdint.h on C++.
* Honestly, gnu-efi should always use stdint.h, or find a better
  way to detect it. (or platforms without it need to catch up to 2007)
2019-11-27 17:03:49 -06:00
Nigel Croxon
2ab1abfd26 Bump revision to VERSION = 3.0.11 2019-10-28 07:48:52 -04:00
Nigel Croxon
8b2da2c224 Revert "efilink: fix build with gcc 4.8"
Breaks gcc builds with '-nostdinc' flag.

The fix in 1a53d8f88a
(Fix for problem with undeclared intptr_t type), which is also merged
fixes the same problem, without causing breakage.

This reverts commit 6335e5c697.
2019-10-28 07:45:38 -04:00
Nigel Croxon
9b14e7dab0 Bump revision to VERSION = 3.0.10 2019-10-03 12:05:00 -04:00
Nigel Croxon
3e4d5c7990 Merge /u/lslrt/gnu-efi/ branch exclude_efisetjmp into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/8/
2019-05-16 20:31:59 +00:00
leo
486ba3c3bd Do not include efisetjmp.h on efi.h
People than really want to use efisetjmp implementation can include
the header on their own.

Signed-off-by: leo <leo.sartre@geebol.fr>
2019-05-15 05:32:24 +02:00
leo
238358c6df efiapi.h: fix EventGroup parameter of EFI_CREATE_EVENT_EX prototype
From UEFI specifications, this parameter is a pointer, see
https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
page 148 for reference.

Signed-off-by: leo <leo.sartre@geebol.fr>
2019-05-14 07:44:28 +02:00
Nigel Croxon
230c36c6aa gnuefi/Makefile uses a strange rule to create libgnuefi.a, which only works
because of a "make" builtin rule. This breaks make -r, and it is an
inefficient way to build, at least for multiple files.

I have made a git tree which includes a patch for this problem,
and also forces -r by adding it to MAKEFLAGS:

git://git.zytor.com/users/hpa/gnu-efi.git make-r-fixes

Signed-off-by: H. Peter Anvin <hpa@users.sourceforge.net>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2019-04-02 09:47:24 -04:00
Nigel Croxon
7604ff2629 Merge /u/esben/gnu-efi/ branch intptr-t-fix into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/5/
2019-03-22 18:02:34 +00:00
Nigel Croxon
99c1436dc9 Merge /u/ffontaine35/gnu-efi/ branch master into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/3/
2019-03-22 18:01:07 +00:00
Nigel Croxon
de4e5e4e3b Make.rules incomplete/wrong; make -r failure
Make.rules is not complete; in particular it lacks a %.o: %.S rule.
This happens to work due to the builtin make rule to that effect. but
building with make -r, or building as a sub-make of an environment that
uses make -r (or MAKEFLAGS += -r) causes it to break.

In general, make -r is strongly preferred, and Make.rules seems to have
been created explicitly to support this.

To further complicate things, the rule %.S: %.c causes a completely
incomprehensible error message. This rule is wrong, it should be %.s:
%.c not %.S: %.c.

Finally, the rule %.E: %.c is normally %.i: %.c; .i is the normal
extension for preprocessed C source. The equivalent rule for assembly is
%.s: %.S.

Signed-off-by: H. Peter Anvin <hpa@users.sf.net>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2019-03-15 09:48:10 -04:00
Nigel Croxon
5b74db0e15 Redefine jmp_buf to comply with C calling convention.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@infinera.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2019-03-15 09:32:06 -04:00
Esben Haabendal
1a53d8f88a Fix for problem with undeclared intptr_t type
When building gnu-efi with old compilers with pre C90 compilers:

In file included from gnu-efi-3.0.9/lib/../inc/efilib.h:25:0,
                 from gnu-efi-3.0.9/lib/lib.h:24,
                 from gnu-efi-3.0.9/lib/dpath.c:25:
gnu-efi-3.0.9/lib/dpath.c: In function 'FileDevicePath':
gnu-efi-3.0.9/lib/../inc/efilink.h:145:47: error: 'intptr_t' undeclared (first use in this function)
 #define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(intptr_t)(&(((TYPE *) 0)->Field)))

Problem introduced with commit a46a62b12b
(Fix some types gcc doesn't like).

Avoid this by adding intptr_t (and uintptr_t) typedefs for builds that does
not include stdint.h.

Signed-off-by: Esben Haabendal <esben@esben1.localdomain>
2019-03-15 12:09:50 +01:00
Fabrice Fontaine
6335e5c697 efilink: fix build with gcc 4.8
intptr_t is undefined without an include on stdint.h

Fixes:
 - http://autobuild.buildroot.org/results/a0ca37b5ed27af445344e3ac49dc87bb17512c50

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-01-18 22:12:38 +01:00
Nigel Croxon
d34132e62f * Fixed typeo lib/error.c EFI_WARN_UNKNOWN_GLYPH definition.
On couple of locations in runtime string library (rtstr.c)
there are calls to non-runtime variant of StrLen function.
* Another issue is with formatting 1394 paths.
The F1394_DEVICE_PATH::Guid is formatted as %g, but 1394
GUID is 8 byte integer, not EFI_GUID and therefore should
be formatted as e.g. %016lx (as edk2 does).
* Beyond what's mentioned above, changed the format of the
harddrive path, so it's in line with edk2 format and spec
(2.7 errata A, chapter 10.6.1.6, table 102).

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: manison <manison@users.sf.net>
2019-01-09 07:03:46 -05:00
Nigel Croxon
5d0d538c25 Fix typeo in efierr.h EFI_WARN_UNKNOWN_GLYPH definition.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: manison <manison@users.sf.net>
2019-01-08 11:19:25 -05:00
Gary Lin
5bb5032fda Set '\0' properly in StrnCpy()
The arguments to SetMem() were wrong. Besides, SetMem() should start at
"Dest + Size" since "Size" will be smaller than "Len" if they are not
equal.

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-12 08:17:20 -04:00
Nigel Croxon
183ec634ee Bump revision to VERSION = 3.0.9 2018-10-11 08:46:29 -04:00
Gary Lin
ba250504b9 Implement StrnCat() without StrnCpy()
StrnCpy() doesn't guarantee the dest string will be null-terminated, so
we shouldn't use StrnCpy().

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-11 08:35:12 -04:00
Gary Lin
6058ffcd54 Set '\0' properly in StpnCpy()
The arguments to SetMem() were wrong. Besides, SetMem() should start at
"Dest + Size" since "Size" will be smaller than "Len" if they are not
equal.

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-11 08:35:06 -04:00
Pete Batard
85f1c797f6 Fix conversion from 'UINTN' to 'UINT8' warnings
* MSVC generates two of the following in rtstr.c:
  warning C4244: 'function': conversion from 'UINTN' to 'UINT8', possible loss of data
2018-05-01 08:00:48 -04:00
Nigel Croxon
fc5af9e47f Bump revision from VERSION = 3.0.7 to VERSION = 3.0.8
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:54:51 -04:00
Peter Jones
b030bfce35 Add debug helper applications
Add debug helper applications.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
656e495d51 Call ar in deterministic mode.
We need the x86_64 and i686 builds of .a's to be the same, and that
means we need to not have timestamps.  Also force the timestamps on disk
just in case that doesn't work, because RHEL's ar /silently ignores -D/.

v2: use "ar rvD" not "ar rv -D".

It's a wonder anybody ever gets these command line options right, if
"ar rv -D libfoo.a foo.o" doesn't use deterministic mode (or
complain), but "ar rvD libfoo.a foo.o" does.

v3: Add a bunch of junk to try to set timestamps to 0 manually

For some reason I'm still getting timestamps in the .a even though ar seems to
be invoked correctly.  When I do "mock -r rhel-7-build --shell" and run make
manually, they're fine.  Very strange.

v4: go back to v2, the problem isn't in the make process.

"ar rDv" works just fine, but /usr/lib/rpm/redhat/brp-strip-static-archive is
calling "%{__strip} -g $for_each.a", and it's rewriting our binary from
ts/uid/gid of 0/0/0 to $epoch/$UID/$GID.  Awesomely /usr/bin/strip it seems to
have 3 modes of operation:
-U: the default, which adds $epoch/$UID/$GID to your binary archive
    instead of just removing stuff.  Clearly the Principle of Least
    Surprise is strong here.
-p: preserve the timestamp from the original .a, but add UID and GID,
    because this is 1980 and people use ar(1) for archiving stuff they
    might want that out of.
-D: Condescend at you in a command line error and explain that -D both
    is and is not a valid option:
      /usr/bin/strip: invalid option -- 'D'
      Usage: /usr/bin/strip <option(s)> in-file(s)
      Removes symbols and sections from files
      The options are:
      ...
      -D --enable-deterministic-archives
                  Produce deterministic output when stripping archives
    So I agree that it's invalid, but I think we may be pronouncing that
    second vowel differently.  They say in-VAL-id, I say IN-vuh-lid.

Nobody should ever have to run "strace -ttt -v -f -o make.strace make all",
just to discover the problem isn't even in there.

Related: rhbz#1310782

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
be57aadba6 Nerf -Werror=pragma away
Nerf -Werror=-pragma away

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
5ec879ace7 apps: Add bltgrid and lfbgrid, and add error checks to modelist
This adds bltgrid and lfbgrid, which draw checkerboards using GOP's
Blt() and linear framebuffer, respectively, and adds some error checks
to modelist.efi.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
2c624c22fe Make ARCH overrideable on the command line
Make ARCH overrideable on the command line.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
28793041d7 Add %D to print device paths
Add %D to print device paths.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
9485c65f6d gnu-efi: add some more common string functions.
This adds bounded string helper functions:

StrnLen()
StrnCpy()
StrnCat()
StpnCpy()

And the unbounded function StpCpy().

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
5abc3858a2 Fix another place clang complains about
Fix another place clang complains about.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
f0bf464a37 make clang not complain about -fno-merge-all-constants
Make clang not complain about -fno-merge-all-constants

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
28b487d1ae Fix typedef of EFI_PXE_BASE_CODE
Commit 751cbce3 fixed up a bunch of types to better match the edk2
definitions and the names in the UEFI Spec, but while doing so
inadvertantly defined things thusly:

  INTERFACE_DECL(_EFI_PXE_BASE_CODE_PROTOCOL);
  ...
  typedef struct _EFI_PXE_BASE_CODE_PROTOCOL {
  ...
  } EFI_PXE_BASE_CODE_PROTOCOL;
  ...
  typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE;
  typedef struct EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE;

Because EFI_BASE_CODE_PROTOCOL is declared with a typedef, and is
therefore in the type namespace rather than the struct namespace, this
results in EFI_PXE_BASE_CODE being a forward declaration of an
incomplete type.  The net result is that code which dereferences any
field in the struct, even with the correct names, will not correctly
build.

This patch changes both _EFI_PXE_BASE_CODE and EFI_PXE_BASE_CODE
typedefs to inherit from struct _EFI_PXE_BASE_CODE_PROTOCOL.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
25cebcee2a Fix a sign error in the debughook example app
On ISO C90 on i386 4294967294 is a signed integer, and so x can't be
greater (or equal) to that.  Make it an unsigned and choose a better type
for the variable.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
e861bb3861 Work around -Werror=maybe-uninitialized not being very bright.
The compiler doesn't believe the loop always executes at least once,
even though the data in the first array entry doesn't satisfy the exit
condition.  So just initialize the thing to shut it up.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:23 -04:00
Peter Jones
5fa13d4609 Fix arm build paths in the makefile
Previous work was apparently done with arm-linux-gnueabi-gcc as a
cross-builder, but our armv7 builders have native gcc with the target as
armv7hl-linux-gnueabi, so we need to munge the arch there to get our arm
path.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:22 -04:00
Peter Jones
a46a62b12b Fix some types gcc doesn't like
Most of these come from building on i386 with -Wextra, but they're still
incorrect everywhere else; they just happen to have identical typedefs
at other places, so the compiler doesn't care.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-03-14 14:50:22 -04:00
Nigel Croxon
3b523e30f3 Merge /u/trofi/gnu-efi/ branch fix-64-build into master
https://sourceforge.net/p/gnu-efi/code/merge-requests/2/
2018-01-29 18:18:20 +00:00
Sergei Trofimovich
0e6995a96b gnu-efi: fix lib/ia64/setjmp.S IA-64 build failure
The build failed as:
  lib/ia64/setjmp.S:171: Error: Unknown opcode `ldf.nt1 f26=[r10],8'
  lib/ia64/setjmp.S:178: Error: Operand 1 of `ldf.fill.nt1' should be a floating-point register

The change syncs longjmp definition with
    edk2/EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/setjmp.s
pulling in:
- branch in the end of function
- registers used wrong instruction for float restore

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2018-01-28 16:44:21 +00:00
Sergei Trofimovich
2cc0b085fb gnuefi: preserve .gnu.hash sections (unbreaks elilo on IA-64)
Gentoo has slightly modified linker defaults: --hash-style=gnu
This means all ELF files in system have '.gnu.hash' section
but no '.hash' section.

gnuefi's ldscript did not account for it and as a result
one symbol 'ImageBase' did not resolve locally for elilo.so
and caused 'elilo' to fail to load by ia64 EFI:
  Loading.: Gentoo (try new elilo)
  ImageAddress: pointer is outside of image
  ImageAddress: pointer is outside of image

Those two relocations come from crt0-efi-ia64.S PE32 entry point
fdescr:

```
    #define IMAGE_REL_BASED_DIR64<->10
    .section .reloc, "a"
    data4   _start_plabel // Page RVA
    data4   12            // Block Size (2*4+2*2)
    data2   (IMAGE_REL_BASED_DIR64<<12) +  0 // reloc for plabel's entry point
    data2   (IMAGE_REL_BASED_DIR64<<12) +  8 // reloc for plabel's global pointer
```

These refer ImageBase.

The change adds '.gnu.hash' collection (follows existing '.hash'
collection).

Tested on IA-64 by successfully booting elilo-3.16.

Bug: https://bugs.gentoo.org/575300
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2018-01-27 20:29:05 +00:00
Nigel Croxon
d039cd620b Currently we have DivU64x32 on ia32, but it tries to call
__umoddi3 and __udivdi3 from libgcc, which we don't have.
This fixes it to use our implementation in that case.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-01-10 10:28:36 -05:00
Nigel Croxon
f99001cd7d Bump revision from VERSION = 3.0.6 to VERSION = 3.0.7
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:44:21 -05:00
Nigel Croxon
b1d426ce67 Move memcpy/memset definition to global init.c
Following up on previous patch, I think we should move
memcpy/memset definitions to the global init.c, since MSVC does
also inserts calls to memset/memcpy for the x86_32 platform,
even when disabling standard libraries and intrinsics.

All in all, it looks like, for all platforms, we should assume
that a compiler may still insert these calls regardless.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:38:38 -05:00
Nigel Croxon
787b53a66c Add EFI_DRIVER_ENTRY_POINT support for MSVC/ARM64
Similar to what we do for other MSVC architectures.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:34:14 -05:00
Nigel Croxon
39ce220cb6 Make sure stdint.h is always used with MSVC on ARM/ARM64, since all
the versions of Visual Studio that support ARM or ARM64 have that
header. Without this, uint64_t would be defined to unsigned long,
which is 32-bits in the Microsoft world.

Also fix aarch64/initplat.c so that memset/memcpy only apply
to gcc. Otherwise MSVC throws an error for __SIZE_TYPE__.

Updating this patch to v2, since it turns out MSVC will also emit
memset and memcpy intrinsics that we can use an implementation for.
This is true for both ARM and ARM64.
To make this work, I'm defining __SIZE_TYPE__ to UINTN if not
already defined.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:26:05 -05:00
Nigel Croxon
15bcddc996 Stripped diff for makefile
This patch allows one to run make outside the source tree
with make -f <makefile>.

Signed-off-by: wolfra <wolfra@users.sf.net>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-11-06 09:06:31 -05:00
Nigel Croxon
08a46615c7 Use ARFLAGS when invoking ar.
The use of ARFLAGS makes these flags overridable.
The '-U' option is already added to ARFLAGS in Make.defaults.

Signed-off-by: Janosch Hildebrand <jnosh+git@jnosh.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-08-07 13:32:54 -04:00
Nigel Croxon
99d94682de [PATCH] Disable AVX instruction set on IA32 and x86_64 platforms
If gnu-efi is compiled with "-march=native" on a host that supports AVX, both
gcc and clang will use AVX instructions freely which is currently not supported
and will result in a non-functional gnu-efi build (e.g. black screen, hangs).

For now, disable AVX on IA32 and x86_64 by checking first if the compiler does
actually support the appropriate flag (-mno-avx) and use it if possible.

Credit for the compiler command line to check if a flag is supported goes to
Gentoo's awesome flag-o-matic eclass, where it is taken from. Thanks.

Signed-off-by: Matthias Dahl <matthias.dahl@binary-island.eu>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-07-13 08:43:16 -04:00
Nigel Croxon
af5d1494a9 -VERSION = 3.0.5
+VERSION = 3.0.6

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-06-20 10:12:22 -04:00
Nigel Croxon
bf07e81417 Declare EFI_PXE_BASE_CODE correctly
EFI_PXE_BASE_CODE was redefined in the early commit(*) to match the
definition in EDK2. However, EFI_PXE_BASE_CODE wasn't declared
correctly. Since EFI_PXE_BASE_CODE_PROTOCOL is already an alias of
"struct _EFI_PXE_BASE_CODE_PROTOCOL", the additional struct in front of
EFI_PXE_BASE_CODE_PROTOCOL actually confused the compiler and caused
build fail. Remove the redundant struct to avoid confusion.

*751cbce3f640c7 Update global protocol GUIDs definitions to match EDK2

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-06-14 08:05:45 -04:00
Nigel Croxon
61859152d8 This commit inserts the libefi.a objects in a stable order.
When building libefi.a with "make -jN", the object files in libefi.a
will be inserted in a random order. Although it won't hurt the functionality,
it could make the EFI image irreproducible and invalidate the detached
signature after rebuilding libefi.a without any change in the source
code.

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-06-01 07:47:37 -04:00
Nigel Croxon
8d8a3b5dff Add the fallthrough attribute to notify gcc7 that it's on purpose.
Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-05-31 06:53:49 -04:00
Nigel Croxon
08b72e8d99 This typedef is already defined with the structure and can
generate an error ("typedef redefinition is only available
in C11") with Clang.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-05-30 19:36:55 -04:00
Nigel Croxon
72a19c3a00 On x86_64, newish gcc will use relocation types R_X86_64_GOTPCREL,
R_X86_64_GOTPCREL64, R_X86_64_GOTPCRELX, and R_X86_64_REX_GOTPCRELX,
which our _relocate() does not support, for extern declarations visible
to things linking against a DSO.  Since we're really just building a .a
here, and *nothing* needs to be exported in the .so sense, we don't need
any of that optimization at all, there's no point in making _relocate()
know how to handle these.

Instead, this patch simply removes the visibility from everything in the
.a, which gets us back to fairly normal relative relocations that wind
up being R_X86_64_RELATIVE in the final binary, which we can handle.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-04-07 13:16:58 -04:00
Nigel Croxon
574b48d8e4 This is mere refactoring of the code and is not linked to any
specific issue.

I think ARM's DivU64x32() would be better located along MultU64x32()
and other calls in ARM's math.c, as having it in a header seems weird,
even with the goal of inlining it. I doubt there's much performance
to be lost from having it non-inline in math.c and it should make the
code breakdown more logical.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-30 18:04:42 -04:00
Nigel Croxon
d3e46ee9cb x86-64/efibind: sanitize ms-abi cpp conditionals
Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-10 16:03:59 -05:00
Nigel Croxon
9d0d941591 apps/tcc: tcc marcked ok for non x86-64 archs
Tested on qemu (x86-64 and arm64).

Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-10 16:02:03 -05:00
Nigel Croxon
0e808e122a apps/tcc: remove unneeded includes
Signed-off-by: David Decotigny <<ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-03-10 16:00:06 -05:00
Nigel Croxon
79f4f38d15 Version checks in inc/x86_64/efibind.h for ms_abi support gives
false negative for clang.

Signed-off-by: toazzz < toal193@users.sf.net>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-20 14:29:53 -05:00
Nigel Croxon
049a863e14 Fixed build issue with apps/exit.c
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:31:39 -05:00
Nigel Croxon
3f8935c3d0 add-Exit - Add Exit() library function which calls BS->Exit()
Signed-off-by: Jonathon Reinhart <jonathon.reinhart@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:30:28 -05:00
Nigel Croxon
787cb7fcd8 fix clang support.
Tested:
  make all apps + tests apps/ on x86_64
  make CC=clang all apps + tests apps/ on x86_64

Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:24:26 -05:00
Nigel Croxon
bdb6182f0a don't expect non-x86 compilers to compile x86 asm.
also remove what looks like garbage inside an #if 0 block.

Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:22:44 -05:00
Nigel Croxon
7b0521df53 remove dead code
Signed-off-by: David Decotigny <ddecotig@gmail.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-17 16:19:16 -05:00
Nigel Croxon
8581a58e5b For compatibility with an upcoming EDK2 feature that maps UEFI apps
using strict permissions, emit the code as split .text/.data with
R-X/RW- permissions, respectively.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2017-02-15 19:54:32 -05:00
Nigel Croxon
f164fd6785 -VERSION = 3.0.4
+VERSION = 3.0.5
2017-01-09 10:12:04 -05:00
Nigel Croxon
4d326eae7d Allow gcc to emit warnings for unsafe usage of setjmp/longjmp
Patch to allow gcc to emit warnings for unsafe usage of setjmp/long

Signed-off-by: David Decotigny <gdaviddecotigny@users.sf.net>
Signed-off-by: Nigel Croxon <noxorc@mac.com>
2017-01-08 07:11:24 -05:00
Nigel Croxon
3f234f5b6f Add support for 64 bit MIPS
This is a patch to add support for 64-bit MIPS.

Signed-off-by: Hev heiher <heiher@users.sf.net>
Signed-off-by: Nigel Croxon <noxorc@mac.com>
2017-01-08 07:04:52 -05:00
Nigel Croxon
87484730de Restore correct operation of BS driver test
Attaching a patch to fix apps/drv0.efi and apps/drv0_use.efi,
which are both currently not working.

Signed-off-by: David Decotigny <gdaviddecotigny@users.sf.net>
Signed-off-by: Nigel Croxon <noxorc@mac.com>
2017-01-08 06:58:30 -05:00
Nigel Croxon
fa1b977962 GCC 4.8 (and others) const warnings
Calling the various Print functions picked up some warnings in my
project (using GCC 4.8 and 4.9 at the moment):
warning: passing argument 1 of Print discards const qualifier from
pointer target type [enabled by default]

Signed-off-by: Nigel Croxon <noxorc@mac.com>
Signed-off-by: Justinian <justinian@users.sf.net>
2017-01-08 06:52:33 -05:00
Nigel Croxon
bd38ba4b6b GNU ar warning about deterministic mode
GNU ar currently produces the following string of warnings:
Warning: Archive 'libefi.a' seems to have been created in
deterministic mode.
'<file>.o' will always be updated. Please consider passing
the U flag to ar to avoid the problem. This patch fixes the issue.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <noxorc@users.sf.net>
2016-11-21 10:59:13 -05:00
Nigel Croxon
8071303f52 AARCH64 gcc error with const qualifiers
aarch64-linux-gnu-gcc on Debian/Sid fails lib compilation with:
lib/aarch64/initplat.c:44:35: error: initialization discards
‘const’ qualifier from pointer target type
[-Werror=discarded-qualifiers].  This patch fixes it.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <noxorc@users.sf.net>
2016-11-21 10:55:10 -05:00
Nigel Croxon
b14cc9cb4f Add Debugger protocol support.
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 14:38:51 -04:00
Nigel Croxon
447ad9aa3a Add EBC (EFI Byte Code) protocol support.
Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 14:34:56 -04:00
Nigel Croxon
c108e118da Add support for PCI Root Bridge I/O protocol.
PCI Root Bridge I/O protocol is used by PCI Bus Driver to perform
PCI Memory, PCI I/O, and PCI Configuration cycles on a
PCI Root Bridge. It also provides services to perform different
types of bus mastering DMA.

V2 - Scratch that - there already exists an efipciio.h with most
of these definitions. Let me remove this patch and propose a new
one that will amend what's already there.
OK, here's a better version that adds the required definition in
efipciio.h. Note that EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL and
EFI_PCI_IO_PROTOCOL are two different protocols.

V3 - Pete, There are now two defines of EFI_PCI_ADDRESS.
Please repost with your define removed.
Nigel, Sorry about that. Here's v3.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 12:50:48 -04:00
Nigel Croxon
9cdd67da85 Bridge more gaps between EDK and gnu-efi
This patch adds a few more items to facilitate porting
from EDK to gnu-efi.
It also adds updated PE machine types and fixes a discrepancy
for EVT_EFI_SIGNAL_MAX.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-09-15 11:41:45 -04:00
Nigel Croxon
751cbce3f6 Update global protocol GUIDs definitions to match EDK2
This patch introduces the use of the EDK2 names for the global GUID
variables, to allow for easier code conversion between EDK2 and
gnu-efi. All the existing GUID global variables have also been
aliased for backwards compatibility.

The patch also completes some of the earlier work with regards to
protocol struct definitions to also match the EDK2, with the
following caveat:
Because some of gnu-efi GUID macro definitions were declared with
the name that the EDK2 uses for the protocol struct itself, we have
to immediately deprecate the following GUID data aliases:
EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL
EFI_SIMPLE_NETWORK_PROTOCOL
EFI_PCI_IO_PROTOCOL
EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL
This means that existing code using one of the above will break
on compilation. To mitigate this, explicit warnings have been
placed at the location where a developer will look for breakage,
detailing how they should amend their code.

The KnownGuids short labels in guid.c were also updated/amended
in a manner that should be a bit more consistent (though I have
no idea what the EDK2 does here, since I haven't looked at the
actual EDK2 source).

Finally, besides clean up (typo, whitespaces, duplicate removal),
we introduce the _GNU_EFI macro, in efi.h, to allow for conditional
selection of specific gnu-efi API calls, in code that may be
compiled with either EDK2 or gnu-efi.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-18 08:42:11 -04:00
Nigel Croxon
7993cbcc72 Add support for some UEFI 2.0 protocols
* DevicePath[To|From]Text
* BlockIo2
* DiskIo2
* Ex calls for Simple File System

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-16 10:18:58 -04:00
Nigel Croxon
1b10394e06 This patch is a follow up to 8118d08727
and completes the renaming of structs, defines, and typedefs to match
the naming convention from the latest UEFI specifications.

This should make it easier for people to switch between EDK2 and
gnu-efi compilation.

The original names are #defined or typedef'd to the new names for
backwards compatibility. Also some whitespace cleanup was applied.

Note 1: From what I could see of the EDK API documentation,
structs are being aliased to their old names using typedef rather
than #define, so that's what I used. I altered some of the #define
from 8118d0 accordingly

Note 2: I also think it might be more helpful for users to keep
the backwards compatibility defs close to their declaration
(e.g. old GUID def right after current GUID declaration), rather
than in a separate section as was done in 8118d0, so that's what
I did in this patch.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-15 10:41:40 -04:00
Nigel Croxon
ef81c051c9 Add GUID for SMBIOS 3 entry point structure.
64 bit entry point structure has a different GUID
from the existing 32 bit version.

Signed-off-by: Jianxun Zhang <jianxun.zhang@linux.intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-08-12 10:43:25 -04:00
Nigel Croxon
93ef26559c The latest gnu-efi produces the following warning when
compiled with MSVC: lib\print.c(1345): warning C4244:
'initializing': conversion from 'double' to 'float',
possible loss of data

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-07-08 11:01:40 -04:00
Nigel Croxon
cae022d6e4 This patch adds definitions to efiprot.h for
EFI_EDID_ACTIVE_PROTOCOL
     EFI_EDID_DISCOVERED_PROTOCOL
     EFI_EDID_OVERRIDE_PROTOCOL
It also adds the matching global variables to libefi.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-07-08 10:56:31 -04:00
Nigel Croxon
44d9ae1929 I did not submit the right file on my last submission.
This patch corrects the printing of leading fractional
part 0s in Print("%f").

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-06-17 13:08:56 -04:00
Nigel Croxon
b2c4db065f I did a quick review of the MS x86_64 calling convention for floating
point and as far as I can tell it agrees with the UEFI spec.
The attached patch removes -mno-mmx and -mno-sse for x86_64 and adds
a new Print target, "%f", to print float and double types.

It seems to compile for ia32, although I'm not sure why - shouldn't
it be throwing errors because the new function FloatToStr() in print.c
accepts a float, yet I left -no-sse for ARCH=ia32? A better solution
might be to add -msoft-float for targets where the floating point
calling convention doesn't match the UEFI spec. As I'm not familiar
with UEFI on ia32, I didn't make any changes to it.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-06-17 10:07:25 -04:00
Nigel Croxon
8118d08727 Protocol struct/type/define renaming to match spec naming convention.
This patch renames a number of structs, defines, and typedefs to match
the naming convention in the UEFI specification. For example, it renames
DRIVER_BINDING_PROTOCOL (preprocessor GUID define) to
EFI_DRIVER_BINDING_PROTOCOL_GUID, and renames EFI_DRIVER_BINDING (protocol
interface) to EFI_DRIVER_BINDING_PROTOCOL.

The original names are all #defined to the new names for backwards
compatibility, so nothing should be broken.

Included in this patch are renames for all the types/defines for the
following protocols:
EFI_DRIVER_BINDING_PROTOCOL
EFI_COMPONENT_NAME_PROTOCOL
EFI_COMPONENT_NAME2_PROTOCOL
EFI_LOADED_IMAGE_PROTOCOL

If you accept this patch I'll work on adjusting all the other protocols
to match the spec as well, as time allows. Moving to the spec's naming
convention makes the code clearer and improves portability with EDK2.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-05-10 13:07:19 -04:00
Nigel Croxon
63213a7b4e This patch adds protocol definitions (and the corresponding global
EFI_GUID instances) for EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL,
EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL, and
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL, used in the driver
binding search procedure to select which driver to connect when
multiple drivers' Supported() functions indicate support for
the same controller.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-05-03 14:13:43 -04:00
Nigel Croxon
78e4df7c5e The default __GNUC__ C code cannot be used with MinGW as it inserts
implicit calls to _umoddi3 and _udivdi3, which are unavailable when
compiling without the standard libraries (-nostdlib).

This patch addresses this by providing an inline assembly definition
that is an exact conversion of the existing MS one, but for GCC's
AT&T syntax.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-04-18 10:54:32 -04:00
Nigel Croxon
6605c16fc8 This patch simply duplicates the use of /ENTRY option being passed to
the MSVC ARM linker, to specify the entry point, as is already the case
for ia32 and x86_64.

Required to enable the compilation of ARM drivers with MSVC, without
having to manually specify the entry point.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-04-07 08:50:00 -04:00
Nigel Croxon
b5b6a81af0 When copying structs, some compilers (e.g. MSVC for ARM) will use an
implicit call to memcpy(), which can result in an undefined reference.
Use CopyMem() to duplicate struct data instead.
NB: This patch also removes trailing whitespaces in event.c

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-04-04 10:09:51 -04:00
Nigel Croxon
38c57d52fb When compiling in x86_32|Debug mode and choosing not to link with standard
Windows libraries, the MSVC compiler will throw the error:
gnu-efi.lib(print.obj) : error LNK2019: unresolved external symbol __allmul referenced in function _ValueToHex

Adding an explicit cast on the array index, to ensure that is not larger
than 32 bits, appears to fix the problem.

NB: This patch also removes trailing whitespaces, but the only real change
is on line 1253.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-04-04 10:02:40 -04:00
Nigel Croxon
50b883773f -fpic is not needed for MinGW, and MinGW32 issues a warning as a
result, which breaks gnu-efi compilation due to -Werror:
gnu-efi/lib/boxdraw.c:1:0: error: -fpic ignored for target
(all code is position independent) [-Werror]

This patch ensures that -fpic is disabled when MinGW is used.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-29 10:16:21 -04:00
Nigel Croxon
58e6955b44 The following fixes a couple GCC specifics for the ARM platform,
that MSVC compilers will complain about (such as Visual Studio
2015 with ARM target).

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-28 09:00:57 -04:00
Nigel Croxon
dd5c3db93b I also found an issue when compiling setjmp.S using MinGW for both
x86_32 and x86_64, due to the use of ELF specific assembler
extensions (.type setjmp, @function is not comptaible with PE-COFF).

This patch addresses that, by making sure that we use the equivalent
.type definition for MinGW. Note that I only addressed x86_32 and
x86_64 as I'm not aware of MinGW developments for any other archs.

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-25 13:36:53 -04:00
Nigel Croxon
5ff74ecae8 Commit 3dd05c and subsequent ones introduced the use of the GNU
specific __attribute__((__unused__)), which breaks MSVC compilation...

I'll use this as a reminder that gnu-efi is compiled with more than
GNU toolchains, and that contributors might want to be careful about
adding GNU-specific extensions...

This patch does the following:
Create a new eficompiler.h header that sets all compiler-specific
options and extensions
Create a new EFI_UNUSED macro to be used in lieu of
__attribute__((__unused__)) and applies it to the relevant sources
Move the ALIGN(x) macro, previously defined in efisetjmp.h to the new header

Oh, and it also fixes a bunch of trailing whitespaces (because my code
editor is set to do just that by default).

Signed-off-by: Pete Batard <pbatard@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-25 13:32:54 -04:00
Nigel Croxon
1acb1d9dae %d now represents signed decimal, %u represents unsigned decimal.
This patch changes the behavior of Print() slightly. %d is now signed decimal,
and %u (new) is unsigned decimal. Previously, although ValueToString supports
signed decimal printing, %d always read args as UINTxx.

Old behavior:
Print(L"%d\n", -4) -> "4294967292"

New behavior:
Print(L"%d\n, -4) -> "-4"
Print(L"%u\n", -4) -> "4294967292"

If you want to keep complete backwards compatibility you could leave %d alone
and make something else (probably shouldn't be %u to avoid confusion) be
signed decimal. But this way it agrees with the usual use of %d and %u.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-25 10:28:02 -04:00
Nigel Croxon
9b0fe34e20 Add support for EFI_RNG_PROTOCOL to the library.
Signed-off-by: Daniel Roy <danielbroy@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-21 11:37:28 -04:00
Nigel Croxon
e30b880270 Bump zipfile rev to 3.0.4
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-17 09:53:14 -04:00
Nigel Croxon
3b31a5e394 Moved LOADED_IMAGE_PROTOCOL definitions into efiprot.h,
with other protocol definitions.

Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-17 09:50:15 -04:00
Nigel Croxon
8c29617e0b Added definitions for EFI HASH PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-17 09:31:29 -04:00
Nigel Croxon
883702e813 Add definitions for EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-15 14:52:12 -04:00
Nigel Croxon
0f78eb65fe Global GUID for DRIVER_BINDING_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-10 09:32:52 -05:00
Nigel Croxon
533a042d00 Add definitions for EFI_DRIVER_BINDING_PROTOCOL
Signed-off-by: Nathan Blythe <nblythe@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-09 10:10:58 -05:00
Nigel Croxon
76206d9ebf This -Wall -Wextra thing actually caught a real bug.
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:55:26 -05:00
Nigel Croxon
ab6c6ef7f3 This -Wall -Wextra thing actually caught a real bug.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:36:45 -05:00
Nigel Croxon
a213b514a3 Note that there are probably some bugs on some architectures that
I havan't fixed, so somebody will see a build failure from this.
It will most likely be very easy to fix.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:34:17 -05:00
Nigel Croxon
fb8f9bfe52 This makes "-Werror=old-style-declaration" work.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:27:04 -05:00
Nigel Croxon
087d22af38 Don't pass a pointer-to-(LoadedImage *) as a void **;
pass in a real void pointer's address and cast it reasonably.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:24:31 -05:00
Nigel Croxon
1ecae7d44c This makes "-Werror=unused-but-set-variable" work.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 16:19:24 -05:00
Nigel Croxon
3dd05c7b21 This makes "-Werror=unused-parameter" not fail.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-03-03 13:40:08 -05:00
Nigel Croxon
d39106b3e4 Apparently some linkers will just throw caution to the wind and
decide to stick stuff we don't explicitly mention at 0,
no matter what else has already explicitly been located there.
A debian/ubuntu builder noted:

gcc -O0 -g3 -fpic -Wall -fshort-wchar -fno-strict-aliasing \
	-fno-merge-constants -ffreestanding -fno-stack-protector \
	-fno-stack-check --std=c11 -DCONFIG_aarch64 -D__KERNEL__ \
	-I/usr/include/efi/ -I/usr/include/efi/aarch64/ \
	-iquote/«PKGBUILDDIR»/include "-DDEBUGDIR=L\"/\"" \
	-ffreestanding -I/usr/lib/gcc/aarch64-linux-gnu/4.9/include \
	-c -o fakeesrt2.o fakeesrt2.c
ld -nostdlib --warn-common --no-undefined --fatal-warnings -shared \
	-Bsymbolic -L/usr/lib -L/usr/lib --build-id=sha1 \
	/usr/lib/crt0-efi-aarch64.o --defsym=EFI_SUBSYSTEM=0xa \
	-o fakeesrt2.so fakeesrt2.o -lefi -lgnuefi \
	/usr/lib/gcc/aarch64-linux-gnu/4.9/libgcc.a \
	-T elf_aarch64_efi.lds
ld: section .note.gnu.build-id loaded at [00000000,00000023] overlaps section .text loaded at [00000000,0000668f]

This shouldn't be a problem if we explicitly tell it where to put them.

Ard added a patch to do this on Arm and aarch64 targets in 16409cad4cb,
but it needs to be everywhere.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-02-25 09:36:53 -05:00
Nigel Croxon
06db4a2b53 arm: fix linker script for building efi binaries
On arm, the linker script is missing section collection for data and
bss.  This causes some symbols (notably static array symbols) not to
get relocated correctly and the resulting efi binary to crash.  Fix
this by correctly collecting all the data and bss sections.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-02-17 15:32:23 -05:00
Nigel Croxon
333bf05da9 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v2] ARM/AARCH64: define C99 types explicitly when building against
older standard

This adds support for the C99 uintXX_t types when building for
older versions of the standard, like the other architectures
already implement.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2016-01-07 09:40:50 -05:00
Nigel Croxon
e64257b90d From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH] Add ARM .note.gnu.build-id input section to
a dedicated output section

This fixes the builds for ARM and AARCH64, which currently fail at link
time with an error like this:

arm-linux-gnueabi-ld: section .note.gnu.build-id loaded at
   [0000000000000000,0000000000000023] overlaps section .text loaded at
   [0000000000000000,00000000000064cf]

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:38:24 -05:00
Nigel Croxon
d119b0d759 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2] Replace ARM arithmetic support routines
with EDK2 versions.

Replace the incomplete GPL licensed ARM arithmetic support routines
with the ones from the EDK2 project. These cover long long multiplication
and long long logical shift as well.

Also remove the special case for small dividends in DivU64x32: we can
simply let the compiler handle this, and emit calls to the support
routines where appropriate.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:33:02 -05:00
Nigel Croxon
88e3cf9535 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 1/2] Relicense ARM and AARCH64 source files as
both BSD and GPL

This updates the licenses of the files authored by me under lib/arm
and lib/aarch64 to be both 2-clause BSD and GPL v2+

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-12-23 08:19:46 -05:00
Nigel Croxon
1ae8baefca From: Julian Andres Klode <jak@debian.org>
Subject: [PATCH gnu-efi] lib/arm/setjmp.S: Use %function instead of @function

@ is a comment character on ARM, so use % instead.

Nigel adjusted the wordwrap on the copyright header.

Signed-off-by: Julian Andres Klode <jak@degian.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-11-30 08:52:25 -05:00
Nigel Croxon
9ce3546d05 From: Pete Batard <pete@akeo.ie>
Subject: [PATCH] Fix MSVC breakage due to GNU align extensions in setjmp

* __attribute__((__aligned__(x))), which is used in setjmp, is GNU only => use a macro instead

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-23 10:03:31 -04:00
Nigel Croxon
0b5f181a36 From: Pete Batard <pete@akeo.ie>
Date: Wed, 16 Sep 2015 18:26:28 +0100
Subject: [PATCH] Fix VS2015 warnings

* Currently, Visual Studio 2015 generates a lot of warnings such as:
  gnu-efi\inc\efipciio.h(7): warning C4091: 'typedef ': ignored on left of '_EFI_PCI_IO' when no variable is declared
* To address this, gnu-efi should define the INTERFACE_DECL() for MS compilers as it does for GNU

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-09-17 08:22:39 -04:00
Nigel Croxon
fbcdcf56e8 Add the missing URI device path to the unions.
Signed-off-by: Gary Ching-Pang Lin <chinpang@gmail.com>
SIgned-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-19 07:28:45 -04:00
Nigel Croxon
af174b874e version 3.0.3 2015-08-17 16:06:47 -04:00
Nigel Croxon
ad7f0d4ba2 From: Gary Ching-Pang Lin <chingpang@gmail.com>
Date: Mon, 17 Aug 2015 17:00:11 +0800
Subject: [PATCH] Add URI Device Path

Add the definition of URI Device Path according to UEFI 2.4c.

Signed-off-by: Gary Ching-Pang Lin <chingpang@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
2015-08-17 16:00:33 -04:00
Nigel Croxon
11a459ba96 This patch makes the following symbols (relatively) consistent between
all of our linker scripts:

_text
_etext
_text_size
_data
_edata
_data_size

There are various things that are slightly different (positions of
.rela*, .dynamic, and similar in relation to .data), but _text and _data
are now always at the beginning of their respective sections with regard
to how a debuger would reference the debug info, and _etext and _edata
are now always extant and guaranteed to be after any of the respective
kind of data the debugger would look for in that section.

This also adds an application example of how it might be used, and a
makefile target for %.efi.debug which will generate a separate debuginfo
file for that example.

This also enables debugging by default (i.e. -g is in CFLAGS) and adds
.note.gnu.build-id sections to our .so files (i.e. --build-id=sha1 is in
LDFLAGS).

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-07-16 12:31:23 -04:00
Nigel Croxon
aac405cc66 Updated Changelog
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:49:40 -04:00
Nigel Croxon
37d7bee82a Added some missing error code descriptions
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:38:39 -04:00
Nigel Croxon
dae0b4b0b0 Turns out we actually need setjmp in one of gnu-efi's prominent
users, and it seems to make more sense to put it here than in
the application.

All of these are derived from the Tiano code, but I re-wrote the
x86_64 one because we use the ELF psABI calling conventions instead
of the MS ABI calling conventions.  Which is to say you probably
shouldn't setjmp()/longjmp() between functions with EFIAPI (aka
__attribute__((ms_abi))) and those without.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-05-14 12:20:51 -04:00
Nigel Croxon
b5a8e93cec Bump version to 3.0.2
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-04-10 08:49:50 -04:00
Nigel Croxon
01c9f11ed5 Fix ARM32 and AARCH64 builds
Without these added into SUBDIRS the initplat.c compilation will fail.

Signed-off-by: Koen Kooi <koen.kooi@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-04-10 08:46:40 -04:00
Nigel Croxon
dada63fd3d [PATCH] _SPrint: fix NULL termination
maxlen is the maximum string length not the buffer size.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-03-23 10:41:43 -04:00
Nigel Croxon
ce7098fb52 Enable out-of-tree building
This patch enables building gnu-efi outside of the source tree.
That in turn enables building for multiple architectures in parallel.

The build directory is controlled by the OBJDIR make variable.  It
defaults to the value of ARCH, and can be overridden from the command
line.

This patch also cleans up some doubled slashes between INSTALLROOT
and PREFIX.

Signed-off-by: Jonathan Boeing <jonathan.n.boeing@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-02-19 11:22:45 -05:00
Nigel Croxon
f64cef2627 Since we're keeping this in git, it'd be nice not to see a bunch
of make targets in 'status'

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-06 15:49:50 -05:00
Nigel Croxon
322efb6b21 version number changed from VERSION = 3.0u to VERSION = 3.0.1
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-05 13:20:43 -05:00
Nigel Croxon
09027207f7 From: Pete Batard <pete@akeo.ie>
Date: Wed, 10 Dec 2014 21:08:34 +0000
Subject: [PATCH] fixes for MSVC compilation

These fixes are needed to address the following error and warnings when compiling the library part
using Visual Studio 2013 Community Edition (as in https://github.com/pbatard/uefi-simple):
* "lib\x86_64\math.c(49): error C4235: nonstandard extension used : '_asm' keyword not supported
  on this architecture"
* "lib\print.c(98): error C2059: syntax error : '('" due to placement of EFIAPI macro
* "lib\cmdline.c(94): warning C4090: 'function' : different 'const' qualifiers"
* "lib\smbios.c(25): warning C4068: unknown pragma"
* Also update macro definitions in "inc\<arch>\efibind.h" for MSVC

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2015-01-05 13:13:22 -05:00
Nigel Croxon
15805ff38b Add README.git file. Instructions on how to archive.
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 14:23:21 -05:00
Nigel Croxon
b868aa7566 This patch makes generating releases from git a very simple process; you
simply edit the makefile's "VERSION" line to the new version, commit
that as its own commit, and do: "make test-archive".  That'll make a
file in the current directory gnu-efi-$VERSION.tar.bz2 , with its top
level directory gnu-efi-$VERSION/ and the source tree under that.

Once you've tested that and you're sure it's what you want to release,
you do "make archive", which will tag a release in git and generate a
final tarball from it.  You then push to the archive, being sure to
include the tag:

git push origin master:master --tags

And upload the archive wherever it's supposed to go.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 13:26:45 -05:00
Nigel Croxon
530d68ba19 The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 10:09:50 -05:00
Nigel Croxon
00bd66ef46 FreeBSD's binutils doesn't have "-j <glob>" support, so we need to
include non-globbed versions of .rel/.rela individually.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Bill Paul <wpaul@windriver.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 14:33:09 -05:00
Nigel Croxon
56eb64d3c0 Right now we wind up trying to build gnuefi/.o from a source file that's
an empty string.  This is caused by the macros trying to generate
install rules, but there's no real reason to have all that anyway.  So
just have some static install rules that are simpler and don't generate
stuff on the fly.

Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 14:27:14 -05:00
Nigel Croxon
65e28a90a7 Add current OsIndications values.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com
2014-11-24 12:17:45 -05:00
Nigel Croxon
be231055ce Add the QueryVariableInfo() API.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 12:15:34 -05:00
Nigel Croxon
60efb7a293 Add the capsule API.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-24 12:13:23 -05:00
Nigel Croxon
ef08b655d1 Fix Table Header misspelling. Change from EFI_TABLE_HEARDER to
EFI_TABLE_HEADER.

Signed-Off-By: Nigel Croxon <nigel.croxon@hp.com>
2014-11-17 16:08:00 -05:00
Nigel Croxon
370cce41da If CROSS_COMPILE is set, ignore the ARCH value supplied on the
command line and use the target machine of the cross compiler.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-06 14:41:40 -05:00
Nigel Croxon
d32fb84543 Allow reuse of this file beyond GPL compatible software,
update the license of crt0-efi-aarch64.S to dual 2-clause BSD/GPLv2+.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-06 14:30:03 -05:00
Nigel Croxon
aa1df67f48 Add the missing Variable attributes
From: Jeremy Compostella <jeremy.compostella@intel.com>
Date: Mon, 13 Oct 2014 17:50:50 +0200
Subject: [PATCH] Add the missing Variable attributes

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-10-21 11:08:47 -04:00
Nigel Croxon
5706dff093 From: David Decotigny <decot@googlers.com>
Date: Mon, 25 Aug 2014 13:28:49 -0700
Subject: [PATCH] document that binutils >= 2.24 needed.

commit ac983081 "Add support for non-PE/COFF capable objcopy" depends
on objcopy accepting wildcards for the section names. This feature is
available only with binutils >= 2.24 (binutils 2e62b7218 "PR
binutils/15033").

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-26 10:54:22 -04:00
Nigel Croxon
6c10e225bc From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 18:19:16 -0700
Subject: [PATCH 5/5] allow to use external stdarg.h

in cases we use gnu-efi together with other libs that define stdarg.h,
break the tie by telling gnu-efi to use that stdarg.h .

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-25 08:51:23 -04:00
Nigel Croxon
16d65c0669 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Mon, 11 Aug 2014 15:39:16 +0200
Subject: [PATCH] Add support for 32-bit ARM

This adds support for 32-bit ARM using an approach similar to the one used for
64-bit ARM (AArch64), i.e., it does not rely on an objcopy that is aware of EFI
or PE/COFF, but lays out the entire PE/COFF header using the assembler.

In the 32-bit ARM case (which does not have a division instruction), some code
has been imported from the Linux kernel to perform the division operations in
software.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-19 12:07:00 -04:00
Nigel Croxon
b28143d4fb Updated Changelog
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:54:19 -04:00
Nigel Croxon
1525190354 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 18:16:59 +0200
Subject: [PATCH 4/4] Add support for 64-bit ARM (AArch64)

This adds support for 64-bit ARM (AArch64) environments. Since there is no
EFI-capable objcopy for this platform, this contains a manually laid out
PE/COFF header using the assembler.

In addition, it includes the relocation bits, some string functions that GCC
assumes are available and other glue to hold it all together.

This can be cross built using

	make CROSS_COMPILE=aarch64-linux-gnu-

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:35:09 -04:00
Nigel Croxon
ac98308152 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 17:53:42 +0200
Subject: [PATCH 3/4] Add support for non-PE/COFF capable objcopy

Introduce HAVE_EFI_OBJCOPY and set it if objcopy for $ARCH support PE/COOF and
EFI, i.e., it supports --target efi-[app|bsdrv|rtdrv] options. Use it to decide
whether to invoke objcopy with those options or use the linker to populate the
PE/COFF header.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:32:26 -04:00
Nigel Croxon
fb063f0f65 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 17:37:36 +0200
Subject: [PATCH 2/4] Add support for cross compilation

This changes the logic that defines ARCH (and HOSTARCH) to take CROSS_COMPILE
into account. Also, $prefix is not assigned, so that the default will be what
is on the path rather than hardcoded in /usr/bin.

This results in the build doing the right thing if CROSS_COMPILE is set in the
environment and no ARCH or prefix options are passed to make, aligning it with
most other CROSS_COMPILE compatible projects.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:26:38 -04:00
Nigel Croxon
7a98d83fc3 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Fri, 8 Aug 2014 16:50:45 +0200
Subject: [PATCH 1/4] Restrict GNU_EFI_USE_MS_ABI GCC version test to x86_64

The version test only applies to x86_64 builds, so no need to do it
for other archs.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:25:03 -04:00
Nigel Croxon
f42974dd9a From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:42:23 -0700
Subject: [PATCH 4/4] Use Shell protocols to retrieve argc/argv, when
 available.

New header files efishellintf.h efishellparm.h are coming from EDK
II, initial location and license at top of files. Only modifications:
 - efishellintf.h: s/EFI_FILE_PROTOCOL/EFI_FILE/ + expand BITx macros (1<<x)
 - efishellparm.h: typedef VOID *SHELL_FILE_HANDLE to avoid including
   ShellBase.h
 - both: removed extern EFI_GUID variable decls

This also adds apps/t8.c, a simple demo.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:21:16 -04:00
Nigel Croxon
a61fa058e9 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:41:52 -0700
Subject: [PATCH 3/4] document format of LoadedImage::LoadOptions data

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:17:32 -04:00
Nigel Croxon
2f440200c8 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:39:37 -0700
Subject: [PATCH 2/4] Use OpenProtocol instead of HandleProtocol

UEFI 2.x recommends OpenProtocol instead of HandleProtocol.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:15:59 -04:00
Nigel Croxon
7f173da1e5 From: David Decotigny <decot@googlers.com>
Date: Thu, 31 Jul 2014 13:30:07 -0700
Subject: [PATCH 1/4] move cmdline parser to its own file

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-08-08 15:14:26 -04:00
Nigel Croxon
0ad8fb87cb From: David Decotigny <decot@googlers.com>
Date: Mon, 28 Jul 2014 21:28:50 -0700
Subject: [PATCH 3/3] make cmdline parsing a 1st class citizen

Refactor ParseCmdline and apps/Alloc+FreePages to factorize
boilerplate and move the new parser to the main API.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-07-30 15:06:36 -04:00
Nigel Croxon
ff7ec964f2 From: David Decotigny <decot@googlers.com>
Date: Mon, 28 Jul 2014 21:00:52 -0700
Subject: [PATCH 2/3] Avoid buffer overflow while parsing the cmdline args

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-07-30 15:05:28 -04:00
Nigel Croxon
8d86ee202a From: David Decotigny <decot@googlers.com>
Date: Mon, 28 Jul 2014 21:01:35 -0700
Subject: [PATCH 1/3] Fix cmdline parser

The cmdline parser would not return the correct number of args, would
allocate one too many. Also make it clear from the declaration that we
expect a suitably lare argv.

Signed-off-by: David Decotigny <decot@googlers.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-07-30 15:04:44 -04:00
Nigel Croxon
1ec094bfaf From: Julian Klode <julian.klode@gmail.com>
Date: Mon, 21 Jul 2014 14:26:23 -0400
Subject: [PATCH] inc/efistdarg.h: Use gcc builtins instead of stdarg.h or broken stubs

We cannot use stdarg.h, as this breaks applications compiling
with -nostdinc because those will not find the header.
We also cannot use the stubs, as they just produce broken code,
as seen in the gummiboot 45-1 Debian release.

Signed-off-by: Julian Klode <julian.klode@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-07-23 09:54:25 -04:00
Nigel Croxon
6caab22f23 From: Laszlo Ersek <lersek@redhat.com>
Date: Mon, 2 Jun 2014 23:26:48 +0200
Subject: [PATCH] always observe EFIAPI calling convention when calling
 STO.SetAttribute

We have to consider the following cases wrt. the PRINT_STATE.Output and
PRINT_STATE.SetAttr EFIAPI function pointers, especially when building for
x86_64 with gcc:

(1) The compiler is new enough, and EFIAPI actually ensures the Microsoft
    calling convention. In this case everything happens to work fine even
    if we forget uefi_call_wrapper(), because the wrapper would expand to
    a normal C function call anyway.

(2) Otherwise (ie. gcc is old), EFIAPI expands to nothing, and we must
    take into account the called function's origin:

  (2a) If the callee that is declared EFIAPI is *defined* inside gnu-efi,
       then EFIAPI means nothing for the callee too, so caller and callee
       only understand each other if the caller intentionally omits
       uefi_call_wrapper().

  (2b) If the callee that is declared EFIAPI is defined by the platform
       UEFI implementation, then the caller *must* use
       uefi_call_wrapper().

The PRINT_STATE.Output EFIAPI function pointer is dereferenced correctly:
the PFLUSH() distinguishes cases (2a) from (2b) by using IsLocalPrint().

However use of the PRINT_STATE.SetAttr EFIAPI function pointer is not
always correct:

- The PSETATTR() helper function always relies on the wrapper (case (2b)).
  This is correct, because PRINT_STATE.SetAttr always points to a
  platform-provided function.

- The DbgPrint() function contains two incorrect calls: they mistakenly
  assume case (2a) (or case (1)), even though the pointer always points to
  a platform function, implying (2b). (The error is masked in case (1).)
  Fix them.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-06-19 10:39:23 -04:00
Nigel Croxon
ecfd1ded9a Add VPoolPrint Function
Equivalent to PoolPrint but using a va_list parameter

Signed-off-by: Sylvain Chouleur <sylvain.chouleur@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-06-10 13:02:06 -04:00
Nigel Croxon
f16d93f3b9 Revert "The prototype of DbgPrint() is incorrect, at the end of "inc/efidebug.h"."
A problem was found compiling on GCC 4.8.

This reverts commit 644898eabc.
2014-05-16 11:33:51 -04:00
Nigel Croxon
644898eabc The prototype of DbgPrint() is incorrect, at the end of "inc/efidebug.h".
Consequently, when your program calls DbgPrint() via the DEBUG() macro,
it fails to set up the stack correctly (it does not pass the arguments
through the ellipsis (...) according to the EFIAPI calling convention).
However, va_start() inside DbgPrint() *assumes* that stack.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-05-14 09:12:52 -04:00
Nigel Croxon
8921ba2fc5 Cleaned up compile warnings.
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 18:49:23 -04:00
Nigel Croxon
42cca551db Module lib/ParseCmdLine.c has errors, it incorrectly mixes "char" and "CHAR16"
and uses a pointer to argv[] like it's argv[]. The compiler only issues
warnings though. Here is a patch to remove compiler warnings and make the
code behave.

Signed-off-by: Bernard Burette <bub75@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 14:04:11 -04:00
Nigel Croxon
4e8460f1ae Here is a very small patch to remove a compiler warning when processing lib/smbios.c.
Signed-off-by: Bernard Burette <bub75@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 13:53:03 -04:00
Nigel Croxon
6a0875ca2f Here is a very small patch to remove compiler warning in function
"LibLocateHandleByDiskSignature()" because the "Start" variable is
give a value which is not used.

Signed-off-by: Bernard Burette <bub75@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 13:45:16 -04:00
Nigel Croxon
d5f35dfb80 Here is a very small patch to remove *~ files in include diretory.
Signed-off-by: Bernard Burette <bub75@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 13:40:29 -04:00
Nigel Croxon
1a04669a7b Here is a patch for "DevicePathToStr()" to display device path according to UEFI 2 specification.
The path is in the two files inc/efidevp.h and lib/dpath.c.

It also add the Sata device path and removes the "/?" path for unknown device paths.

Signed-off-by: Bernard Burette <bub75@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-14 12:45:57 -04:00
Nigel Croxon
3c62e78556 Removed GPL code setjmp_ia32.S, setjmp_ia64.S, setjmp_x86_64.S
Not used anymore.

   Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-04-01 10:26:44 -04:00
Nigel Croxon
f9baa4f622 Remove incumbent GPL 'debian' subdiretory.
Update ChangeLog

Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-03-31 08:37:56 -04:00
Nigel Croxon
9ae56e03e7 Add support for the simple pointer and absolute pointer protocols
Signed-off-by: John Cronin <johncronin@users.sf.net>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-03-17 12:26:59 -04:00
Nigel Croxon
3cbe61fa41 From: Sylvain Gault <sylvain.gault@gmail.com>
Date: Fri, 21 Feb 2014 06:03:00 +0100
Subject: [PATCH] Makefile: Don't clean what doesn't already exists

Trying to recurse into subdirectories of object files may lead to an
error if the directory doesn't exist. Even when cleaning.

Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-03-14 13:49:41 -04:00
Nigel Croxon
06744d6927 From: Sylvain Gault <sylvain.gault@gmail.com>
Date: Wed, 19 Feb 2014 05:18:14 +0100
Subject: [PATCH] make install: Don't overwrite up-to-date files

make install used to copy files unconditionnally to their destination.
However, if the destination is used by another Makefile, it will always
see modified files. "install" target now only update the files when they
need to.

Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-03-14 13:47:39 -04:00
Nigel Croxon
b32a578573 Patch GNU-EFI to remove the ELILO code
Signed-off-by: Jerry Hoemann <jerry.hoemann@hp.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-02-13 16:32:48 -05:00
Nigel Croxon
ab54e2b40e Initialize Status before calling GrowBuffer()
Status must be initialized before calling GrowBuffer() as it may
otherwise be uninitialized or set to EFI_BUFFER_TOO_SMALL by other
functions.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-02-13 14:05:10 -05:00
Nigel Croxon
28cfdd48b9 These changes allow manually overridden SRCDIR (current source
directory) and TOPDIR (top of source tree) to separate the
build directory from the source tree.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-01-23 10:45:59 -05:00
Nigel Croxon
7bcb832680 compilation: fix uninitialized variables warning
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-01-16 10:46:15 -05:00
Nigel Croxon
9b8f92e3a1 Update Changelog file 2014-01-13 09:59:08 -05:00
Nigel Croxon
107c806352 Implement VSPrint function, prints a formatted unicode string to a buffer.
Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
    Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-01-13 08:48:45 -05:00
Nigel Croxon
5f162133fe Created lib/argify.c and inc/argify.h containing the function argify.
It contains verbatim copy of the comment at beginning of file from
elilo.
(there was no COPYING file in the elilo source that the comment refers
to.)

    Signed-off-by: Jerry Hoemann <jerry.hoemann@hp.com>
    Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-01-10 11:36:29 -05:00
Nigel Croxon
aeee09cc6a The information needed is not really the host architecture as given by
the kernel arch. The information actually needed is the default target
of gcc.

Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
Signed-off-by: Sylvain Gault <sylvain.gault@gmail.com>
2014-01-08 16:12:59 -05:00
Nigel Croxon
27cdb74865 Added support for SetVariable to store volatile variable,
and SetNVVariable to store non volatile variable.

Signed-off-by: Sylvain Chouleur <sylvain.chouleur@gmail.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2013-10-11 11:17:43 -04:00
Nigel Croxon
5f765e9208 Atoi needs to have consistent declaration/definition. 2013-10-07 13:29:30 -04:00
croxon
94009cecd7 if you have a function that takes const arguments and then
e.g. tries to copy StrCmp, gcc will give you warnings about those
calls, and the warnings are right.  These clutter up other things you
might miss that you should be more concerned about.

You could work around it through vigorous typecasting to non-const
types, but why should you have to?  All of these functions are
rigorously defined as not changing their input - it is const, and should
be marked as such.

Signed-off-by: Peter Jones <pjones@redhat.com>

 Please enter the commit message for your changes. Lines starting
2013-10-02 17:19:55 -04:00
croxon
e7a2d1299b Added two simple applications to allocate/free memory at EFI.
Used to test/find memory fragmentation issues linux.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hp.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2013-10-02 14:46:03 -04:00
Nigel Croxon
8f5ba0e4fd Sample boot service driver.
Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-25 08:53:58 -04:00
Nigel Croxon
9d6b441ec5 be more pedantic when linking
Don't allow duplicate symbols, abort upon first error.
also make sure the linker script comes last for apps.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-25 08:47:03 -04:00
Nigel Croxon
401d5b7194 fix compilation on x86_64 without HAVE_USE_MS_ABI
make -C apps would fail on tcc.c because uefi_call_wrapper() doesn't
deal correctly with efi_call0-type invocation. Fixed by this patch.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-25 08:45:44 -04:00
root
8cb1e8771f Update Changelog for non-git users 2013-06-12 11:22:56 -04:00
Nigel Croxon
05e597056b Fix typo when disabling mno-mmx
Signed-Off-By: Nigel Croxon <nigel.croxon@hp.com>
2013-06-12 10:53:15 -04:00
Nigel Croxon
0f42f7579c 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.

Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 10:38:10 -04:00
Nigel Croxon
525455a9ea bug in make 3.82 expand to odd values
Some Makefiles tickle a bug in make 3.82 that cause libefi.a
and libgnuefi.a dependencies to expand to the odd values:

libefi.a: boxdraw.o) smbios.o) ...
libgnuefi.a(reloc_x86_64.o:

The patch replaces libgnuefi.a($(OBJS)) & libefi.a($(OBJS))
with an equivalent expansion that should work with any make
that supports $(patsubst).
2013-06-12 10:29:40 -04:00
Nigel Croxon
6e17af6dd7 support .text.* sections on x86_64
Group them in .text. Also add vague linkage sections in .text.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-12 09:53:01 -04:00
Nigel Croxon
f00a8a2783 cleanup and fix Make.defaults
Reorder variables in Make.defaults so that they are grouped by
functions. Also fixed ifeq (x,y) to have required syntax and make it
work for ARCH amd64->x86_64 renaming on BSD. Also provides top-level
Makefile with a "mkvars" target that displays effective variables.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-12 09:51:36 -04:00
Nigel Croxon
6e8db87995 automatically determine number of uefi_call_wrapper() args on x86_64
Instead of asking developers to explicitly pass the number of
parameters to the functions that get called, we determine them
automatically at preprocessing time. This should result in more
robust code.

Argument va_num is now ignored in x86_64 code, both with and
without HAVE_USE_MS_ABI.

Credits to the macro magic given in the comments.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-12 09:47:16 -04:00
Nigel Croxon
c0b8d974a6 fix parameter-passing corruption on x86_64 for >= 5 args
On x86_64 without HAVE_USE_MS_ABI support, uefi_call_wrapper() is a
variadic function. Parameters >=5 are copied to the stack and, when
passed small immediate values (and possibly other parameters), gcc
would emit a movl instruction before calling uefi_call_wrapper(). As a
result, only the lower 32b of these stack values are significant, the
upper 32b potentially contain garbage. Considering that
uefi_call_wrapper() assumes these arguments are clean 64b values
before calling the efi_callX() trampolines, the latter may be passed
garbage. This makes calling functions like
EFI_PCI_IO_PROTOCOL.Mem.Read()/Write() or BS->OpenProtocol() quite
unreliable.

This patch fixes this by turning uefi_call_wrapper() into a macro that
allows to expose the efi_callX() trampoline signatures to the callers,
so that gcc can know upfront that it has to pass all arguments to
efi_callX() as clean 64b values (eg. movq for immediates). The
_cast64_efi_callX macros are just here to avoid a gcc warning, they do
nothing otherwise.

Signed-off-by: David Decotigny <decot@googlers.com>
2013-06-12 09:38:10 -04:00
noxorc
0ca0dacb59 - 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 <link.h> from reloc_ia32.c and reloc_x86_64.c (since
with the previous changes it's not needed anymore).

- Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so
that we know the types will always be defined properly, in case you build on a
system where <elf.h> 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)
2013-05-15 15:26:16 -04:00
noxorc
8e25267615 Add the definitions for TCP, UDP and IP, for both IPv4 and IPv6. 2013-05-08 16:29:45 -04:00
noxorc
f9d9f33b7a Add the definitions for TCP, UDP and IP, for both IPv4 and IPv6. 2013-05-08 16:28:34 -04:00
croxon
2aa8482961 In preparation for adding the networking protocol definitions, add the service binding protocol. 2013-05-02 13:16:30 -04:00
noxorc
acea2e9ad8 version T 2013-02-21 10:45:36 -05:00
noxorc
1d931b46c0 version T 2013-02-21 10:44:23 -05:00
327 changed files with 21641 additions and 5362 deletions

13
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
directory: "/"
schedule:
interval: "weekly"

98
.github/workflows/linux-gcc-musl.yml vendored Normal file
View File

@ -0,0 +1,98 @@
name: Linux, gcc+musl
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64]
include:
- arch: x64
dir: x86_64
musl: musl-dev
cross_compile: x86_64-linux-musl-
steps:
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.musl }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
mkdir -p $HOME/.local/bin
for i in ld as ar ranlib objcopy; do
ln -s /usr/bin/${i} $HOME/.local/bin/${{ matrix.cross_compile }}${i};
done
make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }}
- name: Generate binary information
run: readelf -a ./${{ matrix.dir }}/apps/ctors_dtors_priority_test.so > ./${{ matrix.dir }}/apps/readelf.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: |
./${{ matrix.dir }}/apps/*
tests:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
arch: [x64]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

140
.github/workflows/linux-gcc.yml vendored Normal file
View File

@ -0,0 +1,140 @@
name: Linux, gcc
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ia32, x64, aa64, arm, riscv64, mips64]
include:
- arch: ia32
dir: ia32
gcc: multilib
cross_compile:
- arch: x64
dir: x86_64
gcc: multilib
cross_compile:
- arch: aa64
dir: aarch64
gcc: aarch64-linux-gnu
cross_compile: aarch64-linux-gnu-
- arch: arm
dir: arm
gcc: arm-linux-gnueabihf
cross_compile: arm-linux-gnueabihf-
- arch: riscv64
dir: riscv64
gcc: riscv64-linux-gnu
cross_compile: riscv64-linux-gnu-
- arch: mips64
dir: mips64el
gcc: mips64el-linux-gnuabi64
cross_compile: mips64el-linux-gnuabi64-
# - arch: loongarch64
# dir: loongarch64
# gcc: loongarch64-linux-gnu
# cross_compile: loongarch64-linux-gnu-
steps:
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install gcc-${{ matrix.gcc }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }}
- name: Generate binary information
run: readelf -a ./${{ matrix.dir }}/apps/ctors_dtors_priority_test.so > ./${{ matrix.dir }}/apps/readelf.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: |
./${{ matrix.dir }}/apps/*
tests:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
arch: [x64, ia32, aa64, arm, riscv64]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
- arch: aa64
pkg: qemu-system-arm
qemu_arch: aarch64
qemu_opts: -M virt -cpu cortex-a57
fw_base: AAVMF
- arch: arm
pkg: qemu-system-arm
qemu_arch: arm
qemu_opts: -M virt -cpu cortex-a15
fw_base: AAVMF
- arch: riscv64
pkg: qemu-system-riscv64
qemu_arch: riscv64
qemu_opts: -M virt,pflash0=pflash0
fw_base: QEMU_EFI
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
if [ "$UEFI_ARCH" = "riscv64" ]; then\
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -blockdev node-name=pflash0,driver=file,read-only=on,filename=${{ matrix.fw_base }}.fd -drive format=raw,file=fat:rw:image,id=drv1 -device virtio-blk-device,drive=drv1"
else \
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image"
fi
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

92
.github/workflows/linux-llvm.yml vendored Normal file
View File

@ -0,0 +1,92 @@
name: Linux, LLVM
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64]
include:
- arch: x64
dir: x86_64
gcc: multilib
cross_compile:
steps:
- name: Install toolchain
run: |
sudo apt-get update
sudo apt-get install gcc-${{ matrix.gcc }} clang lld
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }} CC=clang LD=ld.lld
- name: Generate binary information
run: readelf -a ./${{ matrix.dir }}/apps/ctors_dtors_priority_test.so > ./${{ matrix.dir }}/apps/readelf.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: |
./${{ matrix.dir }}/apps/*
tests:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
arch: [x64]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

96
.github/workflows/linux-mingw.yml vendored Normal file
View File

@ -0,0 +1,96 @@
name: Linux, MinGW
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
dir: x86_64
pkg: gcc-mingw-w64-x86-64
tuple: x86_64-w64-mingw32-
- arch: ia32
dir: ia32
pkg: gcc-mingw-w64-i686
tuple: i686-w64-mingw32-
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install gcc toolchain
run: sudo apt install ${{ matrix.pkg }}
- name: Build
run: make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.tuple }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: ./${{ matrix.dir }}/apps/*.efi
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image -nodefaults -nographic -serial stdio -net none"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

121
.github/workflows/macos-gcc.yml vendored Normal file
View File

@ -0,0 +1,121 @@
name: macOS, gcc
on: [push, pull_request]
jobs:
build:
runs-on: macos-latest
strategy:
matrix:
arch: [ia32, x64, aa64, arm]
include:
- arch: ia32
dir: ia32
cross_compile: i686-elf-
toolchain: i686-elf-gcc
- arch: x64
dir: x86_64
cross_compile: x86_64-elf-
toolchain: x86_64-elf-gcc
- arch: aa64
dir: aarch64
cross_compile: aarch64-elf-
toolchain: aarch64-elf-gcc
- arch: arm
dir: arm
cross_compile: arm-none-eabi-
toolchain: arm-none-eabi-gcc
steps:
- name: Install toolchain
run: |
brew install ${{ matrix.toolchain }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: |
make ARCH=${{ matrix.arch }} CROSS_COMPILE=${{ matrix.cross_compile }}
- name: Generate binary information
run: ${{ matrix.cross_compile }}readelf -a ./${{ matrix.dir }}/apps/ctors_dtors_priority_test.so > ./${{ matrix.dir }}/apps/readelf.txt
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: |
./${{ matrix.dir }}/apps/*
tests:
runs-on: ubuntu-24.04
needs: build
strategy:
matrix:
arch: [ia32, x64, aa64, arm]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
- arch: aa64
pkg: qemu-system-arm
qemu_arch: aarch64
qemu_opts: -M virt -cpu cortex-a57
fw_base: AAVMF
- arch: arm
pkg: qemu-system-arm
qemu_arch: arm
qemu_opts: -M virt -cpu cortex-a15
fw_base: AAVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -nodefaults -nographic -serial stdio -net none -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

107
.github/workflows/windows-mingw.yml vendored Normal file
View File

@ -0,0 +1,107 @@
name: Windows, MinGW
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
dir: x86_64
sys: mingw64
env: x86_64
- arch: ia32
dir: ia32
sys: mingw32
env: i686
defaults:
run:
shell: msys2 {0}
steps:
- name: Install MinGW
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: >-
mingw-w64-${{ matrix.env }}-toolchain
base-devel
git
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build
run: make
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}
path: ./${{ matrix.dir }}/apps/*.efi
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
arch: [x64, ia32]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image -nodefaults -nographic -serial stdio -net none"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

102
.github/workflows/windows-vs2022.yml vendored Normal file
View File

@ -0,0 +1,102 @@
name: Windows, VS2022
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
arch: [x64, ia32, aa64, arm]
conf: [Debug, Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Build
shell: cmd
run: msbuild ./gnu-efi.sln /m /p:Configuration=${{ matrix.conf }},Platform=${{ matrix.arch }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.conf == 'Release' }}
with:
name: ${{ matrix.arch }}
path: ./${{ matrix.arch }}/${{ matrix.conf }}/*.efi
tests:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
arch: [x64, ia32, aa64, arm]
include:
- arch: x64
pkg: qemu-system-x86
qemu_arch: x86_64
qemu_opts: -M q35
fw_base: OVMF
- arch: ia32
pkg: qemu-system-x86
qemu_arch: i386
qemu_opts: -M pc
fw_base: OVMF
- arch: aa64
pkg: qemu-system-arm
qemu_arch: aarch64
qemu_opts: -M virt -cpu cortex-a57
fw_base: AAVMF
- arch: arm
pkg: qemu-system-arm
qemu_arch: arm
qemu_opts: -M virt -cpu cortex-a15
fw_base: AAVMF
steps:
- name: Set up Linux environment
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install ${{ matrix.pkg }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.arch }}
- name: Download UEFI firmware
run: |
fw_arch=$(echo ${{ matrix.arch }} | tr a-z A-Z)
fw_zip=${{ matrix.fw_base }}-${fw_arch}.zip
curl -O https://efi.akeo.ie/${{ matrix.fw_base }}/${fw_zip}
7z x ${fw_zip}
rm ${fw_zip}
- name: Download UEFI Shell
run: |
curl -L -O https://github.com/pbatard/UEFI-Shell/releases/download/23H2/UEFI-Shell-2.2-23H2-RELEASE.iso
mkdir ./image
7z x -o./image *.iso
rm *.iso
- name: Run tests
run: |
export UEFI_ARCH=${{ matrix.arch }}
export UEFI_DIR=./image
export QEMU_CMD="qemu-system-${{ matrix.qemu_arch }} ${{ matrix.qemu_opts }} -L . -drive if=pflash,format=raw,unit=0,file=${{ matrix.fw_base }}.fd,readonly=on -drive format=raw,file=fat:rw:image -nodefaults -nographic -serial stdio -net none"
./tests/gen_tests.sh ./tests/test_list.txt
./tests/run_tests.sh

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
*.efi
*.efi.debug
*.o
*.a
*.so
*.tar.*
*.tar

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE}</ProjectGuid>
<RootNamespace>AllocPages</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>AllocPages</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\AllocPages.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\AllocPages.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{627A0AFB-B9A9-4FC9-9D6B-4D9E227A0666}</ProjectGuid>
<RootNamespace>FreePages</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>FreePages</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\FreePages.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\FreePages.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

45
.vs/apps/_gen_vcxproj.ps1 Normal file
View File

@ -0,0 +1,45 @@
$Source = "AllocPages"
$EfiArchName = @{
"x64" = "x64"
"Win32" = "ia32"
"ARM64" = "aa64"
"ARM" = "arm"
}
$i = 0
$sln = (Get-Content ..\..\gnu-efi.sln) -as [collections.arraylist]
Get-ChildItem "..\..\apps" -Filter *.c |
Foreach-Object {
if ($_.BaseName -ne $Source) {
$guid = [guid]::NewGuid().ToString().ToUpper()
Write-Host $guid = $_.BaseName
copy "$Source.vcxproj" "$($_.BaseName).vcxproj"
copy "$Source.vcxproj.filters" "$($_.BaseName).vcxproj.filters"
copy "$Source.vcxproj.user" "$($_.BaseName).vcxproj.user"
(Get-Content "$($_.BaseName).vcxproj").Replace("DFA0BA98-D0BA-4176-9A34-B5BA6355B1DE", $guid).Replace($Source, $_.BaseName) | Set-Content "$($_.BaseName).vcxproj"
(Get-Content "$($_.BaseName).vcxproj.filters").Replace($Source, $_.BaseName) | Set-Content "$($_.BaseName).vcxproj.filters"
$line = 14 + 5 * $i
$sln.insert($line,"Project(""{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"") = ""$($_.BaseName)"", "".vs\apps\$($_.BaseName).vcxproj"", ""{$guid}""")
$line++
$sln.insert($line," ProjectSection(ProjectDependencies) = postProject")
$line++
$sln.insert($line," {3135D563-9596-4584-9ED6-616ADEC52974} = {3135D563-9596-4584-9ED6-616ADEC52974}")
$line++
$sln.insert($line," EndProjectSection")
$line++
$sln.insert($line,"EndProject")
$line++
$line += 44 + 16 * $i
foreach ($Build in @("Debug", "Release")) {
foreach ($Arch in @("ARM64", "ARM", "Win32", "x64")) {
foreach ($Cfg in @("ActiveCfg", "Build.0")) {
$sln.insert($line, " {$guid}.$Build|$($EfiArchName.$Arch).$Cfg = $Build|$Arch")
$line++
}
}
}
$line += 6 + $i
$sln.insert($line, " {$guid} = {DF105116-5A3A-4D48-AB1D-7221690ED545}")
$i++
}
}
$sln | Set-Content ..\..\gnu-efi.sln

13
.vs/apps/bltgrid.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{7FD7832D-F7C7-4B3F-9B6D-8A48BDC74E6C}</ProjectGuid>
<RootNamespace>bltgrid</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>bltgrid</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\bltgrid.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\bltgrid.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

385
.vs/apps/common.props Normal file
View File

@ -0,0 +1,385 @@
<Project>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<TargetExt>.efi</TargetExt>
<GenerateManifest>false</GenerateManifest>
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>efilib.lib;libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>efilib.lib;libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<TargetMachine>MachineX86</TargetMachine>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>efilib.lib;libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<AdditionalDependencies>efilib.lib;libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalDependencies>efilib.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalDependencies>efilib.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalDependencies>efilib.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<WarningLevel>Level3</WarningLevel>
<DisableSpecificWarnings>4091</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi- %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Lib>
<SubSystem>EFI Application</SubSystem>
</Lib>
<ProjectReference>
<LinkLibraryDependencies>true</LinkLibraryDependencies>
</ProjectReference>
<Link>
<DataExecutionPrevention>false</DataExecutionPrevention>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<EntryPointSymbol>efi_main</EntryPointSymbol>
<SubSystem>EFI Application</SubSystem>
<AdditionalDependencies>efilib.lib;libcmt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<RandomizedBaseAddress />
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{090590E4-A94D-477A-8512-42522BDDFE0C}</ProjectGuid>
<RootNamespace>debughook</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>debughook</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\debughook.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\debughook.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

53
.vs/apps/drv0.vcxproj Normal file
View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{ED1B23FB-FCCA-4ED7-9E99-EEAAD9F2FB7F}</ProjectGuid>
<RootNamespace>drv0</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>drv0</ProjectName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<SubSystem>EFI Boot Service Driver</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\drv0.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\drv0.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/drv0_use.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{3947DB96-3A01-4F8C-B7C1-2C4D6C00D640}</ProjectGuid>
<RootNamespace>drv0_use</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>drv0_use</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\drv0_use.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\drv0_use.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/exit.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{80BD2830-EF30-4110-97BA-1B9A7B855996}</ProjectGuid>
<RootNamespace>exit</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>exit</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\exit.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\exit.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/lfbgrid.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{7C059723-3CD2-484B-8064-238CE7A437BD}</ProjectGuid>
<RootNamespace>lfbgrid</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>lfbgrid</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\lfbgrid.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\lfbgrid.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/modelist.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{5AD238D9-79AA-4166-BC86-EF759EA45BAB}</ProjectGuid>
<RootNamespace>modelist</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>modelist</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\modelist.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\modelist.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/printenv.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{731CD95E-7CCD-495F-9456-E2D71357C807}</ProjectGuid>
<RootNamespace>printenv</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>printenv</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\printenv.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\printenv.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/route80h.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{6F1EB89D-8968-4C3B-9F77-B23788F2D8C1}</ProjectGuid>
<RootNamespace>route80h</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>route80h</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\route80h.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\route80h.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/setdbg.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{5D8EA8B2-C75F-4E3A-B0BC-E6B77AC77FF5}</ProjectGuid>
<RootNamespace>setdbg</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>setdbg</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\setdbg.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\setdbg.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/setjmp.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{8EC47C20-B7C3-4B82-8B06-967A15C7B323}</ProjectGuid>
<RootNamespace>setjmp</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>setjmp</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\setjmp.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\setjmp.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{9BA1F692-0824-442E-B700-69C3D85D64EE}</ProjectGuid>
<RootNamespace>t</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t2.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{DCB81D4D-15B8-440D-A757-5B0036C0F4F6}</ProjectGuid>
<RootNamespace>t2</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t2</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t2.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t2.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t3.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{AFF91400-F772-419A-9463-D9900B43C666}</ProjectGuid>
<RootNamespace>t3</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t3</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t3.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t3.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t4.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{3428718B-4B7E-48F5-8D15-B9F3E3CFF38E}</ProjectGuid>
<RootNamespace>t4</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t4</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t4.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t4.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t5.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{7F52AAA4-2071-49D6-A783-529D3CB5AF61}</ProjectGuid>
<RootNamespace>t5</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t5</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t5.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t5.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t6.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{0AE45092-20C3-4999-BFDC-77F2D0FDFF60}</ProjectGuid>
<RootNamespace>t6</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t6</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t6.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t6.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t7.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{04D2685F-8150-47E0-BC10-338D2D6B804C}</ProjectGuid>
<RootNamespace>t7</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t7</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t7.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t7.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/t8.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{6C664A44-BC53-4225-A14B-D969D4EED647}</ProjectGuid>
<RootNamespace>t8</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>t8</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t8.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\t8.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/tcc.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{6E45A33B-E4A0-48D4-81AE-ACFD46FDB1CA}</ProjectGuid>
<RootNamespace>tcc</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>tcc</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\tcc.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\tcc.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

13
.vs/apps/unsetdbg.vcxproj Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(SolutionDir)\.vs\apps\common.props" />
<PropertyGroup Label="Globals">
<ProjectGuid>{06089797-265A-4FF5-838E-25374C1F0159}</ProjectGuid>
<RootNamespace>unsetdbg</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>unsetdbg</ProjectName>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\unsetdbg.c" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\apps\unsetdbg.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

430
.vs/efilib.vcxproj Normal file
View File

@ -0,0 +1,430 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM">
<Configuration>Debug</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM">
<Configuration>Release</Configuration>
<Platform>ARM</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3135D563-9596-4584-9ED6-616ADEC52974}</ProjectGuid>
<RootNamespace>gnuefi</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>efilib</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup>
<PreferredToolArchitecture>x64</PreferredToolArchitecture>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)x64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)ia32\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<OutDir>$(SolutionDir)arm\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<OutDir>$(SolutionDir)aa64\$(Configuration)\</OutDir>
<IntDir>$(OutDir)$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<BufferSecurityCheck>false</BufferSecurityCheck>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>$(SolutionDir)\inc</AdditionalIncludeDirectories>
<ExceptionHandling>false</ExceptionHandling>
<CompileAs>CompileAsC</CompileAs>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4312</DisableSpecificWarnings>
<BufferSecurityCheck>false</BufferSecurityCheck>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalOptions>/Oi-</AdditionalOptions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<SubSystem>EFI Application</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\lib\aarch64\initplat.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\aarch64\math.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\arm\initplat.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\arm\math.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\boxdraw.c" />
<ClCompile Include="..\lib\cmdline.c" />
<ClCompile Include="..\lib\console.c" />
<ClCompile Include="..\lib\crc.c" />
<ClCompile Include="..\lib\data.c" />
<ClCompile Include="..\lib\debug.c" />
<ClCompile Include="..\lib\dpath.c" />
<ClCompile Include="..\lib\error.c" />
<ClCompile Include="..\lib\event.c" />
<ClCompile Include="..\lib\exit.c" />
<ClCompile Include="..\lib\guid.c" />
<ClCompile Include="..\lib\hand.c" />
<ClCompile Include="..\lib\hw.c" />
<ClCompile Include="..\lib\ia32\initplat.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\ia32\math.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\init.c" />
<ClCompile Include="..\lib\lock.c" />
<ClCompile Include="..\lib\misc.c" />
<ClCompile Include="..\lib\print.c" />
<ClCompile Include="..\lib\runtime\efirtlib.c" />
<ClCompile Include="..\lib\runtime\rtdata.c" />
<ClCompile Include="..\lib\runtime\rtlock.c" />
<ClCompile Include="..\lib\runtime\rtstr.c" />
<ClCompile Include="..\lib\runtime\vm.c" />
<ClCompile Include="..\lib\smbios.c" />
<ClCompile Include="..\lib\sread.c" />
<ClCompile Include="..\lib\str.c" />
<ClCompile Include="..\lib\x86_64\initplat.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\lib\x86_64\math.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

126
.vs/efilib.vcxproj.filters Normal file
View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Source Files\arm">
<UniqueIdentifier>{20c8e9bd-0fa8-46d3-b825-e3eebd64ab3d}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\x86_64">
<UniqueIdentifier>{87122940-e80f-416d-a840-5e32f703f3ff}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\ia32">
<UniqueIdentifier>{e6e3d25a-4fce-4036-bef9-3cfbafc4baaf}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\aarch64">
<UniqueIdentifier>{cf7e7031-77e5-4827-9aa6-f996fc4b3d06}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\lib\console.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\print.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\init.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\str.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\guid.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\misc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\boxdraw.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\smbios.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\crc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\data.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\debug.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\dpath.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\event.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\exit.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\hand.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\hw.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\lock.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\sread.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\cmdline.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\runtime\rtlock.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\runtime\efirtlib.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\runtime\rtstr.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\runtime\vm.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\runtime\rtdata.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\error.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\lib\arm\math.c">
<Filter>Source Files\arm</Filter>
</ClCompile>
<ClCompile Include="..\lib\x86_64\math.c">
<Filter>Source Files\x86_64</Filter>
</ClCompile>
<ClCompile Include="..\lib\ia32\math.c">
<Filter>Source Files\ia32</Filter>
</ClCompile>
<ClCompile Include="..\lib\x86_64\initplat.c">
<Filter>Source Files\x86_64</Filter>
</ClCompile>
<ClCompile Include="..\lib\ia32\initplat.c">
<Filter>Source Files\ia32</Filter>
</ClCompile>
<ClCompile Include="..\lib\arm\initplat.c">
<Filter>Source Files\arm</Filter>
</ClCompile>
<ClCompile Include="..\lib\aarch64\initplat.c">
<Filter>Source Files\aarch64</Filter>
</ClCompile>
<ClCompile Include="..\lib\aarch64\math.c">
<Filter>Source Files\aarch64</Filter>
</ClCompile>
</ItemGroup>
</Project>

339
LICENSE Normal file
View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

303
Make.defaults Executable file
View File

@ -0,0 +1,303 @@
# -*- makefile -*-
# Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
TOPDIR ?= $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
#
# Variables below overridable from command-line:
# make VARNAME=value ...
#
#
# Where to install the package. GNU-EFI will create and access
# lib and include under the root
#
DESTDIR ?= /
ifeq ($(origin INSTALLROOT),undefined)
INSTALLROOT = $(DESTDIR)
endif
empty :=
space := $(empty) $(empty)
stripped = $(subst $(space),/,$(strip $(subst /,$(space),$(1))))
unstripped = $(subst $(space),/,$(subst /,$(space),$(1)))
is_absolute = $(subst $(call stripped,$(1)),$(empty),$(call unstripped,$(1)))
override INSTALLROOT:=$(if $(call is_absolute,$(INSTALLROOT)),,$(TOPDIR)/)$(INSTALLROOT)
PREFIX := /usr/local
EXEC_PREFIX := $(PREFIX)
LIBDIR := $(EXEC_PREFIX)/lib
INCLUDEDIR := $(PREFIX)/include
INSTALL := install
# Compilation tools
HOSTCC := $(prefix)gcc
CC := $(prefix)$(CROSS_COMPILE)gcc
AS := $(prefix)$(CROSS_COMPILE)as
LD := $(prefix)$(CROSS_COMPILE)ld
AR := $(prefix)$(CROSS_COMPILE)ar
RANLIB := $(prefix)$(CROSS_COMPILE)ranlib
OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy
# Set verbose or nonverbose output similarly to automake's silent rules.
# Default is nonverbose, but, just like with automake, it can be disabled
# with: 'make V=1'
ifneq ($(V),1)
HIDE=@
ECHO=echo
else
HIDE=
ECHO=true
endif
# Host/target identification
OS := $(shell uname -s)
USING_APPLE ?= $(shell echo $(OS) | grep -q 'Darwin' && echo 1 || echo 0)
USING_FREEBSD ?= $(shell echo $(OS) | grep -q 'FreeBSD' && echo 1 || echo 0)
# FreeBSD uses clang with no gcc symlink
ifeq ($(USING_FREEBSD),1)
override HOSTCC := $(prefix)clang
endif
HOSTARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
ARCH ?= $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
# Get ARCH from the compiler if cross compiling
ifneq ($(CROSS_COMPILE),)
override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv[67].*,arm,' )
endif
# FreeBSD (and possibly others) reports amd64 instead of x86_64
ifeq ($(ARCH),amd64)
override ARCH := x86_64
endif
# Allow UEFI shorthands to be specified for the arch
ifeq ($(ARCH),x64)
override ARCH := x86_64
endif
ifeq ($(ARCH),mips64)
override ARCH := mips64el
endif
GCCVERSION := $(shell $(CC) -dumpversion | sed -e 's/-win32/.0/' | cut -f1 -d.)
GCCMINOR := $(shell $(CC) -dumpversion | sed -e 's/-win32/.0/' | cut -f2 -d.)
USING_CLANG := $(shell $(CC) -v 2>&1 | grep -q 'clang version' && echo clang || echo 0)
NO_GLIBC ?= 0
# Rely on GCC MS ABI support?
GCCNEWENOUGH := $(shell ( [ $(GCCVERSION) -gt "4" ] \
|| ( [ $(GCCVERSION) -eq "4" ] \
&& [ $(GCCMINOR) -ge "7" ] ) ) \
&& echo 1)
PART_ONE = $(shell echo "$(1)" | cut -f1 -d.)
PART_TWO = $(shell echo "$(1)" | cut -f2 -d.)
IS_NEW_ENOUGH = $(shell ( [ $(call PART_ONE,$(1)) -gt "$(2)" ] \
|| ( [ $(call PART_ONE,$(1)) -eq "$(2)" ] \
&& [ $(call PART_TWO,$(1)) -ge "$(3)" ] ) ) \
&& echo 1)
#
# Where to build the package
#
OBJDIR := $(TOPDIR)/$(ARCH)
#
# Variables below derived from variables above
#
# Arch-specific compilation flags
CPPFLAGS += -DCONFIG_$(ARCH)
CFLAGS += -Wno-error=pragmas
ifeq ($(ARCH),ia64)
CFLAGS += -mfixed-range=f32-f127
endif
ifeq ($(ARCH),ia32)
CFLAGS += -mno-mmx -mno-sse
ifeq ($(HOSTARCH),x86_64)
ARCH3264 = -m32
endif
endif
# Set ISO C mode
CPPFLAGS += -std=c11
ifeq ($(ARCH),x86_64)
ifeq ($(GCCNEWENOUGH),1)
CPPFLAGS += -DGNU_EFI_USE_MS_ABI
ifneq ($(USING_CLANG),clang)
CPPFLAGS += -maccumulate-outgoing-args
endif
endif
CFLAGS += -mno-red-zone
ifeq ($(HOSTARCH),ia32)
ARCH3264 = -m64
endif
endif
ifneq (,$(filter $(ARCH),ia32 x86_64))
# Disable AVX, if the compiler supports that.
CC_CAN_DISABLE_AVX=$(shell $(CC) -Werror -c -o /dev/null -xc -mno-avx - </dev/null >/dev/null 2>&1 && echo 1)
ifeq ($(CC_CAN_DISABLE_AVX), 1)
CFLAGS += -mno-avx
endif
endif
ifeq ($(ARCH),mips64el)
CFLAGS += -march=mips64r2
ARCH3264 = -mabi=64
endif
#
# Set HAVE_EFI_OBJCOPY if objcopy understands --target efi-[app|bsdrv|rtdrv],
# otherwise we need to compose the PE/COFF header using the assembler
#
OBJCOPY_VERSION := $(shell $(OBJCOPY) --version | head -n 1 | awk '{print $$(NF)}')
ifneq ($(ARCH),arm)
ifneq ($(ARCH),mips64el)
export HAVE_EFI_OBJCOPY=y
endif
endif
ifeq ($(ARCH),riscv64)
ifneq ($(call IS_NEW_ENOUGH,$(OBJCOPY_VERSION),2,42),1)
export SYSTEM_HAS_EFI_OBJCOPY ?= 0
endif
endif
ifeq ($(ARCH),aarch64)
ifneq ($(call IS_NEW_ENOUGH,$(OBJCOPY_VERSION),2,38),1)
export SYSTEM_HAS_EFI_OBJCOPY ?= 0
endif
endif
ifeq ($(ARCH),ia32)
ifeq ($(USING_APPLE),1)
export SYSTEM_HAS_EFI_OBJCOPY ?= 0
endif
endif
ifeq ($(HAVE_EFI_OBJCOPY),y)
export SYSTEM_HAS_EFI_OBJCOPY ?= 1
else
export SYSTEM_HAS_EFI_OBJCOPY ?= 0
endif
ifeq ($(USING_APPLE),1)
CFLAGS += -D__GNU_EFI_NO_GLIBC
endif
ifeq ($(NO_GLIBC),1)
CFLAGS += -D__GNU_EFI_NO_GLIBC
endif
ifeq ($(ARCH),arm)
CFLAGS += -marm
endif
ifneq (,$(filter $(ARCH),aarch64 arm loongarch64))
LDFLAGS += -z common-page-size=4096
LDFLAGS += -z max-page-size=4096
endif
# Generic compilation flags
INCDIR += -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) \
-I$(TOPDIR)/inc/protocol
# Only enable -fPIE for non MinGW compilers (unneeded on MinGW)
GCCMACHINE := $(shell $(CC) -dumpmachine)
IS_MINGW32 := $(findstring mingw32, $(GCCMACHINE))
ifeq ($(IS_MINGW32),)
CFLAGS += -fPIE
endif
ifeq ($(USING_FREEBSD),1)
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
-fno-strict-aliasing \
-ffreestanding -fno-stack-protector
else
CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Wno-pointer-sign -Werror \
-fno-strict-aliasing \
-ffreestanding -fno-stack-protector -fno-stack-check \
$(if $(findstring 0,$(USING_CLANG)),-Wno-error=maybe-uninitialized,) \
$(if $(findstring 0,$(USING_CLANG)),-fno-merge-all-constants,)
endif
# Force DWARF 4 on LLVM
# Otherwise readelf becomes very unhappy
ifeq ($(USING_CLANG),clang)
CFLAGS += -gdwarf-4
endif
# Force hard float (for library mismatch)
ifeq ($(ARCH),arm)
ifeq ($(USING_APPLE),1)
CFLAGS += -mfloat-abi=hard -mfpu=vfpv2
endif
endif
ifeq ($(V),1)
ARFLAGS := rDv
else
ARFLAGS := rD
endif
ASFLAGS += $(ARCH3264)
LDFLAGS += -nostdlib
ifeq ($(IS_MINGW32),)
LDFLAGS += --warn-common --no-undefined --fatal-warnings \
--build-id=sha1
ifeq ($(USING_APPLE),0)
LDFLAGS += -z norelro -z nocombreloc
endif
else
LDFLAGS += -Wl,--warn-common -Wl,--no-undefined -Wl,--fatal-warnings \
-Wl,--build-id=sha1
endif
ifneq ($(ARCH),arm)
export LIBGCC=$(shell $(CC) $(CFLAGS) $(ARCH3264) -print-libgcc-file-name)
endif

View File

@ -34,13 +34,54 @@
# SUCH DAMAGE.
#
.SECONDARY:
CHAR_SUBSYSTEM=$(subst 0x,\x,$(SUBSYSTEM))
ifeq ($(IS_MINGW32),)
%.efi: %.so
$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
-j .rela -j .reloc --target=$(FORMAT) $*.so $@
@$(ECHO) " OBJCOPY $(notdir $@)"
$(HIDE)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .rodata -j .rel \
-j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
-j .areloc -j .reloc $(FORMAT) $*.so $@
ifeq ($(ARCH),riscv64)
ifeq ($(SYSTEM_HAS_EFI_OBJCOPY),0)
$(HIDE)/bin/echo -ne "$(CHAR_SUBSYSTEM)" | dd of=$@ bs=1 seek=156 count=1 conv=notrunc status=none
endif
endif
%.efi.debug: %.so
@$(ECHO) " OBJCOPY $(notdir $@)"
$(HIDE)$(OBJCOPY) -j .debug_info -j .debug_abbrev -j .debug_aranges \
-j .debug_line -j .debug_str -j .debug_ranges \
-j .note.gnu.build-id \
$(FORMAT) $*.so $@
%.so: %.o
$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
@$(ECHO) " LD $(notdir $@)"
$(HIDE)$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES)
else
%.efi: %.o
@$(ECHO) " CCLD $(notdir $@)"
$(HIDE)$(CC) $(LDFLAGS) $< -o $@ $(LOADLIBES)
endif
%.o: %.c
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
@$(ECHO) " CC $(notdir $@)"
$(HIDE)$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%.s: %.c
@$(ECHO) " CC $(notdir $@)"
$(HIDE)$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -S $< -o $@
%.i: %.c
@$(ECHO) " CPP $(notdir $@)"
$(HIDE)$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@
%.o: %.S
@$(ECHO) " CC $(notdir $@)"
$(HIDE)$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
%.s: %.S
@$(ECHO) " CPP $(notdir $@)"
$(HIDE)$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -E $< -o $@

138
Makefile Normal file
View File

@ -0,0 +1,138 @@
#
# Copyright (C) 1999-2007 Hewlett-Packard Co.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
export VERSION = 4.0.0
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
SRCDIR = $(dir $(MKFILE_PATH))
VPATH = $(SRCDIR)
include $(SRCDIR)/Make.defaults
SUBDIRS = lib inc apps
ifeq ($(IS_MINGW32),)
SUBDIRS += gnuefi
endif
all: check_gcc $(SUBDIRS)
ifeq ($(IS_MINGW32),)
gnuefi: lib
apps: gnuefi
else
apps: lib
endif
mkvars:
@echo AR=$(AR)
@echo ARCH=$(ARCH)
@echo ARCH3264=$(ARCH3264)
@echo AS=$(AS)
@echo ASFLAGS=$(ASFLAGS)
@echo CC=$(CC)
@echo CFLAGS=$(CFLAGS)
@echo CPPFLAGS=$(CPPFLAGS)
@echo GCCMINOR=$(GCCMINOR)
@echo GCCNEWENOUGH=$(GCCNEWENOUGH)
@echo GCCVERSION=$(GCCVERSION)
@echo HOSTARCH=$(HOSTARCH)
@echo INCDIR=$(INCDIR)
@echo INSTALL=$(INSTALL)
@echo INSTALLROOT=$(INSTALLROOT)
@echo LD=$(LD)
@echo LDFLAGS=$(LDFLAGS)
@echo LIBDIR=$(LIBDIR)
@echo OBJCOPY=$(OBJCOPY)
@echo OS=$(OS)
@echo prefix=$(prefix)
@echo PREFIX=$(PREFIX)
@echo RANLIB=$(RANLIB)
@echo SRCDIR=$(SRCDIR)
@echo TOPDIR=$(TOPDIR)
$(SUBDIRS):
mkdir -p $(OBJDIR)/$@
$(MAKE) -C $(OBJDIR)/$@ -f $(SRCDIR)/$@/Makefile SRCDIR=$(SRCDIR)/$@ ARCH=$(ARCH)
clean:
@rm -vrf *~
@set -e ; for d in $(SUBDIRS); do \
if [ -d $(OBJDIR)/$$d ]; then \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d clean; \
fi; \
done
install:
@set -e ; for d in $(SUBDIRS); do \
mkdir -p $(OBJDIR)/$$d; \
$(MAKE) -C $(OBJDIR)/$$d -f $(SRCDIR)/$$d/Makefile SRCDIR=$(SRCDIR)/$$d install; done
.PHONY: $(SUBDIRS) clean depend
#
# on both platforms you must use gcc 3.0 or higher
#
check_gcc:
ifeq ($(GCC_VERSION),2)
@echo "you need to use a version of gcc >= 3.0, you are using `$(CC) --version`"
@exit 1
endif
include $(SRCDIR)/Make.rules
test-archive:
@rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
@mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
@git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
@git diff | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; patch -s -p1 -b -z .gitdiff )
@mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
@rm -rf /tmp/gnu-efi-$(VERSION)
@echo "The archive is in gnu-efi-$(VERSION).tar.bz2"
tag:
git tag $(VERSION) refs/heads/master
archive: tag
@rm -rf /tmp/gnu-efi-$(VERSION) /tmp/gnu-efi-$(VERSION)-tmp
@mkdir -p /tmp/gnu-efi-$(VERSION)-tmp
@git archive --format=tar $(VERSION) | ( cd /tmp/gnu-efi-$(VERSION)-tmp/ ; tar x )
@mv /tmp/gnu-efi-$(VERSION)-tmp/ /tmp/gnu-efi-$(VERSION)/
@dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/gnu-efi-$(VERSION).tar.bz2 gnu-efi-$(VERSION)
@rm -rf /tmp/gnu-efi-$(VERSION)
@echo "The archive is in gnu-efi-$(VERSION).tar.bz2"

View File

@ -1,18 +1,19 @@
-------------------------------------------------
Building EFI Applications Using the GNU Toolchain
-------------------------------------------------
-------------------------------------------------
Building EFI Applications Using the GNU Toolchain
-------------------------------------------------
David Mosberger <davidm@hpl.hp.com>
David Mosberger <davidm@hpl.hp.com>
23 September 1999
23 September 1999
Copyright (c) 1999-2007 Hewlett-Packard Co.
Copyright (c) 2006-2010 Intel Co.
Copyright (c) 1999-2007 Hewlett-Packard Co.
Last update: 04/09/2007
Copyright (c) 2006-2010 Intel Co.
* Introduction
Last update (DD/MM/YYYY): 19/08/2024
# Introduction
This document has two parts: the first part describes how to develop
EFI applications for IA-64,x86 and x86_64 using the GNU toolchain and the EFI
@ -22,75 +23,63 @@ environment works.
* Part 1: Developing EFI Applications
# Part 1: Developing EFI Applications
** Prerequisites:
## Prerequisites:
To develop x86 and x86_64 EFI applications, the following tools are needed:
To develop EFI applications, the following tools are needed:
- gcc-3.0 or newer (gcc 2.7.2 is NOT sufficient!)
As of gnu-efi-3.0b, the Redhat 8.0 toolchain is known to work,
but the Redhat 9.0 toolchain is not currently supported.
- A C11 compiler: gcc, clang (Supported since 4.0) or MSVC (Supported since 4.0)
- A version of "objcopy" that supports EFI applications. To
check if your version includes EFI support, issue the
command:
- A version of "objcopy" that supports EFI applications (if using a GNU based toolchain).
To check if your version includes EFI support, issue the
command: `objcopy --help`
objcopy --help
Verify that the line "supported targets" contains the string
"efi-app-ia32" and "efi-app-x86_64" (for x86 and x64 respectively)
and that the "-j" option accepts wildcards.
The binutils release binutils-2.24 supports Intel64 EFI and
accepts wildcard section names.
and verify that the line "supported targets" contains the
string "efi-app-ia32" and "efi-app-x86_64". The binutils release
binutils-2.17.50.0.14 supports Intel64 EFI.
- For debugging purposes, it's useful to have a version of
"objdump" that supports EFI applications as well. This
allows inspect and disassemble EFI binaries.
To develop IA-64 EFI applications, the following tools are needed:
- A version of gcc newer than July 30th 1999 (older versions
had problems with generating position independent code).
As of gnu-efi-3.0b, gcc-3.1 is known to work well.
- A version of "objcopy" that supports EFI applications. To
check if your version includes EFI support, issue the
command:
objcopy --help
and verify that the line "supported targets" contains the
string "efi-app-ia64".
- For debugging purposes, it's useful to have a version of
"objdump" that supports EFI applications as well. This
allows inspect and disassemble EFI binaries.
- For debugging purposes, it's useful to have a version of
"objdump" that supports EFI applications as well. This
allows inspect and disassemble EFI binaries.
Alternatively, use dumpbin on Windows from Visual Studio
Development Tools, by launching it through Developer Command
Prompt for Visual Studio.
** Directory Structure
## Directory Structure
This EFI development environment contains the following
subdirectories:
inc: This directory contains the EFI-related include files. The
- inc: This directory contains the EFI-related include files. The
files are taken from Intel's EFI source distribution, except
that various fixes were applied to make it compile with the
GNU toolchain.
lib: This directory contains the source code for Intel's EFI library.
- lib: This directory contains the source code for Intel's EFI library.
Again, the files are taken from Intel's EFI source
distribution, with changes to make them compile with the GNU
toolchain.
gnuefi: This directory contains the glue necessary to convert ELF64
- gnuefi: This directory contains the glue necessary to convert ELF64
binaries to EFI binaries. Various runtime code bits, such as
a self-relocator are included as well. This code has been
contributed by the Hewlett-Packard Company and is distributed
under the GNU GPL.
apps: This directory contains a few simple EFI test apps.
- apps: This directory contains a few simple EFI test apps.
** Setup
- licenses: This directory contains the supplementary license files applicable to this project
The main license is found in LICENSE
- docs: This directory contains some additional notices about building with gnu-efi
## Setup
It is necessary to edit the Makefile in the directory containing this
README file before EFI applications can be built. Specifically, you
@ -104,7 +93,7 @@ x86_64 and "ia64" for IA-64). For convenience, this can also be done from
the make command line (e.g., "make ARCH=ia64").
** Building
## Building
To build the sample EFI applications provided in subdirectory "apps",
simply invoke "make" in the toplevel directory (the directory
@ -113,7 +102,7 @@ gnuefi/libgnuefi.a first and then all the EFI applications such as a
apps/t6.efi.
** Running
## Running
Just copy the EFI application (e.g., apps/t6.efi) to the EFI
filesystem, boot EFI, and then select "Invoke EFI application" to run
@ -122,7 +111,7 @@ Intel-provided "nshell" application and then invoke your test binary
via the command line interface that "nshell" provides.
** Writing Your Own EFI Application
## Writing Your Own EFI Application
Suppose you have your own EFI application in a file called
"apps/myefiapp.c". To get this application built by the GNU EFI build
@ -149,7 +138,7 @@ described in Intel's EFI documentation, except for two differences:
ensures appropriate parameter passing for the architecture.
* Part 2: Inner Workings
# Part 2: Inner Workings
WARNING: This part contains all the gory detail of how the GNU EFI
toolchain works. Normal users do not have to worry about such
@ -174,16 +163,14 @@ and each has there own subsystem id and are identical otherwise. At
present, the GNU EFI build environment supports the building of EFI
applications only, though it would be trivial to generate drivers, as
the only difference is the subsystem id. For more details on PE32+,
see the spec at
http://msdn.microsoft.com/library/specs/msdn_pecoff.htm.
see the [Specification](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format).
In theory, converting a suitable ELF64 binary to PE32+ is easy and
could be accomplished with the "objcopy" utility by specifying option
--target=efi-app-ia32 (x86) or --target=efi-app-ia64 (IA-64). But
life never is that easy, so here some complicating factors:
(1) COFF sections are very different from ELF sections.
1. COFF sections are very different from ELF sections.
ELF binaries distinguish between program headers and sections.
The program headers describe the memory segments that need to
@ -194,7 +181,7 @@ life never is that easy, so here some complicating factors:
(4KB for EFI), whereas ELF allows sections at arbitrary
addresses and with arbitrary sizes.
(2) EFI binaries should be relocatable.
2. EFI binaries should be relocatable.
Since EFI binaries are executed in physical mode, EFI cannot
guarantee that a given binary can be loaded at its preferred
@ -203,10 +190,10 @@ life never is that easy, so here some complicating factors:
address and then relocate the binary using the contents of the
.reloc section.
(3) On IA-64, the EFI entry point needs to point to a function
3. On IA-64, the EFI entry point needs to point to a function
descriptor, not to the code address of the entry point.
(4) The EFI specification assumes that wide characters use UNICODE
4. The EFI specification assumes that wide characters use UNICODE
encoding.
ANSI C does not specify the size or encoding that a wide
@ -219,7 +206,7 @@ In the following sections, we address how the GNU EFI build
environment addresses each of these issues.
** (1) Accommodating COFF Sections
## (1) Accommodating COFF Sections
In order to satisfy the COFF constraint of page-sized and page-aligned
sections, the GNU EFI build environment uses the special linker script
@ -230,18 +217,24 @@ and page sized.These eight sections are used to group together the much
greater number of sections that are typically present in ELF object files.
Specifically:
.hash
Collects the ELF .hash info (this section _must_ be the first
section in order to build a shared object file; the section is
not actually loaded or used at runtime).
- .text
.text
Collects all sections containing executable code.
.data
Collects read-only and read-write data, literal string data,
global offset tables, the uninitialized data segment (bss) and
various other sections containing data.
- .data
Collects read-write data, literal string data,
global offset tables, the uninitialized data segment (bss)
and various other sections containing data.
The reason the uninitialized data is placed in this section is
that the EFI loader appears to be unable to handle sections
that are allocated but not loaded from the binary.
- .rodata
Collects read-only data to retain the correct memory
permissions
The reason read-only data is placed here instead of the in
.text is to make it possible to disassemble the .text section
@ -249,17 +242,34 @@ Specifically:
EFI binaries execute in physical mode, differences in page
protection do not matter.
The reason the uninitialized data is placed in this section is
that the EFI loader appears to be unable to handle sections
that are allocated but not loaded from the binary.
- .dynamic, .rela, .rel, .reloc, .areloc
.dynamic, .dynsym, .rela, .rel, .reloc
These sections contains the dynamic information necessary to
self-relocate the binary (see below).
### Unnecessary sections:
- .hash (and/or .gnu.hash)
Collects the ELF .hash info (this section _must_ be the first
section in order to build a shared object file; the section is
not actually loaded or used at runtime).
GNU binutils provides a mechanism to generate different hash info
via --hash-style=<sysv|gnu|both> option. In this case output
shared object will contain .hash section, .gnu.hash section or
both. In order to generate correct output linker script preserves
both types of hash sections.
- .dynsym, .symtab
The symbol tables used for ELF debugging
A couple of more points worth noting about the linker script:
o On IA-64, the global pointer symbol (__gp) needs to be placed such
- On IA-64, the global pointer symbol (__gp) needs to be placed such
that the _entire_ EFI binary can be addressed using the signed
22-bit offset that the "addl" instruction affords. Specifically,
this means that __gp should be placed at ImageBase + 0x200000.
@ -269,17 +279,17 @@ A couple of more points worth noting about the linker script:
to be addressable in this fashion, grep the assembly files in
directory gnuefi for the string "@gprel".
o The link address (ImageBase) of the binary is (arbitrarily) set to
- The link address (ImageBase) of the binary is (arbitrarily) set to
zero. This could be set to something larger to increase the chance
of EFI being able to load the binary without requiring relocation.
However, a start address of 0 makes debugging a wee bit easier
(great for those of us who can add, but not subtract... ;-).
o The relocation related sections (.dynamic, .rel, .rela, .reloc)
- The relocation related sections (.dynamic, .rel, .rela, .reloc)
cannot be placed inside .data because some tools in the GNU
toolchain rely on the existence of these sections.
o Some sections in the ELF binary intentionally get dropped when
- Some sections in the ELF binary intentionally get dropped when
building the EFI binary. Particularly noteworthy are the dynamic
relocation sections for the .plabel and .reloc sections. It would
be _wrong_ to include these sections in the EFI binary because it
@ -287,10 +297,10 @@ A couple of more points worth noting about the linker script:
the EFI loader and once by the self-relocator; see below for a
description of the latter). Specifically, only the sections
mentioned with the -j option in the final "objcopy" command are
retained in the EFI binary (see apps/Makefile).
retained in the EFI binary (see Make.rules).
** (2) Building Relocatable Binaries
## (2) Building Relocatable Binaries
ELF binaries are normally linked for a fixed load address and are thus
not relocatable. The only kind of ELF object that is relocatable are
@ -302,13 +312,13 @@ normally require relocation of the global offset table.
The approach to building relocatable binaries in the GNU EFI build
environment is to:
(a) build an ELF shared object
1. build an ELF shared object
(b) link it together with a self-relocator that takes care of
2. link it together with a self-relocator that takes care of
applying the dynamic relocations that may be present in the
ELF shared object
(c) convert the resulting image to an EFI binary
3. convert the resulting image to an EFI binary
The self-relocator is of course architecture dependent. The x86
version can be found in gnuefi/reloc_ia32.c, the x86_64 version
@ -343,12 +353,12 @@ and the application recompiled. An easy way to count the number of
function descriptors required by an EFI application is to run the
command:
objdump --dynamic-reloc example.so | fgrep FPTR64 | wc -l
`objdump --dynamic-reloc example.so | fgrep FPTR64 | wc -l`
assuming "example" is the name of the desired EFI application.
** (3) Creating the Function Descriptor for the IA-64 EFI Binaries
## (3) Creating the Function Descriptor for the IA-64 EFI Binaries
As mentioned above, the IA-64 PE32+ format assumes that the entry
point of the binary is a function descriptor. A function descriptors
@ -383,9 +393,9 @@ its own section so that the objcopy program can recognize it and can
create the correct directory entries in the PE32+ binary.
** (4) Convenient and Portable Generation of UNICODE String Literals
## (4) Convenient and Portable Generation of UNICODE String Literals
As of gnu-efi-3.0, we make use (and somewhat abuse) the gcc option
From gnu-efi-3.0, we made use (and somewhat abused) the gcc option
that forces wide characters (WCHAR_T) to use short integers (2 bytes)
instead of integers (4 bytes). This way we match the Unicode character
size. By abuse, we mean that we rely on the fact that the regular ASCII
@ -395,4 +405,7 @@ to just use them interchangeably.
The gcc option to force short wide characters is : -fshort-wchar
* * * The End * * *
We have since defined CHAR16 to be char16_t which allows us to use the C11
'u' string literals instead hence avoiding abuse of short wide characters
***The End***

18
SECURITY.md Normal file
View File

@ -0,0 +1,18 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 4.0.x | :white_check_mark: |
| 3.0.x | :x: |
| 3.0a | :x: |
## Reporting a Vulnerability
Please provide:
1. Details of how the EFI binary was produced
2. Where the vulnerability is found in gnu-efi's source code (if known)
3. Steps to (re-)produce the vulnerability
[Report here](https://github.com/ncroxon/gnu-efi/security/advisories/new)

184
apps/AllocPages.c Normal file
View File

@ -0,0 +1,184 @@
/*
* Copyright (C) 2013 Jerry Hoemann <jerry.hoemann@hp.com>
*
*
* Application to allocate memory at EFI. Syntax of command
* mimics the EFI Boot Service "AllocatePages."
*
* See UEFI spec 2.3, Section 6.2.
*
*
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000005CDFFFFF 000000000004CD9E 000000000000000F
ACPI_NVS 000000005CE00000-000000005DDFFFFF 0000000000001000 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000005EF1CFFF 0000000000000F1D 000000000000000F
BS_Data 000000005EF1D000-00000000709FBFFF 0000000000011ADF 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
LoaderCode 00000000710E4000-00000000711FEFFF 000000000000011B 000000000000000F
Available 00000000711FF000-0000000071901FFF 0000000000000703 000000000000000F
BS_Code 0000000071902000-00000000721FEFFF 00000000000008FD 000000000000000F
Example to allocat 5 pages type BootCode at address 20000000 (hex)
FS1:\> AllocPages.efi 2 3 5 20000000
AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]
__AllocType__ {0,1,2} -- Any, MaxAddr, Addr
__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...
__NumPages__ {0..F000000}
[__Addr__] 0... 3FFFFFFFFFFF
All numbers in hex no leading 0x
AllocatPage(2,3,5,20000000)
Example to allocat 5 pages type BootCode at address 30000000 (hex)
FS1:\> AllocPages.efi 2 3 5 30000000
AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]
__AllocType__ {0,1,2} -- Any, MaxAddr, Addr
__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...
__NumPages__ {0..F000000}
[__Addr__] 0... 3FFFFFFFFFFF
All numbers in hex no leading 0x
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000001FFFFFFF 000000000000FF9E 000000000000000F
BS_Code 0000000020000000-0000000020004FFF 0000000000000005 000000000000000F
Available 0000000020005000-000000002FFFFFFF 000000000000FFFB 000000000000000F
BS_Code 0000000030000000-0000000030004FFF 0000000000000005 000000000000000F
Available 0000000030005000-000000005CDFFFFF 000000000002CDFB 000000000000000F
ACPI_NVS 000000005CE00000-000000005DDFFFFF 0000000000001000 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000005EF1CFFF 0000000000000F1D 000000000000000F
BS_Data 000000005EF1D000-00000000709FBFFF 0000000000011ADF 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
LoaderCode 00000000710E4000-00000000711FEFFF 000000000000011B 000000000000000F
Available 00000000711FF000-0000000071901FFF 0000000000000703 000000000000000F
BS_Code 0000000071902000-00000000721FEFFF 00000000000008FD 000000000000000F
*/
#include <efi.h>
#include <efilib.h>
#define MAX_NUM_PAGES 0x000000000F000000
#define MAX_ADDR ((1ULL << 46) - 1)
#ifdef DEBUG
#undef DEBUG
#endif
#define DEBUG 0
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS efi_status;
CHAR16 **argv;
INTN argc;
INTN err = 0;
#if DEBUG
INTN c = 0;
#endif
INTN AllocType = -1;
INTN MemType = -1;
INTN NumPages = -1;
EFI_PHYSICAL_ADDRESS Addr = 0;
InitializeLib(image, systab);
Print(u"AllocatePage: __AllocType__ __MemType__ __NumPages__ [__Addr__]\n");
Print(u"__AllocType__ {0,1,2} -- Any, MaxAddr, Addr\n");
Print(u"__MemType__ {0..13}, Reserved ==0, LCode==1, LData==2, BSCode==3, BSData==4, ...\n");
Print(u"__NumPages__ {0..%x}\n", MAX_NUM_PAGES);
Print(u"[__Addr__] 0... %llx\n", MAX_ADDR);
Print(u"All numbers in hex no leading 0x\n");
Print(u"\n");
#if DEBUG
Print(u"Now get argc/argv\n");
#endif
argc = GetShellArgcArgv(image, &argv);
#if DEBUG
Print(u"argc = %d\n", argc);
#endif
#if DEBUG
for (c = 0; c < argc; c++ ) {
Print(u"argv[%d] = <%s>\n", c, argv[c]);
}
#endif
if ( (argc < 4) || (argc > 5) ) {
Print(u"Wrong argument count\n");
return EFI_SUCCESS;
}
AllocType = xtoi(argv[1]);
MemType = xtoi(argv[2]);
NumPages = xtoi(argv[3]);
if ( argc == 5 ) Addr = xtoi(argv[4]);
if ( (AllocType < 0) || (AllocType > 2)) {
Print(u"Invalid AllocType\n");
err++;
}
if ( (MemType < 0) || (MemType > 13) ) {
Print(u"Invalid MemType\n");
err++;
}
if ( (NumPages < 0) || (NumPages > MAX_NUM_PAGES) ) {
Print(u"Inavlid NumPages\n");
err++;
}
if ( Addr > MAX_ADDR ) {
Print(u"Inavlid Address\n");
err++;
}
if ( err ) {
return EFI_INVALID_PARAMETER;
}
Print(u"AllocatPage(%d,%d,%d,%lx)\n", AllocType, MemType, NumPages, Addr);
efi_status = uefi_call_wrapper(BS->AllocatePages, 4, AllocType, MemType, NumPages, &Addr);
if ( EFI_ERROR(efi_status) ) {
Print(u"Allocate Pages Failed: %d\n", efi_status);
return efi_status;
}
return EFI_SUCCESS;
}

145
apps/FreePages.c Normal file
View File

@ -0,0 +1,145 @@
/*
* Copyright (C) 2013 Jerry Hoemann <jerry.hoemann@hp.com>
*
* Application to allocate memory at EFI. Syntax of command
* mimics the EFI Boot Service "FreePages."
*
* See UEFI spec 2.3, Section 6.2.
*
Example freeing a 5 page BS_Code setment at address: 0000000020000000 (hex)
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000001FFFFFFF 000000000000FF9E 000000000000000F
BS_Code 0000000020000000-0000000020004FFF 0000000000000005 000000000000000F
Available 0000000020005000-000000005DDFFFFF 000000000003DDFB 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000006DE7CFFF 000000000000FE7D 000000000000000F
ACPI_NVS 000000006DE7D000-000000006EE7CFFF 0000000000001000 000000000000000F
BS_Data 000000006EE7D000-00000000709FBFFF 0000000000001B7F 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
FS1:\> FreePages 0000000020000000 5
FreePages: __PhysAddr__ __PgCnt__
__PhysAddr__ 0... 3FFFFFFFFFFF
__PgCnt__ [0..F000000]
All numbers hex w/ no leading 0x
FreePages(20000000,5)
FS1:\> memmap
Type Start End #pages Attributes
BS_Code 0000000000000000-0000000000000FFF 0000000000000001 000000000000000F
Available 0000000000001000-000000000008DFFF 000000000000008D 000000000000000F
Reserved 000000000008E000-000000000008FFFF 0000000000000002 000000000000000F
Available 0000000000090000-000000000009FFFF 0000000000000010 000000000000000F
Available 0000000000100000-000000000FFFFFFF 000000000000FF00 000000000000000F
BS_Code 0000000010000000-0000000010061FFF 0000000000000062 000000000000000F
Available 0000000010062000-000000005DDFFFFF 000000000004DD9E 000000000000000F
BS_Data 000000005DE00000-000000005DFFFFFF 0000000000000200 000000000000000F
Available 000000005E000000-000000006DE7CFFF 000000000000FE7D 000000000000000F
ACPI_NVS 000000006DE7D000-000000006EE7CFFF 0000000000001000 000000000000000F
BS_Data 000000006EE7D000-00000000709FBFFF 0000000000001B7F 000000000000000F
Available 00000000709FC000-00000000710E3FFF 00000000000006E8 000000000000000F
*/
#include <efi.h>
#include <efilib.h>
/*
* FreePages: __PhysAddr__ __PgCnt__
*
*/
#define MAX_NUM_PAGES 0x000000000F000000
#define MAX_ADDR ((1ULL << 46) - 1)
#ifdef DEBUG
#undef DEBUG
#endif
#define DEBUG 0
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS efi_status;
CHAR16 **argv;
INTN argc = 0;
#if DEBUG
INTN c = 0;
#endif
INTN err = 0;
INTN PgCnt = -1;
EFI_PHYSICAL_ADDRESS PhysAddr = 0;
InitializeLib(image, systab);
Print(u"FreePages: __PhysAddr__ __PgCnt__\n");
Print(u"__PhysAddr__ 0... %llx\n", MAX_ADDR);
Print(u"__PgCnt__ [0..%lx]\n", MAX_NUM_PAGES);
Print(u"All numbers hex w/ no leading 0x\n");
Print(u"\n");
#if DEBUG
Print(u"Now parse argc/argv\n");
#endif
argc = GetShellArgcArgv(image, &argv);
#if DEBUG
Print(u"argc = %d\n", argc);
#endif
#if DEBUG
for (c = 0; c < argc; c++ ) {
Print(u"argv[%d] = <%s>\n", c, argv[c]);
}
#endif
if (argc != 3) {
Print(u"Invalid argument count\n");
return EFI_SUCCESS;
}
PhysAddr = xtoi(argv[1]);
PgCnt = xtoi(argv[2]);
if ( (PgCnt < 0) || (PgCnt > MAX_NUM_PAGES) ) {
Print(u"Inavlid PgCnt\n");
err++;
}
if ( PhysAddr > MAX_ADDR ) {
Print(u"Inavlid Address\n");
err++;
}
if ( err ) {
return EFI_SUCCESS;
}
Print(u"FreePages(%lx,%d)\n", PhysAddr, PgCnt);
efi_status = uefi_call_wrapper(BS->FreePages, 2, PhysAddr, PgCnt);
if ( EFI_ERROR(efi_status) ) {
Print(u"Free Pages Failed: %d\n", efi_status);
return efi_status;
}
return EFI_SUCCESS;
}

View File

@ -37,33 +37,96 @@
SRCDIR = .
VPATH = $(SRCDIR)
TOPDIR = $(SRCDIR)/..
include $(SRCDIR)/../Make.defaults
TOPDIR = $(SRCDIR)/..
CDIR=$(TOPDIR)/..
LINUX_HEADERS = /usr/src/sys/build
APPSDIR = $(LIBDIR)/gnuefi/apps
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)))
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
endif
ifneq ($(HAVE_EFI_OBJCOPY),)
ifeq ($(SYSTEM_HAS_EFI_OBJCOPY),0)
CRT0_LOCAL = -local
LDS_LOCAL = _local
endif
endif
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
LOADLIBES = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
FORMAT = efi-app-$(ARCH)
ifeq ($(IS_MINGW32),)
# The CRT0 libs are only needed for non MinGW platforms
CRT0_LIBS = -lgnuefi
endif
TARGETS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi printenv.efi t7.efi tcc.efi
ifneq ($(CRT0_LIBS),)
CRTOBJS = $(TOPDIR)/$(ARCH)/gnuefi/crt0-efi-$(ARCH)$(CRT0_LOCAL).o
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_efi$(LDS_LOCAL).lds
ifeq ($(USING_FREEBSD),1)
LDSCRIPT = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
endif
LDFLAGS += -L$(TOPDIR)/$(ARCH)/lib -L$(TOPDIR)/$(ARCH)/gnuefi $(CRTOBJS)
LOADLIBES += -T $(LDSCRIPT)
endif
LDFLAGS += -shared -Bsymbolic -L$(TOPDIR)/$(ARCH)/lib
LOADLIBES += -lefi $(CRT0_LIBS)
LOADLIBES += $(LIBGCC)
TARGET_APPS = t.efi t2.efi t3.efi t4.efi t5.efi t6.efi t7.efi t8.efi \
tcc.efi printenv.efi modelist.efi route80h.efi drv0_use.efi \
AllocPages.efi exit.efi FreePages.efi bltgrid.efi \
lfbgrid.efi setdbg.efi unsetdbg.efi old_ABI.efi
ifeq ($(IS_MINGW32),)
TARGET_APPS += setjmp.efi debughook.efi debughook.efi.debug \
ctors_test.efi ctors_dtors_priority_test.efi
endif
ifeq ($(USING_FREEBSD),0)
TARGET_BSDRIVERS = drv0.efi
else
TARGET_BSDRIVERS =
endif
TARGET_RTDRIVERS =
SUBSYSTEM := 0xa
$(TARGET_BSDRIVERS): SUBSYSTEM = 0xb
$(TARGET_RTDRIVERS): SUBSYSTEM = 0xc
ifeq ($(SYSTEM_HAS_EFI_OBJCOPY),1)
FORMAT := -O efi-app-$(ARCH)
$(TARGET_BSDRIVERS): FORMAT=-O efi-bsdrv-$(ARCH)
$(TARGET_RTDRIVERS): FORMAT=-O efi-rtdrv-$(ARCH)
ifneq ($(IS_MINGW32),)
LDFLAGS += -s -Wl,-dll -Wl,--subsystem,$(SUBSYSTEM)
ifeq ($(ARCH),ia32)
LDFLAGS += -e _efi_main
else
LDFLAGS += -e efi_main
endif
endif
else
FORMAT := -O binary
LDFLAGS += --defsym=EFI_SUBSYSTEM=$(SUBSYSTEM)
endif
TARGETS = $(TARGET_APPS) $(TARGET_BSDRIVERS) $(TARGET_RTDRIVERS)
all: $(TARGETS)
ctors_test.so : ctors_fns.o ctors_test.o
clean:
rm -f $(TARGETS) *~ *.o *.so
@rm -vf $(TARGETS) *~ *.o *.so
install:
mkdir -p $(INSTALLROOT)$(APPSDIR)
$(INSTALL) -m 644 $(TARGETS) $(INSTALLROOT)$(APPSDIR)
.PHONY: install

133
apps/bltgrid.c Normal file
View File

@ -0,0 +1,133 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
static void
fill_boxes(UINT32 *PixelBuffer, UINT32 Width, UINT32 Height)
{
UINT32 y, x = 0;
/*
* This assums BGRR, but it doesn't really matter; we pick red and
* green so it'll just be blue/green if the pixel format is backwards.
*/
EFI_GRAPHICS_OUTPUT_BLT_PIXEL Red = {0, 0, 0xff, 0},
Green = {0, 0xff, 0, 0},
*Color;
for (y = 0; y < Height; y++) {
Color = ((y / 32) % 2 == 0) ? &Red : &Green;
for (x = 0; x < Width; x++) {
if (x % 32 == 0 && x != 0)
Color = (Color == &Red) ? &Green : &Red;
PixelBuffer[y * Width + x] = *(UINT32 *)Color;
}
}
}
static void
draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
UINTN NumPixels;
UINT32 *PixelBuffer;
UINT32 BufferSize;
if (gop->Mode) {
imax = gop->Mode->MaxMode;
} else {
Print(u"gop->Mode is NULL\n");
return;
}
for (i = 0; i < imax; i++) {
UINTN SizeOfInfo;
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
&info);
if (rc == EFI_NOT_STARTED) {
Print(u"gop->QueryMode() returned %r\n", rc);
Print(u"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(u"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
if (CompareMem(info, gop->Mode->Info, sizeof (*info)))
continue;
NumPixels = (UINTN)info->VerticalResolution
* (UINTN)info->HorizontalResolution;
BufferSize = (UINT32)(NumPixels * sizeof(UINT32));
PixelBuffer = AllocatePool(BufferSize);
if (!PixelBuffer) {
Print(u"Allocation of 0x%08lx bytes failed.\n",
sizeof(UINT32) * NumPixels);
return;
}
fill_boxes(PixelBuffer,
info->HorizontalResolution, info->VerticalResolution);
uefi_call_wrapper(gop->Blt, 10, gop,
(EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)PixelBuffer,
EfiBltBufferToVideo,
0, 0, 0, 0,
info->HorizontalResolution,
info->VerticalResolution,
0);
FreePool(PixelBuffer);
return;
}
Print(u"Never found the active video mode?\n");
}
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(u"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)) {
Print(u"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(u"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
draw_boxes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,29 @@
#include <efi.h>
#include <efilib.h>
// 101 in init_array, 65434 in ctors
static void __attribute__((constructor(101))) EFI_NO_TAIL_CALL ctors101() {
Print(u"1) ctor with lower numbered priority \r\n");
}
// 65434 in init_array, 101 in ctors
static void __attribute__((constructor(65434))) EFI_NO_TAIL_CALL ctors65434() {
Print(u"2) ctor with higher numbered priority \r\n");
}
// 101 in fini_array, 65434 in dtors
static void __attribute__((destructor(101))) EFI_NO_TAIL_CALL dtors101() {
Print(u"4) dtor with lower numbered priority \r\n");
}
// 65434 in fini_array, 101 in dtors
static void __attribute__((destructor(65434))) EFI_NO_TAIL_CALL dtors65434() {
Print(u"3) dtor with higher numbered priority \r\n");
}
EFI_STATUS
efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
Print(u"Main function \r\n");
return EFI_SUCCESS;
}

26
apps/ctors_fns.c Normal file
View File

@ -0,0 +1,26 @@
/*
* ctors.c
* Copyright 2019 Peter Jones <pjones@redhat.com>
*
*/
#include <efi.h>
#include <efilib.h>
int constructed_value = 0;
static void __attribute__((__constructor__)) EFI_NO_TAIL_CALL ctor(void)
{
Print(u"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
constructed_value = 1;
Print(u"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
}
static void __attribute__((__destructor__)) EFI_NO_TAIL_CALL dtor(void)
{
Print(u"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
constructed_value = 0;
Print(u"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
}
// vim:fenc=utf-8:tw=75:noet

20
apps/ctors_test.c Normal file
View File

@ -0,0 +1,20 @@
/*
* ctors_test.c
* Copyright 2019 Peter Jones <pjones@redhat.com>
*
*/
#include <efi.h>
#include <efilib.h>
extern int constructed_value;
EFI_STATUS
efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
Print(u"%a:%d:%a() constructed_value:%d\n", __FILE__, __LINE__, __func__, constructed_value);
return EFI_SUCCESS;
}
// vim:fenc=utf-8:tw=75:noet

91
apps/debughook.c Normal file
View File

@ -0,0 +1,91 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
GetVariableAttr(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner,
UINT32 *attributes)
{
EFI_STATUS efi_status;
*len = 0;
efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner,
NULL, len, NULL);
if (efi_status != EFI_BUFFER_TOO_SMALL)
return efi_status;
*data = AllocateZeroPool(*len);
if (!*data)
return EFI_OUT_OF_RESOURCES;
efi_status = uefi_call_wrapper(RT->GetVariable, 5, var, &owner,
attributes, len, *data);
if (efi_status != EFI_SUCCESS) {
FreePool(*data);
*data = NULL;
}
return efi_status;
}
EFI_STATUS
GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner)
{
return GetVariableAttr(var, data, len, owner, NULL);
}
EFI_GUID DUMMY_GUID =
{0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}};
static EFI_OPTNONE void
DebugHook(void)
{
EFI_GUID guid = DUMMY_GUID;
UINT8 *data = NULL;
UINTN dataSize = 0;
EFI_STATUS efi_status;
register volatile unsigned long long x = 0;
extern char _text, _data;
if (x)
return;
efi_status = GetVariable(u"DUMMY_DEBUG", &data, &dataSize, guid);
if (EFI_ERROR(efi_status)) {
return;
}
Print(u"add-symbol-file /usr/lib/debug/boot/efi/debughook.debug "
u"0x%08x -s .data 0x%08x\n", &_text, &_data);
Print(u"Pausing for debugger attachment.\n");
Print(u"To disable this, remove the EFI variable DUMMY_DEBUG-%g .\n",
&guid);
x = 1;
while (x++) {
/* Make this so it can't /totally/ DoS us. */
#if defined(__x86_64__) || defined(__i386__) || defined(__i686__)
if (x > 4294967294ULL)
break;
__asm__ __volatile__("pause");
#elif defined(__aarch64__)
if (x > 1000)
break;
__asm__ __volatile__("wfi");
#else
if (x > 12000)
break;
uefi_call_wrapper(BS->Stall, 1, 5000);
#endif
}
x = 1;
}
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image, systab);
DebugHook();
return EFI_SUCCESS;
}

191
apps/drv0.c Normal file
View File

@ -0,0 +1,191 @@
/*
* Copyright (C) 2013 David Decotigny <decot@googlers.com>
*
* Sample EFI shell session, together with drv0_use.efi:
*
* # Loading first instance:
*
* fs0:\> load drv0.efi
* Driver instance loaded successfully.
* load: Image fs0:\drv0.efi loaded at 2FD7C000 - Success
*
* # Testing 1st instance:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 1 time(s).
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 2 time(s).
*
* # Loading another instance:
*
* fs0:\> load drv0.efi
* Driver instance loaded successfully.
* load: Image fs0:\drv0.efi loaded at 2FD6D000 - Success
*
* # Using both instances:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 3 time(s).
* Playing with driver instance 1...
* Hello Sample UEFI Driver!
* Hello was called 1 time(s).
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 4 time(s).
* Playing with driver instance 1...
* Hello Sample UEFI Driver!
* Hello was called 2 time(s).
*
* # Removing 1st instance:
*
* fs0:\> dh
* Handle dump
* 1: Image(DxeCore)
* [...]
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* 7A: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
*
* fs0:\> unload 79
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* Unload driver image (y/n)? y
* Driver instance unloaded.
* unload: Success
*
* # Only 2nd instance remaining:
*
* fs0:\> drv0_use.efi
* Playing with driver instance 0...
* Hello Sample UEFI Driver!
* Hello was called 3 time(s).
*
* # Removing 2nd/last instance:
*
* fs0:\> dh
* Handle dump
* 1: Image(DxeCore)
* [...]
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
*
* fs0:\> unload 79
* 79: Image(\/drv0.efi) ImageDevPath (..A,0x800,0x17F7DF)/\/drv0.efi)
* Unload driver image (y/n)? y
* Driver instance unloaded.
* unload: Success
*
* # Expect error: no other drv0 instance left
*
* fs0:\> drv0_use.efi
* Error looking up handles for proto: 14
*/
#include <efi.h>
#include <efilib.h>
#include "drv0.h"
static const EFI_GUID GnuEfiAppsDrv0ProtocolGuid
= GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
static struct {
GNU_EFI_APPS_DRV0_PROTOCOL Proto;
UINTN Counter;
} InternalGnuEfiAppsDrv0ProtocolData;
static
EFI_STATUS
EFI_FUNCTION
Drv0SayHello(
IN const CHAR16 *HelloWho
)
{
if (! HelloWho)
return EFI_INVALID_PARAMETER;
Print(u"Hello %s!\n", HelloWho);
InternalGnuEfiAppsDrv0ProtocolData.Counter ++;
return EFI_SUCCESS;
}
static
EFI_STATUS
EFI_FUNCTION
Drv0GetNumberOfHello(
OUT UINTN *NumberOfHello
)
{
if (! NumberOfHello)
return EFI_INVALID_PARAMETER;
*NumberOfHello = InternalGnuEfiAppsDrv0ProtocolData.Counter;
return EFI_SUCCESS;
}
static
EFI_STATUS
EFI_FUNCTION
Drv0Unload(IN EFI_HANDLE ImageHandle)
{
LibUninstallProtocolInterfaces(ImageHandle,
&GnuEfiAppsDrv0ProtocolGuid,
&InternalGnuEfiAppsDrv0ProtocolData.Proto,
NULL);
Print(u"Driver instance unloaded.\n", ImageHandle);
return EFI_SUCCESS;
}
EFI_STATUS
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SysTab)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE *LoadedImage = NULL;
InitializeLib(ImageHandle, SysTab);
/* Initialize global protocol definition + data */
InternalGnuEfiAppsDrv0ProtocolData.Proto.SayHello
= (GNU_EFI_APPS_DRV0_SAY_HELLO) Drv0SayHello;
InternalGnuEfiAppsDrv0ProtocolData.Proto.GetNumberOfHello
= (GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) Drv0GetNumberOfHello;
InternalGnuEfiAppsDrv0ProtocolData.Counter = 0;
/* Grab handle to this image: we'll attach our proto instance to it */
Status = uefi_call_wrapper(BS->OpenProtocol, 6,
ImageHandle, &LoadedImageProtocol,
(void**)&LoadedImage, ImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
Print(u"Could not open loaded image protocol: %d\n", Status);
return Status;
}
/* Attach our proto to the current driver image */
Status = LibInstallProtocolInterfaces(
&ImageHandle, &GnuEfiAppsDrv0ProtocolGuid,
&InternalGnuEfiAppsDrv0ProtocolData.Proto, NULL);
if (EFI_ERROR(Status)) {
Print(u"Error registering driver instance: %d\n", Status);
return Status;
}
/* Register Unload callback, used to unregister current protocol
* instance from system */
LoadedImage->Unload = (EFI_IMAGE_UNLOAD)Drv0Unload;
Print(u"Driver instance loaded successfully.\n");
return EFI_SUCCESS; /* at this point, this instance stays resident
* until image is unloaded, eg. with shell's unload,
* ExitBootServices() */
}

35
apps/drv0.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef _GNU_EFI_APPS_DRV0_H_
#define _GNU_EFI_APPS_DRV0_H_
#ifdef __cplusplus
extern "C" {
#endif
/* UEFI naming conventions */
#define GNU_EFI_APPS_DRV0_PROTOCOL_GUID \
{ 0xe4dcafd0, 0x586c, 0x4b3d, {0x86, 0xe7, 0x28, 0xde, 0x7f, 0xcc, 0x04, 0xb9} }
INTERFACE_DECL(_GNU_EFI_APPS_DRV0_PROTOCOL);
typedef
EFI_STATUS
(EFIAPI *GNU_EFI_APPS_DRV0_SAY_HELLO) (
IN const CHAR16 *HelloWho
);
typedef
EFI_STATUS
(EFIAPI *GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO) (
OUT UINTN *NumberOfHello
);
typedef struct _GNU_EFI_APPS_DRV0_PROTOCOL {
GNU_EFI_APPS_DRV0_SAY_HELLO SayHello;
GNU_EFI_APPS_DRV0_GET_NUMBER_OF_HELLO GetNumberOfHello;
} GNU_EFI_APPS_DRV0_PROTOCOL;
#ifdef __cplusplus
}
#endif
#endif

79
apps/drv0_use.c Normal file
View File

@ -0,0 +1,79 @@
/*
* Copyright (C) 2013 David Decotigny <decot@googlers.com>
*
* See drv0.c for an example session.
*/
#include <efi.h>
#include <efilib.h>
#include "drv0.h"
static EFI_GUID GnuEfiAppsDrv0ProtocolGuid
= GNU_EFI_APPS_DRV0_PROTOCOL_GUID;
static
EFI_STATUS
PlayWithGnuEfiAppsDrv0Protocol(IN EFI_HANDLE DrvHandle) {
EFI_STATUS Status;
GNU_EFI_APPS_DRV0_PROTOCOL *drv = NULL;
UINTN NumberOfHello = 0;
Status = uefi_call_wrapper(BS->OpenProtocol, 6,
DrvHandle,
&GnuEfiAppsDrv0ProtocolGuid,
(void**)&drv,
DrvHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(Status)) {
Print(u"Cannot open proto: %d\n", Status);
return Status;
}
Status = uefi_call_wrapper(drv->SayHello, 2, u"Sample UEFI Driver");
if (EFI_ERROR(Status)) {
Print(u"Cannot call SayHello: %d\n", Status);
}
Status = uefi_call_wrapper(drv->GetNumberOfHello, 2, &NumberOfHello);
if (EFI_ERROR(Status)) {
Print(u"Cannot call GetNumberOfHello: %d\n", Status);
} else {
Print(u"Hello was called %d time(s).\n", NumberOfHello);
}
return EFI_SUCCESS;
}
EFI_STATUS
efi_main (EFI_HANDLE Image, EFI_SYSTEM_TABLE *SysTab)
{
EFI_STATUS Status;
EFI_HANDLE *Handles = NULL;
UINTN i, NoHandles = 0;
InitializeLib(Image, SysTab);
Status = LibLocateHandle(ByProtocol, &GnuEfiAppsDrv0ProtocolGuid,
NULL, &NoHandles, &Handles);
if (EFI_ERROR(Status)) {
Print(u"Error looking up handles for proto: %d\n", Status);
return Status;
}
for (i = 0 ; i < NoHandles ; ++i)
{
Print(u"Playing with driver instance %d...\n", i);
Status = PlayWithGnuEfiAppsDrv0Protocol(Handles[i]);
if (EFI_ERROR(Status))
Print(u"Error playing with instance %d, skipping\n", i);
}
if (Handles)
FreePool(Handles);
return EFI_SUCCESS;
}

12
apps/exit.c Normal file
View File

@ -0,0 +1,12 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image_handle, systab);
Exit(EFI_SUCCESS, 0, NULL);
return EFI_UNSUPPORTED;
}

188
apps/lfbgrid.c Normal file
View File

@ -0,0 +1,188 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
#ifdef _MSC_VER
#if defined(_M_X64) || defined (_M_ARM64)
#define __SIZEOF_POINTER__ 8
#elif defined(_M_IX86) || defined(_M_ARM)
#define __SIZEOF_POINTER__ 4
#else
#error "Unknown arch"
#endif
#endif
#ifdef __GNUC__
#define be32_to_cpu(x) __builtin_bswap32(x)
#else
static inline UINT32 be32_to_cpu(const UINT32 x) {
return ((x >> 24) & 0x000000FFUL) | ((x << 24) & 0xFF000000UL) |
((x >> 8) & 0x0000FF00UL) | ((x << 8) & 0x00FF0000UL);
}
#endif
static void
fill_boxes(UINT32 *PixelBuffer, UINT32 Width, UINT32 Height, UINT32 Pitch,
EFI_GRAPHICS_PIXEL_FORMAT Format, EFI_PIXEL_BITMASK Info )
{
UINT32 Red, Green;
UINT32 y, x, color;
switch(Format) {
case PixelRedGreenBlueReserved8BitPerColor:
Red = be32_to_cpu(0xff000000);
Green = be32_to_cpu(0x00ff0000);
break;
case PixelBlueGreenRedReserved8BitPerColor:
Red = be32_to_cpu(0x0000ff00);
Green = be32_to_cpu(0x00ff0000);
break;
case PixelBitMask:
Red = Info.RedMask;
Green = Info.GreenMask;
break;
case PixelBltOnly:
return;
default:
Print(u"Invalid pixel format\n");
return;
}
for (y = 0; y < Height; y++) {
color = ((y / 32) % 2 == 0) ? Red : Green;
for (x = 0; x < Width; x++) {
if (x % 32 == 0 && x != 0)
color = (color == Red) ? Green : Red;
PixelBuffer[y * Pitch + x] = color;
}
}
}
static void
draw_boxes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
UINTN NumPixels;
UINT32 *PixelBuffer;
UINT32 CopySize, BufferSize;
#if __SIZEOF_POINTER__ == 8
UINT64 FrameBufferAddr;
#elif __SIZEOF_POINTER__ == 4
UINT32 FrameBufferAddr;
#else
#error YOUR ARCH HERE
#endif
if (gop->Mode) {
imax = gop->Mode->MaxMode;
} else {
Print(u"gop->Mode is NULL\n");
return;
}
for (i = 0; i < imax; i++) {
UINTN SizeOfInfo;
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i, &SizeOfInfo,
&info);
if (rc == EFI_NOT_STARTED) {
Print(u"gop->QueryMode() returned %r\n", rc);
Print(u"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(u"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
if (CompareMem(info, gop->Mode->Info, sizeof (*info)))
continue;
NumPixels = (UINTN)info->VerticalResolution
* (UINTN)info->PixelsPerScanLine;
BufferSize = (UINT32)(NumPixels * sizeof(UINT32));
if (BufferSize == gop->Mode->FrameBufferSize) {
CopySize = BufferSize;
} else {
CopySize = BufferSize < gop->Mode->FrameBufferSize ?
BufferSize : (UINT32)gop->Mode->FrameBufferSize;
Print(u"height * pitch * pixelsize = %lu buf fb size is %lu; using %lu\n",
BufferSize, gop->Mode->FrameBufferSize, CopySize);
}
PixelBuffer = AllocatePool(BufferSize);
if (!PixelBuffer) {
Print(u"Allocation of 0x%08lx bytes failed.\n",
sizeof(UINT32) * NumPixels);
return;
}
fill_boxes(PixelBuffer, info->HorizontalResolution,
info->VerticalResolution, info->PixelsPerScanLine,
info->PixelFormat, info->PixelInformation);
if (info->PixelFormat == PixelBltOnly) {
Print(u"No linear framebuffer on this device.\n");
return;
}
#if __SIZEOF_POINTER__ == 8
FrameBufferAddr = (UINT64)gop->Mode->FrameBufferBase;
#elif __SIZEOF_POINTER__ == 4
FrameBufferAddr = (UINT32)(UINT64)gop->Mode->FrameBufferBase;
#else
#error YOUR ARCH HERE
#endif
CopyMem((VOID *)FrameBufferAddr, PixelBuffer, CopySize);
return;
}
Print(u"Never found the active video mode?\n");
}
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(u"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)) {
Print(u"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(u"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
draw_boxes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

108
apps/modelist.c Normal file
View File

@ -0,0 +1,108 @@
#include <efi.h>
#include <efilib.h>
extern EFI_GUID GraphicsOutputProtocol;
static void
print_modes(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
{
int i, imax;
EFI_STATUS rc;
if (gop->Mode) {
imax = gop->Mode->MaxMode;
Print(u"GOP reports MaxMode %d\n", imax);
} else {
Print(u"gop->Mode is NULL\n");
imax = 1;
}
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 (rc == EFI_NOT_STARTED) {
Print(u"gop->QueryMode() returned %r\n", rc);
Print(u"Trying to start GOP with SetMode().\n");
rc = uefi_call_wrapper(gop->SetMode, 2, gop,
gop->Mode ? gop->Mode->Mode : 0);
rc = uefi_call_wrapper(gop->QueryMode, 4, gop, i,
&SizeOfInfo, &info);
}
if (EFI_ERROR(rc)) {
Print(u"%d: Bad response from QueryMode: %r (%d)\n",
i, rc, rc);
continue;
}
Print(u"%c%d: %dx%d ",
(gop->Mode &&
CompareMem(info,gop->Mode->Info,sizeof(*info)) == 0
) ? '*' : ' ',
i, info->HorizontalResolution, info->VerticalResolution);
switch(info->PixelFormat) {
case PixelRedGreenBlueReserved8BitPerColor:
Print(u"RGBR");
break;
case PixelBlueGreenRedReserved8BitPerColor:
Print(u"BGRR");
break;
case PixelBitMask:
Print(u"R:%08x G:%08x B:%08x X:%08x",
info->PixelInformation.RedMask,
info->PixelInformation.GreenMask,
info->PixelInformation.BlueMask,
info->PixelInformation.ReservedMask);
break;
case PixelBltOnly:
Print(u"(blt only)");
break;
default:
Print(u"(Invalid pixel format)");
break;
}
Print(u" 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(u"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)) {
Print(u"Could not locate GOP: %r\n", rc);
return rc;
}
if (!gop) {
Print(u"LocateProtocol(GOP, &gop) returned %r but GOP is NULL\n", rc);
return EFI_UNSUPPORTED;
}
print_modes(gop);
SetWatchdog(0);
return EFI_SUCCESS;
}

33
apps/old_ABI.c Normal file
View File

@ -0,0 +1,33 @@
#define GNU_EFI_3_0_COMPAT
#include <efi.h>
#include <efilib.h>
/* EFI_TIMESTAMP_PROTOCOL */
#define TEST_GUID { 0xafbfde41, 0x2e6e, 0x4262,\
{ 0xba, 0x65, 0x62, 0xb9, 0x23, 0x6e, 0x54, 0x95 }}
EFI_STATUS
efi_main (EFI_HANDLE image EFI_UNUSED, EFI_SYSTEM_TABLE *systab EFI_UNUSED)
{
CHAR16 *Dest = 0;
EFI_UNUSED CHAR16 *Copy = 0;
UINTN test_str_size = 0;
CONST CHAR16 *test_str = u"Hello World!";
test_str_size = StrSize(test_str);
Dest = AllocatePool(test_str_size);
CopyMem(Dest, test_str, test_str_size);
Copy = ReallocatePool(Dest, test_str_size, test_str_size+10);
Print(u"Done CopyMem and ReallocatePool!\r\n");
EFI_GUID a = TEST_GUID;
EFI_GUID b = TEST_GUID;
if (CompareGuid(&a, &b) == 0) {
Print(u"CompareGuid ok!\r\n");
} else {
Print(u"CompareGuid fail!\r\n");
}
return EFI_SUCCESS;
}

View File

@ -14,10 +14,10 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
name[0] = 0;
vendor = NullGuid;
Print(L"GUID Variable Name Value\n");
Print(L"=================================== ==================== ========\n");
Print(u"GUID Variable Name Value\n");
Print(u"=================================== ==================== ========\n");
StrCpy(fmt, L"%.-35g %.-20s %s\n");
StrCpy(fmt, u"%.-35g %.-20s %s\n");
while (1) {
size = sizeof(name);
status = uefi_call_wrapper(RT->GetNextVariableName, 3, &size, name, &vendor);

136
apps/route80h.c Normal file
View File

@ -0,0 +1,136 @@
#include <efi.h>
#include <efilib.h>
/* 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
#define DEVICE_ID_COUGARPOINT_LPCIF 0x1c56
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(u"current value is 0x%2x\n", val);
if (value) {
val |= (1 << bit);
} else {
val &= ~(1 << bit);
}
Print(u"setting value to 0x%2x\n", val);
*flag = val;
val = *flag;
Print(u"new value is 0x%2x\n", val);
}
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, i;
if (!pciio)
return EFI_INVALID_PARAMETER;
rc = LibLocateHandle(ByProtocol, &PciIoProtocol, NULL, &NoHandles,
&Handles);
if (EFI_ERROR(rc))
return rc;
for (i = 0; i < NoHandles; i++) {
void *pciio_tmp = NULL;
rc = uefi_call_wrapper(BS->OpenProtocol, 6, Handles[i],
&PciIoProtocol, &pciio_tmp, ImageHandle,
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (EFI_ERROR(rc))
continue;
*pciio = pciio_tmp;
if (!is_device(*pciio, vendor_id, device_id)) {
*pciio = NULL;
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 = NULL;
lpcif_t lpcif;
EFI_STATUS rc = EFI_SUCCESS;
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;
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(u"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(u"rcrb is not mapped, cannot route port 80h\n");
return EFI_UNSUPPORTED;
}
lpcif.rcba &= ~1UL;
Print(u"rcba: 0x%8x\n", lpcif.rcba, lpcif.rcba);
set_bit((uint32_t *)(intptr_t)(lpcif.rcba + GCS_OFFSET_ADDR),
GCS_RPR_SHIFT, GCS_RPR_PCI);
return EFI_SUCCESS;
}

37
apps/setdbg.c Normal file
View File

@ -0,0 +1,37 @@
#include <efi.h>
#include <efilib.h>
EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}};
EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}};
char grubenv[] = "# GRUB Environment Block\n\
debug=tcp,http,net\n\
####################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################";
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS status;
InitializeLib(image, systab);
#if 0
UINT8 data = 1;
status = RT->SetVariable(u"SHIM_DEBUG", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(data), &data);
if (EFI_ERROR(status))
Print(u"SetVariable failed: %r\n", status);
#endif
status = RT->SetVariable(u"GRUB_ENV", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(grubenv)-1, grubenv);
if (EFI_ERROR(status))
Print(u"SetVariable(GRUB_ENV) failed: %r\n", status);
return EFI_SUCCESS;
}

32
apps/setjmp.c Normal file
View File

@ -0,0 +1,32 @@
#include <efi.h>
#include <efilib.h>
#include <efisetjmp.h>
EFI_STATUS
efi_main(
EFI_HANDLE image_handle,
EFI_SYSTEM_TABLE *systab
)
{
jmp_buf env;
int rc;
InitializeLib(image_handle, systab);
rc = setjmp(env);
Print(u"setjmp() = %d\n", rc);
if (rc == 3) {
Print(u"3 worked\n");
longjmp(env, 0);
return 0;
}
if (rc == 1) {
Print(u"0 got to be one yay\n");
return 0;
}
longjmp(env, 3);
return 0;
}

View File

@ -20,8 +20,8 @@ efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
InitializeLib(image_handle, systab);
conout = systab->ConOut;
uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)L"Hello World!\n\r");
uefi_call_wrapper(conout->OutputString, 2, conout, a2u("Hello World!\n\r"));
uefi_call_wrapper(conout->OutputString, 2, conout, (CHAR16 *)u"Hello World!\r\n");
uefi_call_wrapper(conout->OutputString, 2, conout, a2u("Hello World!\r\n"));
return EFI_SUCCESS;
}

View File

@ -6,8 +6,9 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
InitializeLib(image, systab);
conout = systab->ConOut;
uefi_call_wrapper(conout->OutputString, 2, conout, L"Hello World!\n\r");
uefi_call_wrapper(conout->OutputString, 2, conout, u"Hello World!\r\n");
return EFI_SUCCESS;
}

View File

@ -16,19 +16,19 @@ efi_main(
InitializeLib(image_handle, systab);
PoolAllocationType = 2; /* klooj */
Print(L"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13);
Print(u"Hello World! (0xd=0x%x, 13=%d)\n", 13, 13);
Print(L"before InitializeLib(): PoolAllocationType=%d\n",
Print(u"before InitializeLib(): PoolAllocationType=%d\n",
pat);
Print(L" after InitializeLib(): PoolAllocationType=%d\n",
Print(u" after InitializeLib(): PoolAllocationType=%d\n",
PoolAllocationType);
/*
* Locate loaded_image_handle instance.
*/
Print(L"BS->HandleProtocol() ");
Print(u"BS->HandleProtocol() ");
efi_status = uefi_call_wrapper(
BS->HandleProtocol,
@ -38,31 +38,31 @@ efi_main(
&void_li_p);
li = void_li_p;
Print(L"%xh (%r)\n", efi_status, efi_status);
Print(u"%xh (%r)\n", efi_status, efi_status);
if (efi_status != EFI_SUCCESS) {
return efi_status;
}
Print(L" li: %xh\n", li);
Print(u" li: %xh\n", li);
if (!li) {
return EFI_UNSUPPORTED;
}
Print(L" li->Revision: %xh\n", li->Revision);
Print(L" li->ParentHandle: %xh\n", li->ParentHandle);
Print(L" li->SystemTable: %xh\n", li->SystemTable);
Print(L" li->DeviceHandle: %xh\n", li->DeviceHandle);
Print(L" li->FilePath: %xh\n", li->FilePath);
Print(L" li->Reserved: %xh\n", li->Reserved);
Print(L" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize);
Print(L" li->LoadOptions: %xh\n", li->LoadOptions);
Print(L" li->ImageBase: %xh\n", li->ImageBase);
Print(L" li->ImageSize: %xh\n", li->ImageSize);
Print(L" li->ImageCodeType: %xh\n", li->ImageCodeType);
Print(L" li->ImageDataType: %xh\n", li->ImageDataType);
Print(L" li->Unload: %xh\n", li->Unload);
Print(u" li->Revision: %xh\n", li->Revision);
Print(u" li->ParentHandle: %xh\n", li->ParentHandle);
Print(u" li->SystemTable: %xh\n", li->SystemTable);
Print(u" li->DeviceHandle: %xh\n", li->DeviceHandle);
Print(u" li->FilePath: %xh\n", li->FilePath);
Print(u" li->Reserved: %xh\n", li->Reserved);
Print(u" li->LoadOptionsSize: %xh\n", li->LoadOptionsSize);
Print(u" li->LoadOptions: %xh\n", li->LoadOptions);
Print(u" li->ImageBase: %xh\n", li->ImageBase);
Print(u" li->ImageSize: %xh\n", li->ImageSize);
Print(u" li->ImageCodeType: %xh\n", li->ImageCodeType);
Print(u" li->ImageDataType: %xh\n", li->ImageDataType);
Print(u" li->Unload: %xh\n", li->Unload);
#if 0
typedef struct {

View File

@ -6,8 +6,9 @@ efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
{
UINTN index;
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"Hello application started\r\n");
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, L"\r\n\r\n\r\nHit any key to exit\r\n");
InitializeLib(image, systab);
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, u"Hello application started\r\n");
uefi_call_wrapper(systab->ConOut->OutputString, 2, systab->ConOut, u"\r\n\r\n\r\nHit any key to exit\r\n");
uefi_call_wrapper(systab->BootServices->WaitForEvent, 3, 1, &systab->ConIn->WaitForKey, &index);
return EFI_SUCCESS;
}

View File

@ -5,9 +5,9 @@ EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
InitializeLib(image, systab);
Print(L"HelloLib application started\n");
Print(L"\n\n\nHit any key to exit this image\n");
Print(u"HelloLib application started\n");
Print(u"\n\n\nHit any key to exit this image\n");
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, u"\n\n");
return EFI_SUCCESS;
}

View File

@ -25,19 +25,19 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
&LoadedImageProtocol,
(void **) &loaded_image);
if (EFI_ERROR(status)) {
Print(L"handleprotocol: %r\n", status);
Print(u"handleprotocol: %r\n", status);
}
#if 0
BS->HandleProtocol(loaded_image->DeviceHandle, &DevicePathProtocol, (void **) &dev_path);
Print(L"Image device : %s\n", DevicePathToStr(dev_path));
Print(L"Image file : %s\n", DevicePathToStr(loaded_image->FilePath));
Print(u"Image device : %s\n", DevicePathToStr(dev_path));
Print(u"Image file : %s\n", DevicePathToStr(loaded_image->FilePath));
#endif
Print(L"Image base : %lx\n", loaded_image->ImageBase);
Print(L"Image size : %lx\n", loaded_image->ImageSize);
Print(L"Load options size : %lx\n", loaded_image->LoadOptionsSize);
Print(L"Load options : %s\n", loaded_image->LoadOptions);
Print(u"Image base : %lx\n", loaded_image->ImageBase);
Print(u"Image size : %lx\n", loaded_image->ImageSize);
Print(u"Load options size : %lx\n", loaded_image->LoadOptionsSize);
Print(u"Load options : %s\n", loaded_image->LoadOptions);
return EFI_SUCCESS;
}

View File

@ -9,17 +9,17 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
InitializeLib(image, systab);
Print(L"HelloLib application started\n");
Print(u"HelloLib application started\n");
Print(L"\n\n\nHit any key to exit this image\n");
Print(u"\n\n\nHit any key to exit this image\n");
WaitForSingleEvent(ST->ConIn->WaitForKey, 0);
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, L"\n\n");
uefi_call_wrapper(ST->ConOut->OutputString, 2, ST->ConOut, u"\n\n");
efi_status = uefi_call_wrapper(ST->ConIn->ReadKeyStroke, 2, ST->ConIn, &efi_input_key);
Print(L"ScanCode: %xh UnicodeChar: %xh\n",
efi_input_key.ScanCode, efi_input_key.UnicodeChar);
Print(u"ScanCode: %xh UnicodeChar: %xh CallRtStatus: %x\n",
efi_input_key.ScanCode, efi_input_key.UnicodeChar, efi_status);
return EFI_SUCCESS;
}

19
apps/t8.c Normal file
View File

@ -0,0 +1,19 @@
#include <efi.h>
#include <efilib.h>
EFI_STATUS
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
INTN Argc, i;
CHAR16 **Argv;
InitializeLib(ImageHandle, SystemTable);
Argc = GetShellArgcArgv(ImageHandle, &Argv);
Print(u"Hello World, started with Argc=%d\n", Argc);
for (i = 0 ; i < Argc ; ++i)
Print(u" Argv[%d] = '%s'\n", i, Argv[i]);
Print(u"Bye.\n");
return EFI_SUCCESS;
}

View File

@ -5,14 +5,7 @@
#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"
@ -25,15 +18,15 @@ void dump_stack_helper(uint64_t rsp_val)
uint64_t *rsp = (uint64_t *)rsp_val;
int x;
Print(L"%%rsp: 0x%08x%08x stack:\r\n",
Print(u"%%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++);
Print(u"%08x: ", ((uint64_t)rsp) & 0xffffffff);
Print(u"%016x ", *rsp++);
Print(u"%016x ", *rsp++);
Print(u"%016x ", *rsp++);
Print(u"%016x\r\n", *rsp++);
}
}
#endif
@ -331,110 +324,106 @@ efi_main (EFI_HANDLE *image, EFI_SYSTEM_TABLE *systab)
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;
#ifdef __x86_64__
__asm__ volatile("out %0,%1" : : "a" ((uint8_t)0x14), "dN" (0x80));
#endif
asm volatile("out %0,%1" : : "a" ((uint8_t)0x14), "dN" (0x80));
Print(L"Hello\r\n");
Print(u"Hello\n");
rc = test_failure();
if (EFI_ERROR(rc)) {
Print(L"Returning Failure works\n");
Print(u"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",
Print(u"Returning failure doesn't work.\n");
Print(u"%%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");
Print(u"0 args works just fine here.\n");
} else {
Print(L"0 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"1 arg works just fine here.\n");
} else {
Print(L"1 arg failed: 0x%016x\n", rc);
Print(u"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");
Print(u"2 args works just fine here.\n");
} else {
Print(L"2 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"3 args works just fine here.\n");
} else {
Print(L"3 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"4 args works just fine here.\n");
} else {
Print(L"4 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"5 args works just fine here.\n");
} else {
Print(L"5 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"6 args works just fine here.\n");
} else {
Print(L"6 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"7 args works just fine here.\n");
} else {
Print(L"7 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"8 args works just fine here.\n");
} else {
Print(L"8 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"9 args works just fine here.\n");
} else {
Print(L"9 args failed: 0x%016x\n", rc);
Print(u"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");
Print(u"10 args works just fine here.\n");
} else {
Print(L"10 args failed: 0x%016x\n", rc);
Print(u"10 args failed: 0x%016x\n", rc);
return rc;
}

37
apps/unsetdbg.c Normal file
View File

@ -0,0 +1,37 @@
#include <efi.h>
#include <efilib.h>
EFI_GUID GRUB_EFI_GRUB_VARIABLE_GUID = {0x91376aff,0xcba6,0x42be,{0x94,0x9d,0x06,0xfd,0xe8,0x11,0x28,0xe8}};
EFI_GUID SHIM_GUID = {0x605dab50,0xe046,0x4300,{0xab,0xb6,0x3d,0xd8,0x10,0xdd,0x8b,0x23}};
char grubenv[] = "# GRUB Environment Block\n\
debug=all\n\
#############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################";
EFI_STATUS
efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
{
EFI_STATUS status;
UINT8 data = 1;
InitializeLib(image, systab);
status = RT->SetVariable(u"SHIM_DEBUG", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
0, &data);
if (EFI_ERROR(status))
Print(u"SetVariable failed: %r\n", status);
#if 0
status = RT->SetVariable(u"GRUB_ENV", &SHIM_GUID,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(grubenv)-1, grubenv);
if (EFI_ERROR(status))
Print(u"SetVariable(GRUB_ENV) failed: %r\n", status);
#endif
return EFI_SUCCESS;
}

26
docs/README.ABI.md Normal file
View File

@ -0,0 +1,26 @@
1) When using gnu-efi 4.0 with an application which was written
for gnu-efi 3.0, it may be required to set the `GNU_EFI_3_0_COMPAT` compile flag
this changes the default versions of some changed functions back to their prior
versions
This currently includes the following functions:
- ReallocatePool
Inputs were re-ordered
- CopyMem
Source is no longer marked as constant
CopyMemC is introduced as a helper function when using a constant source input
- CompareGuid
Function now returns BOOLEAN instead of INTN
Return codes are now reversed
**Will break at runtime - likely causing opposite output to expected**
2) Applications which haven't been updated in a while may also be missing the
required `.rodata` section which contains needed read-only data which will prevent
any binary missing this section from running correctly

19
docs/README.elilo.md Normal file
View File

@ -0,0 +1,19 @@
# IMPORTANT information related to the gnu-efi package
----------------------------------------------------
June 2001
As of version 3.0, the gnu-efi package is now split in two different packages:
- gnu-efi-X.y: contains the EFI library, include files and crt0.
- elilo-X.y : contains the ELILO bootloader.
Note that X.y don't need to match for both packages. However elilo-3.x
requires at least gnu-efi-3.0. EFI support for x86_64 is provided in
gnu-efi-3.0d.
Both packages can be downloaded from:
- [gnu-efi](https://github.com/ncroxon/gnu-efi)
- [elilo](https://sourceforge.net/projects/elilo/)

32
docs/README.git.md Normal file
View File

@ -0,0 +1,32 @@
# README.git
Generating releases on GitHub is a very simple process;
## Set version in repo
1) Edit the file "Makefile". Changing the "VERSION" line to the new version.
2) Do a "git commit" just for the version number change.
## Create new release
1) Go to the [GitHub release page](https://github.com/ncroxon/gnu-efi/releases/new)
2) Enter the version number in the tag field, selecting "create tag on publish"
**Ignore GitHub's suggestion of prefixing the version with a "v"**
3) Set previous tag manually
- Last stable for stable releases
- Last alpha/beta for alpha/beta releases
**Ensures GitHub sets the Full Changelog to be between the last release in the cycle**
**and not the start of the repository**
4) Add a release title - use the version number
**Otherwise GitHub will add the last commit name as the title**
5) ***OPTIONAL***
Add a release description *and/or* a list of pull requests and contributors via "Generate release notes"
6) For alpha/beta versions, set it to be a pre-release
7) Release the new version
8) GitHub will automatically generate a GZ compressed TAR file and a ZIP file of the repo

19
docs/README.packaging.md Normal file
View File

@ -0,0 +1,19 @@
# Packaging gnu-efi
## Set variables per distro configuration
make should be called with the following variables:
- PREFIX (defaults to `/usr/local`)(`%{_prefix}` on RPM distros)
- EXEC_PREFIX (*optional*) (defaults to `$PREFIX`) (`%{_exec_prefix}` on RPM distros)
- LIBDIR (defaults to `$EXEC_PREFIX/lib`) (`%{_libdir}` on RPM distros)
- INCLUDEDIR (*optional*) (defaults to `$PREFIX/include`) (`%{_includedir}` on RPM distros)
- LINUX_HEADERS (*optional*) (**build only**) - location of Linux kernel header files (defaults to `/usr/src/sys/build`)
- DESTDIR (**install only**) - installation output directory (`%{buildroot}` on RPM distros - included in `%make_install`)
Currently, these variables unless stated will need to be set for both build and installation stages.
Those without optional markers I heavily suggest you to set them otherwise files may be located in the wrong directory
for the architecture which you are building for
*The related RPM variables are included here for cross referencing purposes*

View File

@ -1,279 +0,0 @@
2012-09-21 Nigel Croxon <nigel.croxon@hp.com>
* Change from Peter Jones <pjones@redhat.com>
- EFI Block I/O protocol versions 2 and 3 provide more information
regarding physical disk layout, including alingment offset at the
beginning of the disk ("LowestAlignedLba"), logical block size
("LogicalBlocksPerPhysicalBlock"), and optimal block transfer size
("OptimalTransferLengthGranularity").
* Release 3.0r
2012-04-30 Nigel Croxon <nigel.croxon@hp.com>
* Change from Matt Fleming <matt.fleming@intel.com>
- The .reloc section is now 4096-byte boundary for x86_64.
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.
* Release 3.0q
2011-12-12 Nigel Croxon <nigel.croxon@hp.com>
* Changes from Fenghua Yu <fenghua.yu@intel.com>
- This fixes redefined types compilation failure for tcc.c on x86_64 machines.
* Release 3.0p
2011-11-15 Nigel Croxon <nigel.croxon@hp.com>
* Changes from Darren Hart <dvhart@linux.intel.com>
- Conditionally assign toolchain binaries to allow overriding them.
- Force a dependency on lib for gnuefi.
* Release 3.0n
2011-08-23 Nigel Croxon <nigel.croxon@hp.com>
* Changes from Peter Jones <pjones@redhat.com>
- Add guarantee 16-byte stack alignment on x86_64.
- Add routine to make callbacks work.
- Add apps/tcc.efi to test calling convention.
* Release 3.0m
2011-07-22 Nigel Croxon <nigel.croxon@hp.com>
* Changed Makefiles from GPL to BSD.
* Changes from Peter Jones <pjones@redhat.com>
- Add ifdefs for ia64 to mirror ia32 and x86-64 so that
one can build with GCC.
- Add headers for PciIo.
- Add the UEFI 2.x bits for EFI_BOOT_SERVICES
- Add an ignore for .note.GNU-stack section in X86-64 linker maps.
* Release 3.0l
2011-04-07 Nigel Croxon <nigel.croxon@hp.com>
* Change license from GPL to BSD.
* Release 3.0j
2009-09-12 Julien BLACHE <jb@jblache.org>
* Add support for FreeBSD.
* Release 3.0i
2009-09-11 Julien BLACHE <jb@jblache.org>
* Fix elf_ia32_efi.lds linker script to be compatible with the new
linker behaviour. Patch from the RedHat bugzilla 492183.
2009-06-18 Nigel Croxon <nigel.croxon@hp.com>
* Release 3.0h
2008-11-06 Nigel Croxon <nigel.croxon@hp.com>
* Fix to not having any relocations at all.
2008-09-18 Nigel Croxon <nigel.croxon@hp.com>
* Use LIBDIR in makefiles
* Add setjmp/longjmp
* Fixes incorrect section attribute in crt0-efi-ia32.S
* Adds value EfiResetShutdown to enum EFI_RESET_TYPE
* Fixes a RAW warning in reloc_ia64.S
* Adds the USB HCI device path structure in the headers
patches were supplied by Peter Jones @ RedHat
2008-02-22 Nigel Croxon <nigel.croxon@hp.com>
* Added '-mno-red-zone' to x68_64 compiles.
Patch provided by Mats Andersson.
2008-01-23 Nigel Croxon <nigel.croxon@hp.com>
* release 3.0e to support x86_64
EFI calling convention, the stack should be aligned in 16 bytes
to make it possible to use SSE2 in EFI boot services.
This patch fixes this issue. Patch provided by Huang Ying from Intel.
2007-05-11 Nigel Croxon <nigel.croxon@hp.com>
* release 3.0d to support x86_64 from Chandramouli Narayanan
from Intel and based on 3.0c-1
2006-03-21 Stephane Eranian <eranian@hpl.hp.com>
* merged patch to support gcc-4.1 submitted by
Raymund Will from Novell/SuSE
2006-03-20 Stephane Eranian <eranian@hpl.hp.com>
* updated ia-64 and ia-32 linker scripts to
match latest gcc. The new gcc may put functions in
.text* sections. patch submitted by H.J. Lu from Intel.
2004-11-19 Stephane Eranian <eranian@hpl.hp.com>
* added patch to ignore .eh_frame section for IA-32. Patch
submitted by Jim Wilson
2004-09-23 Stephane Eranian <eranian@hpl.hp.com>
* added patch to discard unwind sections, newer toolchains
complained about them. Patch submitted by Jesse Barnes from SGI.
2003-09-29 Stephane Eranian <eranian@hpl.hp.com>
* updated elf_ia64_efi.lds to reflect new data sections
created by gcc-3.3. Patch provided by Andreas Schwab from Suse.
2003-06-20 Stephane Eranian <eranian@hpl.hp.com>
* updated elf_ia64_efi.lds and elf_ia32_efi.lds to include
new types data sections produced by recent version of gcc-3.x
2002-02-22 Stephane Eranian <eranian@hpl.hp.com>
* release 3.0a
* modified both IA-64 and IA-32 loader scripts to add support for the
new .rodata sections names (such as rodata.str2.8). Required
for new versions of gcc3.x.
2001-06-20 Stephane Eranian <eranian@hpl.hp.com>
* release 3.0
* split gnu-efi package in two different packages: the libary+include+crt and the bootloader.
* removed W2U() hack and related files to get from wide-char to unicode.
* Use -fshort-wchar option for unicode.
* restructured Makefiles now install under INSTALLROOT.
2001-04-06 Stephane Eranian <eranian@hpl.hp.com>
* incorporated patches from David and Michael Johnston at Intel
to get the package to compile for IA-32 linux target.
* Fixed ELILO to compile for Ia-32 (does not execute yet, though):
Makefile and start_kernel() function.
2001-04-06 Andreas Schwab <schwab@suse.de>
* Fixed config.c to
get the timeout directive to do something. implemented the global
root= directive.
* Fix the efi_main() to deal with the -C option properly
2001-04-05 Stephane Eranian <eranian@hpl.hp.com>
* update efi library to latest EFI toolkit 1.02 as distributed
by Intel. Fixed header + library files to compile with GCC
* merged ELI and LILO (as of gnu-efi-1.1) together, mostly
taking the config file feature of ELI.
* renamed LILO to ELILO to make the distinction
* restructured code to make it easier to understand and maintain
* fixed FPSWA driver checking and loading: we try all possible
files and let the driver itself figure out if it is the most
recent.
* added support for compression (gzip) but keep support for plain
ELF image. ELILO autodetects the format
* change the way the kernel is invoked. Now we call it in
physical memory mode. This breaks the dependency between the
kernel code and the loader. No more lilo_start.c madness.
* changed the way the boot_params are passed. We don't use the
ZERO_PAGE_ADDR trick anymore. Instead we use EFI runtime memory.
The address of the structure is passed to the kernel in r28
by our convention.
* released as gnu-efi-2.0
2001-04-03 David Mosberger <davidm@hpl.hp.com>
* gnuefi/reloc_ia32.c (_relocate): Change return type from "void"
to "int". Return error status if relocation fails for some
reason.
* gnuefi/elf_ia32_efi.lds: Drop unneeded ".rel.reloc" section.
* gnuefi/crt0-efi-ia32.S (_start): Exit if _relocate() returns with
non-zero exit status.
* inc/ia32/efibind.h [__GNUC__]: Force 8-byte alignment for 64-bit
types as that is what EFI appears to be expecting, despite the
"#pragma pack()" at the beginning of the file!
2001-03-29 David Mosberger <davidm@hpl.hp.com>
* gnuefi/reloc_ia32.c: Add a couple of defines to work around
libc/efilib collision on uint64_t et al.
(_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)().
* gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry.
2001-03-29 David Mosberger <davidm@hpl.hp.com>
* gnuefi/reloc_ia32.c: Add a couple of defines to work around
libc/efilib collision on uint64_t et al.
(_relocate): Use ELF32_R_TYPE() instead of ELFW(R_TYPE)().
* gnuefi/crt0-efi-ia32.S (dummy): Add a dummy relocation entry.
2000-10-26 David Mosberger <davidm@hpl.hp.com>
* gnuefi/elf_ia64_efi.lds: Mention .rela.sdata.
* Make.defaults (CFLAGS): Remove -nostdinc flags so we can pick
up the C compiler's stdarg.h.
* inc/stdarg.h: Remove this file. It's not correct for gcc (nor
most other optimizing compilers).
2000-10-10 Stephane Eranian <eranian@hpl.hp.com>
* cleaned up the error message and printing of those.
* added support to load the FPSWA from a file in case support is not
present in the firmware already
* fixed split_args() to do the right thing when you have leading spaces
before kernel name
* changed the argify() function to rely on \0 instead of LoadOptionSize
as the field seems to be broken with current firmware
* bumped version to 1.0
2000-10-04 David Mosberger <davidm@hpl.hp.com>
* gnuefi/reloc_ia64.S: Reserve space for up to 750 function descriptors.
* gnuefi/elf_ia64_efi.lds: Add .sdata section for small data and
put __gp in the "middle" of it.
* gnuefi/crt0-efi-ia64.S (_start): Use movl/add to load
gp-relative addresses that could be out of the range of the addl
offset.
* gnuefi/reloc_ia64.S (_relocate): Ditto.
* apps/Makefile: Remove standard rules and include Make.rules instead.
* lilo/Makefile: Ditto.
* Make.rules: New file.
2000-08-04 Stephane Eranian <eranian@hpl.hp.com>
* released version 0.9
* incorporated ACPI changes for Asuza by NEC < kouchi@hpc.bs1.fc.nec.co.jp>
* added support for initrd (-i option) original ELI code from Bill Nottingham <notting@redhat.com>)
* lots of cleanups
* got rid of #ifdef LILO_DEBUG and uses macro instead
* fix a few extra memory leaks in create_boot_params()
* added exit capability just before starting the kernel
2000-06-22 David Mosberger <davidm@hpl.hp.com>
* gnuefi/elf_ia64_efi.lds: Add .srodata, .ctors, .IA64.unwind,
.IA64.unwind_info to .data section and .rela.ctors to .rela
section.
2000-04-03 David Mosberger <davidm@hpl.hp.com>
* lilo/lilo.c (LILO_VERSION): Up version number to 0.9.
* gnuefi/elf_ia64_efi.lds: Include .IA_64.unwind and
.IA_64.unwind_info in .data segment to avoid EFI load error
"ImageAddress: pointer outside of image" error due to the .dynsym
relocations against these sections.
* ChangeLog: Moved from lilo/ChangeLogs.
* gnuefi/reloc_ia64.S: fixed typo: .space directive had constant
100 hardcoded instead of using MAX_FUNCTION_DESCRIPTORS
macro. Duh.
Fri Mar 17 15:19:18 PST 2000 Stephane Eranian <eranian@hpl.hp.com>
* Released 0.8
* replace the getopt.c with new version free with better license
* created a documentation file
* fix a couple of memory leaks
* code cleanups
* created a separate directory for lilo in the gnu-efi package.
* added support for the BOOT_IMAGE argument to kernel
* default is to build natively now

View File

@ -1,80 +0,0 @@
#
# Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
# Contributed by David Mosberger <davidm@hpl.hp.com>
# Contributed by Stephane Eranian <eranian@hpl.hp.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
# * Neither the name of Hewlett-Packard Co. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# #
#
# Where to install the package. GNU-EFI will create and access
# lib and include under the root
#
INSTALLROOT=/usr/local
LIBDIR=lib
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,)
OS = $(shell uname -s)
INCDIR = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol
CPPFLAGS = -DCONFIG_$(ARCH)
CFLAGS = $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants
ASFLAGS = $(ARCH3264)
LDFLAGS = -nostdlib
INSTALL = install
prefix = /usr/bin/
CC := $(prefix)gcc
AS := $(prefix)as
LD := $(prefix)ld
AR := $(prefix)ar
RANLIB := $(prefix)ranlib
OBJCOPY := $(prefix)objcopy
ifeq ($(ARCH),ia64)
CFLAGS += -mfixed-range=f32-f127
endif
ifeq ($(ARCH), ia32)
ifeq ($(HOSTARCH), x86_64)
ARCH3264 = -m32
endif
endif
ifeq ($(ARCH), x86_64)
CFLAGS += -mno-red-zone
LIBDIR = lib
ifeq ($(HOSTARCH), ia32)
ARCH3264 = -m64
endif
endif

Some files were not shown because too many files have changed in this diff Show More