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>
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>
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>
As per the PE format specification, relocation blocks must be aligned on 32-bit boundaries. Fix the dummy relocations to obey the alignment constraints.
For each va_start() there must be a va_end().
Correct LibInstallProtocolInterfaces() and
LibUninstallProtocolInterfaces().
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
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>
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.
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.
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.
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...
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>
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>
* __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)
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.
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>
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>