Commit Graph

128 Commits

Author SHA1 Message Date
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
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
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
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
Callum Farmer
f5bb548df5
Align RTLIB CopyMem/SetMem with normal versions
Looks like 699e452654 broke rEFInd
(189e405630/)
2024-04-25 15:27:26 +01: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
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
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
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
9e47db1193 Add C++ extern C header markers
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-03-22 10:06:43 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
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