[haiku-commits] BRANCH jessicah-github.uefi-fix-boot [709a457fd837] headers/private/kernel/boot/platform/efi src/system/boot/platform/efi headers/private/kernel/boot/platform/efi/arch/x86_64 headers/private/kernel/boot/platform/efi/arch/x86 headers/private/kernel/boot/platform/efi/protocol

  • From: jessicah-github.uefi-fix-boot <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 23 Sep 2015 14:47:06 +0200 (CEST)

added 91 changesets to branch 'refs/remotes/jessicah-github/uefi-fix-boot'
old head: 0000000000000000000000000000000000000000
new head: 709a457fd8377025d4041be501eea9d3a234892e
overview: https://github.com/jessicah/haiku/compare/709a457fd837

----------------------------------------------------------------------------

2012cda3cf4e: UEFI: platform headers

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

8a738ec65e9c: Add EFI linker script for x86_64 from GNU-EFI project.

Original file is gnuefi/elf_x86_64.lds in GNU-EFI.
From GNU-EFI commit 8f5ba0e4fd398d49c0004164d18e50fb6acd36ca

http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

c26339b31ea8: Add x86_64 EFI relocation function from GNU-EFI project.

Original file is gnuefi/reloc_x86_64.c in GNU-EFI.

From GNU-EFI commit 8f5ba0e

http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

1b1b0f884a7c: Remove efilib header, use extern "C" block.

Removed #include <efilib.h> as we're stripping down GNU-EFI.
Added extern "C" block around _relocate function to avoid name mangling.
Whitespace cleanup.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

797b1b0a44e7: Add x86_64 EFI start function from GNU-EFI project.

Original file is gnuefi/crt0-efi-x86_64.S in GNU-EFI.

From GNU-EFI commit 8f5ba0e

http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

26d5c13f8a9c: Working EFI application ('Hello World') and Jamfile.

First version of an EFI Application that actually runs.
The Jamfile is a still a bit of a hack, but builds with updated buildtools.

I currently build by adding
SubInclude HAIKU_TOP src system boot platform efi ;
to src/system/boot/Jamfile and running jam haiku.efi but that is just a
temporary hack.
There are still things to clean up in Jamfile, for instance haiku.efi is put
in the haiku directory atm. This is however first working version. To set up
QEMU to test haiku.efi see my docs in https://github.com/tqh/efi-example

Now it is 'just' the work of writing a bootloader left.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

f6397480bf32: As I understand MakeLocateDebug should be used on haiku.efi

This causes haiku.efi to be built in the right directory.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

9922fd37fa87: Set bios_ia32 only if no other boot platform is set.

Only set bios_ia32 flags for x86_64 if boot platform is bios_ia32.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

03ed28c52f13: Use boot_loader_$(TARGET_BOOT_PLATFORM).ld naming for linker
script.

As dictated in system/boot/Jamfile.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

0b026841726b: Added simple calloc implementation.

Needed for HashMap.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

5c48c041de41: Don't use partition pointer as id, as it only works on 32bit
platforms.

Use a counter to generate the partition id, and store the id to partition
lookup in a hashmap instead.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

3d3e5bb985f6: Use memset in calloc, return NULL on size or numElements == 0.

Posix states 'If either numElements or size is 0, then either a null pointer
or a
unique pointer value that can be successfully passed to free() shall be
returned.'

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

2d3bdb8a57e5: Only use 32 bit functions in boot on x86_64 if we are bios_ia32.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

0c8da824b291: Add TARGET_BOOT_LINKFLAGS to LINKFLAGS in BootLD.

Consulted with Ingo on adding TARGET_BOOT_LINKFLAGS, and
this is 'probably' ok as x86_64 builds still build and runs.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

96ead93193de: Make 32 bit ELF relocation compile on 64 bit boot platforms.

boot_arch_elf_relocate_rel tries to call boot_elf_resolve_symbol
with an *addr_t so we make sure it is always *Elf32_Addr.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

a66dcf8a85d1: Cleaning up EFI platform Jamfile a bit.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

9e7a8878ea46: Use x86_64 functions for x86_64 non bios platforms.

This logic is handled in libroot Jamfiles, but we only
use parts of that in boot.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

36e9399ed91c: Setup -fno-pic or -fpic in Architecture Rules.

EFI boot needs -fpic but all boot code was built with -fno-pic.
This is now set accordingly in HAIKU_BOOT_CCFLAGS and
HAIKU_BOOT_C++FLAGS.

Also setup compile flags for EFI platform.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

13833f1989d7: Introduce new build flag for bootld and add EFI boot targets.

EFI needs BootLd to use -BSymbolic and others to link.
Also moved BoardSetup to use that flag instead of Jamfile magic.
BoardSetup was called and added to XX_CC_FLAGS before
XX_CC_FLAGS was set so moved BoardSetup to after it, which also
made sense for this change.

This allow building a runnable(!) EFI app with
jam -sHAIKU_BOOT_PLATFORM=efi haiku_loader.efi
Atm it only prints a message and waits for a key.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

11a9fecf5092: Implement console code.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

30a19a11d136: Init console.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

cb1015bdc758: Remove old start.c.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

652bad9866e9: Update Jamfile to build console, remove old rules.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

02ab4a20c33b: Remove old EFI string writing test code.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

014eb43605da: Make sure bootloader builds to the right directory.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

d66450e3c557: loader: Drop the HashMap for partition lookup by id

The HashMap constructor was called before the heap is initialized,
ending up calling malloc from the OpenHashMap constructor.

Oddly it was still working on x86 but broke other platforms.

Instead we add a Lookup() static method to Partition,
which by default walks gPartitions for the id,
and recursively calls itself on the children lists.

This means we must add a partition even temporarily to gPartitions
before Scan()ing it though.

Signed-off-by: François Revol <revol@xxxxxxx>

[ François Revol <revol@xxxxxxx> ]

aced58ce96be: GNU-EFI has removed the -S (strip-all) option, so do we.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

bdf03dfbea9b: Implement EFI keyboard functions. Mostly done.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

5e6a44f5e6f9: Implemented EFI serial code. Seems to work.

Not sure we can pass EFI drivers to kernel so probably
should remove commented kernel args section later.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

bd8010a75fff: Loop on EFI_NOT_READY when checking for keypress.

Not sure

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

770f6fb2dc44: Partial implementation of EFI debug functions.

Lacks implementation of debug_init_post_mmu and debug_cleanup

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

182175c1b235: Update Jamfile and work in progress on start.cpp

Enable serial and early debug functions.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

0fdca13ea74e: Remove leftovers from bios code.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

cd00f49380c2: Adding ctor_list in linking, and _bss_start.

Clearing bss seems to hang at the moment.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

52d4c1ce59d0: Don't include mmu.h for now.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

c83571706cb8: Don't clear BSS, it is already zeroed.

EFI doesn't seem to like a .bss section according to GNU-EFI.
Therefore it is put and expanded inside .data. It is already zeroed
there. It makes the EFI app bigger so maybe there is a better
way?

The reason clearBSS() made the application hang was because
kSystemTable that we set before clearBSS() was part of .bss which
meant it was erased on clearing.

[ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

c1398be2d2bc: EFI: fix kprintf; didn't copy variable arguments like it should

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

3433d7911c0a: EFI: temporarily disable treating warnings as errors

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

84e81fd7221f: EFI: add simple accessors for boot & runtime services

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

e8a3e7665375: EFI: implement basic memory allocation & heap

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

bfa869861e1d: EFI: add basic text-mode menu support

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

00e702a224a5: EFI: implement EFI block io devices, stub out video code.

* The EFI block io devices are read-only, and it will scan
all block devices reported by EFI; in theory, one can
forego even scanning for a partitioning system
* May want to later change the EFI block io code to only return
disks rather than individual partitions, and rely on the
system partitioning code
* Also forced the boot menu to show for now (start.cpp)
* With these changes, it's now possible to get to the Haiku
boot menu on a 64-bit EFI system (at least without any
actual Haiku installations present)

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

8e9ef1745d51: EFI: acpi init

* Not used yet; depends on functions in bios_ia32/acpi.cpp which
will be put into a shared location for the various x86 boot
loaders to use

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

cf9dcdec8c0d: EFI: use the best text mode available to us

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

e0979183ad3b: EFI: fixes boot on a macbook air; seems memory isn't zeroed

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

aa37c64cae0e: EFI: chooses the best resolution and throws up the splash screen

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

47216a6db5ba: EFI: make switching between text & graphics modes work

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

9dd6c9103abf: Preliminary EFI support in the bootloader.

Enough to let the kernel to print hello, but not much beyond that.
I think this also breaks non-EFI x86-64 support, code cleanups required.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

5f205e9ef9ff: Fix initial kernel stack address.

Leaving stack_address uninitialized caused platform_allocate_region to
allocate a random virtual address to the stack.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

6698f7dc4f13: Bootloader: Populate gKernelArgs with plausible values.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

89995743e1c9: bootloader: Bug fix, PML4 must not overlap physical map.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

55ec6e8c35ed: bootloader: Initialize/load the GDT.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

6e456b79b9a6: Try harder to allocate early physical pages.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

4f7b73c1e74d: bootloader: Translate kernel args before adding them to
kernel_args_range.

Chunks may be physically contiguous, but virtually disjoint. Adding
physical addresses may cause ranges to be merged incorrectly.

[ Henry Harrington <henry.harrington@xxxxxxxxx> ]

0ba4560475c8: acpi: try to get ACPI RSDP from kernel

* To support UEFI, platform_kernel_args has been extended to
include a pointer to the ACPI RSDP.
* x86 platform init then adds a boot_item for the ACPI RSDP
* acpi driver now looks for the ACPI RSDP using get_boot_item,
and if not found, falls back to letting ACPICA probe for it.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

07c1c62633b7: EFI kernel support hacking

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

f7b67093d223: Allow configuring for a given boot platform.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

e990c5578a76: bootloader: wrap UEFI specific code in _BOOT_PLATFORM_efi

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

e8fca236c6a6: UEFI: fix which arch_string/cpuid to use

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

0bfa5cccfcb4: UEFI: define _BOOT_PLATFORM_$(TARGET_BOOT_PLATFORM)

* This is used in the generic parts of the bootloader,
where we need to do more complex mapping between
kernel & bootloader addresses
* Other platforms just use pointer arithmetic against
a fixed address, which doesn't apply to UEFI

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

1f0100ded054: bootloader: only pass -std=c++11 for UEFI

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

b67c43040129: UEFI: initial implementation of mmu_map_physical_memory

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

23f693d003d8: UEFI: an attempt at HPET support, testing out ACPI a bit more

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

f33cf807021d: UEFI: add init_smp() code

* Need to copy bios_ia32/support.S and update for x86_64
* Need to actually boot the other CPUs

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

58ca90d30b3e: UEFI: add missing globals and timer init from cpu.cpp

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

5ada191296fa: src/system/boot: re-enable -Werror

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

b6205014d0d3: UEFI: cleanup some warnings

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

6131fd2169b0: First stab at SMP

[ Nick Smallbone <nick.smallbone@xxxxxxxxx> ]

bca77cacc16c: Making progress with SMP bring-up

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

de01f4c1dd8a: More SMP work...

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

57ad6d4a648e: Fix bug setting smp_trampoline_args.

[ Nick Smallbone <nick.smallbone@xxxxxxxxx> ]

50e2fcf6fa9c: Fix several silly bugs in trampoline

[ Nick Smallbone <nick.smallbone@xxxxxxxxx> ]

63a8fd83c278: Fix up SMP, add some extra debugging for testing on actual
hardware.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

db9aa4fbc451: UEFI: fix up debug, trace MMU post-UEFI code.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

91e8d093986a: UEFI: see if we actually need to use AllocatePages.

Doesn't seem to be helping with boot issues at all,
however :(

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

75a491c5d26b: Lots of debugging: delete this commit later

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

3d13a90fdc7f: UEFI: don't do all the things!

- No SMP support
- Don't create virtual mappings for UEFI boot/runtime services
- Don't call UEFI SetVirtualAddressMap()

This at least gets us booting on some actual hardware. The
booted system is quite unstable, however :(

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

fc9998924169: UEFI: working SMP on actual hardware now

On at least one machine, we were trying to copy the SMP
trampoline code over top of ACPI NVS!

Interestingly, Haiku now fails to load all the device
drivers... so not quite getting to the Desktop now :(

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

82a29c4dc6fc: UEFI: weird issues with the -std=c++11 flag...

... so just put up with the warnings instead.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

15fef1f2ddce: UEFI: fix printf formatting warnings.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

bc8347acaf09: UEFI: device manager/vfs tracing

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

66f53331867a: UEFI: add some more framebuffer config to kernel args.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

3ef3554628cb: UEFI: cleanup of src/system/boot/loader

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

7b2d40f5777c: Fix line endings.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

69aa9464d846: UEFI: cleanup of src/system/kernel.

Still need to work on fs/vfs_boot.cpp

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

5d22c749039f: UEFI: update platform function names for converting addresses

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

cd9f036635c2: UEFI: add support for SATA device paths.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

d865e8289871: booting: support identifying disks & partitions by UUID.

This adds a UUID field for partition_data, and updates the
GPT partitioning system to add the UUIDs for both the
partitioning system and each child partition.

The VFS boot code has been updated to detect whether disks
and partitions should be identified by UUID, skipping the
fallback mechanisms used for other platforms.

These changes will allow the UEFI boot loader to correctly
pass the boot device and partition to the kernel.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

1300bdd7fb37: UEFI: use the Device Path API to get disk/partition UUIDs.

With the new support for UUIDs kernel-side, we can now
pass the correct disk & partition UUIDs to the kernel.

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

f1abbd61d6e7: UEFI: find the target boot partition from command line args.

Conflicts:
src/system/boot/platform/efi/devices.cpp

Conflicts:
src/system/boot/platform/efi/devices.cpp

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

709a457fd837: UEFI: committing because of scary system failure...

This commit doesn't work yet, and will be redone once I can
debug again without the system falling apart...

[ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]

----------------------------------------------------------------------------

126 files changed, 15222 insertions(+), 164 deletions(-)
build/jam/ArchitectureRules | 44 +-
build/jam/BootRules | 2 +-
build/jam/BuildSetup | 2 +-
configure | 6 +
headers/os/drivers/disk_device_manager.h | 1 +
.../private/kernel/arch/x86/arch_kernel_args.h | 4 +-
headers/private/kernel/boot/disk_identifier.h | 2 +
headers/private/kernel/boot/kernel_args.h | 1 +
headers/private/kernel/boot/partitions.h | 2 +
headers/private/kernel/boot/platform.h | 2 +
.../platform/bios_ia32/platform_kernel_args.h | 2 +
.../kernel/boot/platform/efi/arch/x86/efibind.h | 284 +++
.../kernel/boot/platform/efi/arch/x86/pe.h | 595 ++++++
.../boot/platform/efi/arch/x86_64/efibind.h | 380 ++++
.../kernel/boot/platform/efi/arch/x86_64/pe.h | 595 ++++++
headers/private/kernel/boot/platform/efi/efi.h | 53 +
.../private/kernel/boot/platform/efi/efi_nii.h | 74 +
.../private/kernel/boot/platform/efi/efi_pxe.h | 1743 ++++++++++++++++++
.../private/kernel/boot/platform/efi/efiapi.h | 890 +++++++++
.../private/kernel/boot/platform/efi/eficon.h | 302 +++
.../private/kernel/boot/platform/efi/efidef.h | 209 +++
.../private/kernel/boot/platform/efi/efidevp.h | 410 ++++
.../private/kernel/boot/platform/efi/efierr.h | 67 +
headers/private/kernel/boot/platform/efi/efifs.h | 116 ++
.../private/kernel/boot/platform/efi/efigpt.h | 68 +
headers/private/kernel/boot/platform/efi/efiip.h | 459 +++++
.../private/kernel/boot/platform/efi/efilink.h | 177 ++
.../private/kernel/boot/platform/efi/efinet.h | 340 ++++
.../private/kernel/boot/platform/efi/efipart.h | 61 +
.../private/kernel/boot/platform/efi/efipciio.h | 219 +++
.../private/kernel/boot/platform/efi/efiprot.h | 757 ++++++++
.../private/kernel/boot/platform/efi/efipxebc.h | 464 +++++
.../private/kernel/boot/platform/efi/efiser.h | 132 ++
.../private/kernel/boot/platform/efi/efistdarg.h | 33 +
.../private/kernel/boot/platform/efi/efitcp.h | 391 ++++
.../private/kernel/boot/platform/efi/efiudp.h | 272 +++
headers/private/kernel/boot/platform/efi/efiui.h | 54 +
.../private/kernel/boot/platform/efi/libsmbios.h | 132 ++
headers/private/kernel/boot/platform/efi/pci22.h | 193 ++
.../boot/platform/efi/platform_kernel_args.h | 42 +
.../boot/platform/efi/platform_stage2_args.h | 12 +
.../boot/platform/efi/protocol/adapterdebug.h | 32 +
.../boot/platform/efi/protocol/eficonsplit.h | 32 +
.../kernel/boot/platform/efi/protocol/efidbg.h | 210 +++
.../kernel/boot/platform/efi/protocol/efivar.h | 133 ++
.../boot/platform/efi/protocol/ia64/eficontext.h | 208 +++
.../kernel/boot/platform/efi/protocol/intload.h | 27 +
.../boot/platform/efi/protocol/legacyboot.h | 119 ++
.../boot/platform/efi/protocol/piflash64.h | 121 ++
.../kernel/boot/platform/efi/protocol/vgaclass.h | 95 +
.../private/kernel/boot/platform/efi/romload.h | 41 +
.../kernel/bus_managers/acpi/ACPICAHaiku.cpp | 14 +-
.../kernel/partitioning_systems/gpt/Header.h | 2 +
.../kernel/partitioning_systems/gpt/efi_gpt.cpp | 2 +
src/system/boot/Jamfile | 35 +-
src/system/boot/arch/arm/Jamfile | 2 +-
src/system/boot/arch/m68k/Jamfile | 8 +-
src/system/boot/arch/x86/Jamfile | 47 +-
src/system/boot/loader/Jamfile | 4 +-
src/system/boot/loader/elf.cpp | 44 +-
.../boot/loader/file_systems/amiga_ffs/File.cpp | 2 +-
.../boot/loader/file_systems/amiga_ffs/Jamfile | 1 -
.../loader/file_systems/amiga_ffs/amiga_ffs.cpp | 2 +-
src/system/boot/loader/file_systems/bfs/Jamfile | 1 -
.../boot/loader/file_systems/bfs/Stream.cpp | 2 +-
src/system/boot/loader/file_systems/bfs/bfs.cpp | 2 +-
src/system/boot/loader/file_systems/fat/Jamfile | 1 -
.../boot/loader/file_systems/fat/Stream.cpp | 2 +-
.../boot/loader/file_systems/hfs_plus/Jamfile | 1 -
.../boot/loader/file_systems/packagefs/Jamfile | 2 -
.../loader/file_systems/packagefs/packagefs.cpp | 2 +-
.../boot/loader/file_systems/tarfs/Jamfile | 2 -
src/system/boot/loader/heap.cpp | 15 +
src/system/boot/loader/kernel_args.cpp | 14 +
src/system/boot/loader/load_driver_settings.cpp | 2 +-
src/system/boot/loader/loader.cpp | 6 +-
src/system/boot/loader/net/Jamfile | 2 -
src/system/boot/loader/net/RemoteDisk.cpp | 9 +-
src/system/boot/loader/partitions.cpp | 74 +-
src/system/boot/loader/vfs.cpp | 9 +-
src/system/boot/platform/amiga_m68k/Jamfile | 2 +-
src/system/boot/platform/atari_m68k/Jamfile | 2 +-
src/system/boot/platform/bios_ia32/Jamfile | 2 +-
src/system/boot/platform/efi/Jamfile | 45 +
src/system/boot/platform/efi/acpi.cpp | 255 +++
src/system/boot/platform/efi/acpi.h | 22 +
.../platform/efi/arch/x86_64/relocation_func.cpp | 99 +
.../boot/platform/efi/arch/x86_64/start_func.S | 76 +
src/system/boot/platform/efi/console.cpp | 219 +++
src/system/boot/platform/efi/console.h | 14 +
src/system/boot/platform/efi/cpu.cpp | 362 ++++
src/system/boot/platform/efi/cpu.h | 22 +
src/system/boot/platform/efi/debug.cpp | 216 +++
src/system/boot/platform/efi/debug.h | 26 +
src/system/boot/platform/efi/devices.cpp | 634 +++++++
src/system/boot/platform/efi/efi_platform.h | 23 +
src/system/boot/platform/efi/entry.S | 68 +
src/system/boot/platform/efi/heap.cpp | 37 +
src/system/boot/platform/efi/hpet.cpp | 55 +
[ *** stats truncated: 27 lines dropped *** ]

############################################################################

Commit: 2012cda3cf4e70fbeeb51941a315c59e6d91fb8b
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Fri Apr 24 09:25:48 2015 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:26 2015 UTC

UEFI: platform headers

----------------------------------------------------------------------------

diff --git a/headers/private/kernel/boot/platform/efi/arch/x86/efibind.h
b/headers/private/kernel/boot/platform/efi/arch/x86/efibind.h
new file mode 100644
index 0000000..7138716
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/arch/x86/efibind.h
@@ -0,0 +1,284 @@
+/*++
+
+Copyright (c) 1998 Intel Corporation
+
+Module Name:
+
+ efefind.h
+
+Abstract:
+
+ EFI to compile bindings
+
+
+
+
+Revision History
+
+--*/
+
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+//
+// Basic int types of various widths
+//
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+ // No ANSI C 1999/2000 stdint.h integer width declarations
+
+ #if defined(_MSC_EXTENSIONS)
+
+ // Use Microsoft C compiler integer width declarations
+
+ typedef unsigned __int64 uint64_t;
+ typedef __int64 int64_t;
+ typedef unsigned __int32 uint32_t;
+ typedef __int32 int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #elif defined(__GNUC__)
+ typedef int __attribute__((__mode__(__DI__))) int64_t;
+ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef signed char int8_t;
+ #elif defined(UNIX_LP64)
+
+ /* Use LP64 programming model from C_FLAGS for integer width
declarations */
+
+ typedef unsigned long uint64_t;
+ typedef long int64_t;
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #else
+
+ /* Assume P64 programming model from C_FLAGS for integer width
declarations */
+
+ typedef unsigned long long uint64_t __attribute__((aligned (8)));
+ typedef long long int64_t __attribute__((aligned (8)));
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #endif
+#elif defined(__GNUC__)
+ #include <stdint.h>
+#endif
+
+//
+// Basic EFI types of various widths
+//
+
+#ifndef __WCHAR_TYPE__
+# define __WCHAR_TYPE__ short
+#endif
+
+typedef uint64_t UINT64;
+typedef int64_t INT64;
+
+#ifndef _BASETSD_H_
+ typedef uint32_t UINT32;
+ typedef int32_t INT32;
+#endif
+
+typedef uint16_t UINT16;
+typedef int16_t INT16;
+typedef uint8_t UINT8;
+typedef int8_t INT8;
+typedef __WCHAR_TYPE__ WCHAR;
+
+#undef VOID
+#define VOID void
+
+
+typedef int32_t INTN;
+typedef uint32_t UINTN;
+
+#ifdef EFI_NT_EMULATOR
+ #define POST_CODE(_Data)
+#else
+ #ifdef EFI_DEBUG
+#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
+ #else
+ #define POST_CODE(_Data)
+ #endif
+#endif
+
+#define EFIERR(a) (0x80000000 | a)
+#define EFI_ERROR_MASK 0x80000000
+#define EFIERR_OEM(a) (0xc0000000 | a)
+
+
+#define BAD_POINTER 0xFBFBFBFB
+#define MAX_ADDRESS 0xFFFFFFFF
+
+#ifdef EFI_NT_EMULATOR
+ #define BREAKPOINT() __asm { int 3 }
+#else
+ #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32
+#endif
+
+//
+// Pointers must be aligned to these address to function
+//
+
+#define MIN_ALIGNMENT_SIZE 4
+
+#define ALIGN_VARIABLE(Value ,Adjustment) \
+ (UINTN)Adjustment = 0; \
+ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
+ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value %
MIN_ALIGNMENT_SIZE); \
+ Value = (UINTN)Value + (UINTN)Adjustment
+
+
+//
+// Define macros to build data structure signatures from characters.
+//
+
+#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
+#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) |
(EFI_SIGNATURE_16(C,D) << 16))
+#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) |
((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
+//
+// To export & import functions in the EFI emulator environment
+//
+
+#ifdef EFI_NT_EMULATOR
+ #define EXPORTAPI __declspec( dllexport )
+#else
+ #define EXPORTAPI
+#endif
+
+
+//
+// EFIAPI - prototype calling convention for EFI function pointers
+// BOOTSERVICE - prototype for implementation of a boot service interface
+// RUNTIMESERVICE - prototype for implementation of a runtime service interface
+// RUNTIMEFUNCTION - prototype for implementation of a runtime function that
is not a service
+// RUNTIME_CODE - pragma macro for declaring runtime code
+//
+
+#ifndef EFIAPI // Forces EFI calling conventions reguardless
of compiler options
+ #ifdef _MSC_EXTENSIONS
+ #define EFIAPI __cdecl // Force C calling convention for Microsoft C
compiler
+ #else
+ #define EFIAPI // Substitute expresion to force C calling
convention
+ #endif
+#endif
+
+#define BOOTSERVICE
+//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
+//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
+#define RUNTIMESERVICE
+#define RUNTIMEFUNCTION
+
+
+#define RUNTIME_CODE(a) alloc_text("rtcode", a)
+#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
+#define END_RUNTIME_DATA() data_seg("")
+
+#define VOLATILE volatile
+
+#define MEMORY_FENCE()
+
+#ifdef EFI_NT_EMULATOR
+
+//
+// To help ensure proper coding of integrated drivers, they are
+// compiled as DLLs. In NT they require a dll init entry pointer.
+// The macro puts a stub entry point into the DLL so it will load.
+//
+
+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ __stdcall \
+ _DllMainCRTStartup ( \
+ UINTN Inst, \
+ UINTN reason_for_call, \
+ VOID *rserved \
+ ) \
+ { \
+ return 1; \
+ } \
+ \
+ int \
+ EXPORTAPI \
+ __cdecl \
+ InitializeDriver ( \
+ void *ImageHandle, \
+ void *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, SystemTable); \
+ }
+
+
+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
+ (_if)->LoadInternal(type, name, NULL)
+
+#else // EFI_NT_EMULATOR
+
+//
+// When build similiar to FW, then link everything together as
+// one big module.
+//
+
+ #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ InitializeDriver ( \
+ VOID *ImageHandle, \
+ VOID *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, \
+ SystemTable); \
+ } \
+ \
+ EFI_STATUS efi_main( \
+ EFI_HANDLE image, \
+ EFI_SYSTEM_TABLE *systab \
+ ) __attribute__((weak, \
+ alias ("InitializeDriver")));
+
+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
+ (_if)->LoadInternal(type, name, entry)
+
+#endif // EFI_FW_NT
+
+//
+// Some compilers don't support the forward reference construct:
+// typedef struct XXXXX
+//
+// The following macro provide a workaround for such cases.
+//
+#ifdef NO_INTERFACE_DECL
+#define INTERFACE_DECL(x)
+#else
+#ifdef __GNUC__
+#define INTERFACE_DECL(x) struct x
+#else
+#define INTERFACE_DECL(x) typedef struct x
+#endif
+#endif
+
+/* No efi call wrapper for IA32 architecture */
+#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+#define EFI_FUNCTION
+
+#ifdef _MSC_EXTENSIONS
+#pragma warning ( disable : 4731 ) // Suppress warnings about modification of
EBP
+#endif
+
diff --git a/headers/private/kernel/boot/platform/efi/arch/x86/pe.h
b/headers/private/kernel/boot/platform/efi/arch/x86/pe.h
new file mode 100644
index 0000000..624fa09
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/arch/x86/pe.h
@@ -0,0 +1,595 @@
+/*
+ PE32+ header file
+ */
+#ifndef _PE_H
+#define _PE_H
+
+#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
+#define IMAGE_OS2_SIGNATURE 0x454E // NE
+#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
+#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
+#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
+
+
+typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
+ UINT16 e_magic; // Magic number
+ UINT16 e_cblp; // Bytes on last page of file
+ UINT16 e_cp; // Pages in file
+ UINT16 e_crlc; // Relocations
+ UINT16 e_cparhdr; // Size of header in paragraphs
+ UINT16 e_minalloc; // Minimum extra paragraphs needed
+ UINT16 e_maxalloc; // Maximum extra paragraphs needed
+ UINT16 e_ss; // Initial (relative) SS value
+ UINT16 e_sp; // Initial SP value
+ UINT16 e_csum; // Checksum
+ UINT16 e_ip; // Initial IP value
+ UINT16 e_cs; // Initial (relative) CS value
+ UINT16 e_lfarlc; // File address of relocation table
+ UINT16 e_ovno; // Overlay number
+ UINT16 e_res[4]; // Reserved words
+ UINT16 e_oemid; // OEM identifier (for e_oeminfo)
+ UINT16 e_oeminfo; // OEM information; e_oemid specific
+ UINT16 e_res2[10]; // Reserved words
+ UINT32 e_lfanew; // File address of new exe header
+ } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
+
+typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header
+ UINT16 ne_magic; // Magic number
+ UINT8 ne_ver; // Version number
+ UINT8 ne_rev; // Revision number
+ UINT16 ne_enttab; // Offset of Entry Table
+ UINT16 ne_cbenttab; // Number of bytes in Entry Table
+ UINT32 ne_crc; // Checksum of whole file
+ UINT16 ne_flags; // Flag UINT16
+ UINT16 ne_autodata; // Automatic data segment number
+ UINT16 ne_heap; // Initial heap allocation
+ UINT16 ne_stack; // Initial stack allocation
+ UINT32 ne_csip; // Initial CS:IP setting
+ UINT32 ne_sssp; // Initial SS:SP setting
+ UINT16 ne_cseg; // Count of file segments
+ UINT16 ne_cmod; // Entries in Module Reference Table
+ UINT16 ne_cbnrestab; // Size of non-resident name table
+ UINT16 ne_segtab; // Offset of Segment Table
+ UINT16 ne_rsrctab; // Offset of Resource Table
+ UINT16 ne_restab; // Offset of resident name table
+ UINT16 ne_modtab; // Offset of Module Reference Table
+ UINT16 ne_imptab; // Offset of Imported Names Table
+ UINT32 ne_nrestab; // Offset of Non-resident Names Table
+ UINT16 ne_cmovent; // Count of movable entries
+ UINT16 ne_align; // Segment alignment shift count
+ UINT16 ne_cres; // Count of resource segments
+ UINT8 ne_exetyp; // Target Operating system
+ UINT8 ne_flagsothers; // Other .EXE flags
+ UINT16 ne_pretthunks; // offset to return thunks
+ UINT16 ne_psegrefbytes; // offset to segment ref. bytes
+ UINT16 ne_swaparea; // Minimum code swap area size
+ UINT16 ne_expver; // Expected Windows version number
+ } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
+
+//
+// File header format.
+//
+
+typedef struct _IMAGE_FILE_HEADER {
+ UINT16 Machine;
+ UINT16 NumberOfSections;
+ UINT32 TimeDateStamp;
+ UINT32 PointerToSymbolTable;
+ UINT32 NumberOfSymbols;
+ UINT16 SizeOfOptionalHeader;
+ UINT16 Characteristics;
+} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
+
+#define IMAGE_SIZEOF_FILE_HEADER 20
+
+#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info
stripped from file.
+#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable
(i.e. no unresolved externel references).
+#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped
from file.
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped
from file.
+#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word
are reversed.
+#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
+#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info
stripped from file in .DBG file
+#define IMAGE_FILE_SYSTEM 0x1000 // System File.
+#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
+#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word
are reversed.
+
+#define IMAGE_FILE_MACHINE_UNKNOWN 0
+#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
+#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian,
0540 big-endian
+#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian
+#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP
+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb
+#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC
Little-Endian
+#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64
+#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
+#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code
+#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64
+//
+// Directory format.
+//
+
+typedef struct _IMAGE_DATA_DIRECTORY {
+ UINT32 VirtualAddress;
+ UINT32 Size;
+} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
+
+#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
+
+//
+// Optional header format.
+//
+
+typedef struct _IMAGE_OPTIONAL_HEADER {
+ //
+ // Standard fields.
+ //
+
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+
+ //
+ // NT additional fields.
+ //
+
+ UINT32 ImageBase;
+ UINT32 SectionAlignment;
+ UINT32 FileAlignment;
+ UINT16 MajorOperatingSystemVersion;
+ UINT16 MinorOperatingSystemVersion;
+ UINT16 MajorImageVersion;
+ UINT16 MinorImageVersion;
+ UINT16 MajorSubsystemVersion;
+ UINT16 MinorSubsystemVersion;
+ UINT32 Reserved1;
+ UINT32 SizeOfImage;
+ UINT32 SizeOfHeaders;
+ UINT32 CheckSum;
+ UINT16 Subsystem;
+ UINT16 DllCharacteristics;
+ UINT32 SizeOfStackReserve;
+ UINT32 SizeOfStackCommit;
+ UINT32 SizeOfHeapReserve;
+ UINT32 SizeOfHeapCommit;
+ UINT32 LoaderFlags;
+ UINT32 NumberOfRvaAndSizes;
+ IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
+
+typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+ UINT32 BaseOfBss;
+ UINT32 GprMask;
+ UINT32 CprMask[4];
+ UINT32 GpValue;
+} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
+
+#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
+#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
+#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
+
+#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
+
+typedef struct _IMAGE_NT_HEADERS {
+ UINT32 Signature;
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER OptionalHeader;
+} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
+
+typedef struct _IMAGE_ROM_HEADERS {
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
+} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
+
+#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
+ ((UINT32)ntheader + \
+ FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
+ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
+ ))
+
+
+// Subsystem Values
+
+#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
+#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a
subsystem.
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows
GUI subsystem.
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows
character subsystem.
+#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2
character subsystem.
+#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix
character subsystem.
+
+
+// Directory Entries
+
+#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
+#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
+#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
+#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
+#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
+#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
+#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
+#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String
+#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP)
+#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
+#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration
Directory
+
+//
+// Section header format.
+//
+
+#define IMAGE_SIZEOF_SHORT_NAME 8
+
+typedef struct _IMAGE_SECTION_HEADER {
+ UINT8 Name[IMAGE_SIZEOF_SHORT_NAME];
+ union {
+ UINT32 PhysicalAddress;
+ UINT32 VirtualSize;
+ } Misc;
+ UINT32 VirtualAddress;
+ UINT32 SizeOfRawData;
+ UINT32 PointerToRawData;
+ UINT32 PointerToRelocations;
+ UINT32 PointerToLinenumbers;
+ UINT16 NumberOfRelocations;
+ UINT16 NumberOfLinenumbers;
+ UINT32 Characteristics;
+} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
+
+#define IMAGE_SIZEOF_SECTION_HEADER 40
+
+#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
+
+#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains
code.
+#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains
initialized data.
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains
uninitialized data.
+
+#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
+#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains
comments or some other type of information.
+#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents
will not become part of image.
+#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents
comdat.
+
+#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
+#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
+#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
+#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
+#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment
if no others are specified.
+#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
+#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
+
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be
discarded.
+#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not
cachable.
+#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not
pageable.
+#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is
shareable.
+#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is
executable.
+#define IMAGE_SCN_MEM_READ 0x40000000 // Section is
readable.
+#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is
writeable.
+
+//
+// Symbol format.
+//
+
+
+#define IMAGE_SIZEOF_SYMBOL 18
+
+//
+// Section values.
+//
+// Symbols have a section number of the section in which they are
+// defined. Otherwise, section numbers have the following meanings:
+//
+
+#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is
undefined or is common.
+#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an
absolute value.
+#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a
special debug item.
+
+//
+// Type (fundamental) values.
+//
+
+#define IMAGE_SYM_TYPE_NULL 0 // no type.
+#define IMAGE_SYM_TYPE_VOID 1 //
+#define IMAGE_SYM_TYPE_CHAR 2 // type character.
+#define IMAGE_SYM_TYPE_SHORT 3 // type short integer.
+#define IMAGE_SYM_TYPE_INT 4 //
+#define IMAGE_SYM_TYPE_LONG 5 //
+#define IMAGE_SYM_TYPE_FLOAT 6 //
+#define IMAGE_SYM_TYPE_DOUBLE 7 //
+#define IMAGE_SYM_TYPE_STRUCT 8 //
+#define IMAGE_SYM_TYPE_UNION 9 //
+#define IMAGE_SYM_TYPE_ENUM 10 // enumeration.
+#define IMAGE_SYM_TYPE_MOE 11 // member of
enumeration.
+#define IMAGE_SYM_TYPE_BYTE 12 //
+#define IMAGE_SYM_TYPE_WORD 13 //
+#define IMAGE_SYM_TYPE_UINT 14 //
+#define IMAGE_SYM_TYPE_DWORD 15 //
+
+//
+// Type (derived) values.
+//
+
+#define IMAGE_SYM_DTYPE_NULL 0 // no derived type.
+#define IMAGE_SYM_DTYPE_POINTER 1 // pointer.
+#define IMAGE_SYM_DTYPE_FUNCTION 2 // function.
+#define IMAGE_SYM_DTYPE_ARRAY 3 // array.
+
+//
+// Storage classes.
+//
+
+#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
+#define IMAGE_SYM_CLASS_NULL 0
+#define IMAGE_SYM_CLASS_AUTOMATIC 1
+#define IMAGE_SYM_CLASS_EXTERNAL 2
+#define IMAGE_SYM_CLASS_STATIC 3
+#define IMAGE_SYM_CLASS_REGISTER 4
+#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
+#define IMAGE_SYM_CLASS_LABEL 6
+#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
+#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
+#define IMAGE_SYM_CLASS_ARGUMENT 9
+#define IMAGE_SYM_CLASS_STRUCT_TAG 10
+#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
+#define IMAGE_SYM_CLASS_UNION_TAG 12
+#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
+#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
+#define IMAGE_SYM_CLASS_ENUM_TAG 15
+#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
+#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
+#define IMAGE_SYM_CLASS_BIT_FIELD 18
+#define IMAGE_SYM_CLASS_BLOCK 100
+#define IMAGE_SYM_CLASS_FUNCTION 101
+#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
+#define IMAGE_SYM_CLASS_FILE 103
+// new
+#define IMAGE_SYM_CLASS_SECTION 104
+#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
+
+// type packing constants
+
+#define N_BTMASK 017
+#define N_TMASK 060
+#define N_TMASK1 0300
+#define N_TMASK2 0360
+#define N_BTSHFT 4
+#define N_TSHIFT 2
+
+// MACROS
+
+//
+// Communal selection types.
+//
+
+#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
+#define IMAGE_COMDAT_SELECT_ANY 2
+#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
+#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
+#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
+
+#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
+#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
+#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
+
+
+//
+// Relocation format.
+//
+
+typedef struct _IMAGE_RELOCATION {
+ UINT32 VirtualAddress;
+ UINT32 SymbolTableIndex;
+ UINT16 Type;
+} IMAGE_RELOCATION;
+
+#define IMAGE_SIZEOF_RELOCATION 10
+
+//
+// I386 relocation types.
+//
+
+#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is
absolute, no relocation is necessary
+#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit
reference to the symbols virtual address, base not included
+#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit
reference to the segment-selector bits of a 32-bit virtual address
+#define IMAGE_REL_I386_SECTION 012
+#define IMAGE_REL_I386_SECREL 013
+#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit
reference to the symbols virtual address
+
+//
+// MIPS relocation types.
+//
+
+#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is
absolute, no relocation is necessary
+#define IMAGE_REL_MIPS_REFHALF 01
+#define IMAGE_REL_MIPS_REFWORD 02
+#define IMAGE_REL_MIPS_JMPADDR 03
+#define IMAGE_REL_MIPS_REFHI 04
+#define IMAGE_REL_MIPS_REFLO 05
+#define IMAGE_REL_MIPS_GPREL 06
+#define IMAGE_REL_MIPS_LITERAL 07
+#define IMAGE_REL_MIPS_SECTION 012
+#define IMAGE_REL_MIPS_SECREL 013
+#define IMAGE_REL_MIPS_REFWORDNB 042
+#define IMAGE_REL_MIPS_PAIR 045
+
+//
+// Alpha Relocation types.
+//
+
+#define IMAGE_REL_ALPHA_ABSOLUTE 0x0
+#define IMAGE_REL_ALPHA_REFLONG 0x1
+#define IMAGE_REL_ALPHA_REFQUAD 0x2
+#define IMAGE_REL_ALPHA_GPREL32 0x3
+#define IMAGE_REL_ALPHA_LITERAL 0x4
+#define IMAGE_REL_ALPHA_LITUSE 0x5
+#define IMAGE_REL_ALPHA_GPDISP 0x6
+#define IMAGE_REL_ALPHA_BRADDR 0x7
+#define IMAGE_REL_ALPHA_HINT 0x8
+#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9
+#define IMAGE_REL_ALPHA_REFHI 0xA
+#define IMAGE_REL_ALPHA_REFLO 0xB
+#define IMAGE_REL_ALPHA_PAIR 0xC
+#define IMAGE_REL_ALPHA_MATCH 0xD
+#define IMAGE_REL_ALPHA_SECTION 0xE
+#define IMAGE_REL_ALPHA_SECREL 0xF
+#define IMAGE_REL_ALPHA_REFLONGNB 0x10
+
+//
+// IBM PowerPC relocation types.
+//
+
+#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP
+#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address
+#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address
+#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2
(branch absolute)
+#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address
+#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load
doubleword)
+#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted
left 2 (branch relative)
+#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted
left 2 (br cond relative)
+#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base
+#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted
left 2 (load doubleword)
+
+#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base
+#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an
image sectionhdr)
+#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number
+#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction
iff symbol is glue code
+#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address
is TOC restore instruction
+
+#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in
IMAGE_RELOCATION.Type
+
+// Flag bits in IMAGE_RELOCATION.TYPE
+
+#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than
adding it
+#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict
branch taken
+#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict
branch not taken
+#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data
in toc)
+
+//
+// Based relocation format.
+//
+
+typedef struct _IMAGE_BASE_RELOCATION {
+ UINT32 VirtualAddress;
+ UINT32 SizeOfBlock;
+// UINT16 TypeOffset[1];
+} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
+
+#define IMAGE_SIZEOF_BASE_RELOCATION 8
+
+//
+// Based relocation types.
+//
+
+#define IMAGE_REL_BASED_ABSOLUTE 0
+#define IMAGE_REL_BASED_HIGH 1
+#define IMAGE_REL_BASED_LOW 2
+#define IMAGE_REL_BASED_HIGHLOW 3
+#define IMAGE_REL_BASED_HIGHADJ 4
+#define IMAGE_REL_BASED_MIPS_JMPADDR 5
+#define IMAGE_REL_BASED_IA64_IMM64 9
+#define IMAGE_REL_BASED_DIR64 10
+
+//
+// Line number format.
+//
+
+typedef struct _IMAGE_LINENUMBER {
+ union {
+ UINT32 SymbolTableIndex; // Symbol table index of
function name if Linenumber is 0.
+ UINT32 VirtualAddress; // Virtual address of line
number.
+ } Type;
+ UINT16 Linenumber; // Line number.
+} IMAGE_LINENUMBER;
+
+#define IMAGE_SIZEOF_LINENUMBER 6
+
+//
+// Archive format.
+//
+
+#define IMAGE_ARCHIVE_START_SIZE 8
+#define IMAGE_ARCHIVE_START "!<arch>\n"
+#define IMAGE_ARCHIVE_END "`\n"
+#define IMAGE_ARCHIVE_PAD "\n"
+#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
+#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
+
+typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
+ UINT8 Name[16]; // File member name - `/'
terminated.
+ UINT8 Date[12]; // File member date - decimal.
+ UINT8 UserID[6]; // File member user id -
decimal.
+ UINT8 GroupID[6]; // File member group id -
decimal.
+ UINT8 Mode[8]; // File member mode - octal.
+ UINT8 Size[10]; // File member size - decimal.
+ UINT8 EndHeader[2]; // String to end header.
+} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
+
+#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
+
+//
+// DLL support.
+//
+
+//
+// Export Format
+//
+
+typedef struct _IMAGE_EXPORT_DIRECTORY {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT32 Name;
+ UINT32 Base;
+ UINT32 NumberOfFunctions;
+ UINT32 NumberOfNames;
+ UINT32 *AddressOfFunctions;
+ UINT32 *AddressOfNames;
+ UINT32 *AddressOfNameOrdinals;
+} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
+
+//
+// Import Format
+//
+
+typedef struct _IMAGE_IMPORT_BY_NAME {
+ UINT16 Hint;
+ UINT8 Name[1];
+} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
+
+typedef struct _IMAGE_THUNK_DATA {
+ union {
+ UINT32 Function;
+ UINT32 Ordinal;
+ PIMAGE_IMPORT_BY_NAME AddressOfData;
+ } u1;
+} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
+
+#define IMAGE_ORDINAL_FLAG 0x80000000
+#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
+
+typedef struct _IMAGE_IMPORT_DESCRIPTOR {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT32 ForwarderChain;
+ UINT32 Name;
+ PIMAGE_THUNK_DATA FirstThunk;
+} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
+
+#endif
diff --git a/headers/private/kernel/boot/platform/efi/arch/x86_64/efibind.h
b/headers/private/kernel/boot/platform/efi/arch/x86_64/efibind.h
new file mode 100644
index 0000000..e258534
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/arch/x86_64/efibind.h
@@ -0,0 +1,380 @@
+/*++
+
+Copyright (c) 1998 Intel Corporation
+
+Module Name:
+
+ efefind.h
+
+Abstract:
+
+ EFI to compile bindings
+
+
+
+
+Revision History
+
+--*/
+#ifndef X86_64_EFI_BIND
+#define X86_64_EFI_BIND
+#ifndef __GNUC__
+#pragma pack()
+#endif
+
+#if defined(GNU_EFI_USE_MS_ABI)
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__

= 7))
+ #define HAVE_USE_MS_ABI 1
+ #else
+ #error Compiler is too old for GNU_EFI_USE_MS_ABI
+ #endif
+#endif
+
+//
+// Basic int types of various widths
+//
+
+#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L )
+
+ // No ANSI C 1999/2000 stdint.h integer width declarations
+
+ #if defined(_MSC_EXTENSIONS)
+
+ // Use Microsoft C compiler integer width declarations
+
+ typedef unsigned __int64 uint64_t;
+ typedef __int64 int64_t;
+ typedef unsigned __int32 uint32_t;
+ typedef __int32 int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #elif defined(__GNUC__)
+ typedef int __attribute__((__mode__(__DI__))) int64_t;
+ typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef signed char int8_t;
+ #elif defined(UNIX_LP64)
+
+ /* Use LP64 programming model from C_FLAGS for integer width
declarations */
+
+ typedef unsigned long uint64_t;
+ typedef long int64_t;
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #else
+
+ /* Assume P64 programming model from C_FLAGS for integer width
declarations */
+
+ typedef unsigned long long uint64_t __attribute__((aligned (8)));
+ typedef long long int64_t __attribute__((aligned (8)));
+ typedef unsigned int uint32_t;
+ typedef int int32_t;
+ typedef unsigned short uint16_t;
+ typedef short int16_t;
+ typedef unsigned char uint8_t;
+ typedef char int8_t;
+ #endif
+#elif defined(__GNUC__)
+ #include <stdint.h>
+#endif
+
+//
+// Basic EFI types of various widths
+//
+
+#ifndef __WCHAR_TYPE__
+# define __WCHAR_TYPE__ short
+#endif
+
+typedef uint64_t UINT64;
+typedef int64_t INT64;
+
+#ifndef _BASETSD_H_
+ typedef uint32_t UINT32;
+ typedef int32_t INT32;
+#endif
+
+typedef uint16_t UINT16;
+typedef int16_t INT16;
+typedef uint8_t UINT8;
+typedef int8_t INT8;
+typedef __WCHAR_TYPE__ WCHAR;
+
+#undef VOID
+#define VOID void
+
+
+typedef int64_t INTN;
+typedef uint64_t UINTN;
+
+#ifdef EFI_NT_EMULATOR
+ #define POST_CODE(_Data)
+#else
+ #ifdef EFI_DEBUG
+#define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
+ #else
+ #define POST_CODE(_Data)
+ #endif
+#endif
+
+#define EFIERR(a) (0x8000000000000000 | a)
+#define EFI_ERROR_MASK 0x8000000000000000
+#define EFIERR_OEM(a) (0xc000000000000000 | a)
+
+
+#define BAD_POINTER 0xFBFBFBFBFBFBFBFB
+#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF
+
+#ifdef EFI_NT_EMULATOR
+ #define BREAKPOINT() __asm { int 3 }
+#else
+ #define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32
+#endif
+
+//
+// Pointers must be aligned to these address to function
+//
+
+#define MIN_ALIGNMENT_SIZE 4
+
+#define ALIGN_VARIABLE(Value ,Adjustment) \
+ (UINTN)Adjustment = 0; \
+ if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
+ (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value %
MIN_ALIGNMENT_SIZE); \
+ Value = (UINTN)Value + (UINTN)Adjustment
+
+
+//
+// Define macros to build data structure signatures from characters.
+//
+
+#define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
+#define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) |
(EFI_SIGNATURE_16(C,D) << 16))
+#define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) |
((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
+//
+// To export & import functions in the EFI emulator environment
+//
+
+#ifdef EFI_NT_EMULATOR
+ #define EXPORTAPI __declspec( dllexport )
+#else
+ #define EXPORTAPI
+#endif
+
+
+//
+// EFIAPI - prototype calling convention for EFI function pointers
+// BOOTSERVICE - prototype for implementation of a boot service interface
+// RUNTIMESERVICE - prototype for implementation of a runtime service interface
+// RUNTIMEFUNCTION - prototype for implementation of a runtime function that
is not a service
+// RUNTIME_CODE - pragma macro for declaring runtime code
+//
+
+#ifndef EFIAPI // Forces EFI calling conventions reguardless
of compiler options
+ #ifdef _MSC_EXTENSIONS
+ #define EFIAPI __cdecl // Force C calling convention for Microsoft C
compiler
+ #elif defined(HAVE_USE_MS_ABI)
+ // Force amd64/ms calling conventions.
+ #define EFIAPI __attribute__((ms_abi))
+ #else
+ #define EFIAPI // Substitute expresion to force C calling
convention
+ #endif
+#endif
+
+#define BOOTSERVICE
+//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
+//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
+#define RUNTIMESERVICE
+#define RUNTIMEFUNCTION
+
+
+#define RUNTIME_CODE(a) alloc_text("rtcode", a)
+#define BEGIN_RUNTIME_DATA() data_seg("rtdata")
+#define END_RUNTIME_DATA() data_seg("")
+
+#define VOLATILE volatile
+
+#define MEMORY_FENCE()
+
+#ifdef EFI_NT_EMULATOR
+
+//
+// To help ensure proper coding of integrated drivers, they are
+// compiled as DLLs. In NT they require a dll init entry pointer.
+// The macro puts a stub entry point into the DLL so it will load.
+//
+
+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ __stdcall \
+ _DllMainCRTStartup ( \
+ UINTN Inst, \
+ UINTN reason_for_call, \
+ VOID *rserved \
+ ) \
+ { \
+ return 1; \
+ } \
+ \
+ int \
+ EXPORTAPI \
+ __cdecl \
+ InitializeDriver ( \
+ void *ImageHandle, \
+ void *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, SystemTable); \
+ }
+
+
+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
+ (_if)->LoadInternal(type, name, NULL)
+
+#else // EFI_NT_EMULATOR
+
+//
+// When build similiar to FW, then link everything together as
+// one big module.
+//
+
+ #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+ UINTN \
+ InitializeDriver ( \
+ VOID *ImageHandle, \
+ VOID *SystemTable \
+ ) \
+ { \
+ return InitFunction(ImageHandle, \
+ SystemTable); \
+ } \
+ \
+ EFI_STATUS efi_main( \
+ EFI_HANDLE image, \
+ EFI_SYSTEM_TABLE *systab \
+ ) __attribute__((weak, \
+ alias ("InitializeDriver")));
+
+ #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
+ (_if)->LoadInternal(type, name, entry)
+
+#endif // EFI_FW_NT
+
+//
+// Some compilers don't support the forward reference construct:
+// typedef struct XXXXX
+//
+// The following macro provide a workaround for such cases.
+//
+#ifdef NO_INTERFACE_DECL
+#define INTERFACE_DECL(x)
+#else
+#ifdef __GNUC__
+#define INTERFACE_DECL(x) struct x
+#else
+#define INTERFACE_DECL(x) typedef struct x
+#endif
+#endif
+
+/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
+#if defined(HAVE_USE_MS_ABI)
+#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
+#else
+/*
+ Credits for macro-magic:
+ https://groups.google.com/forum/?fromgroups#!topic/comp.std.c/d-6Mj5Lko_s
+ http://efesx.com/2010/08/31/overloading-macros/
+*/
+#define __VA_NARG__(...) \
+ __VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N())
+#define __VA_NARG_(...) \
+ __VA_ARG_N(__VA_ARGS__)
+#define __VA_ARG_N( \
+ _0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,N,...) N
+#define __RSEQ_N() \
+ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
+
+#define __VA_ARG_NSUFFIX__(prefix,...) \
+ __VA_ARG_NSUFFIX_N(prefix, __VA_NARG__(__VA_ARGS__))
+#define __VA_ARG_NSUFFIX_N(prefix,nargs) \
+ __VA_ARG_NSUFFIX_N_(prefix, nargs)
+#define __VA_ARG_NSUFFIX_N_(prefix,nargs) \
+ prefix ## nargs
+
+/* Prototypes of EFI cdecl -> stdcall trampolines */
+UINT64 efi_call0(void *func);
+UINT64 efi_call1(void *func, UINT64 arg1);
+UINT64 efi_call2(void *func, UINT64 arg1, UINT64 arg2);
+UINT64 efi_call3(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3);
+UINT64 efi_call4(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4);
+UINT64 efi_call5(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5);
+UINT64 efi_call6(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5, UINT64 arg6);
+UINT64 efi_call7(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7);
+UINT64 efi_call8(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+ UINT64 arg8);
+UINT64 efi_call9(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+ UINT64 arg8, UINT64 arg9);
+UINT64 efi_call10(void *func, UINT64 arg1, UINT64 arg2, UINT64 arg3,
+ UINT64 arg4, UINT64 arg5, UINT64 arg6, UINT64 arg7,
+ UINT64 arg8, UINT64 arg9, UINT64 arg10);
+
+/* Front-ends to efi_callX to avoid compiler warnings */
+#define _cast64_efi_call0(f) \
+ efi_call0(f)
+#define _cast64_efi_call1(f,a1) \
+ efi_call1(f, (UINT64)(a1))
+#define _cast64_efi_call2(f,a1,a2) \
+ efi_call2(f, (UINT64)(a1), (UINT64)(a2))
+#define _cast64_efi_call3(f,a1,a2,a3) \
+ efi_call3(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3))
+#define _cast64_efi_call4(f,a1,a2,a3,a4) \
+ efi_call4(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4))
+#define _cast64_efi_call5(f,a1,a2,a3,a4,a5) \
+ efi_call5(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5))
+#define _cast64_efi_call6(f,a1,a2,a3,a4,a5,a6) \
+ efi_call6(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5), (UINT64)(a6))
+#define _cast64_efi_call7(f,a1,a2,a3,a4,a5,a6,a7) \
+ efi_call7(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5), (UINT64)(a6), (UINT64)(a7))
+#define _cast64_efi_call8(f,a1,a2,a3,a4,a5,a6,a7,a8) \
+ efi_call8(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8))
+#define _cast64_efi_call9(f,a1,a2,a3,a4,a5,a6,a7,a8,a9) \
+ efi_call9(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \
+ (UINT64)(a9))
+#define _cast64_efi_call10(f,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
+ efi_call10(f, (UINT64)(a1), (UINT64)(a2), (UINT64)(a3), (UINT64)(a4), \
+ (UINT64)(a5), (UINT64)(a6), (UINT64)(a7), (UINT64)(a8), \
+ (UINT64)(a9), (UINT64)(a10))
+
+/* main wrapper (va_num ignored) */
+#define uefi_call_wrapper(func,va_num,...) \
+ __VA_ARG_NSUFFIX__(_cast64_efi_call, __VA_ARGS__) (func , ##__VA_ARGS__)
+
+#endif
+#define EFI_FUNCTION __attribute__((ms_abi))
+
+#ifdef _MSC_EXTENSIONS
+#pragma warning ( disable : 4731 ) // Suppress warnings about modification of
EBP
+#endif
+
+#endif
diff --git a/headers/private/kernel/boot/platform/efi/arch/x86_64/pe.h
b/headers/private/kernel/boot/platform/efi/arch/x86_64/pe.h
new file mode 100644
index 0000000..624fa09
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/arch/x86_64/pe.h
@@ -0,0 +1,595 @@
+/*
+ PE32+ header file
+ */
+#ifndef _PE_H
+#define _PE_H
+
+#define IMAGE_DOS_SIGNATURE 0x5A4D // MZ
+#define IMAGE_OS2_SIGNATURE 0x454E // NE
+#define IMAGE_OS2_SIGNATURE_LE 0x454C // LE
+#define IMAGE_NT_SIGNATURE 0x00004550 // PE00
+#define IMAGE_EDOS_SIGNATURE 0x44454550 // PEED
+
+
+typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header
+ UINT16 e_magic; // Magic number
+ UINT16 e_cblp; // Bytes on last page of file
+ UINT16 e_cp; // Pages in file
+ UINT16 e_crlc; // Relocations
+ UINT16 e_cparhdr; // Size of header in paragraphs
+ UINT16 e_minalloc; // Minimum extra paragraphs needed
+ UINT16 e_maxalloc; // Maximum extra paragraphs needed
+ UINT16 e_ss; // Initial (relative) SS value
+ UINT16 e_sp; // Initial SP value
+ UINT16 e_csum; // Checksum
+ UINT16 e_ip; // Initial IP value
+ UINT16 e_cs; // Initial (relative) CS value
+ UINT16 e_lfarlc; // File address of relocation table
+ UINT16 e_ovno; // Overlay number
+ UINT16 e_res[4]; // Reserved words
+ UINT16 e_oemid; // OEM identifier (for e_oeminfo)
+ UINT16 e_oeminfo; // OEM information; e_oemid specific
+ UINT16 e_res2[10]; // Reserved words
+ UINT32 e_lfanew; // File address of new exe header
+ } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
+
+typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header
+ UINT16 ne_magic; // Magic number
+ UINT8 ne_ver; // Version number
+ UINT8 ne_rev; // Revision number
+ UINT16 ne_enttab; // Offset of Entry Table
+ UINT16 ne_cbenttab; // Number of bytes in Entry Table
+ UINT32 ne_crc; // Checksum of whole file
+ UINT16 ne_flags; // Flag UINT16
+ UINT16 ne_autodata; // Automatic data segment number
+ UINT16 ne_heap; // Initial heap allocation
+ UINT16 ne_stack; // Initial stack allocation
+ UINT32 ne_csip; // Initial CS:IP setting
+ UINT32 ne_sssp; // Initial SS:SP setting
+ UINT16 ne_cseg; // Count of file segments
+ UINT16 ne_cmod; // Entries in Module Reference Table
+ UINT16 ne_cbnrestab; // Size of non-resident name table
+ UINT16 ne_segtab; // Offset of Segment Table
+ UINT16 ne_rsrctab; // Offset of Resource Table
+ UINT16 ne_restab; // Offset of resident name table
+ UINT16 ne_modtab; // Offset of Module Reference Table
+ UINT16 ne_imptab; // Offset of Imported Names Table
+ UINT32 ne_nrestab; // Offset of Non-resident Names Table
+ UINT16 ne_cmovent; // Count of movable entries
+ UINT16 ne_align; // Segment alignment shift count
+ UINT16 ne_cres; // Count of resource segments
+ UINT8 ne_exetyp; // Target Operating system
+ UINT8 ne_flagsothers; // Other .EXE flags
+ UINT16 ne_pretthunks; // offset to return thunks
+ UINT16 ne_psegrefbytes; // offset to segment ref. bytes
+ UINT16 ne_swaparea; // Minimum code swap area size
+ UINT16 ne_expver; // Expected Windows version number
+ } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
+
+//
+// File header format.
+//
+
+typedef struct _IMAGE_FILE_HEADER {
+ UINT16 Machine;
+ UINT16 NumberOfSections;
+ UINT32 TimeDateStamp;
+ UINT32 PointerToSymbolTable;
+ UINT32 NumberOfSymbols;
+ UINT16 SizeOfOptionalHeader;
+ UINT16 Characteristics;
+} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
+
+#define IMAGE_SIZEOF_FILE_HEADER 20
+
+#define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info
stripped from file.
+#define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable
(i.e. no unresolved externel references).
+#define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped
from file.
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped
from file.
+#define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word
are reversed.
+#define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
+#define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info
stripped from file in .DBG file
+#define IMAGE_FILE_SYSTEM 0x1000 // System File.
+#define IMAGE_FILE_DLL 0x2000 // File is a DLL.
+#define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word
are reversed.
+
+#define IMAGE_FILE_MACHINE_UNKNOWN 0
+#define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
+#define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian,
0540 big-endian
+#define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian
+#define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP
+#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x1c2 // Arm/Thumb
+#define IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM PowerPC
Little-Endian
+#define IMAGE_FILE_MACHINE_IA64 0x200 // IA-64
+#define IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
+#define IMAGE_FILE_MACHINE_EBC 0xebc // EFI Byte Code
+#define IMAGE_FILE_MACHINE_X64 0x8664 // x86_64
+//
+// Directory format.
+//
+
+typedef struct _IMAGE_DATA_DIRECTORY {
+ UINT32 VirtualAddress;
+ UINT32 Size;
+} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
+
+#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
+
+//
+// Optional header format.
+//
+
+typedef struct _IMAGE_OPTIONAL_HEADER {
+ //
+ // Standard fields.
+ //
+
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+
+ //
+ // NT additional fields.
+ //
+
+ UINT32 ImageBase;
+ UINT32 SectionAlignment;
+ UINT32 FileAlignment;
+ UINT16 MajorOperatingSystemVersion;
+ UINT16 MinorOperatingSystemVersion;
+ UINT16 MajorImageVersion;
+ UINT16 MinorImageVersion;
+ UINT16 MajorSubsystemVersion;
+ UINT16 MinorSubsystemVersion;
+ UINT32 Reserved1;
+ UINT32 SizeOfImage;
+ UINT32 SizeOfHeaders;
+ UINT32 CheckSum;
+ UINT16 Subsystem;
+ UINT16 DllCharacteristics;
+ UINT32 SizeOfStackReserve;
+ UINT32 SizeOfStackCommit;
+ UINT32 SizeOfHeapReserve;
+ UINT32 SizeOfHeapCommit;
+ UINT32 LoaderFlags;
+ UINT32 NumberOfRvaAndSizes;
+ IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
+} IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
+
+typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
+ UINT16 Magic;
+ UINT8 MajorLinkerVersion;
+ UINT8 MinorLinkerVersion;
+ UINT32 SizeOfCode;
+ UINT32 SizeOfInitializedData;
+ UINT32 SizeOfUninitializedData;
+ UINT32 AddressOfEntryPoint;
+ UINT32 BaseOfCode;
+ UINT32 BaseOfData;
+ UINT32 BaseOfBss;
+ UINT32 GprMask;
+ UINT32 CprMask[4];
+ UINT32 GpValue;
+} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
+
+#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
+#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
+#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
+
+#define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
+
+typedef struct _IMAGE_NT_HEADERS {
+ UINT32 Signature;
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_OPTIONAL_HEADER OptionalHeader;
+} IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
+
+typedef struct _IMAGE_ROM_HEADERS {
+ IMAGE_FILE_HEADER FileHeader;
+ IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
+} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
+
+#define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \
+ ((UINT32)ntheader + \
+ FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \
+ ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \
+ ))
+
+
+// Subsystem Values
+
+#define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem.
+#define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a
subsystem.
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows
GUI subsystem.
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows
character subsystem.
+#define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2
character subsystem.
+#define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix
character subsystem.
+
+
+// Directory Entries
+
+#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory
+#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory
+#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory
+#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory
+#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory
+#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table
+#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory
+#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String
+#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP)
+#define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory
+#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration
Directory
+
+//
+// Section header format.
+//
+
+#define IMAGE_SIZEOF_SHORT_NAME 8
+
+typedef struct _IMAGE_SECTION_HEADER {
+ UINT8 Name[IMAGE_SIZEOF_SHORT_NAME];
+ union {
+ UINT32 PhysicalAddress;
+ UINT32 VirtualSize;
+ } Misc;
+ UINT32 VirtualAddress;
+ UINT32 SizeOfRawData;
+ UINT32 PointerToRawData;
+ UINT32 PointerToRelocations;
+ UINT32 PointerToLinenumbers;
+ UINT16 NumberOfRelocations;
+ UINT16 NumberOfLinenumbers;
+ UINT32 Characteristics;
+} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
+
+#define IMAGE_SIZEOF_SECTION_HEADER 40
+
+#define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
+
+#define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains
code.
+#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains
initialized data.
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains
uninitialized data.
+
+#define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
+#define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains
comments or some other type of information.
+#define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents
will not become part of image.
+#define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents
comdat.
+
+#define IMAGE_SCN_ALIGN_1BYTES 0x00100000 //
+#define IMAGE_SCN_ALIGN_2BYTES 0x00200000 //
+#define IMAGE_SCN_ALIGN_4BYTES 0x00300000 //
+#define IMAGE_SCN_ALIGN_8BYTES 0x00400000 //
+#define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment
if no others are specified.
+#define IMAGE_SCN_ALIGN_32BYTES 0x00600000 //
+#define IMAGE_SCN_ALIGN_64BYTES 0x00700000 //
+
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be
discarded.
+#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not
cachable.
+#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not
pageable.
+#define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is
shareable.
+#define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is
executable.
+#define IMAGE_SCN_MEM_READ 0x40000000 // Section is
readable.
+#define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is
writeable.
+
+//
+// Symbol format.
+//
+
+
+#define IMAGE_SIZEOF_SYMBOL 18
+
+//
+// Section values.
+//
+// Symbols have a section number of the section in which they are
+// defined. Otherwise, section numbers have the following meanings:
+//
+
+#define IMAGE_SYM_UNDEFINED (UINT16)0 // Symbol is
undefined or is common.
+#define IMAGE_SYM_ABSOLUTE (UINT16)-1 // Symbol is an
absolute value.
+#define IMAGE_SYM_DEBUG (UINT16)-2 // Symbol is a
special debug item.
+
+//
+// Type (fundamental) values.
+//
+
+#define IMAGE_SYM_TYPE_NULL 0 // no type.
+#define IMAGE_SYM_TYPE_VOID 1 //
+#define IMAGE_SYM_TYPE_CHAR 2 // type character.
+#define IMAGE_SYM_TYPE_SHORT 3 // type short integer.
+#define IMAGE_SYM_TYPE_INT 4 //
+#define IMAGE_SYM_TYPE_LONG 5 //
+#define IMAGE_SYM_TYPE_FLOAT 6 //
+#define IMAGE_SYM_TYPE_DOUBLE 7 //
+#define IMAGE_SYM_TYPE_STRUCT 8 //
+#define IMAGE_SYM_TYPE_UNION 9 //
+#define IMAGE_SYM_TYPE_ENUM 10 // enumeration.
+#define IMAGE_SYM_TYPE_MOE 11 // member of
enumeration.
+#define IMAGE_SYM_TYPE_BYTE 12 //
+#define IMAGE_SYM_TYPE_WORD 13 //
+#define IMAGE_SYM_TYPE_UINT 14 //
+#define IMAGE_SYM_TYPE_DWORD 15 //
+
+//
+// Type (derived) values.
+//
+
+#define IMAGE_SYM_DTYPE_NULL 0 // no derived type.
+#define IMAGE_SYM_DTYPE_POINTER 1 // pointer.
+#define IMAGE_SYM_DTYPE_FUNCTION 2 // function.
+#define IMAGE_SYM_DTYPE_ARRAY 3 // array.
+
+//
+// Storage classes.
+//
+
+#define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
+#define IMAGE_SYM_CLASS_NULL 0
+#define IMAGE_SYM_CLASS_AUTOMATIC 1
+#define IMAGE_SYM_CLASS_EXTERNAL 2
+#define IMAGE_SYM_CLASS_STATIC 3
+#define IMAGE_SYM_CLASS_REGISTER 4
+#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
+#define IMAGE_SYM_CLASS_LABEL 6
+#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
+#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
+#define IMAGE_SYM_CLASS_ARGUMENT 9
+#define IMAGE_SYM_CLASS_STRUCT_TAG 10
+#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
+#define IMAGE_SYM_CLASS_UNION_TAG 12
+#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
+#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
+#define IMAGE_SYM_CLASS_ENUM_TAG 15
+#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
+#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
+#define IMAGE_SYM_CLASS_BIT_FIELD 18
+#define IMAGE_SYM_CLASS_BLOCK 100
+#define IMAGE_SYM_CLASS_FUNCTION 101
+#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
+#define IMAGE_SYM_CLASS_FILE 103
+// new
+#define IMAGE_SYM_CLASS_SECTION 104
+#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
+
+// type packing constants
+
+#define N_BTMASK 017
+#define N_TMASK 060
+#define N_TMASK1 0300
+#define N_TMASK2 0360
+#define N_BTSHFT 4
+#define N_TSHIFT 2
+
+// MACROS
+
+//
+// Communal selection types.
+//
+
+#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
+#define IMAGE_COMDAT_SELECT_ANY 2
+#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
+#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
+#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
+
+#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
+#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
+#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
+
+
+//
+// Relocation format.
+//
+
+typedef struct _IMAGE_RELOCATION {
+ UINT32 VirtualAddress;
+ UINT32 SymbolTableIndex;
+ UINT16 Type;
+} IMAGE_RELOCATION;
+
+#define IMAGE_SIZEOF_RELOCATION 10
+
+//
+// I386 relocation types.
+//
+
+#define IMAGE_REL_I386_ABSOLUTE 0 // Reference is
absolute, no relocation is necessary
+#define IMAGE_REL_I386_DIR16 01 // Direct 16-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_DIR32 06 // Direct 32-bit
reference to the symbols virtual address
+#define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit
reference to the symbols virtual address, base not included
+#define IMAGE_REL_I386_SEG12 011 // Direct 16-bit
reference to the segment-selector bits of a 32-bit virtual address
+#define IMAGE_REL_I386_SECTION 012
+#define IMAGE_REL_I386_SECREL 013
+#define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit
reference to the symbols virtual address
+
+//
+// MIPS relocation types.
+//
+
+#define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is
absolute, no relocation is necessary
+#define IMAGE_REL_MIPS_REFHALF 01
+#define IMAGE_REL_MIPS_REFWORD 02
+#define IMAGE_REL_MIPS_JMPADDR 03
+#define IMAGE_REL_MIPS_REFHI 04
+#define IMAGE_REL_MIPS_REFLO 05
+#define IMAGE_REL_MIPS_GPREL 06
+#define IMAGE_REL_MIPS_LITERAL 07
+#define IMAGE_REL_MIPS_SECTION 012
+#define IMAGE_REL_MIPS_SECREL 013
+#define IMAGE_REL_MIPS_REFWORDNB 042
+#define IMAGE_REL_MIPS_PAIR 045
+
+//
+// Alpha Relocation types.
+//
+
+#define IMAGE_REL_ALPHA_ABSOLUTE 0x0
+#define IMAGE_REL_ALPHA_REFLONG 0x1
+#define IMAGE_REL_ALPHA_REFQUAD 0x2
+#define IMAGE_REL_ALPHA_GPREL32 0x3
+#define IMAGE_REL_ALPHA_LITERAL 0x4
+#define IMAGE_REL_ALPHA_LITUSE 0x5
+#define IMAGE_REL_ALPHA_GPDISP 0x6
+#define IMAGE_REL_ALPHA_BRADDR 0x7
+#define IMAGE_REL_ALPHA_HINT 0x8
+#define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9
+#define IMAGE_REL_ALPHA_REFHI 0xA
+#define IMAGE_REL_ALPHA_REFLO 0xB
+#define IMAGE_REL_ALPHA_PAIR 0xC
+#define IMAGE_REL_ALPHA_MATCH 0xD
+#define IMAGE_REL_ALPHA_SECTION 0xE
+#define IMAGE_REL_ALPHA_SECREL 0xF
+#define IMAGE_REL_ALPHA_REFLONGNB 0x10
+
+//
+// IBM PowerPC relocation types.
+//
+
+#define IMAGE_REL_PPC_ABSOLUTE 0x0000 // NOP
+#define IMAGE_REL_PPC_ADDR64 0x0001 // 64-bit address
+#define IMAGE_REL_PPC_ADDR32 0x0002 // 32-bit address
+#define IMAGE_REL_PPC_ADDR24 0x0003 // 26-bit address, shifted left 2
(branch absolute)
+#define IMAGE_REL_PPC_ADDR16 0x0004 // 16-bit address
+#define IMAGE_REL_PPC_ADDR14 0x0005 // 16-bit address, shifted left 2 (load
doubleword)
+#define IMAGE_REL_PPC_REL24 0x0006 // 26-bit PC-relative offset, shifted
left 2 (branch relative)
+#define IMAGE_REL_PPC_REL14 0x0007 // 16-bit PC-relative offset, shifted
left 2 (br cond relative)
+#define IMAGE_REL_PPC_TOCREL16 0x0008 // 16-bit offset from TOC base
+#define IMAGE_REL_PPC_TOCREL14 0x0009 // 16-bit offset from TOC base, shifted
left 2 (load doubleword)
+
+#define IMAGE_REL_PPC_ADDR32NB 0x000A // 32-bit addr w/o image base
+#define IMAGE_REL_PPC_SECREL 0x000B // va of containing section (as in an
image sectionhdr)
+#define IMAGE_REL_PPC_SECTION 0x000C // sectionheader number
+#define IMAGE_REL_PPC_IFGLUE 0x000D // substitute TOC restore instruction
iff symbol is glue code
+#define IMAGE_REL_PPC_IMGLUE 0x000E // symbol is glue code; virtual address
is TOC restore instruction
+
+#define IMAGE_REL_PPC_TYPEMASK 0x00FF // mask to isolate above values in
IMAGE_RELOCATION.Type
+
+// Flag bits in IMAGE_RELOCATION.TYPE
+
+#define IMAGE_REL_PPC_NEG 0x0100 // subtract reloc value rather than
adding it
+#define IMAGE_REL_PPC_BRTAKEN 0x0200 // fix branch prediction bit to predict
branch taken
+#define IMAGE_REL_PPC_BRNTAKEN 0x0400 // fix branch prediction bit to predict
branch not taken
+#define IMAGE_REL_PPC_TOCDEFN 0x0800 // toc slot defined in file (or, data
in toc)
+
+//
+// Based relocation format.
+//
+
+typedef struct _IMAGE_BASE_RELOCATION {
+ UINT32 VirtualAddress;
+ UINT32 SizeOfBlock;
+// UINT16 TypeOffset[1];
+} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
+
+#define IMAGE_SIZEOF_BASE_RELOCATION 8
+
+//
+// Based relocation types.
+//
+
+#define IMAGE_REL_BASED_ABSOLUTE 0
+#define IMAGE_REL_BASED_HIGH 1
+#define IMAGE_REL_BASED_LOW 2
+#define IMAGE_REL_BASED_HIGHLOW 3
+#define IMAGE_REL_BASED_HIGHADJ 4
+#define IMAGE_REL_BASED_MIPS_JMPADDR 5
+#define IMAGE_REL_BASED_IA64_IMM64 9
+#define IMAGE_REL_BASED_DIR64 10
+
+//
+// Line number format.
+//
+
+typedef struct _IMAGE_LINENUMBER {
+ union {
+ UINT32 SymbolTableIndex; // Symbol table index of
function name if Linenumber is 0.
+ UINT32 VirtualAddress; // Virtual address of line
number.
+ } Type;
+ UINT16 Linenumber; // Line number.
+} IMAGE_LINENUMBER;
+
+#define IMAGE_SIZEOF_LINENUMBER 6
+
+//
+// Archive format.
+//
+
+#define IMAGE_ARCHIVE_START_SIZE 8
+#define IMAGE_ARCHIVE_START "!<arch>\n"
+#define IMAGE_ARCHIVE_END "`\n"
+#define IMAGE_ARCHIVE_PAD "\n"
+#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
+#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
+
+typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
+ UINT8 Name[16]; // File member name - `/'
terminated.
+ UINT8 Date[12]; // File member date - decimal.
+ UINT8 UserID[6]; // File member user id -
decimal.
+ UINT8 GroupID[6]; // File member group id -
decimal.
+ UINT8 Mode[8]; // File member mode - octal.
+ UINT8 Size[10]; // File member size - decimal.
+ UINT8 EndHeader[2]; // String to end header.
+} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
+
+#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
+
+//
+// DLL support.
+//
+
+//
+// Export Format
+//
+
+typedef struct _IMAGE_EXPORT_DIRECTORY {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT32 Name;
+ UINT32 Base;
+ UINT32 NumberOfFunctions;
+ UINT32 NumberOfNames;
+ UINT32 *AddressOfFunctions;
+ UINT32 *AddressOfNames;
+ UINT32 *AddressOfNameOrdinals;
+} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
+
+//
+// Import Format
+//
+
+typedef struct _IMAGE_IMPORT_BY_NAME {
+ UINT16 Hint;
+ UINT8 Name[1];
+} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
+
+typedef struct _IMAGE_THUNK_DATA {
+ union {
+ UINT32 Function;
+ UINT32 Ordinal;
+ PIMAGE_IMPORT_BY_NAME AddressOfData;
+ } u1;
+} IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA;
+
+#define IMAGE_ORDINAL_FLAG 0x80000000
+#define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
+#define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
+
+typedef struct _IMAGE_IMPORT_DESCRIPTOR {
+ UINT32 Characteristics;
+ UINT32 TimeDateStamp;
+ UINT32 ForwarderChain;
+ UINT32 Name;
+ PIMAGE_THUNK_DATA FirstThunk;
+} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
+
+#endif
diff --git a/headers/private/kernel/boot/platform/efi/efi.h
b/headers/private/kernel/boot/platform/efi/efi.h
new file mode 100644
index 0000000..20d2740
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/efi.h
@@ -0,0 +1,53 @@
+/*++
+
+Copyright (c) 1998 Intel Corporation
+
+Module Name:
+
+ efi.h
+
+Abstract:
+
+ Public EFI header files
+
+
+
+Revision History
+
+--*/
+
+//
+// Build flags on input
+// EFI32
+// EFI_DEBUG - Enable debugging code
+// EFI_NT_EMULATOR - Building for running under NT
+//
+
+
+#ifndef _EFI_INCLUDE_
+#define _EFI_INCLUDE_
+
+#define EFI_FIRMWARE_VENDOR L"INTEL"
+#define EFI_FIRMWARE_MAJOR_REVISION 12
+#define EFI_FIRMWARE_MINOR_REVISION 33
+#define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) |
(EFI_FIRMWARE_MINOR_REVISION))
+
+#include "efibind.h"
+#include "efidef.h"
+#include "efidevp.h"
+#include "efipciio.h"
+#include "efiprot.h"
+#include "eficon.h"
+#include "efiser.h"
+#include "efi_nii.h"
+#include "efipxebc.h"
+#include "efinet.h"
+#include "efiapi.h"
+#include "efifs.h"
+#include "efierr.h"
+#include "efiui.h"
+#include "efiip.h"
+#include "efiudp.h"
+#include "efitcp.h"
+
+#endif
diff --git a/headers/private/kernel/boot/platform/efi/efi_nii.h
b/headers/private/kernel/boot/platform/efi/efi_nii.h
new file mode 100644
index 0000000..fbff95d
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/efi_nii.h
@@ -0,0 +1,74 @@
+#ifndef _EFI_NII_H
+#define _EFI_NII_H
+
+/*++
+Copyright (c) 2000 Intel Corporation
+
+Module name:
+ efi_nii.h
+
+Abstract:
+
+Revision history:
+ 2000-Feb-18 M(f)J GUID updated.
+ Structure order changed for machine word alignment.
+ Added StringId[4] to structure.
+
+ 2000-Feb-14 M(f)J Genesis.
+--*/
+
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL \
+ { 0xE18541CD, 0xF755, 0x4f73, {0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2,
0x29} }
+
+#define EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE_REVISION 0x00010000
+
+typedef enum {
+ EfiNetworkInterfaceUndi = 1
+} EFI_NETWORK_INTERFACE_TYPE;
+
+typedef struct {
+
+ UINT64 Revision;
+ // Revision of the network interface identifier protocol interface.
+
+ UINT64 ID;
+ // Address of the first byte of the identifying structure for this
+ // network interface. This is set to zero if there is no structure.
+ //
+ // For PXE/UNDI this is the first byte of the !PXE structure.
+
+ UINT64 ImageAddr;
+ // Address of the UNrelocated driver/ROM image. This is set
+ // to zero if there is no driver/ROM image.
+ //
+ // For 16-bit UNDI, this is the first byte of the option ROM in
+ // upper memory.
+ //
+ // For 32/64-bit S/W UNDI, this is the first byte of the EFI ROM
+ // image.
+ //
+ // For H/W UNDI, this is set to zero.
+
+ UINT32 ImageSize;
+ // Size of the UNrelocated driver/ROM image of this network interface.
+ // This is set to zero if there is no driver/ROM image.
+
+ CHAR8 StringId[4];
+ // 4 char ASCII string to go in class identifier (option 60) in DHCP
+ // and Boot Server discover packets.
+ // For EfiNetworkInterfaceUndi this field is "UNDI".
+ // For EfiNetworkInterfaceSnp this field is "SNPN".
+
+ UINT8 Type;
+ UINT8 MajorVer;
+ UINT8 MinorVer;
+ // Information to be placed into the PXE DHCP and Discover packets.
+ // This is the network interface type and version number that will
+ // be placed into DHCP option 94 (client network interface identifier).
+ BOOLEAN Ipv6Supported;
+ UINT8 IfNum; // interface number to be used with pxeid structure
+} EFI_NETWORK_INTERFACE_IDENTIFIER_INTERFACE;
+
+extern EFI_GUID NetworkInterfaceIdentifierProtocol;
+
+#endif // _EFI_NII_H
diff --git a/headers/private/kernel/boot/platform/efi/efi_pxe.h
b/headers/private/kernel/boot/platform/efi/efi_pxe.h
new file mode 100644
index 0000000..922edcb
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/efi_pxe.h
@@ -0,0 +1,1743 @@
+#ifndef _EFI_PXE_H
+#define _EFI_PXE_H
+
+
+/*++
+Copyright (c) Intel 1999
+
+Module name:
+ efi_pxe.h
+
+32/64-bit PXE specification:
+ alpha-4, 99-Dec-17
+
+Abstract:
+ This header file contains all of the PXE type definitions,
+ structure prototypes, global variables and constants that
+ are needed for porting PXE to EFI.
+--*/
+
+#pragma pack(1)
+
+#define PXE_INTEL_ORDER 1 // Intel order
+//#define PXE_NETWORK_ORDER 1 // network order
+
+#define PXE_UINT64_SUPPORT 1 // UINT64 supported
+//#define PXE_NO_UINT64_SUPPORT 1 // UINT64 not supported
+
+#define PXE_BUSTYPE(a,b,c,d) \
+((((PXE_UINT32)(d) & 0xFF) << 24) | \
+(((PXE_UINT32)(c) & 0xFF) << 16) | \
+(((PXE_UINT32)(b) & 0xFF) << 8) | \
+((PXE_UINT32)(a) & 0xFF))
+
+//
+// UNDI ROM ID and devive ID signature
+//
+#define PXE_BUSTYPE_PXE PXE_BUSTYPE('!', 'P', 'X', 'E')
+
+//
+// BUS ROM ID signatures
+//
+#define PXE_BUSTYPE_PCI PXE_BUSTYPE('P', 'C', 'I', 'R')
+#define PXE_BUSTYPE_PC_CARD PXE_BUSTYPE('P', 'C', 'C', 'R')
+#define PXE_BUSTYPE_USB PXE_BUSTYPE('U', 'S', 'B', 'R')
+#define PXE_BUSTYPE_1394 PXE_BUSTYPE('1', '3', '9', '4')
+
+#define PXE_SWAP_UINT16(n) \
+((((PXE_UINT16)(n) & 0x00FF) << 8) | \
+(((PXE_UINT16)(n) & 0xFF00) >> 8))
+
+#define PXE_SWAP_UINT32(n) \
+((((PXE_UINT32)(n) & 0x000000FF) << 24) | \
+(((PXE_UINT32)(n) & 0x0000FF00) << 8) | \
+(((PXE_UINT32)(n) & 0x00FF0000) >> 8) | \
+(((PXE_UINT32)(n) & 0xFF000000) >> 24))
+
+#if PXE_UINT64_SUPPORT != 0
+#define PXE_SWAP_UINT64(n) \
+((((PXE_UINT64)(n) & 0x00000000000000FF) << 56) | \
+(((PXE_UINT64)(n) & 0x000000000000FF00) << 40) | \
+(((PXE_UINT64)(n) & 0x0000000000FF0000) << 24) | \
+(((PXE_UINT64)(n) & 0x00000000FF000000) << 8) | \
+(((PXE_UINT64)(n) & 0x000000FF00000000) >> 8) | \
+(((PXE_UINT64)(n) & 0x0000FF0000000000) >> 24) | \
+(((PXE_UINT64)(n) & 0x00FF000000000000) >> 40) | \
+(((PXE_UINT64)(n) & 0xFF00000000000000) >> 56))
+#endif // PXE_UINT64_SUPPORT
+
+#if PXE_NO_UINT64_SUPPORT != 0
+#define PXE_SWAP_UINT64(n) \
+{ \
+PXE_UINT32 tmp = (PXE_UINT64)(n)[1]; \
+(PXE_UINT64)(n)[1] = PXE_SWAP_UINT32((PXE_UINT64)(n)[0]); \
+(PXE_UINT64)(n)[0] = tmp; \
+}
+#endif // PXE_NO_UINT64_SUPPORT
+
+#define PXE_CPBSIZE_NOT_USED 0 // zero
+#define PXE_DBSIZE_NOT_USED 0 // zero
+#define PXE_CPBADDR_NOT_USED (PXE_UINT64)0 // zero
+#define PXE_DBADDR_NOT_USED (PXE_UINT64)0 // zero
+
+#define PXE_CONST const
+
+#define PXE_VOLATILE volatile
+
+typedef void PXE_VOID;
+
+typedef unsigned char PXE_UINT8;
+
+typedef unsigned short PXE_UINT16;
+
+typedef unsigned PXE_UINT32;
+
+#if PXE_UINT64_SUPPORT != 0
+// typedef unsigned long PXE_UINT64;
+typedef UINT64 PXE_UINT64;
+#endif // PXE_UINT64_SUPPORT
+
+#if PXE_NO_UINT64_SUPPORT != 0
+typedef PXE_UINT32 PXE_UINT64[2];
+#endif // PXE_NO_UINT64_SUPPORT
+
+typedef unsigned PXE_UINTN;
+
+typedef PXE_UINT8 PXE_BOOL;
+
+#define PXE_FALSE 0 // zero
+#define PXE_TRUE (!PXE_FALSE)
+
+typedef PXE_UINT16 PXE_OPCODE;
+
+//
+// Return UNDI operational state.
+//
+#define PXE_OPCODE_GET_STATE 0x0000
+
+//
+// Change UNDI operational state from Stopped to Started.
+//
+#define PXE_OPCODE_START 0x0001
+
+//
+// Change UNDI operational state from Started to Stopped.
+//
+#define PXE_OPCODE_STOP 0x0002
+
+//
+// Get UNDI initialization information.
+//
+#define PXE_OPCODE_GET_INIT_INFO 0x0003
+
+//
+// Get NIC configuration information.
+//
+#define PXE_OPCODE_GET_CONFIG_INFO 0x0004
+
+//
+// Changed UNDI operational state from Started to Initialized.
+//
+#define PXE_OPCODE_INITIALIZE 0x0005
+
+//
+// Re-initialize the NIC H/W.
+//
+#define PXE_OPCODE_RESET 0x0006
+
+//
+// Change the UNDI operational state from Initialized to Started.
+//
+#define PXE_OPCODE_SHUTDOWN 0x0007
+
+//
+// Read & change state of external interrupt enables.
+//
+#define PXE_OPCODE_INTERRUPT_ENABLES 0x0008
+
+//
+// Read & change state of packet receive filters.
+//
+#define PXE_OPCODE_RECEIVE_FILTERS 0x0009
+
+//
+// Read & change station MAC address.
+//
+#define PXE_OPCODE_STATION_ADDRESS 0x000A
+
+//
+// Read traffic statistics.
+//
+#define PXE_OPCODE_STATISTICS 0x000B
+
+//
+// Convert multicast IP address to multicast MAC address.
+//
+#define PXE_OPCODE_MCAST_IP_TO_MAC 0x000C
+
+//
+// Read or change non-volatile storage on the NIC.
+//
+#define PXE_OPCODE_NVDATA 0x000D
+
+//
+// Get & clear interrupt status.
+//
+#define PXE_OPCODE_GET_STATUS 0x000E
+
+//
+// Fill media header in packet for transmit.
+//
+#define PXE_OPCODE_FILL_HEADER 0x000F
+
+//
+// Transmit packet(s).
+//
+#define PXE_OPCODE_TRANSMIT 0x0010
+
+//
+// Receive packet.
+//
+#define PXE_OPCODE_RECEIVE 0x0011
+
+// last valid opcode:
+#define PXE_OPCODE_VALID_MAX 0x0011
+
+//
+// Last valid PXE UNDI OpCode number.
+//
+#define PXE_OPCODE_LAST_VALID 0x0011
+
+typedef PXE_UINT16 PXE_OPFLAGS;
+
+#define PXE_OPFLAGS_NOT_USED 0x0000
+
+////////////////////////////////////////
+// UNDI Get State
+//
+
+// No OpFlags
+
+////////////////////////////////////////
+// UNDI Start
+//
+
+// No OpFlags
+
+////////////////////////////////////////
+// UNDI Stop
+//
+
+// No OpFlags
+
+////////////////////////////////////////
+// UNDI Get Init Info
+//
+
+// No Opflags
+
+////////////////////////////////////////
+// UNDI Get Config Info
+//
+
+// No Opflags
+
+////////////////////////////////////////
+// UNDI Initialize
+//
+
+#define PXE_OPFLAGS_INITIALIZE_CABLE_DETECT_MASK 0x0001
+#define PXE_OPFLAGS_INITIALIZE_DETECT_CABLE 0x0000
+#define PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE 0x0001
+
+////////////////////////////////////////
+// UNDI Reset
+//
+
+#define PXE_OPFLAGS_RESET_DISABLE_INTERRUPTS 0x0001
+#define PXE_OPFLAGS_RESET_DISABLE_FILTERS 0x0002
+
+////////////////////////////////////////
+// UNDI Shutdown
+//
+
+// No OpFlags
+
+////////////////////////////////////////
+// UNDI Interrupt Enables
+//
+
+//
+// Select whether to enable or disable external interrupt signals.
+// Setting both enable and disable will return PXE_STATCODE_INVALID_OPFLAGS.
+//
+#define PXE_OPFLAGS_INTERRUPT_OPMASK 0xC000
+#define PXE_OPFLAGS_INTERRUPT_ENABLE 0x8000
+#define PXE_OPFLAGS_INTERRUPT_DISABLE 0x4000
+#define PXE_OPFLAGS_INTERRUPT_READ 0x0000
+
+//
+// Enable receive interrupts. An external interrupt will be generated
+// after a complete non-error packet has been received.
+//
+#define PXE_OPFLAGS_INTERRUPT_RECEIVE 0x0001
+
+//
+// Enable transmit interrupts. An external interrupt will be generated
+// after a complete non-error packet has been transmitted.
+//
+#define PXE_OPFLAGS_INTERRUPT_TRANSMIT 0x0002
+
+//
+// Enable command interrupts. An external interrupt will be generated
+// when command execution stops.
+//
+#define PXE_OPFLAGS_INTERRUPT_COMMAND 0x0004
+
+//
+// Generate software interrupt. Setting this bit generates an external
+// interrupt, if it is supported by the hardware.
+//
+#define PXE_OPFLAGS_INTERRUPT_SOFTWARE 0x0008
+
+////////////////////////////////////////
+// UNDI Receive Filters
+//
+
+//
+// Select whether to enable or disable receive filters.
+// Setting both enable and disable will return PXE_STATCODE_INVALID_OPCODE.
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_OPMASK 0xC000
+#define PXE_OPFLAGS_RECEIVE_FILTER_ENABLE 0x8000
+#define PXE_OPFLAGS_RECEIVE_FILTER_DISABLE 0x4000
+#define PXE_OPFLAGS_RECEIVE_FILTER_READ 0x0000
+
+//
+// To reset the contents of the multicast MAC address filter list,
+// set this OpFlag:
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_RESET_MCAST_LIST 0x2000
+
+//
+// Enable unicast packet receiving. Packets sent to the current station
+// MAC address will be received.
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_UNICAST 0x0001
+
+//
+// Enable broadcast packet receiving. Packets sent to the broadcast
+// MAC address will be received.
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST 0x0002
+
+//
+// Enable filtered multicast packet receiving. Packets sent to any
+// of the multicast MAC addresses in the multicast MAC address filter
+// list will be received. If the filter list is empty, no multicast
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_FILTERED_MULTICAST 0x0004
+
+//
+// Enable promiscuous packet receiving. All packets will be received.
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS 0x0008
+
+//
+// Enable promiscuous multicast packet receiving. All multicast
+// packets will be received.
+//
+#define PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST 0x0010
+
+////////////////////////////////////////
+// UNDI Station Address
+//
+
+#define PXE_OPFLAGS_STATION_ADDRESS_READ 0x0000
+#define PXE_OPFLAGS_STATION_ADDRESS_RESET 0x0001
+
+////////////////////////////////////////
+// UNDI Statistics
+//
+
+#define PXE_OPFLAGS_STATISTICS_READ 0x0000
+#define PXE_OPFLAGS_STATISTICS_RESET 0x0001
+
+////////////////////////////////////////
+// UNDI MCast IP to MAC
+//
+
+//
+// Identify the type of IP address in the CPB.
+//
+#define PXE_OPFLAGS_MCAST_IP_TO_MAC_OPMASK 0x0003
+#define PXE_OPFLAGS_MCAST_IPV4_TO_MAC 0x0000
+#define PXE_OPFLAGS_MCAST_IPV6_TO_MAC 0x0001
+
+////////////////////////////////////////
+// UNDI NvData
+//
+
+//
+// Select the type of non-volatile data operation.
+//
+#define PXE_OPFLAGS_NVDATA_OPMASK 0x0001
+#define PXE_OPFLAGS_NVDATA_READ 0x0000
+#define PXE_OPFLAGS_NVDATA_WRITE 0x0001
+
+////////////////////////////////////////
+// UNDI Get Status
+//
+
+//
+// Return current interrupt status. This will also clear any interrupts
+// that are currently set. This can be used in a polling routine. The
+// interrupt flags are still set and cleared even when the interrupts
+// are disabled.
+//
+#define PXE_OPFLAGS_GET_INTERRUPT_STATUS 0x0001
+
+//
+// Return list of transmitted buffers for recycling. Transmit buffers
+// must not be changed or unallocated until they have recycled. After
+// issuing a transmit command, wait for a transmit complete interrupt.
+// When a transmit complete interrupt is received, read the transmitted
+// buffers. Do not plan on getting one buffer per interrupt. Some
+// NICs and UNDIs may transmit multiple buffers per interrupt.
+//
+#define PXE_OPFLAGS_GET_TRANSMITTED_BUFFERS 0x0002
+
+////////////////////////////////////////
+// UNDI Fill Header
+//
+
+#define PXE_OPFLAGS_FILL_HEADER_OPMASK 0x0001
+#define PXE_OPFLAGS_FILL_HEADER_FRAGMENTED 0x0001
+#define PXE_OPFLAGS_FILL_HEADER_WHOLE 0x0000
+
+////////////////////////////////////////
+// UNDI Transmit
+//
+
+//
+// S/W UNDI only. Return after the packet has been transmitted. A
+// transmit complete interrupt will still be generated and the transmit
+// buffer will have to be recycled.
+//
+#define PXE_OPFLAGS_SWUNDI_TRANSMIT_OPMASK 0x0001
+#define PXE_OPFLAGS_TRANSMIT_BLOCK 0x0001
+#define PXE_OPFLAGS_TRANSMIT_DONT_BLOCK 0x0000
+
+//
+//
+//
+#define PXE_OPFLAGS_TRANSMIT_OPMASK 0x0002
+#define PXE_OPFLAGS_TRANSMIT_FRAGMENTED 0x0002
+#define PXE_OPFLAGS_TRANSMIT_WHOLE 0x0000
+
+////////////////////////////////////////
+// UNDI Receive
+//
+
+// No OpFlags
+
+typedef PXE_UINT16 PXE_STATFLAGS;
+
+#define PXE_STATFLAGS_INITIALIZE 0x0000
+
+////////////////////////////////////////
+// Common StatFlags that can be returned by all commands.
+//
+
+//
+// The COMMAND_COMPLETE and COMMAND_FAILED status flags must be
+// implemented by all UNDIs. COMMAND_QUEUED is only needed by UNDIs
+// that support command queuing.
+//
+#define PXE_STATFLAGS_STATUS_MASK 0xC000
+#define PXE_STATFLAGS_COMMAND_COMPLETE 0xC000
+#define PXE_STATFLAGS_COMMAND_FAILED 0x8000
+#define PXE_STATFLAGS_COMMAND_QUEUED 0x4000
+//#define PXE_STATFLAGS_INITIALIZE 0x0000
+
+#define PXE_STATFLAGS_DB_WRITE_TRUNCATED 0x2000
+
+////////////////////////////////////////
+// UNDI Get State
+//
+
+#define PXE_STATFLAGS_GET_STATE_MASK 0x0003
+#define PXE_STATFLAGS_GET_STATE_INITIALIZED 0x0002
+#define PXE_STATFLAGS_GET_STATE_STARTED 0x0001
+#define PXE_STATFLAGS_GET_STATE_STOPPED 0x0000
+
+////////////////////////////////////////
+// UNDI Start
+//
+

[ *** diff truncated: 8302 lines dropped *** ]


############################################################################

Commit: 8a738ec65e9c581159a655fc2067d06099d77a96
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Aug 7 09:18:47 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:27 2015 UTC

Add EFI linker script for x86_64 from GNU-EFI project.

Original file is gnuefi/elf_x86_64.lds in GNU-EFI.
From GNU-EFI commit 8f5ba0e4fd398d49c0004164d18e50fb6acd36ca
http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

----------------------------------------------------------------------------

############################################################################

Commit: c26339b31ea8e5b9b140bdb23d935e9ee778878f
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Aug 28 20:07:51 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:27 2015 UTC

Add x86_64 EFI relocation function from GNU-EFI project.

Original file is gnuefi/reloc_x86_64.c in GNU-EFI.

From GNU-EFI commit 8f5ba0e
http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

----------------------------------------------------------------------------

############################################################################

Commit: 1b1b0f884a7cb93099ffaf89d6ad0c055264d145
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Aug 28 21:05:07 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:28 2015 UTC

Remove efilib header, use extern "C" block.

Removed #include <efilib.h> as we're stripping down GNU-EFI.
Added extern "C" block around _relocate function to avoid name mangling.
Whitespace cleanup.

----------------------------------------------------------------------------

############################################################################

Commit: 797b1b0a44e751bf072fb519d5ac19839b1cc740
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Thu Aug 29 17:51:08 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:29 2015 UTC

Add x86_64 EFI start function from GNU-EFI project.

Original file is gnuefi/crt0-efi-x86_64.S in GNU-EFI.

From GNU-EFI commit 8f5ba0e
http://sourceforge.net/p/gnu-efi/code/ci/8f5ba0e4fd398d49c0004164d18e50fb6acd36ca/

----------------------------------------------------------------------------

############################################################################

Commit: 26d5c13f8a9c0c6903e71b5d81508d51f2170d19
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Thu Aug 29 17:59:23 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:29 2015 UTC

Working EFI application ('Hello World') and Jamfile.

First version of an EFI Application that actually runs.
The Jamfile is a still a bit of a hack, but builds with updated buildtools.

I currently build by adding
SubInclude HAIKU_TOP src system boot platform efi ;
to src/system/boot/Jamfile and running jam haiku.efi but that is just a
temporary hack.
There are still things to clean up in Jamfile, for instance haiku.efi is put
in the haiku directory atm. This is however first working version. To set up
QEMU to test haiku.efi see my docs in https://github.com/tqh/efi-example

Now it is 'just' the work of writing a bootloader left.

----------------------------------------------------------------------------

############################################################################

Commit: f6397480bf3221ad7aeda2248efbe37937275286
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Thu Aug 29 19:50:18 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:30 2015 UTC

As I understand MakeLocateDebug should be used on haiku.efi

This causes haiku.efi to be built in the right directory.

----------------------------------------------------------------------------

############################################################################

Commit: 9922fd37fa87c3ebb43ae291d87cfa47829042d2
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Sep 7 10:46:12 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:30 2015 UTC

Set bios_ia32 only if no other boot platform is set.

Only set bios_ia32 flags for x86_64 if boot platform is bios_ia32.

----------------------------------------------------------------------------

############################################################################

Commit: 03ed28c52f13ee89a4f56e20008a2186b89399ae
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Sep 7 12:48:04 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:31 2015 UTC

Use boot_loader_$(TARGET_BOOT_PLATFORM).ld naming for linker script.

As dictated in system/boot/Jamfile.

----------------------------------------------------------------------------

############################################################################

Commit: 0b026841726bad7722cb0837dd5aedbe059a34cf
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sun Sep 8 11:10:50 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:32 2015 UTC

Added simple calloc implementation.

Needed for HashMap.

----------------------------------------------------------------------------

############################################################################

Commit: 5c48c041de41472759a29a73fe739343ea8f6a25
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sun Sep 8 11:22:29 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:32 2015 UTC

Don't use partition pointer as id, as it only works on 32bit platforms.

Use a counter to generate the partition id, and store the id to partition
lookup in a hashmap instead.

----------------------------------------------------------------------------

############################################################################

Commit: 3d3e5bb985f65ddad70c32363bedcd48ff0ca36b
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Mon Sep 9 09:53:46 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:33 2015 UTC

Use memset in calloc, return NULL on size or numElements == 0.

Posix states 'If either numElements or size is 0, then either a null pointer or
a
unique pointer value that can be successfully passed to free() shall be
returned.'

----------------------------------------------------------------------------

############################################################################

Commit: 2d3bdb8a57e50ddccbffa3fd9e067b81b5f1dca2
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Sep 14 11:09:37 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:33 2015 UTC

Only use 32 bit functions in boot on x86_64 if we are bios_ia32.

----------------------------------------------------------------------------

############################################################################

Commit: 0c8da824b291ba1d5077be16908f9f0813beed4e
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Sep 14 14:40:14 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:34 2015 UTC

Add TARGET_BOOT_LINKFLAGS to LINKFLAGS in BootLD.

Consulted with Ingo on adding TARGET_BOOT_LINKFLAGS, and
this is 'probably' ok as x86_64 builds still build and runs.

----------------------------------------------------------------------------

############################################################################

Commit: 96ead93193dea0daa37f93c046ae66a949e2be84
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Thu Oct 31 20:58:55 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:35 2015 UTC

Make 32 bit ELF relocation compile on 64 bit boot platforms.

boot_arch_elf_relocate_rel tries to call boot_elf_resolve_symbol
with an *addr_t so we make sure it is always *Elf32_Addr.

----------------------------------------------------------------------------

############################################################################

Commit: a66dcf8a85d152133bb4274d2c976340a1f4aa8c
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Nov 6 20:10:09 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:35 2015 UTC

Cleaning up EFI platform Jamfile a bit.

----------------------------------------------------------------------------

############################################################################

Commit: 9e7a8878ea46f82f3ca450ce60709285b1dc8661
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Nov 6 20:10:46 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:36 2015 UTC

Use x86_64 functions for x86_64 non bios platforms.

This logic is handled in libroot Jamfiles, but we only
use parts of that in boot.

----------------------------------------------------------------------------

############################################################################

Commit: 36e9399ed91c62bdf865f81b0ce14b73baf44078
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Nov 6 20:12:36 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:36 2015 UTC

Setup -fno-pic or -fpic in Architecture Rules.

EFI boot needs -fpic but all boot code was built with -fno-pic.
This is now set accordingly in HAIKU_BOOT_CCFLAGS and
HAIKU_BOOT_C++FLAGS.

Also setup compile flags for EFI platform.

----------------------------------------------------------------------------

############################################################################

Commit: 13833f1989d7841461069b8fbb803168d607171e
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Wed Nov 13 21:58:01 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:37 2015 UTC

Introduce new build flag for bootld and add EFI boot targets.

EFI needs BootLd to use -BSymbolic and others to link.
Also moved BoardSetup to use that flag instead of Jamfile magic.
BoardSetup was called and added to XX_CC_FLAGS before
XX_CC_FLAGS was set so moved BoardSetup to after it, which also
made sense for this change.

This allow building a runnable(!) EFI app with
jam -sHAIKU_BOOT_PLATFORM=efi haiku_loader.efi
Atm it only prints a message and waits for a key.

----------------------------------------------------------------------------

############################################################################

Commit: 11a9fecf5092acb7c5d3ffdf7db1f7812b69cbf2
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Nov 30 20:35:06 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:38 2015 UTC

Implement console code.

----------------------------------------------------------------------------

############################################################################

Commit: 30a19a11d1367ad4081f4ed08591fff873eefefa
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Nov 30 20:35:38 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:38 2015 UTC

Init console.

----------------------------------------------------------------------------

############################################################################

Commit: cb1015bdc7582169fe8994d964fa810300524940
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Nov 30 20:36:14 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:39 2015 UTC

Remove old start.c.

----------------------------------------------------------------------------

############################################################################

Commit: 652bad9866e9a4c2c652e5f84d3112e924f3f68e
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Nov 30 20:36:36 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:39 2015 UTC

Update Jamfile to build console, remove old rules.

----------------------------------------------------------------------------

############################################################################

Commit: 02ab4a20c33b36562bdce72b3bd6ec6234f71378
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Nov 30 20:44:03 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:40 2015 UTC

Remove old EFI string writing test code.

----------------------------------------------------------------------------

############################################################################

Commit: 014eb43605daf4be2d33942533dfea56d614e403
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Mon Dec 2 19:54:33 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:41 2015 UTC

Make sure bootloader builds to the right directory.

----------------------------------------------------------------------------

############################################################################

Commit: d66450e3c5577d906ef7c71a12440832eacb8bae
Author: François Revol <revol@xxxxxxx>
Date: Sat Dec 7 06:47:19 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:41 2015 UTC

loader: Drop the HashMap for partition lookup by id

The HashMap constructor was called before the heap is initialized,
ending up calling malloc from the OpenHashMap constructor.

Oddly it was still working on x86 but broke other platforms.

Instead we add a Lookup() static method to Partition,
which by default walks gPartitions for the id,
and recursively calls itself on the children lists.

This means we must add a partition even temporarily to gPartitions
before Scan()ing it though.

Signed-off-by: François Revol <revol@xxxxxxx>

----------------------------------------------------------------------------

############################################################################

Commit: aced58ce96be90d2e3f4e70521401493bd8c4f83
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:04:33 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:42 2015 UTC

GNU-EFI has removed the -S (strip-all) option, so do we.

----------------------------------------------------------------------------

############################################################################

Commit: bdf03dfbea9bec264405930e87b4207c6939c270
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:30:12 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:42 2015 UTC

Implement EFI keyboard functions. Mostly done.

----------------------------------------------------------------------------

############################################################################

Commit: 5e6a44f5e6f965924e1578044648803158616170
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:37:18 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:43 2015 UTC

Implemented EFI serial code. Seems to work.

Not sure we can pass EFI drivers to kernel so probably
should remove commented kernel args section later.

----------------------------------------------------------------------------

############################################################################

Commit: bd8010a75fff7d70ed7284745afd66fb7bf10753
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:39:44 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:44 2015 UTC

Loop on EFI_NOT_READY when checking for keypress.

Not sure

----------------------------------------------------------------------------

############################################################################

Commit: 770f6fb2dc4473d2edd601aa1d450c30d7491b5d
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:48:10 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:44 2015 UTC

Partial implementation of EFI debug functions.

Lacks implementation of debug_init_post_mmu and debug_cleanup

----------------------------------------------------------------------------

############################################################################

Commit: 182175c1b235e5afff8772241c0997dcff8705f0
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sat Dec 14 23:49:53 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:45 2015 UTC

Update Jamfile and work in progress on start.cpp

Enable serial and early debug functions.

----------------------------------------------------------------------------

############################################################################

Commit: 0fdca13ea74ea57f41ae1ff2edbeb4787019b2b8
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sun Dec 15 12:49:08 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:45 2015 UTC

Remove leftovers from bios code.

----------------------------------------------------------------------------

############################################################################

Commit: cd00f49380c2dbed538004a01b10d3e71779596a
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Mon Dec 16 20:41:33 2013 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:46 2015 UTC

Adding ctor_list in linking, and _bss_start.

Clearing bss seems to hang at the moment.

----------------------------------------------------------------------------

############################################################################

Commit: 52d4c1ce59d09c7416e5f340b377d9fcd0998d9d
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sun Mar 16 14:59:27 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:47 2015 UTC

Don't include mmu.h for now.

----------------------------------------------------------------------------

############################################################################

Commit: c83571706cb8e2635d53b3fcf5aa5292bdb26d7d
Author: Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date: Sun Mar 16 15:31:46 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:47 2015 UTC

Don't clear BSS, it is already zeroed.

EFI doesn't seem to like a .bss section according to GNU-EFI.
Therefore it is put and expanded inside .data. It is already zeroed
there. It makes the EFI app bigger so maybe there is a better
way?

The reason clearBSS() made the application hang was because
kSystemTable that we set before clearBSS() was part of .bss which
meant it was erased on clearing.

----------------------------------------------------------------------------

############################################################################

Commit: c1398be2d2bc25ed546faefac45ab3d5d6abd833
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 03:48:41 2014 UTC

EFI: fix kprintf; didn't copy variable arguments like it should

----------------------------------------------------------------------------

############################################################################

Commit: 3433d7911c0a9c170a0cea939bf060b41be6e335
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 03:49:39 2014 UTC

EFI: temporarily disable treating warnings as errors

----------------------------------------------------------------------------

############################################################################

Commit: 84e81fd7221fe18023e2de044d8c0acf74ae0ae5
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 06:01:32 2014 UTC

EFI: add simple accessors for boot & runtime services

----------------------------------------------------------------------------

############################################################################

Commit: e8a3e766537546ba2063d4602de01275a75fb551
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 06:10:56 2014 UTC

EFI: implement basic memory allocation & heap

----------------------------------------------------------------------------

############################################################################

Commit: bfa869861e1d296d693e9af897ae9d943cce86ce
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 06:20:19 2014 UTC

EFI: add basic text-mode menu support

----------------------------------------------------------------------------

############################################################################

Commit: 00e702a224a5886708c785d60c26d0a534e3bc18
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 10:44:00 2014 UTC

EFI: implement EFI block io devices, stub out video code.

* The EFI block io devices are read-only, and it will scan
all block devices reported by EFI; in theory, one can
forego even scanning for a partitioning system
* May want to later change the EFI block io code to only return
disks rather than individual partitions, and rely on the
system partitioning code
* Also forced the boot menu to show for now (start.cpp)
* With these changes, it's now possible to get to the Haiku
boot menu on a 64-bit EFI system (at least without any
actual Haiku installations present)

----------------------------------------------------------------------------

############################################################################

Commit: 8e9ef1745d5192ecdc7d6e4cfee75ad9ecafb4a1
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Thu Apr 24 11:35:40 2014 UTC

EFI: acpi init

* Not used yet; depends on functions in bios_ia32/acpi.cpp which
will be put into a shared location for the various x86 boot
loaders to use

----------------------------------------------------------------------------

############################################################################

Commit: cf9dcdec8c0d3edeaf1676ec06d0dafb250be58e
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 25 01:07:35 2014 UTC

EFI: use the best text mode available to us

----------------------------------------------------------------------------

############################################################################

Commit: e0979183ad3b9ba8414d5d9b06637ecbf9d250c2
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 25 01:08:31 2014 UTC

EFI: fixes boot on a macbook air; seems memory isn't zeroed

----------------------------------------------------------------------------

############################################################################

Commit: aa37c64cae0e3650c8136d90711063f0494cb3f1
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 25 03:03:59 2014 UTC

EFI: chooses the best resolution and throws up the splash screen

----------------------------------------------------------------------------

############################################################################

Commit: 47216a6db5ba6a11e982a63626434f528c477057
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 25 07:48:07 2014 UTC

EFI: make switching between text & graphics modes work

----------------------------------------------------------------------------

############################################################################

Commit: 9dd6c9103abf6a69fff7bfd9e2ec3bd6edb2fa12
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Tue Oct 21 19:14:45 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:54 2015 UTC

Preliminary EFI support in the bootloader.

Enough to let the kernel to print hello, but not much beyond that.
I think this also breaks non-EFI x86-64 support, code cleanups required.

----------------------------------------------------------------------------

############################################################################

Commit: 5f205e9ef9ffd6993785573d1b81d7c6e4b2d336
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Tue Oct 21 19:57:22 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:55 2015 UTC

Fix initial kernel stack address.

Leaving stack_address uninitialized caused platform_allocate_region to
allocate a random virtual address to the stack.

----------------------------------------------------------------------------

############################################################################

Commit: 6698f7dc4f13bb9c1078d70dae9dd96b4248ff08
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Wed Oct 22 00:52:20 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:55 2015 UTC

Bootloader: Populate gKernelArgs with plausible values.

----------------------------------------------------------------------------

############################################################################

Commit: 89995743e1c9c5da28b7aa38f0165bc08193b99e
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Wed Oct 22 00:53:12 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:56 2015 UTC

bootloader: Bug fix, PML4 must not overlap physical map.

----------------------------------------------------------------------------

############################################################################

Commit: 55ec6e8c35ed2b60ef8d1289c5763472882d148a
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Wed Oct 22 01:13:45 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:57 2015 UTC

bootloader: Initialize/load the GDT.

----------------------------------------------------------------------------

############################################################################

Commit: 6e456b79b9a6fc531750ec9ff42e95723e21b4f7
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Wed Oct 22 03:01:23 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:57 2015 UTC

Try harder to allocate early physical pages.

----------------------------------------------------------------------------

############################################################################

Commit: 4f7b73c1e74d7f82748fffe46983fa6159c92b38
Author: Henry Harrington <henry.harrington@xxxxxxxxx>
Date: Wed Oct 22 17:25:05 2014 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:24:58 2015 UTC

bootloader: Translate kernel args before adding them to kernel_args_range.

Chunks may be physically contiguous, but virtually disjoint. Adding
physical addresses may cause ranges to be merged incorrectly.

----------------------------------------------------------------------------

############################################################################

Commit: 0ba4560475c8391fc726b997800255069a6ff07b
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 24 08:24:32 2015 UTC

acpi: try to get ACPI RSDP from kernel

* To support UEFI, platform_kernel_args has been extended to
include a pointer to the ACPI RSDP.
* x86 platform init then adds a boot_item for the ACPI RSDP
* acpi driver now looks for the ACPI RSDP using get_boot_item,
and if not found, falls back to letting ACPICA probe for it.

----------------------------------------------------------------------------

############################################################################

Commit: 07c1c62633b76fbcee3b133745062de759bf7dc5
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Oct 22 10:56:04 2014 UTC

EFI kernel support hacking

----------------------------------------------------------------------------

############################################################################

Commit: f7b67093d223daf60f9b5a85f89f1c75b5e72a84
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Apr 24 10:20:18 2015 UTC

Allow configuring for a given boot platform.

----------------------------------------------------------------------------

############################################################################

Commit: e990c5578a765c9a8184e16680d551f432ae6472
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat Apr 25 09:37:58 2015 UTC

bootloader: wrap UEFI specific code in _BOOT_PLATFORM_efi

----------------------------------------------------------------------------

############################################################################

Commit: e8fca236c6a69ea77b75dd615a4e996f603e8e7b
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat Apr 25 22:52:33 2015 UTC

UEFI: fix which arch_string/cpuid to use

----------------------------------------------------------------------------

############################################################################

Commit: 0bfa5cccfcb4254da8098e221265f379a239fb12
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat Apr 25 22:53:57 2015 UTC

UEFI: define _BOOT_PLATFORM_$(TARGET_BOOT_PLATFORM)

* This is used in the generic parts of the bootloader,
where we need to do more complex mapping between
kernel & bootloader addresses
* Other platforms just use pointer arithmetic against
a fixed address, which doesn't apply to UEFI

----------------------------------------------------------------------------

############################################################################

Commit: 1f0100ded054112e2b64f3def132ee1291e5fc57
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat Apr 25 23:35:52 2015 UTC

bootloader: only pass -std=c++11 for UEFI

----------------------------------------------------------------------------

############################################################################

Commit: b67c430401293d29f6911578d3d3d003478aa83b
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Apr 26 05:20:33 2015 UTC

UEFI: initial implementation of mmu_map_physical_memory

----------------------------------------------------------------------------

############################################################################

Commit: 23f693d003d8dca943cf11846cea98c93b191e91
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Apr 26 05:22:39 2015 UTC

UEFI: an attempt at HPET support, testing out ACPI a bit more

----------------------------------------------------------------------------

############################################################################

Commit: f33cf807021da6c57e8abf95023a2ba7221398ef
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Tue Apr 28 02:50:23 2015 UTC

UEFI: add init_smp() code

* Need to copy bios_ia32/support.S and update for x86_64
* Need to actually boot the other CPUs

----------------------------------------------------------------------------

############################################################################

Commit: 58ca90d30b3e273cfe267b537a0348fb3a531ad8
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Tue Apr 28 22:54:08 2015 UTC

UEFI: add missing globals and timer init from cpu.cpp

----------------------------------------------------------------------------

############################################################################

Commit: 5ada191296fad789b49110f16a7ff54292da5220
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Apr 29 00:48:14 2015 UTC

src/system/boot: re-enable -Werror

----------------------------------------------------------------------------

############################################################################

Commit: b6205014d0d38370e642daa50fd2913864ae827d
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Apr 29 02:44:54 2015 UTC

UEFI: cleanup some warnings

----------------------------------------------------------------------------

############################################################################

Commit: 6131fd2169b0098bad8cca1ac0ffd7b86f05494a
Author: Nick Smallbone <nick.smallbone@xxxxxxxxx>
Date: Sat May 2 19:43:33 2015 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:27:35 2015 UTC

First stab at SMP

----------------------------------------------------------------------------

############################################################################

Commit: bca77cacc16c36a1aebde4fc9510b22a2204da72
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat May 2 20:41:45 2015 UTC

Making progress with SMP bring-up

----------------------------------------------------------------------------

############################################################################

Commit: de01f4c1dd8a0d4dcb4365299bd327efa1c6531b
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat May 2 21:55:30 2015 UTC

More SMP work...

----------------------------------------------------------------------------

############################################################################

Commit: 57ad6d4a648e09b7690092ae2d5bf87bbf3ee068
Author: Nick Smallbone <nick.smallbone@xxxxxxxxx>
Date: Sat May 2 21:54:02 2015 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:27:37 2015 UTC

Fix bug setting smp_trampoline_args.

----------------------------------------------------------------------------

############################################################################

Commit: 50e2fcf6fa9cc018e3403f90290406c9ccb05789
Author: Nick Smallbone <nick.smallbone@xxxxxxxxx>
Date: Sat May 2 22:25:15 2015 UTC
Committer: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Mon Sep 21 04:27:37 2015 UTC

Fix several silly bugs in trampoline

----------------------------------------------------------------------------

############################################################################

Commit: 63a8fd83c278951d4b4e8d0ae3dcf996c6b4ea83
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat May 2 22:57:42 2015 UTC

Fix up SMP, add some extra debugging for testing on actual hardware.

----------------------------------------------------------------------------

############################################################################

Commit: db9aa4fbc45196826d8a1696bfd308a8b71c93e1
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sat Sep 12 10:04:25 2015 UTC

UEFI: fix up debug, trace MMU post-UEFI code.

----------------------------------------------------------------------------

############################################################################

Commit: 91e8d093986a74d88a1e16916782a634a2121353
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Sep 13 01:14:21 2015 UTC

UEFI: see if we actually need to use AllocatePages.

Doesn't seem to be helping with boot issues at all,
however :(

----------------------------------------------------------------------------

############################################################################

Commit: 75a491c5d26b3dd7ec1b3dd67426e9c2df44762a
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Mon Sep 14 23:13:44 2015 UTC

Lots of debugging: delete this commit later

----------------------------------------------------------------------------

############################################################################

Commit: 3d13a90fdc7ff2dbd15608fa36708c03bf6889e5
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Sep 16 01:31:29 2015 UTC

UEFI: don't do all the things!

- No SMP support
- Don't create virtual mappings for UEFI boot/runtime services
- Don't call UEFI SetVirtualAddressMap()

This at least gets us booting on some actual hardware. The
booted system is quite unstable, however :(

----------------------------------------------------------------------------

############################################################################

Commit: fc99989241694a464c572f0ddf6fb84b9ed9fdd9
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Sep 18 03:03:42 2015 UTC

UEFI: working SMP on actual hardware now

On at least one machine, we were trying to copy the SMP
trampoline code over top of ACPI NVS!

Interestingly, Haiku now fails to load all the device
drivers... so not quite getting to the Desktop now :(

----------------------------------------------------------------------------

############################################################################

Commit: 82a29c4dc6fc270e28a73f6220fca729003d66b4
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Sep 18 03:28:12 2015 UTC

UEFI: weird issues with the -std=c++11 flag...

... so just put up with the warnings instead.

----------------------------------------------------------------------------

############################################################################

Commit: 15fef1f2ddce2813bd83969fe4519ff0883edcae
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Sep 18 03:29:08 2015 UTC

UEFI: fix printf formatting warnings.

----------------------------------------------------------------------------

############################################################################

Commit: bc8347acaf09ff04e8918afd812b48157fdb146e
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Sep 18 09:04:29 2015 UTC

UEFI: device manager/vfs tracing

----------------------------------------------------------------------------

############################################################################

Commit: 66f53331867a675e76b7a456a328bb2a3474c3a1
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Fri Sep 18 21:41:50 2015 UTC

UEFI: add some more framebuffer config to kernel args.

----------------------------------------------------------------------------

############################################################################

Commit: 3ef3554628cb701b7b14ca44df0c37b0b92d60ce
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Sep 20 23:31:38 2015 UTC

UEFI: cleanup of src/system/boot/loader

----------------------------------------------------------------------------

############################################################################

Commit: 7b2d40f5777cc469d74829280af2d05ffb955659
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Sep 20 23:41:57 2015 UTC

Fix line endings.

----------------------------------------------------------------------------

############################################################################

Commit: 69aa9464d846907587240ad87356003ffff05ca5
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Sep 20 23:46:54 2015 UTC

UEFI: cleanup of src/system/kernel.

Still need to work on fs/vfs_boot.cpp

----------------------------------------------------------------------------

############################################################################

Commit: 5d22c749039fe4427b1c6520e705926875b55593
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Sun Sep 20 23:50:53 2015 UTC

UEFI: update platform function names for converting addresses

----------------------------------------------------------------------------

############################################################################

Commit: cd9f036635c2213d94e0ecc55756062089011d60
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Mon Sep 21 23:43:21 2015 UTC

UEFI: add support for SATA device paths.

----------------------------------------------------------------------------

############################################################################

Commit: d865e8289871d2771d6f638fc5d797e160656b5a
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Tue Sep 22 00:02:48 2015 UTC

booting: support identifying disks & partitions by UUID.

This adds a UUID field for partition_data, and updates the
GPT partitioning system to add the UUIDs for both the
partitioning system and each child partition.

The VFS boot code has been updated to detect whether disks
and partitions should be identified by UUID, skipping the
fallback mechanisms used for other platforms.

These changes will allow the UEFI boot loader to correctly
pass the boot device and partition to the kernel.

----------------------------------------------------------------------------

############################################################################

Commit: 1300bdd7fb37be5eb452d3ccbece95378e1a6b4e
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Tue Sep 22 00:08:00 2015 UTC

UEFI: use the Device Path API to get disk/partition UUIDs.

With the new support for UUIDs kernel-side, we can now
pass the correct disk & partition UUIDs to the kernel.

----------------------------------------------------------------------------

############################################################################

Commit: f1abbd61d6e727b7c610b5a078b0352cf8901710
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Sep 23 08:33:34 2015 UTC

UEFI: find the target boot partition from command line args.

Conflicts:
src/system/boot/platform/efi/devices.cpp

Conflicts:
src/system/boot/platform/efi/devices.cpp

----------------------------------------------------------------------------

############################################################################

Commit: 709a457fd8377025d4041be501eea9d3a234892e
Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date: Wed Sep 23 12:33:27 2015 UTC

UEFI: committing because of scary system failure...

This commit doesn't work yet, and will be redone once I can
debug again without the system falling apart...

----------------------------------------------------------------------------


Other related posts:

  • » [haiku-commits] BRANCH jessicah-github.uefi-fix-boot [709a457fd837] headers/private/kernel/boot/platform/efi src/system/boot/platform/efi headers/private/kernel/boot/platform/efi/arch/x86_64 headers/private/kernel/boot/platform/efi/arch/x86 headers/private/kernel/boot/platform/efi/protocol - jessicah-github . uefi-fix-boot