EFI development tools

Eric McCorkle eric at shadowsun.net
Sun Jun 17 22:45:48 UTC 2012


On 6/15/12 6:44 PM, Eric McCorkle wrote:

> However, the EFI programs I produce using the EDK system work
> properly, and don't have the same issues as the ones I produce using
> what's in the base system.
>

Okay, after a whole lot of slogging, I figured out the root of the 
problems I've been seeing, and it needs to be addressed ASAP.

When I compile the following program:

#include <stdlib.h>
#include <efi.h>
#include <efiapi.h>

#include <stdio.h>

int main() {
   printf("%d\n", UINT64);
   return 0;
}

as follows:

gcc -o test -O2 -m32 -I${HEAD}/sys/boot/efi/include 
-I${HEAD}/sys/boot/efi/include/i386 -I${HEAD}/sys/boot/common test.c

and run it, the output is 4, not 8 as it should be.  You can replace 
UINT64 with uint64_t and see the same (erroneous) behavior.  The -m32 
flag seems to be the culprit; removing it fixes the problem.

This is why I was having problems, as the offsets in EFI_SYSTEM_TABLE 
were wrong.

In any case, this is a pretty serious error, and someone should try to 
reproduce it and take a look at it.


More information about the freebsd-hackers mailing list