Commit Graph

208 Commits

Author SHA1 Message Date
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