summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix conversion from 'UINTN' to 'UINT8' warningsPete Batard2018-05-011-2/+2
| | | | | * MSVC generates two of the following in rtstr.c: warning C4244: 'function': conversion from 'UINTN' to 'UINT8', possible loss of data
* Add %D to print device pathsPeter Jones2018-03-141-0/+13
| | | | | | | Add %D to print device paths. Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* gnu-efi: add some more common string functions.Peter Jones2018-03-142-3/+142
| | | | | | | | | | | | | | 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>
* Fix another place clang complains aboutPeter Jones2018-03-141-1/+1
| | | | | | | Fix another place clang complains about. Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* gnu-efi: fix lib/ia64/setjmp.S IA-64 build failureSergei Trofimovich2018-01-281-31/+30
| | | | | | | | | | | | | | 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>
* Currently we have DivU64x32 on ia32, but it tries to callNigel Croxon2018-01-101-2/+2
| | | | | | | | __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>
* Move memcpy/memset definition to global init.cNigel Croxon2017-11-064-94/+40
| | | | | | | | | | | | | 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>
* Make sure stdint.h is always used with MSVC on ARM/ARM64, since allNigel Croxon2017-11-062-1/+9
| | | | | | | | | | | | | | | | | | 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>
* Use ARFLAGS when invoking ar.Nigel Croxon2017-08-071-1/+1
| | | | | | | | 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>
* This commit inserts the libefi.a objects in a stable order.Nigel Croxon2017-06-011-1/+2
| | | | | | | | | | | 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>
* Add the fallthrough attribute to notify gcc7 that it's on purpose.Nigel Croxon2017-05-311-0/+3
| | | | | Signed-off-by: Gary Lin <glin@suse.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* On x86_64, newish gcc will use relocation types R_X86_64_GOTPCREL,Nigel Croxon2017-04-071-0/+3
| | | | | | | | | | | | | | | | 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>
* This is mere refactoring of the code and is not linked to anyNigel Croxon2017-03-301-1/+19
| | | | | | | | | | | | | 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>
* add-Exit - Add Exit() library function which calls BS->Exit()Nigel Croxon2017-02-175-1/+28
| | | | | Signed-off-by: Jonathon Reinhart <jonathon.reinhart@gmail.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* fix clang support.Nigel Croxon2017-02-171-1/+1
| | | | | | | | | 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>
* Add support for 64 bit MIPSNigel Croxon2017-01-085-1/+208
| | | | | | | 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>
* GCC 4.8 (and others) const warningsNigel Croxon2017-01-082-48/+48
| | | | | | | | | | 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>
* AARCH64 gcc error with const qualifiersNigel Croxon2016-11-211-1/+2
| | | | | | | | | | 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>
* Add Debugger protocol support.Nigel Croxon2016-09-151-0/+5
| | | | | Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* Add EBC (EFI Byte Code) protocol support.Nigel Croxon2016-09-151-0/+1
| | | | | Signed-off-by: Pete Batard <pete@akeo.ie> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* Add support for PCI Root Bridge I/O protocol.Nigel Croxon2016-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | 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>
* Update global protocol GUIDs definitions to match EDK2Nigel Croxon2016-08-182-83/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add support for some UEFI 2.0 protocolsNigel Croxon2016-08-161-13/+17
| | | | | | | | | | * 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>
* The latest gnu-efi produces the following warning whenNigel Croxon2016-07-081-1/+1
| | | | | | | | | 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>
* This patch adds definitions to efiprot.h forNigel Croxon2016-07-081-0/+3
| | | | | | | | | | 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>
* I did not submit the right file on my last submission.Nigel Croxon2016-06-171-2/+21
| | | | | | | | 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>
* I did a quick review of the MS x86_64 calling convention for floatingNigel Croxon2016-06-171-0/+44
| | | | | | | | | | | | | | | | 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>
* This patch adds protocol definitions (and the corresponding globalNigel Croxon2016-05-031-0/+3
| | | | | | | | | | | | 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>
* The default __GNUC__ C code cannot be used with MinGW as it insertsNigel Croxon2016-04-181-7/+25
| | | | | | | | | | | | 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>
* When copying structs, some compilers (e.g. MSVC for ARM) will use anNigel Croxon2016-04-041-4/+4
| | | | | | | | | 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>
* When compiling in x86_32|Debug mode and choosing not to link with standardNigel Croxon2016-04-041-36/+37
| | | | | | | | | | | | | | 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>
* The following fixes a couple GCC specifics for the ARM platform,Nigel Croxon2016-03-281-1/+2
| | | | | | | | 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>
* I also found an issue when compiling setjmp.S using MinGW for bothNigel Croxon2016-03-252-2/+18
| | | | | | | | | | | | 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>
* Commit 3dd05c and subsequent ones introduced the use of the GNUNigel Croxon2016-03-258-75/+73
| | | | | | | | | | | | | | | | | | | | | 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>
* %d now represents signed decimal, %u represents unsigned decimal.Nigel Croxon2016-03-251-4/+14
| | | | | | | | | | | | | | | | | | | | 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>
* Added definitions for EFI HASH PROTOCOLNigel Croxon2016-03-171-0/+1
| | | | | Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* Add definitions for EFI_COMPONENT_NAME_PROTOCOL and EFI_COMPONENT_NAME2_PROTOCOLNigel Croxon2016-03-151-0/+3
| | | | | Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* Global GUID for DRIVER_BINDING_PROTOCOLNigel Croxon2016-03-101-0/+1
| | | | | Signed-off-by: Nathan Blythe <nblythe@lgsinnovations.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* This -Wall -Wextra thing actually caught a real bug.Nigel Croxon2016-03-031-2/+2
| | | | | Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* Don't pass a pointer-to-(LoadedImage *) as a void **;Nigel Croxon2016-03-031-3/+3
| | | | | | | 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>
* This makes "-Werror=unused-but-set-variable" work.Nigel Croxon2016-03-032-6/+5
| | | | | Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* This makes "-Werror=unused-parameter" not fail.Nigel Croxon2016-03-038-21/+18
| | | | | Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* From: Ard Biesheuvel <ard.biesheuvel@linaro.org>Nigel Croxon2015-12-2310-473/+606
| | | | | | | | | | | | | | | | 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>
* From: Ard Biesheuvel <ard.biesheuvel@linaro.org>Nigel Croxon2015-12-234-24/+44
| | | | | | | | | | | 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>
* From: Julian Andres Klode <jak@debian.org>Nigel Croxon2015-11-301-11/+8
| | | | | | | | | | | 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>
* From: Gary Ching-Pang Lin <chingpang@gmail.com>Nigel Croxon2015-08-171-0/+14
| | | | | | | | | | 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>
* Added some missing error code descriptionsNigel Croxon2015-05-141-0/+7
| | | | | Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
* Turns out we actually need setjmp in one of gnu-efi's prominentNigel Croxon2015-05-147-1/+450
| | | | | | | | | | | | | | 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>
* Fix ARM32 and AARCH64 buildsNigel Croxon2015-04-101-1/+1
| | | | | | | | 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>
* [PATCH] _SPrint: fix NULL terminationNigel Croxon2015-03-231-1/+1
| | | | | | | 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>