[haiku-commits] haiku: hrev50684 - in src/system/boot: platform/efi loader src platform/efi/arch/x86_64 .

  • From: jessica.l.hamilton@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 14 Nov 2016 11:01:18 +0100 (CET)

hrev50684 adds 22 changesets to branch 'master'
old head: b273e9733d25babe5e6702dc1e24f3dff1ffd6dc
new head: f4ff9cb02c1d292908407314ed023af25e0995da
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=f4ff9cb02c1d+%5Eb273e9733d25

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

20e11028aa31: 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> ]

211483cb512b: EFI: Initial test EFI application
  
  * Only set HAIKU_BOOT_PLATFORM to bios_ia32 if not defined
  * Add gnuefi build feature
  * Introduce BOOT_LDFLAGS, and move options for passing to linker
    into ArchitectureSetup
  * x86_64 compile fixes for warnings in boot loader
  * loader/elf.cpp: don't include ELF32 support when targeting EFI
  * relocation_func.cpp: copy of the relocation code from gnuefi
    to make _relocate extern "C", and avoid including <efilib.h>
  * boot_loader_efi.ld: copy of gnuefi's elf_x86_64_efi.lds,
    modified to include support for C++ constructors, etc. Keep in
    sync with the gnuefi package
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

bd0604764ee1: 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> ]

735f1daee956: EFI: Implement console code.

                         [ Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx> ]

495efc382b3c: 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> ]

e2e1558a02e4: EFI: stub functions so we can call loader's main() function.

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

c0002a79e779: EFI: Implement heap

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

c0bdc8bef589: bootloader: build objects in $(TARGET_BOOT_PLATFORM)
  
  This separates the objects required for the various boot
  loaders, allowing the build system to be able to build
  for different targets alongside each other. Currently
  only done for bios_ia32 vs efi, as both loaders will be
  needed for the x86_64 images.

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

96f4d68b2b1c: EFI: check for boot keys
  
  * Only supports spacebar for the boot menu, and escape for
    enabling debug output. Shift keys will not work.

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

dbf1363b4146: EFI: naive platform_allocate_region() implementation

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

325b1e378771: EFI: add support for graphics mode output
  
  * We can now switch between graphics and text modes, and display
    the splash screen

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

2da1cb75a40b: EFI: device support for anyboot CDs.
  
  I have tried to get normal ISOs working, but the bootloader doesn't
  seem to detect any bootable partitions.

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

b3215a62758d: EFI: preliminary support for starting the kernel.
  
  Enough to let the kernel to print hello, but not much beyond that.
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

34a6dd672874: EFI: Initialize/load the GDT.
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

21e3ac6cf52f: vm: Try harder to allocate early physical pages.
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

82dcc31606c9: 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.
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                           [ Henry Harrington <henry.harrington@xxxxxxxxx> ]

6e6efaecdc51: EFI: add ACPI support
  
  Also add support in the kernel to get the ACPI RSDP from the
  bootloader, and pass onto the ACPI driver using get_boot_item.

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

a1d0102ee4a8: EFI: add support for HPET

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

a7142a503761: EFI: add cpu.cpp from bios_ia32

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

ec239abcf592: EFI: implement mmu_map_physical_memory & mmu_free.
  
  Also move cpu, acpi, hpet init into platform_start_kernel, as we
  need an initialised heap for alllocating memory for recording
  the mapped regions.

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

a99a0c003d14: EFI: add support for SMP.
  
  Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

                               [ Nick Smallbone <nick.smallbone@xxxxxxxxx> ]

f4ff9cb02c1d: Merge branch 'uefi-support'

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

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

72 files changed, 3600 insertions(+), 144 deletions(-)
build/jam/ArchitectureRules                      |  42 +-
build/jam/BootRules                              |   2 +-
build/jam/BuildFeatures                          |  17 +
build/jam/BuildSetup                             |   2 +-
.../private/kernel/arch/x86/arch_kernel_args.h   |   2 +
headers/private/kernel/boot/partitions.h         |   2 +
headers/private/kernel/boot/platform.h           |   2 +
.../boot/platform/efi/platform_kernel_args.h     |  46 ++
.../boot/platform/efi/platform_stage2_args.h     |  17 +
.../kernel/bus_managers/acpi/ACPICAHaiku.cpp     |  14 +-
src/system/boot/Jamfile                          |  36 +-
src/system/boot/arch/arm/Jamfile                 |   2 +-
src/system/boot/arch/m68k/Jamfile                |   8 +-
src/system/boot/arch/x86/Jamfile                 |  36 +-
src/system/boot/loader/Jamfile                   |  14 +-
src/system/boot/loader/elf.cpp                   |  37 +-
.../boot/loader/file_systems/amiga_ffs/File.cpp  |   2 +-
.../boot/loader/file_systems/amiga_ffs/Jamfile   |   3 +-
.../loader/file_systems/amiga_ffs/amiga_ffs.cpp  |   2 +-
src/system/boot/loader/file_systems/bfs/Jamfile  |   3 +-
.../boot/loader/file_systems/bfs/Stream.cpp      |   2 +-
src/system/boot/loader/file_systems/bfs/bfs.cpp  |   3 +-
src/system/boot/loader/file_systems/fat/Jamfile  |   3 +-
.../boot/loader/file_systems/fat/Stream.cpp      |   2 +-
.../boot/loader/file_systems/hfs_plus/Jamfile    |   3 +-
.../boot/loader/file_systems/packagefs/Jamfile   |   4 +-
.../loader/file_systems/packagefs/packagefs.cpp  |   2 +-
.../boot/loader/file_systems/tarfs/Jamfile       |   4 +-
src/system/boot/loader/kernel_args.cpp           |  12 +
src/system/boot/loader/load_driver_settings.cpp  |   2 +-
src/system/boot/loader/loader.cpp                |   6 +-
src/system/boot/loader/net/Jamfile               |   4 +-
src/system/boot/loader/net/RemoteDisk.cpp        |   3 +-
src/system/boot/loader/partitions.cpp            |  75 ++-
src/system/boot/loader/vfs.cpp                   |   4 +-
src/system/boot/platform/amiga_m68k/Jamfile      |   2 +-
src/system/boot/platform/atari_m68k/Jamfile      |   2 +-
src/system/boot/platform/bios_ia32/Jamfile       |   4 +-
src/system/boot/platform/efi/Jamfile             |  59 +++
src/system/boot/platform/efi/acpi.cpp            | 259 +++++++++++
src/system/boot/platform/efi/acpi.h              |  22 +
.../platform/efi/arch/x86_64/relocation_func.cpp |  97 ++++
src/system/boot/platform/efi/console.cpp         | 247 ++++++++++
src/system/boot/platform/efi/console.h           |  16 +
src/system/boot/platform/efi/cpu.cpp             | 349 ++++++++++++++
src/system/boot/platform/efi/cpu.h               |  22 +
src/system/boot/platform/efi/debug.cpp           |  44 ++
src/system/boot/platform/efi/devices.cpp         | 242 ++++++++++
src/system/boot/platform/efi/efi_platform.h      |  23 +
src/system/boot/platform/efi/entry.S             |  69 +++
src/system/boot/platform/efi/heap.cpp            |  40 ++
src/system/boot/platform/efi/hpet.cpp            |  55 +++
src/system/boot/platform/efi/hpet.h              |  21 +
src/system/boot/platform/efi/menu.cpp            |  40 ++
src/system/boot/platform/efi/mmu.cpp             | 381 ++++++++++++++++
src/system/boot/platform/efi/mmu.h               |  73 +++
src/system/boot/platform/efi/smp.cpp             | 457 +++++++++++++++++++
src/system/boot/platform/efi/smp.h               |  30 ++
src/system/boot/platform/efi/smp_trampoline.S    | 129 ++++++
src/system/boot/platform/efi/start.cpp           | 295 ++++++++++++
src/system/boot/platform/efi/support.S           |  39 ++
src/system/boot/platform/efi/video.cpp           | 108 +++++
src/system/boot/platform/generic/Jamfile         |   5 +-
src/system/boot/platform/pxe_ia32/Jamfile        |   2 +-
src/system/boot/platform/raspberrypi_arm/Jamfile |   2 +-
src/system/boot/platform/u-boot/Jamfile          |   2 +-
src/system/boot/platform/u-boot/arch/arm/Jamfile |   1 -
src/system/boot/platform/u-boot/arch/ppc/Jamfile |   4 +-
src/system/kernel/arch/x86/arch_elf.cpp          |   4 +-
src/system/kernel/arch/x86/arch_platform.cpp     |  82 ++--
src/system/kernel/vm/vm.cpp                      |  20 +
src/system/ldscripts/x86_64/boot_loader_efi.ld   |  79 ++++

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

Commit:      20e11028aa31e17ff6f4a08f288afa0e703cc6f2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=20e11028aa31
Author:      Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date:        Sun Sep  8 11:22:29 2013 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Thu Apr 14 07:18:21 2016 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.

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

diff --git a/src/system/boot/loader/partitions.cpp 
b/src/system/boot/loader/partitions.cpp
index f70bc8a..21348ed 100644
--- a/src/system/boot/loader/partitions.cpp
+++ b/src/system/boot/loader/partitions.cpp
@@ -16,6 +16,7 @@
 #include <boot/stdio.h>
 #include <boot/vfs.h>
 #include <ddm_modules.h>
+#include <HashMap.h>
 
 #include "RootFileSystem.h"
 
@@ -99,6 +100,10 @@ private:
 };
 
 
+static int32 sIdCounter = 0;
+static HashMap<HashKey32<int32>, Partition*> sIdPartitionMap;
+
+
 //     #pragma mark -
 
 
@@ -111,7 +116,9 @@ Partition::Partition(int fd)
        TRACE(("%p Partition::Partition\n", this));
 
        memset((partition_data *)this, 0, sizeof(partition_data));
-       id = (partition_id)this;
+
+       id = atomic_add(&sIdCounter, 1);
+       sIdPartitionMap.Put(id, this);
 
        // it's safe to close the file
        fFD = dup(fd);
@@ -132,6 +139,7 @@ Partition::~Partition()
                        child->SetParent(NULL);
        }
 
+       sIdPartitionMap.Remove(id);
        close(fFD);
 }
 
@@ -469,8 +477,13 @@ partition_data *
 create_child_partition(partition_id id, int32 index, off_t offset, off_t size,
        partition_id childID)
 {
-       Partition &partition = *(Partition *)id;
-       Partition *child = partition.AddChild();
+       Partition *partition = sIdPartitionMap.Get(id);
+       if (partition == NULL) {
+               dprintf("creating partition failed: could not find 
partition.\n");
+               return NULL;
+       }
+
+       Partition *child = partition->AddChild();
        if (child == NULL) {
                dprintf("creating partition failed: no memory\n");
                return NULL;
@@ -490,8 +503,6 @@ create_child_partition(partition_id id, int32 index, off_t 
offset, off_t size,
 partition_data *
 get_child_partition(partition_id id, int32 index)
 {
-       //Partition &partition = *(Partition *)id;
-
        // TODO: do we really have to implement this?
        //      The intel partition module doesn't really need this for our 
mission...
        TRACE(("get_child_partition(id = %lu, index = %ld)\n", id, index));
@@ -503,8 +514,11 @@ get_child_partition(partition_id id, int32 index)
 partition_data *
 get_parent_partition(partition_id id)
 {
-       Partition &partition = *(Partition *)id;
-
-       return partition.Parent();
+       Partition *partition = sIdPartitionMap.Get(id);
+       if (partition == NULL) {
+               dprintf("could not find parent partition.\n");
+               return NULL;
+       }
+       return partition->Parent();
 }
 

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

Commit:      211483cb512baaca8b17e0112a360b5a17cde0ca
URL:         http://cgit.haiku-os.org/haiku/commit/?id=211483cb512b
Author:      Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date:        Thu Apr 14 07:15:55 2016 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Fri Sep  2 07:02:29 2016 UTC

EFI: Initial test EFI application

* Only set HAIKU_BOOT_PLATFORM to bios_ia32 if not defined
* Add gnuefi build feature
* Introduce BOOT_LDFLAGS, and move options for passing to linker
  into ArchitectureSetup
* x86_64 compile fixes for warnings in boot loader
* loader/elf.cpp: don't include ELF32 support when targeting EFI
* relocation_func.cpp: copy of the relocation code from gnuefi
  to make _relocate extern "C", and avoid including <efilib.h>
* boot_loader_efi.ld: copy of gnuefi's elf_x86_64_efi.lds,
  modified to include support for C++ constructors, etc. Keep in
  sync with the gnuefi package

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 0730e2d..0c824c4 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -279,7 +279,7 @@ rule KernelArchitectureSetup architecture
                        HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - 
unused yet
 
                case x86 :
-                       HAIKU_BOOT_PLATFORM = bios_ia32 ;
+                       HAIKU_BOOT_PLATFORM ?= bios_ia32 ;
                        HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
                        # offset in floppy image (>= sizeof(haiku_loader))
                        HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB
@@ -291,7 +291,7 @@ rule KernelArchitectureSetup architecture
 
                case x86_64 :
                        # x86_64 completely shares the x86 bootloader.
-                       HAIKU_BOOT_PLATFORM = bios_ia32 ;
+                       HAIKU_BOOT_PLATFORM ?= bios_ia32 ;
                        HAIKU_BOOT_FLOPPY_IMAGE_SIZE = 2880 ; # in kB
                        # offset in floppy image (>= sizeof(haiku_loader))
                        HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 320 ; # in kB
@@ -326,12 +326,6 @@ rule KernelArchitectureSetup architecture
                        Exit "Currently unsupported target CPU:" $(cpu) ;
        }
 
-       # Include embedded board-specific file.
-       if $(HAIKU_BOOT_BOARD) {
-               include [ FDirName $(HAIKU_BUILD_RULES_DIR) board 
$(HAIKU_BOOT_BOARD)
-                       BoardSetup ] ;
-       }
-
        # private kernel headers to be used when compiling kernel code
        HAIKU_PRIVATE_KERNEL_HEADERS =
                [ PrivateHeaders $(DOT) kernel libroot shared
@@ -361,6 +355,7 @@ rule KernelArchitectureSetup architecture
        HAIKU_BOOT_CCFLAGS = $(HAIKU_CCFLAGS_$(architecture)) $(gccBaseFlags) ;
        HAIKU_BOOT_C++FLAGS = $(HAIKU_C++FLAGS_$(architecture)) $(g++BaseFlags) 
;
        HAIKU_BOOT_LINKFLAGS = ;
+       HAIKU_BOOT_LDFLAGS = -Bstatic ;
 
        if $(gccVersion[1]) >= 4 {
                HAIKU_KERNEL_C++FLAGS += -std=gnu++11 ;
@@ -370,6 +365,16 @@ rule KernelArchitectureSetup architecture
        HAIKU_KERNEL_PIC_LINKFLAGS = ;
        HAIKU_KERNEL_ADDON_LINKFLAGS = ;
 
+       # Include embedded board-specific file.
+       if $(HAIKU_BOOT_BOARD) {
+               include [ FDirName $(HAIKU_BUILD_RULES_DIR) board 
$(HAIKU_BOOT_BOARD)
+                       BoardSetup ] ;
+               if $(HAIKU_BOARD_LOADER_BASE) {
+                       HAIKU_BOOT_LDFLAGS +=
+                               --defsym 
BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ;
+               }
+       }
+
        switch $(cpu) {
                case ppc :
                        # Build a position independent PPC kernel. We need to 
be able to
@@ -401,10 +406,20 @@ rule KernelArchitectureSetup architecture
                        HAIKU_KERNEL_PIC_LINKFLAGS += -z max-page-size=0x1000 ;
                        HAIKU_KERNEL_ADDON_LINKFLAGS += -z max-page-size=0x1000 
;
 
-                       # Bootloader is 32-bit.
-                       HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;
-                       HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ;
-                       HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ;
+                       # BIOS Bootloader is 32-bit.
+                       if $(HAIKU_BOOT_PLATFORM) = bios_ia32 {
+                               HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;
+                               HAIKU_BOOT_CCFLAGS += -m32 -march=pentium ;
+                               HAIKU_BOOT_C++FLAGS += -m32 -march=pentium ;
+                       }
+       }
+
+       if $(HAIKU_BOOT_PLATFORM) = efi {
+               HAIKU_BOOT_CCFLAGS += -fpic -fno-stack-protector -fPIC 
-fshort-wchar -mno-red-zone
+                       -maccumulate-outgoing-args -Wno-error=unused-variable ;
+               HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC 
-fshort-wchar -mno-red-zone
+                       -maccumulate-outgoing-args -Wno-error=unused-variable ;
+               HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib 
-znocombreloc -nostartfiles ;
        }
 
        # warning flags
diff --git a/build/jam/BootRules b/build/jam/BootRules
index 63efcc5..f369ead 100644
--- a/build/jam/BootRules
+++ b/build/jam/BootRules
@@ -47,7 +47,7 @@ rule BootLd
 
        LINK on $(1) = $(TARGET_LD_$(TARGET_PACKAGING_ARCH)) ;
 
-       LINKFLAGS on $(1) = $(4) ;
+       LINKFLAGS on $(1) = $(TARGET_BOOT_LINKFLAGS) $(4) ;
        if $(3) { LINKFLAGS on $(1) += --script=$(3) ; }
 
        # Remove any preset LINKLIBS, but link against libgcc.a. Linking against
diff --git a/build/jam/BuildFeatures b/build/jam/BuildFeatures
index e70a411..0f80ffd 100644
--- a/build/jam/BuildFeatures
+++ b/build/jam/BuildFeatures
@@ -571,6 +571,23 @@ if [ IsPackageAvailable expat_devel ] {
 }
 
 
+# gnu-efi
+if $(TARGET_PACKAGING_ARCH) = x86_64 {
+       if [ IsPackageAvailable gnuefi ] {
+               ExtractBuildFeatureArchives gnuefi :
+                       file: base gnuefi
+                               headers: $(developHeadersDir)/gnuefi
+                               headersProtocol: 
$(developHeadersDir)/gnuefi/protocol
+                               headersArch: 
$(developHeadersDir)/gnuefi/$(TARGET_ARCH)
+                               libdir: $(libDir)/gnuefi
+                       ;
+
+               EnableBuildFeatures gnuefi ;
+       } else {
+               Echo "gnuefi support not available on $(TARGET_PACKAGING_ARCH)" 
;
+       }
+}
+
 # GPL add-ons
 if $(HAIKU_INCLUDE_GPL_ADDONS) = 1 {
        EnableBuildFeatures gpl ;
diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index d13922a..a96f847 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -649,7 +649,7 @@ local buildVars =
 
        KERNEL_CCFLAGS KERNEL_C++FLAGS
        KERNEL_PIC_CCFLAGS KERNEL_PIC_LINKFLAGS KERNEL_ADDON_LINKFLAGS
-       BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS
+       BOOT_CCFLAGS BOOT_C++FLAGS BOOT_LINKFLAGS BOOT_LDFLAGS
 
        KERNEL_WARNING_CCFLAGS KERNEL_WARNING_C++FLAGS
 
diff --git a/build/jam/repositories/HaikuPorts/x86_64 
b/build/jam/repositories/HaikuPorts/x86_64
old mode 100755
new mode 100644
diff --git a/headers/private/kernel/boot/platform/efi/platform_kernel_args.h 
b/headers/private/kernel/boot/platform/efi/platform_kernel_args.h
new file mode 100644
index 0000000..4ad0453
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/platform_kernel_args.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013-2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef KERNEL_BOOT_PLATFORM_EFI_KERNEL_ARGS_H
+#define KERNEL_BOOT_PLATFORM_EFI_KERNEL_ARGS_H
+
+
+#ifndef KERNEL_BOOT_KERNEL_ARGS_H
+#      error This file is included from <boot/kernel_args.h> only
+#endif
+
+// currently the EFI loader pretends to be the bios_ia32 platform.
+// not quite right, as the kernel needs to be aware of efi runtime services
+
+#include <arch/x86/apm.h>
+#include <boot/disk_identifier.h>
+#include <util/FixedWidthPointer.h>
+
+
+#define SMP_MAX_CPUS 64
+
+#define MAX_PHYSICAL_MEMORY_RANGE 32
+#define MAX_PHYSICAL_ALLOCATED_RANGE 32
+#define MAX_VIRTUAL_ALLOCATED_RANGE 32
+
+#define MAX_SERIAL_PORTS 4
+
+typedef struct bios_drive {
+       struct bios_drive       *next;
+       uint16                          drive_number;
+       disk_identifier         identifier;
+} bios_drive;
+
+typedef struct {
+       uint16          serial_base_ports[MAX_SERIAL_PORTS];
+
+       FixedWidthPointer<bios_drive> drives;
+               // this does not contain the boot drive
+       // seems to be ignored entirely?
+
+       apm_info        apm;
+} _PACKED platform_kernel_args;
+
+
+#endif /* KERNEL_BOOT_PLATFORM_BIOS_IA32_KERNEL_ARGS_H */
diff --git a/headers/private/kernel/boot/platform/efi/platform_stage2_args.h 
b/headers/private/kernel/boot/platform/efi/platform_stage2_args.h
new file mode 100644
index 0000000..ef2f2ed
--- /dev/null
+++ b/headers/private/kernel/boot/platform/efi/platform_stage2_args.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2013-2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _KERNEL_BOOT_PLATFORM_EFI_STAGE2_ARGS_H
+#define _KERNEL_BOOT_PLATFORM_EFI_STAGE2_ARGS_H
+
+
+#ifndef KERNEL_BOOT_STAGE2_ARGS_H
+#      error This file is included from <boot/stage2_args.h> only
+#endif
+
+struct platform_stage2_args {
+};
+
+
+#endif /* _KERNEL_BOOT_PLATFORM_EFI_STAGE2_ARGS_H */
diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile
index e751743..c8099df 100644
--- a/src/system/boot/Jamfile
+++ b/src/system/boot/Jamfile
@@ -2,8 +2,14 @@ SubDir HAIKU_TOP src system boot ;
 
 DEFINES += _BOOT_MODE ;
 
-SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
-                                       $(TARGET_KERNEL_ARCH) ] ;
+if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) != bios_ia32 {
+       SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
+                               x86_64 ] ;
+} else {
+       SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot os arch
+                               $(TARGET_KERNEL_ARCH) ] ;
+}
+
 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix string ] ;
 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix stdlib ] ;
 SEARCH_SOURCE += [ FDirName $(SUBDIR) $(DOTDOT) libroot posix locale ] ;
@@ -44,11 +50,6 @@ BootMergeObject boot_libroot.o :
        : -fno-pic
 ;
 
-local extraLinkerArgs = ;
-if $(HAIKU_BOARD_LOADER_BASE) {
-       extraLinkerArgs += --defsym 
BOARD_LOADER_BASE=$(HAIKU_BOARD_LOADER_BASE) ;
-}
-
 AddResources haiku_loader : boot_loader.rdef ;
 
 BootLd boot_loader_$(TARGET_BOOT_PLATFORM) :
@@ -76,7 +77,7 @@ BootLd boot_loader_$(TARGET_BOOT_PLATFORM) :
        boot_libroot.o
 
        : 
$(HAIKU_TOP)/src/system/ldscripts/$(TARGET_ARCH)/boot_loader_$(TARGET_BOOT_PLATFORM).ld
-       : -Bstatic $(extraLinkerArgs)
+       : $(TARGET_BOOT_LDFLAGS)
 ;
 
 rule BuildCoffLoader {
@@ -130,6 +131,22 @@ BuildBiosLoader haiku_loader : 
boot_loader_$(TARGET_BOOT_PLATFORM) ;
 # different target for PXE, to be build with TARGET_BOOT_PLATFORM=pxe_ia32 jam 
pxehaiku-loader
 BuildBiosLoader pxehaiku-loader : boot_loader_$(TARGET_BOOT_PLATFORM) ;
 
+rule BuildEFILoader {
+       local efiLoader = $(1) ;
+       local bootLoader = $(2) ;
+
+       Depends $(efiLoader) : $(bootLoader) ;
+       MakeLocateDebug $(efiLoader) ;
+}
+
+actions BuildEFILoader {
+       rm -f $(1)
+       $(TARGET_OBJCOPY_$(TARGET_PACKAGING_ARCH)) -j .text -j .sdata -j .data 
-j .dynamic -j .dynsym \
+       -j .rel -j .rela -j .reloc --target=efi-app-x86_64 $(2) $(1)
+}
+
+BuildEFILoader haiku_loader.efi : boot_loader_$(TARGET_BOOT_PLATFORM) ;
+
 SubInclude HAIKU_TOP src system boot arch $(TARGET_KERNEL_ARCH) ;
 SubInclude HAIKU_TOP src system boot loader ;
 SubInclude HAIKU_TOP src system boot platform ;
diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile
index 0fd15d0..66fb94f 100644
--- a/src/system/boot/arch/x86/Jamfile
+++ b/src/system/boot/arch/x86/Jamfile
@@ -6,13 +6,15 @@ local kernelArchSources =
        arch_elf.cpp
 ;
 
-local kernelArch32Sources =
-       cpuid.S
-;
-
-local kernelLibArchSources =
-       arch_string.S
-;
+local kernelArchSpecificSources ;
+local kernelLibArchSpecificSources ;
+if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) != bios_ia32 {
+       kernelArchSpecificSources = cpuid.cpp ;
+       kernelLibArchSpecificSources = arch_string.cpp ;
+} else {
+       kernelArchSpecificSources = cpuid.S ;
+       kernelLibArchSpecificSources = arch_string.S ;
+}
 
 local librootOsArchSources =
        byteorder.S
@@ -20,17 +22,25 @@ local librootOsArchSources =
 
 BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
        $(kernelArchSources)
-       $(kernelArch32Sources)
-       $(kernelLibArchSources)
+       $(kernelArchSpecificSources)
+       $(kernelLibArchSpecificSources)
        $(librootOsArchSources)
-       : # additional flags
+       : -std=c++11 # additional flags
 ;
 
 SEARCH on [ FGristFiles $(kernelArchSources) ]
     = [ FDirName $(HAIKU_TOP) src system kernel arch x86 ] ;
-SEARCH on [ FGristFiles $(kernelArch32Sources) ]
+
+if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) != bios_ia32 {
+SEARCH on [ FGristFiles $(kernelArchSpecificSources) ]
+    = [ FDirName $(HAIKU_TOP) src system kernel arch x86 64 ] ;
+SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ]
+    = [ FDirName $(HAIKU_TOP) src system libroot posix string arch x86_64 ] ;
+} else {
+SEARCH on [ FGristFiles $(kernelArchSpecificSources) ]
     = [ FDirName $(HAIKU_TOP) src system kernel arch x86 32 ] ;
-SEARCH on [ FGristFiles $(kernelLibArchSources) ]
+SEARCH on [ FGristFiles $(kernelLibArchSpecificSources) ]
     = [ FDirName $(HAIKU_TOP) src system kernel lib arch x86 ] ;
+}
 SEARCH on [ FGristFiles $(librootOsArchSources) ]
     = [ FDirName $(HAIKU_TOP) src system libroot os arch x86 ] ;
diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile
index 6bee5ca..a44793d 100644
--- a/src/system/boot/loader/Jamfile
+++ b/src/system/boot/loader/Jamfile
@@ -45,6 +45,11 @@ UsePrivateHeaders shared storage ;
 
                                #BOOT_SUPPORT_FILE_SYSTEM_FAT
                        ;
+                       if $(HAIKU_BOOT_PLATFORM) != efi {
+                               DEFINES +=
+                                       BOOT_SUPPORT_ELF32
+                               ;
+                       }
                }
        }
 
diff --git a/src/system/boot/loader/elf.cpp b/src/system/boot/loader/elf.cpp
index ec685a4..abb4f5e 100644
--- a/src/system/boot/loader/elf.cpp
+++ b/src/system/boot/loader/elf.cpp
@@ -61,6 +61,7 @@ private:
 };
 
 
+#ifdef BOOT_SUPPORT_ELF32
 struct ELF32Class {
        static const uint8 kIdentClass = ELFCLASS32;
 
@@ -96,6 +97,7 @@ struct ELF32Class {
 };
 
 typedef ELFLoader<ELF32Class> ELF32Loader;
+#endif
 
 
 #ifdef BOOT_SUPPORT_ELF64
@@ -225,7 +227,7 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
                                // known but unused type
                                continue;
                        default:
-                               dprintf("unhandled pheader type 0x%lx\n", 
header.p_type);
+                               dprintf("unhandled pheader type 0x%" B_PRIx32 
"\n", header.p_type);
                                continue;
                }
 
@@ -320,7 +322,7 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
                        header.p_filesz);
                if (length < (ssize_t)header.p_filesz) {
                        status = B_BAD_DATA;
-                       dprintf("error reading in seg %ld\n", i);
+                       dprintf("error reading in seg %" B_PRId32 "\n", i);
                        goto error2;
                }
 
@@ -642,13 +644,14 @@ elf_load_image(int fd, preloaded_image** _image)
                        return status;
        }
 #endif
-
+#if BOOT_SUPPORT_ELF32
        if (gKernelArgs.kernel_image == NULL
                || gKernelArgs.kernel_image->elf_class == ELFCLASS32) {
                status = ELF32Loader::Create(fd, _image);
                if (status == B_OK)
                        return ELF32Loader::Load(fd, *_image);
        }
+#endif
 
        return status;
 }
@@ -706,16 +709,22 @@ elf_relocate_image(preloaded_image* image)
                return ELF64Loader::Relocate(image);
        else
 #endif
+#ifdef BOOT_SUPPORT_ELF32
                return ELF32Loader::Relocate(image);
+#else
+               return B_ERROR;
+#endif
 }
 
 
+#ifdef BOOT_SUPPORT_ELF32
 status_t
 boot_elf_resolve_symbol(preloaded_elf32_image* image, Elf32_Sym* symbol,
        Elf32_Addr* symbolAddress)
 {
        return ELF32Loader::Resolve(image, symbol, symbolAddress);
 }
+#endif
 
 
 #ifdef BOOT_SUPPORT_ELF64
diff --git a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp 
b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp
index 7222fb3..cb9da33 100644
--- a/src/system/boot/loader/file_systems/amiga_ffs/File.cpp
+++ b/src/system/boot/loader/file_systems/amiga_ffs/File.cpp
@@ -107,7 +107,7 @@ Stream::ReadAt(off_t offset, uint8 *buffer, size_t size)
 {
        if (offset < 0)
                return B_BAD_VALUE;
-       if (offset + size > fNode.Size())
+       if (offset + (off_t)size > fNode.Size())
                size = fNode.Size() - offset;
 
        ssize_t bytesLeft = (ssize_t)size;
diff --git a/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp 
b/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp
index 28cc48f..1df6e85 100644
--- a/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp
+++ b/src/system/boot/loader/file_systems/amiga_ffs/amiga_ffs.cpp
@@ -186,7 +186,7 @@ HashIterator::GetNext(int32 &block)
 
        fNode.SetTo(fData);
        if (fNode.ValidateCheckSum() != B_OK) {
-               dprintf("block at %ld bad checksum.\n", fBlock);
+               dprintf("block at %" B_PRId32 " bad checksum.\n", fBlock);
                return NULL;
        }
 
diff --git a/src/system/boot/loader/file_systems/bfs/Stream.cpp 
b/src/system/boot/loader/file_systems/bfs/Stream.cpp
index 47a20e4..d134e6f 100644
--- a/src/system/boot/loader/file_systems/bfs/Stream.cpp
+++ b/src/system/boot/loader/file_systems/bfs/Stream.cpp
@@ -306,7 +306,7 @@ Stream::ReadAt(off_t pos, uint8* buffer, size_t* _length)
 
        size_t length = *_length;
 
-       if (pos + length > data.Size())
+       if (pos + (off_t)length > data.Size())
                length = data.Size() - pos;
 
        block_run run;
diff --git a/src/system/boot/loader/file_systems/bfs/bfs.cpp 
b/src/system/boot/loader/file_systems/bfs/bfs.cpp
index f32e4ba..0fdae9b 100644
--- a/src/system/boot/loader/file_systems/bfs/bfs.cpp
+++ b/src/system/boot/loader/file_systems/bfs/bfs.cpp
@@ -112,7 +112,8 @@ Volume::ValidateBlockRun(block_run run)
                || run.Start() > (1UL << AllocationGroupShift())
                || run.length == 0
                || uint32(run.Length() + run.Start()) > (1UL << 
AllocationGroupShift())) {
-               dprintf("bfs: invalid run(%ld,%d,%d)\n", run.AllocationGroup(), 
run.Start(), run.Length());
+               dprintf("bfs: invalid run(%" B_PRId32 ",%d,%d)\n",
+                       run.AllocationGroup(), run.Start(), run.Length());
                return B_BAD_DATA;
        }
        return B_OK;
diff --git a/src/system/boot/loader/file_systems/fat/Stream.cpp 
b/src/system/boot/loader/file_systems/fat/Stream.cpp
index c8fc4ad..07874cf 100644
--- a/src/system/boot/loader/file_systems/fat/Stream.cpp
+++ b/src/system/boot/loader/file_systems/fat/Stream.cpp
@@ -257,7 +257,7 @@ Stream::ReadAt(off_t pos, void *_buffer, size_t *_length, 
off_t *diskOffset)
 
        size_t length = *_length;
 
-       if (pos + length > fSize)
+       if (pos + (off_t)length > fSize)
                length = fSize - pos;
 
        off_t num; // block number
diff --git a/src/system/boot/loader/file_systems/packagefs/packagefs.cpp 
b/src/system/boot/loader/file_systems/packagefs/packagefs.cpp
index 52be867..3b5dbb5 100644
--- a/src/system/boot/loader/file_systems/packagefs/packagefs.cpp
+++ b/src/system/boot/loader/file_systems/packagefs/packagefs.cpp
@@ -525,7 +525,7 @@ struct File : ::Node {
                off_t size = fFile->Size();
                if (pos < 0 || pos > size)
                        return B_BAD_VALUE;
-               if (pos + bufferSize > size)
+               if (pos + (off_t)bufferSize > size)
                        bufferSize = size - pos;
 
                if (bufferSize > 0) {
diff --git a/src/system/boot/loader/load_driver_settings.cpp 
b/src/system/boot/loader/load_driver_settings.cpp
index 5eabfd4..8a2241f 100644
--- a/src/system/boot/loader/load_driver_settings.cpp
+++ b/src/system/boot/loader/load_driver_settings.cpp
@@ -101,7 +101,7 @@ load_driver_settings(stage2_args* /*args*/, Directory* 
volume)
 
                        status_t status = load_driver_settings_file(settings, 
name);
                        if (status != B_OK)
-                               dprintf("Could not load \"%s\" error %ld\n", 
name, status);
+                               dprintf("Could not load \"%s\" error %" 
B_PRIx32 "\n", name, status);
                }
 
                settings->Close(cookie);
diff --git a/src/system/boot/loader/loader.cpp 
b/src/system/boot/loader/loader.cpp
index 9824ee5..2651468 100644
--- a/src/system/boot/loader/loader.cpp
+++ b/src/system/boot/loader/loader.cpp
@@ -123,7 +123,7 @@ load_kernel(stage2_args* args, BootVolume& volume)
        close(fd);
 
        if (status < B_OK) {
-               dprintf("loading kernel failed: %lx!\n", status);
+               dprintf("loading kernel failed: %" B_PRIx32 "!\n", status);
                return status;
        }
 
@@ -131,7 +131,7 @@ load_kernel(stage2_args* args, BootVolume& volume)
 
        status = elf_relocate_image(gKernelArgs.kernel_image);
        if (status < B_OK) {
-               dprintf("relocating kernel failed: %lx!\n", status);
+               dprintf("relocating kernel failed: %" B_PRIx32 "!\n", status);
                return status;
        }
 
@@ -163,7 +163,7 @@ load_modules_from(BootVolume& volume, const char* path)
 
                        status_t status = elf_load_image(modules, name);
                        if (status != B_OK)
-                               dprintf("Could not load \"%s\" error %ld\n", 
name, status);
+                               dprintf("Could not load \"%s\" error %" 
B_PRIx32 "\n", name, status);
                }
 
                modules->Close(cookie);
diff --git a/src/system/boot/loader/net/RemoteDisk.cpp 
b/src/system/boot/loader/net/RemoteDisk.cpp
index 6778f71..4cce254 100644
--- a/src/system/boot/loader/net/RemoteDisk.cpp
+++ b/src/system/boot/loader/net/RemoteDisk.cpp
@@ -169,7 +169,8 @@ RemoteDisk::GetName(char *nameBuffer, size_t bufferSize) 
const
        if (!nameBuffer)
                return B_BAD_VALUE;
 
-       snprintf(nameBuffer, bufferSize, "RemoteDisk:%ld.%ld.%ld.%ld:%hd",
+       snprintf(nameBuffer, bufferSize,
+               "RemoteDisk:%" B_PRIu32 ".%" B_PRIu32 ".%" B_PRIu32 ".%" 
B_PRIu32 ":%hd",
                (fServerAddress >> 24) & 0xff, (fServerAddress >> 16) & 0xff,
                (fServerAddress >> 8) & 0xff, fServerAddress & 0xff, 
fServerPort);
 
diff --git a/src/system/boot/loader/partitions.cpp 
b/src/system/boot/loader/partitions.cpp
index 21348ed..45c580b 100644
--- a/src/system/boot/loader/partitions.cpp
+++ b/src/system/boot/loader/partitions.cpp
@@ -168,7 +168,7 @@ Partition::ReadAt(void *cookie, off_t position, void 
*buffer, size_t bufferSize)
        if (position < 0)
                return B_BAD_VALUE;
 
-       if (position + bufferSize > this->size)
+       if (position + (off_t)bufferSize > this->size)
                bufferSize = this->size - position;
 
        ssize_t result = read_pos(fFD, this->offset + position, buffer, 
bufferSize);
@@ -185,7 +185,7 @@ Partition::WriteAt(void *cookie, off_t position, const void 
*buffer,
        if (position < 0)
                return B_BAD_VALUE;
 
-       if (position + bufferSize > this->size)
+       if (position + (off_t)bufferSize > this->size)
                bufferSize = this->size - position;
 
        ssize_t result = write_pos(fFD, this->offset + position, buffer,
@@ -321,7 +321,7 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
                if (priority < 0.0)
                        continue;
 
-               TRACE(("  priority: %ld\n", (int32)(priority * 1000)));
+               TRACE(("  priority: %" B_PRId32 "\n", (int32)(priority * 
1000)));
                if (priority <= bestPriority) {
                        // the disk system recognized the partition worse than 
the currently
                        // best one
@@ -379,9 +379,9 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
                Partition *child = NULL;
 
                while ((child = (Partition *)iterator.Next()) != NULL) {
-                       TRACE(("%p Partition::Scan(): scan child %p (start = 
%Ld, size "
-                               "= %Ld, parent = %p)!\n", this, child, 
child->offset,
-                               child->size, child->Parent()));
+                       TRACE(("%p Partition::Scan(): scan child %p (start = %" 
B_PRId64
+                               ", size = %" B_PRIdOFF ", parent = %p)!\n", 
this, child,
+                               child->offset, child->size, child->Parent()));
 
                        child->Scan(mountFileSystems);
 
@@ -466,7 +466,7 @@ add_partitions_for(Node *device, bool mountFileSystems, 
bool isBootDevice)
 
        status_t status = add_partitions_for(fd, mountFileSystems, 
isBootDevice);
        if (status < B_OK)
-               dprintf("add_partitions_for(%d) failed: %ld\n", fd, status);
+               dprintf("add_partitions_for(%d) failed: %" B_PRIx32 "\n", fd, 
status);
 
        close(fd);
        return B_OK;
@@ -505,7 +505,8 @@ get_child_partition(partition_id id, int32 index)
 {
        // TODO: do we really have to implement this?
        //      The intel partition module doesn't really need this for our 
mission...
-       TRACE(("get_child_partition(id = %lu, index = %ld)\n", id, index));
+       TRACE(("get_child_partition(id = %" B_PRId32 ", index = %" B_PRId32 
")\n",
+               id, index));
 
        return NULL;
 }
diff --git a/src/system/boot/loader/vfs.cpp b/src/system/boot/loader/vfs.cpp
index 8408970..9a06460 100644
--- a/src/system/boot/loader/vfs.cpp
+++ b/src/system/boot/loader/vfs.cpp
@@ -294,7 +294,9 @@ MemoryDisk::MemoryDisk(const uint8* data, size_t size, 
const char* name)
 ssize_t
 MemoryDisk::ReadAt(void* cookie, off_t pos, void* buffer, size_t bufferSize)
 {
-       if (pos >= fSize)
+       if (pos < 0)
+               return B_BAD_VALUE;
+       if ((size_t)pos >= fSize)
                return 0;
 
        if (pos + bufferSize > fSize)
diff --git a/src/system/boot/platform/efi/Jamfile 
b/src/system/boot/platform/efi/Jamfile
new file mode 100644
index 0000000..cb92534
--- /dev/null
+++ b/src/system/boot/platform/efi/Jamfile
@@ -0,0 +1,40 @@
+SubDir HAIKU_TOP src system boot platform efi ;
+
+UsePrivateHeaders [ FDirName kernel boot ] ;
+UseBuildFeatureHeaders gnuefi ;
+UseBuildFeatureHeaders gnuefi : headersProtocol ;
+UseBuildFeatureHeaders gnuefi : headersArch ;
+
+{
+       local defines = _BOOT_MODE GNU_EFI_USE_MS_ABI _BOOT_PLATFORM=efi ;
+       defines = [ FDefines $(defines) ] ;
+       SubDirCcFlags $(defines) ;
+       SubDirC++Flags $(defines) -fno-rtti ;
+}
+
+local efi_glue_src =
+       crt0-efi-x86_64.S
+       ;
+
+local platform_src =
+       relocation_func.cpp
+       start.c
+       ;
+
+Includes [ FGristFiles $(efi_glue_src) $(platform_src) ]
+       :
+       [ BuildFeatureAttribute gnuefi : headers ]
+       [ BuildFeatureAttribute gnuefi : headersProtocol ]
+       [ BuildFeatureAttribute gnuefi : headersArch ]
+       ;
+
+BootMergeObject boot_platform_efi.o :
+       $(efi_glue_src)
+       $(platform_src)
+       :
+       : boot_platform_generic.a
+       ;
+
+SEARCH on [ FGristFiles relocation_func.cpp ] = [ FDirName $(SUBDIR) arch 
$(TARGET_ARCH) ] ;
+LOCATE on [ FGristFiles $(efi_glue_src) ] = [ BuildFeatureAttribute gnuefi : 
libdir : path ] ;
+Depends [ FGristFiles $(efi_glue_src) ] : [ BuildFeatureAttribute gnuefi : 
libdir ] ;
diff --git a/src/system/boot/platform/efi/arch/x86_64/relocation_func.cpp 
b/src/system/boot/platform/efi/arch/x86_64/relocation_func.cpp
new file mode 100644
index 0000000..66918e6
--- /dev/null
+++ b/src/system/boot/platform/efi/arch/x86_64/relocation_func.cpp
@@ -0,0 +1,97 @@
+/* reloc_x86_64.c - position independent x86_64 ELF shared object relocator
+   Copyright (C) 1999 Hewlett-Packard Co.
+       Contributed by David Mosberger <davidm@xxxxxxxxxx>.
+   Copyright (C) 2005 Intel Co.
+       Contributed by Fenghua Yu <fenghua.yu@xxxxxxxxx>.
+
+    All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions
+    are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials
+      provided with the distribution.
+    * Neither the name of Hewlett-Packard Co. nor the names of its
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+    BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+    SUCH DAMAGE.
+*/
+
+#include <efi.h>
+
+#include <elf.h>
+
+extern "C" EFI_STATUS _relocate (long ldbase, Elf64_Dyn *dyn,
+                     EFI_HANDLE image __attribute__((__unused__)),
+                     EFI_SYSTEM_TABLE *systab __attribute__((__unused__)))
+{
+       long relsz = 0, relent = 0;
+       Elf64_Rel *rel = 0;
+       unsigned long *addr;
+       int i;
+
+       for (i = 0; dyn[i].d_tag != DT_NULL; ++i) {
+               switch (dyn[i].d_tag) {
+                       case DT_RELA:
+                               rel = (Elf64_Rel*)
+                                       ((unsigned long)dyn[i].d_un.d_ptr
+                                        + ldbase);
+                               break;
+
+                       case DT_RELASZ:
+                               relsz = dyn[i].d_un.d_val;
+                               break;
+
+                       case DT_RELAENT:
+                               relent = dyn[i].d_un.d_val;
+                               break;
+
+                       default:
+                               break;
+               }
+       }
+
+        if (!rel && relent == 0)
+                return EFI_SUCCESS;
+
+       if (!rel || relent == 0)
+               return EFI_LOAD_ERROR;
+
+       while (relsz > 0) {
+               /* apply the relocs */
+               switch (ELF64_R_TYPE (rel->r_info)) {
+                       case R_X86_64_NONE:
+                               break;
+
+                       case R_X86_64_RELATIVE:
+                               addr = (unsigned long *)
+                                       (ldbase + rel->r_offset);
+                               *addr += ldbase;
+                               break;
+
+                       default:
+                               break;
+               }
+               rel = (Elf64_Rel*) ((char *) rel + relent);
+               relsz -= relent;
+       }
+       return EFI_SUCCESS;
+}
diff --git a/src/system/boot/platform/efi/start.c 
b/src/system/boot/platform/efi/start.c
new file mode 100644
index 0000000..fe36d5c
--- /dev/null
+++ b/src/system/boot/platform/efi/start.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2011, Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *    * Redistributions of source code must retain the above copyright
+ *      notice, this list of conditions and the following disclaimer.
+ *    * Redistributions in binary form must reproduce the above copyright
+ *      notice, this list of conditions and the following disclaimer
+ *      in the documentation and/or other materials provided with the
+ *      distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "efibind.h"
+#include "efidef.h"
+#include "efidevp.h"
+#include "eficon.h"
+#include "efiprot.h"
+#include "efiapi.h"
+#include "efierr.h"
+
+static const CHAR16 *exampleText = L"Example EFI Application. Press any key!";
+
+EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable);
+
+/**
+ * efi_main - The entry point for the EFI application
+ * @image: firmware-allocated handle that identifies the image
+ * @SystemTable: EFI system table
+ */
+EFI_STATUS
+efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
+{
+   UINTN index;
+   EFI_EVENT event = systemTable->ConIn->WaitForKey;
+
+   SIMPLE_TEXT_OUTPUT_INTERFACE *conOut = systemTable->ConOut;
+   conOut->OutputString(conOut, (CHAR16*)exampleText);
+
+   systemTable->BootServices->WaitForEvent(1, &event, &index);
+
+   return EFI_SUCCESS;
+}
diff --git a/src/system/kernel/arch/x86/arch_elf.cpp 
b/src/system/kernel/arch/x86/arch_elf.cpp
index eef0c8c..204eb52 100644
--- a/src/system/kernel/arch/x86/arch_elf.cpp
+++ b/src/system/kernel/arch/x86/arch_elf.cpp
@@ -37,7 +37,7 @@ is_in_image(struct elf_image_info *image, addr_t address)
 #endif // !_BOOT_MODE
 
 
-#if !defined(__x86_64__) || defined(_BOOT_MODE)
+#if !defined(__x86_64__) || (defined(_BOOT_MODE) && _BOOT_PLATFORM != efi)
 
 
 #ifdef TRACE_ARCH_ELF
@@ -183,7 +183,7 @@ arch_elf_relocate_rela(struct elf_image_info *image,
 }
 
 
-#endif // !__x86_64__ || _BOOT_MODE
+#endif // !__x86_64__ || (_BOOT_MODE && _BOOT_PLATFORM != efi)
 
 
 #if defined(__x86_64__) || defined(_BOOT_MODE)
diff --git a/src/system/ldscripts/x86_64/boot_loader_efi.ld 
b/src/system/ldscripts/x86_64/boot_loader_efi.ld
new file mode 100644
index 0000000..88f4b25
--- /dev/null
+++ b/src/system/ldscripts/x86_64/boot_loader_efi.ld
@@ -0,0 +1,79 @@
+/* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below & ctor 
support - KEEP IN SYNC */
+OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
+OUTPUT_ARCH(i386:x86-64)
+ENTRY(_start)
+SECTIONS
+{
+  . = 0;
+  ImageBase = .;
+  .hash : { *(.hash) } /* this MUST come first! */
+  . = ALIGN(4096);
+  .eh_frame :
+  {
+    *(.eh_frame)
+  }
+  . = ALIGN(4096);
+  .text :
+  {
+   _text = .;
+   *(.text)
+   *(.text.*)
+   *(.gnu.linkonce.t.*)
+   . = ALIGN(16);
+  }
+  _etext = .;
+  _text_size = . - _text;
+  . = ALIGN(4096);
+  .reloc :
+  {
+   *(.reloc)
+  }
+  . = ALIGN(4096);
+  .data :
+  {
+   . = ALIGN(0x4);
+   __ctor_list = .;
+   *(.ctors)
+   __ctor_end = .;
+   _data = .;
+   *(.rodata*)
+   *(.got.plt)
+   *(.got)
+   *(.data*)
+   *(.sdata)
+   /* the EFI loader doesn't seem to like a .bss section, so we stick
+      it all into .data: */
+   *(.sbss)
+   *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+   *(.rel.local)
+  }
+  .note.gnu.build-id : { *(.note.gnu.build-id) }
+
+  _edata = .;
+  _data_size = . - _etext;
+  . = ALIGN(4096);
+  .dynamic  : { *(.dynamic) }
+  . = ALIGN(4096);
+  .rela :
+  {
+    *(.rela.data*)
+    *(.rela.ctors)
+    *(.rela.got)
+    *(.rela.stab)
+  }
+  . = ALIGN(4096);
+  .dynsym   : { *(.dynsym) }
+  . = ALIGN(4096);
+  .dynstr   : { *(.dynstr) }
+  . = ALIGN(4096);
+  .ignored.reloc :
+  {
+    *(.rela.reloc)
+    *(.eh_frame)
+    *(.note.GNU-stack)
+  }
+  .comment 0 : { *(.comment) }
+}

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

Commit:      bd0604764ee1b12fde65c90eeb8621e68d0dd251
URL:         http://cgit.haiku-os.org/haiku/commit/?id=bd0604764ee1
Author:      Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date:        Wed Nov  6 20:12:36 2013 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Fri Sep  2 07:02:32 2016 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.

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

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 0c824c4..c0c35a1 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -420,6 +420,9 @@ rule KernelArchitectureSetup architecture
                HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC 
-fshort-wchar -mno-red-zone
                        -maccumulate-outgoing-args -Wno-error=unused-variable ;
                HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib 
-znocombreloc -nostartfiles ;
+       } else {
+               HAIKU_BOOT_CCFLAGS += -fno-pic ;
+               HAIKU_BOOT_C++FLAGS += -fno-pic ;
        }
 
        # warning flags
diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile
index c8099df..72bb340 100644
--- a/src/system/boot/Jamfile
+++ b/src/system/boot/Jamfile
@@ -47,7 +47,6 @@ BootMergeObject boot_libroot.o :
        strrchr.c
        strtol.c
        $(extraSources)
-       : -fno-pic
 ;
 
 AddResources haiku_loader : boot_loader.rdef ;
diff --git a/src/system/boot/arch/arm/Jamfile b/src/system/boot/arch/arm/Jamfile
index bea3428..c037767 100644
--- a/src/system/boot/arch/arm/Jamfile
+++ b/src/system/boot/arch/arm/Jamfile
@@ -49,7 +49,7 @@ BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
        $(kernelDebugSources)
 
        $(librootArchObjects)
-       : -fno-pic
+       :
        :
        $(kernelLibArchObjects)
 ;
diff --git a/src/system/boot/arch/m68k/Jamfile 
b/src/system/boot/arch/m68k/Jamfile
index 4e3359b..e6e5b94 100644
--- a/src/system/boot/arch/m68k/Jamfile
+++ b/src/system/boot/arch/m68k/Jamfile
@@ -16,24 +16,24 @@ local kernelLibArchObjects =
 BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
        arch_elf.cpp
        $(librootArchObjects)
-       : -fno-pic
+       :
        :
        $(kernelLibArchObjects)
 ;
 
 BootMergeObject boot_arch_m68k_030.o :
        mmu_030.cpp
-       : -fno-pic -Wno-unused -mcpu=68030
+       : -Wno-unused -mcpu=68030
 ;
 
 BootMergeObject boot_arch_m68k_040.o :
        mmu_040.cpp
-       : -fno-pic -Wno-unused -mcpu=68040 -Wa,-m68040
+       : -Wno-unused -mcpu=68040 -Wa,-m68040
 ;
 
 BootMergeObject boot_arch_m68k_060.o :
        mmu_060.cpp
-       : -fno-pic -Wno-unused -mcpu=68060
+       : -Wno-unused -mcpu=68060
 ;
 
 SEARCH on [ FGristFiles arch_elf.cpp ]
diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile
index a44793d..2884fe6 100644
--- a/src/system/boot/loader/Jamfile
+++ b/src/system/boot/loader/Jamfile
@@ -90,8 +90,6 @@ BootStaticLibrary boot_loader :
 
        DataIO.cpp
        Referenceable.cpp
-
-       : -fno-pic
        ;
 
 # The partition support is built in an extra static library
@@ -110,7 +108,6 @@ BootStaticLibrary boot_partitions :
        intel.cpp
        PartitionMap.cpp
        PartitionMapParser.cpp
-       : -fno-pic
        ;
 
 # Tell Jam where to find the utility sources
diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile 
b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
index 1b2d8bb..ce7ec5e 100644
--- a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
+++ b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
@@ -13,5 +13,4 @@ BootStaticLibrary boot_amiga_ffs :
        Volume.cpp
        Directory.cpp
        File.cpp
-       : -fno-pic
        ;
diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile 
b/src/system/boot/loader/file_systems/bfs/Jamfile
index 25827bd..bf31e75 100644
--- a/src/system/boot/loader/file_systems/bfs/Jamfile
+++ b/src/system/boot/loader/file_systems/bfs/Jamfile
@@ -18,7 +18,6 @@ BootStaticLibrary boot_bfs :
        Stream.cpp
        BPlusTree.cpp
        QueryParserUtils.cpp
-       : -fno-pic
        ;
 
 SEARCH on [ FGristFiles BPlusTree.cpp ]
diff --git a/src/system/boot/loader/file_systems/fat/Jamfile 
b/src/system/boot/loader/file_systems/fat/Jamfile
index 52de886..ec1ea39 100644
--- a/src/system/boot/loader/file_systems/fat/Jamfile
+++ b/src/system/boot/loader/file_systems/fat/Jamfile
@@ -20,5 +20,4 @@ BootStaticLibrary boot_fatfs :
        Directory.cpp
        File.cpp
        Stream.cpp
-       : -fno-pic
        ;
diff --git a/src/system/boot/loader/file_systems/hfs_plus/Jamfile 
b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
index 13bbb37..9617ab0 100644
--- a/src/system/boot/loader/file_systems/hfs_plus/Jamfile
+++ b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
@@ -8,5 +8,4 @@ SubDirC++Flags -fno-rtti ;
 
 BootStaticLibrary boot_hfs_plus :
        hfs_plus.cpp
-       : -fno-pic
        ;
diff --git a/src/system/boot/loader/file_systems/packagefs/Jamfile 
b/src/system/boot/loader/file_systems/packagefs/Jamfile
index 8ef09b5..d1953b1 100644
--- a/src/system/boot/loader/file_systems/packagefs/Jamfile
+++ b/src/system/boot/loader/file_systems/packagefs/Jamfile
@@ -46,8 +46,6 @@ BootStaticLibrary boot_packagefs :
        # support kit
        CompressionAlgorithm.cpp
        ZlibCompressionAlgorithm.cpp
-
-       : -fno-pic
 ;
 
 Includes [ FGristFiles ZlibCompressionAlgorithm.cpp ]
diff --git a/src/system/boot/loader/file_systems/tarfs/Jamfile 
b/src/system/boot/loader/file_systems/tarfs/Jamfile
index 8d1c40b..c0dda86 100644
--- a/src/system/boot/loader/file_systems/tarfs/Jamfile
+++ b/src/system/boot/loader/file_systems/tarfs/Jamfile
@@ -29,7 +29,6 @@ Depends [ FGristFiles $(zlibSources) ]
 
 BootStaticLibrary boot_zlib :
        $(zlibSources)
-       : -fno-pic
        ;
 
 
@@ -41,5 +40,4 @@ Includes [ FGristFiles tarfs.cpp ] : [ BuildFeatureAttribute 
zlib : sources ] ;
 
 BootStaticLibrary boot_tarfs :
        tarfs.cpp
-       : -fno-pic
        ;
diff --git a/src/system/boot/loader/net/Jamfile 
b/src/system/boot/loader/net/Jamfile
index 5bb8291..a06a45a 100644
--- a/src/system/boot/loader/net/Jamfile
+++ b/src/system/boot/loader/net/Jamfile
@@ -23,6 +23,4 @@ BootStaticLibrary boot_net :
        UDP.cpp
        $(tcp)
        $(iscsi)
-
-       : -fno-pic
 ;
diff --git a/src/system/boot/platform/amiga_m68k/Jamfile 
b/src/system/boot/platform/amiga_m68k/Jamfile
index b867ef7..e923167 100644
--- a/src/system/boot/platform/amiga_m68k/Jamfile
+++ b/src/system/boot/platform/amiga_m68k/Jamfile
@@ -49,7 +49,7 @@ BootMergeObject boot_platform_amiga_m68k_other.o :
        #decode_edid.c
        #dump_edid.c
 
-       : -fno-pic #-Wa,--pcrel
+       : #-Wa,--pcrel
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/atari_m68k/Jamfile 
b/src/system/boot/platform/atari_m68k/Jamfile
index e8eb760..0332881 100644
--- a/src/system/boot/platform/atari_m68k/Jamfile
+++ b/src/system/boot/platform/atari_m68k/Jamfile
@@ -54,7 +54,7 @@ BootMergeObject boot_platform_atari_m68k_other.o :
        #decode_edid.c
        #dump_edid.c
 
-       : -fno-pic #-Wa,--pcrel
+       : #-Wa,--pcrel
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/bios_ia32/Jamfile 
b/src/system/boot/platform/bios_ia32/Jamfile
index 934ddc0..3f573c0 100644
--- a/src/system/boot/platform/bios_ia32/Jamfile
+++ b/src/system/boot/platform/bios_ia32/Jamfile
@@ -47,7 +47,7 @@ BootMergeObject boot_platform_bios_ia32.o :
        decode_edid.c
        dump_edid.c
 
-       : -fno-pic
+       :
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/generic/Jamfile 
b/src/system/boot/platform/generic/Jamfile
index 0ffd7b2..758d9a8 100644
--- a/src/system/boot/platform/generic/Jamfile
+++ b/src/system/boot/platform/generic/Jamfile
@@ -9,7 +9,6 @@ BootStaticLibrary boot_platform_generic :
        text_menu.cpp
        video_blit.cpp
        video_splash.cpp
-       : -fno-pic
 ;
 
 Includes [ FGristFiles video_splash.cpp ] 
diff --git a/src/system/boot/platform/pxe_ia32/Jamfile 
b/src/system/boot/platform/pxe_ia32/Jamfile
index 7adb307..74d51b8 100644
--- a/src/system/boot/platform/pxe_ia32/Jamfile
+++ b/src/system/boot/platform/pxe_ia32/Jamfile
@@ -57,7 +57,7 @@ BootMergeObject boot_platform_pxe_ia32.o :
        $(bios_ia32_src)
        $(bios_ia32_edid_src)
 
-       : -fno-pic
+       :
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/raspberrypi_arm/Jamfile 
b/src/system/boot/platform/raspberrypi_arm/Jamfile
index bd6a8ab..d9a102d 100644
--- a/src/system/boot/platform/raspberrypi_arm/Jamfile
+++ b/src/system/boot/platform/raspberrypi_arm/Jamfile
@@ -40,7 +40,7 @@ BootMergeObject boot_platform_raspberrypi_arm.o :
        arch_framebuffer_bcm2835.cpp
 
        $(genericPlatformSources)
-       : -fno-pic
+       :
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/u-boot/Jamfile 
b/src/system/boot/platform/u-boot/Jamfile
index a2e84e1..52aed32 100644
--- a/src/system/boot/platform/u-boot/Jamfile
+++ b/src/system/boot/platform/u-boot/Jamfile
@@ -59,7 +59,7 @@ BootMergeObject boot_platform_u-boot_common.o :
        $(libFDTSources)
 
 
-       : -fno-pic
+       :
        : boot_platform_generic.a
 ;
 
diff --git a/src/system/boot/platform/u-boot/arch/arm/Jamfile 
b/src/system/boot/platform/u-boot/arch/arm/Jamfile
index 7463dc9..8a7939a 100644
--- a/src/system/boot/platform/u-boot/arch/arm/Jamfile
+++ b/src/system/boot/platform/u-boot/arch/arm/Jamfile
@@ -16,7 +16,6 @@ BootMergeObject boot_platform_u-boot_arm.o :
        shell.S
 
        arch_mailbox.cpp
-       : -fno-pic
 ;
 
 #SEARCH on [ FGristFiles arch_cpu_asm.S ]
diff --git a/src/system/boot/platform/u-boot/arch/ppc/Jamfile 
b/src/system/boot/platform/u-boot/arch/ppc/Jamfile
index 639e56f..d7dbefb 100644
--- a/src/system/boot/platform/u-boot/arch/ppc/Jamfile
+++ b/src/system/boot/platform/u-boot/arch/ppc/Jamfile
@@ -12,7 +12,7 @@ SubDirC++Flags -fno-rtti ;
 
 BootMergeObject boot_platform_u-boot_ppc_amcc440.o :
        arch_mmu_amcc440.cpp
-       : -fno-pic -mcpu=440
+       : -mcpu=440
 ;
 
 BootMergeObject boot_platform_u-boot_ppc.o :
@@ -24,7 +24,7 @@ BootMergeObject boot_platform_u-boot_ppc.o :
        arch_start_kernel.S
        arch_cpu.cpp
        #mmu.cpp
-       : -fno-pic
+       :
        : boot_platform_u-boot_ppc_amcc440.o
 ;
 

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

Commit:      735f1daee956b15d1e2e8a80d54463fd2aba4a61
URL:         http://cgit.haiku-os.org/haiku/commit/?id=735f1daee956
Author:      Fredrik Holmqvist <fredrik.holmqvist@xxxxxxxxx>
Date:        Sat Nov 30 20:35:06 2013 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Fri Sep  2 07:02:32 2016 UTC

EFI: Implement console code.

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

diff --git a/src/system/boot/platform/efi/Jamfile 
b/src/system/boot/platform/efi/Jamfile
index cb92534..c125fab 100644
--- a/src/system/boot/platform/efi/Jamfile
+++ b/src/system/boot/platform/efi/Jamfile
@@ -18,7 +18,8 @@ local efi_glue_src =
 
 local platform_src =
        relocation_func.cpp
-       start.c
+       start.cpp
+       console.cpp
        ;
 
 Includes [ FGristFiles $(efi_glue_src) $(platform_src) ]
diff --git a/src/system/boot/platform/efi/console.cpp 
b/src/system/boot/platform/efi/console.cpp
new file mode 100644
index 0000000..47f1cd4
--- /dev/null
+++ b/src/system/boot/platform/efi/console.cpp
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2014-2016 Haiku, Inc. All rights reserved.
+ * Copyright 2013 Fredrik Holmqvist, fredrik.holmqvist@xxxxxxxxx. All rights 
reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include "console.h"
+
+#include <string.h>
+
+#include <SupportDefs.h>
+
+#include <boot/stage2.h>
+#include <boot/platform.h>
+#include <util/kernel_cpp.h>
+
+#include "efi_platform.h"
+
+
+class Console : public ConsoleNode {
+       public:
+               Console();
+
+               virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, 
size_t bufferSize);
+               virtual ssize_t WriteAt(void *cookie, off_t pos, const void 
*buffer, size_t bufferSize);
+};
+
+
+static uint32 sScreenWidth;
+static uint32 sScreenHeight;
+static uint32 sScreenMode;
+static Console sInput, sOutput;
+FILE *stdin, *stdout, *stderr;
+
+
+//     #pragma mark -
+
+
+Console::Console()
+       : ConsoleNode()
+{
+}
+
+
+ssize_t
+Console::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize)
+{
+       return B_ERROR;
+}
+
+
+ssize_t
+Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t 
bufferSize)
+{
+       const char *string = (const char *)buffer;
+       CHAR16 ucsBuffer[bufferSize + 3];
+       uint32 j = 0;
+
+       for (uint32 i = 0; i < bufferSize; i++) {
+               switch (string[i]) {
+                       case '\n': {
+                               ucsBuffer[j++] = '\r';
+                               ucsBuffer[j++] = '\n';
+                       } //fallthrough
+                       case 0 : {
+                               //Not sure if we should keep going or abort for 
0.
+                               //Keep going was easy anyway.
+                               ucsBuffer[j] = 0;
+                               
kSystemTable->ConOut->OutputString(kSystemTable->ConOut, ucsBuffer);
+                               j = 0;
+                               continue;
+                       }
+                       default:
+                               ucsBuffer[j++] = (CHAR16) string[i];
+               }
+       }
+
+       if (j > 0) {
+               ucsBuffer[j] = 0;
+               kSystemTable->ConOut->OutputString(kSystemTable->ConOut, 
ucsBuffer);
+       }
+       return bufferSize;
+}
+
+
+//     #pragma mark -
+
+
+void
+console_clear_screen(void)
+{
+       kSystemTable->ConOut->ClearScreen(kSystemTable->ConOut);
+}
+
+
+int32
+console_width(void)
+{
+       return sScreenWidth;
+}
+
+
+int32
+console_height(void)
+{
+       return sScreenHeight;
+}
+
+
+void
+console_set_cursor(int32 x, int32 y)
+{
+       kSystemTable->ConOut->SetCursorPosition(kSystemTable->ConOut, x, y);
+}
+
+
+void
+console_show_cursor(void)
+{
+       kSystemTable->ConOut->EnableCursor(kSystemTable->ConOut, true);
+}
+
+
+void
+console_hide_cursor(void)
+{
+       kSystemTable->ConOut->EnableCursor(kSystemTable->ConOut, false);
+}
+
+
+void
+console_set_color(int32 foreground, int32 background)
+{
+       kSystemTable->ConOut->SetAttribute(kSystemTable->ConOut,
+               EFI_TEXT_ATTR((foreground & 0xf), (background & 0xf)));
+}
+
+
+int
+console_wait_for_key(void)
+{
+       UINTN index;
+       EFI_STATUS status;
+       EFI_INPUT_KEY key;
+       EFI_EVENT event = kSystemTable->ConIn->WaitForKey;
+
+       do {
+               kBootServices->WaitForEvent(1, &event, &index);
+               status = 
kSystemTable->ConIn->ReadKeyStroke(kSystemTable->ConIn, &key);
+       } while (status == EFI_NOT_READY);
+
+       if (key.UnicodeChar > 0)
+               return (int) key.UnicodeChar;
+
+       switch (key.ScanCode) {
+               case SCAN_UP:
+                       return TEXT_CONSOLE_KEY_UP;
+               case SCAN_DOWN:
+                       return TEXT_CONSOLE_KEY_DOWN;
+               case SCAN_LEFT:
+                       return TEXT_CONSOLE_KEY_LEFT;
+               case SCAN_RIGHT:
+                       return TEXT_CONSOLE_KEY_RIGHT;
+               case SCAN_PAGE_UP:
+                       return TEXT_CONSOLE_KEY_PAGE_UP;
+               case SCAN_PAGE_DOWN:
+                       return TEXT_CONSOLE_KEY_PAGE_DOWN;
+               case SCAN_HOME:
+                       return TEXT_CONSOLE_KEY_HOME;
+               case SCAN_END:
+                       return TEXT_CONSOLE_KEY_END;
+       }
+       return 0;
+}
+
+
+static void update_screen_size(void)
+{
+       UINTN width, height;
+       UINTN area = 0;
+       SIMPLE_TEXT_OUTPUT_INTERFACE *ConOut = kSystemTable->ConOut;
+
+       for (int mode = 0; mode < ConOut->Mode->MaxMode; ++mode) {
+               if (ConOut->QueryMode(ConOut, mode, &width, &height) == 
EFI_SUCCESS) {
+                       if (width * height > area) {
+                               sScreenWidth = width;
+                               sScreenHeight = height;
+                               sScreenMode = mode;
+                       }
+               }
+       }
+
+       ConOut->SetMode(ConOut, sScreenMode);
+}
+
+
+status_t
+console_init(void)
+{
+       update_screen_size();
+       console_hide_cursor();
+       console_clear_screen();
+
+       // enable stdio functionality
+       stdin = (FILE *)&sInput;
+       stdout = stderr = (FILE *)&sOutput;
+
+       return B_OK;
+}
+
+
+extern "C" void
+platform_switch_to_text_mode(void)
+{
+       kSystemTable->ConOut->Reset(kSystemTable->ConOut, false);
+       kSystemTable->ConOut->SetMode(kSystemTable->ConOut, sScreenMode);
+}
diff --git a/src/system/boot/platform/efi/console.h 
b/src/system/boot/platform/efi/console.h
new file mode 100644
index 0000000..1594213
--- /dev/null
+++ b/src/system/boot/platform/efi/console.h
@@ -0,0 +1,15 @@
+/*
+** Copyright 2004, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. All rights reserved.
+** Distributed under the terms of the Haiku License.
+*/
+#ifndef CONSOLE_H
+#define CONSOLE_H
+
+
+#include <boot/platform/generic/text_console.h>
+
+
+extern "C" status_t console_init(void);
+
+
+#endif /* CONSOLE_H */
diff --git a/src/system/boot/platform/efi/efi_platform.h 
b/src/system/boot/platform/efi/efi_platform.h
new file mode 100644
index 0000000..b9670e9
--- /dev/null
+++ b/src/system/boot/platform/efi/efi_platform.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2013, Fredrik Homlqvist, fredrik.holmqvist@xxxxxxxxx.
+ * All rights reserved. Distributed under the terms of the MIT License.
+ */
+#ifndef EFI_PLATFORM_H
+#define EFI_PLATFORM_H
+
+
+#include "efibind.h"
+#include "efidef.h"
+#include "efidevp.h"
+#include "efiprot.h"
+#include "eficon.h"
+#include "efierr.h"
+#include "efiapi.h"
+
+
+extern const EFI_SYSTEM_TABLE          *kSystemTable;
+extern const EFI_BOOT_SERVICES         *kBootServices;
+extern const EFI_RUNTIME_SERVICES      *kRuntimeServices;
+
+
+#endif /* EFI_PLATFORM_H */
diff --git a/src/system/boot/platform/efi/start.c 
b/src/system/boot/platform/efi/start.c
deleted file mode 100644
index fe36d5c..0000000
--- a/src/system/boot/platform/efi/start.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011, Intel Corporation
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *    * Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.
- *    * Redistributions in binary form must reproduce the above copyright
- *      notice, this list of conditions and the following disclaimer
- *      in the documentation and/or other materials provided with the
- *      distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "efibind.h"
-#include "efidef.h"
-#include "efidevp.h"
-#include "eficon.h"
-#include "efiprot.h"
-#include "efiapi.h"
-#include "efierr.h"
-
-static const CHAR16 *exampleText = L"Example EFI Application. Press any key!";
-
-EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable);
-
-/**
- * efi_main - The entry point for the EFI application
- * @image: firmware-allocated handle that identifies the image
- * @SystemTable: EFI system table
- */
-EFI_STATUS
-efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
-{
-   UINTN index;
-   EFI_EVENT event = systemTable->ConIn->WaitForKey;
-
-   SIMPLE_TEXT_OUTPUT_INTERFACE *conOut = systemTable->ConOut;
-   conOut->OutputString(conOut, (CHAR16*)exampleText);
-
-   systemTable->BootServices->WaitForEvent(1, &event, &index);
-
-   return EFI_SUCCESS;
-}
diff --git a/src/system/boot/platform/efi/start.cpp 
b/src/system/boot/platform/efi/start.cpp
new file mode 100644
index 0000000..09ddbf0
--- /dev/null
+++ b/src/system/boot/platform/efi/start.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2014-2016 Haiku, Inc. All rights reserved.
+ * Copyright 2013 Fredrik Holmqvist, fredrik.holmqvist@xxxxxxxxx. All rights 
reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <stdio.h>
+
+#include "console.h"
+#include "efi_platform.h"
+
+
+extern void (*__ctor_list)(void);
+extern void (*__ctor_end)(void);
+
+
+const EFI_SYSTEM_TABLE         *kSystemTable;
+const EFI_BOOT_SERVICES                *kBootServices;
+const EFI_RUNTIME_SERVICES     *kRuntimeServices;
+
+
+static void
+call_ctors(void)
+{
+       void (**f)(void);
+
+       for (f = &__ctor_list; f < &__ctor_end; f++)
+               (**f)();
+}
+
+
+/**
+ * efi_main - The entry point for the EFI application
+ * @image: firmware-allocated handle that identifies the image
+ * @systemTable: EFI system table
+ */
+extern "C" EFI_STATUS
+efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
+{
+       kSystemTable = systemTable;
+       kBootServices = systemTable->BootServices;
+       kRuntimeServices = systemTable->RuntimeServices;
+
+       call_ctors();
+
+       console_init();
+
+       printf("Hello from EFI Loader for Haiku!\nPress any key to 
continue...\n");
+       console_wait_for_key();
+
+       return EFI_SUCCESS;
+}

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

Commit:      495efc382b3cfb100fba1a6e60b6451e5a482ae1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=495efc382b3c
Author:      François Revol <revol@xxxxxxx>
Date:        Sat Dec  7 06:47:19 2013 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Fri Sep  2 07:02:33 2016 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>

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

diff --git a/headers/private/kernel/boot/partitions.h 
b/headers/private/kernel/boot/partitions.h
index 24ef169..908d007 100644
--- a/headers/private/kernel/boot/partitions.h
+++ b/headers/private/kernel/boot/partitions.h
@@ -30,6 +30,8 @@ class Partition : public Node, public partition_data {
                status_t Mount(Directory **_fileSystem = NULL, bool 
isBootDevice = false);
                status_t Scan(bool mountFileSystems, bool isBootDevice = false);
 
+               static Partition *Lookup(partition_id id, NodeList *list = 
NULL);
+
                void SetParent(Partition *parent);
                Partition *Parent() const;
 
diff --git a/src/system/boot/loader/partitions.cpp 
b/src/system/boot/loader/partitions.cpp
index 45c580b..cfcaaa7 100644
--- a/src/system/boot/loader/partitions.cpp
+++ b/src/system/boot/loader/partitions.cpp
@@ -16,7 +16,6 @@
 #include <boot/stdio.h>
 #include <boot/vfs.h>
 #include <ddm_modules.h>
-#include <HashMap.h>
 
 #include "RootFileSystem.h"
 
@@ -101,7 +100,6 @@ private:
 
 
 static int32 sIdCounter = 0;
-static HashMap<HashKey32<int32>, Partition*> sIdPartitionMap;
 
 
 //     #pragma mark -
@@ -118,7 +116,6 @@ Partition::Partition(int fd)
        memset((partition_data *)this, 0, sizeof(partition_data));
 
        id = atomic_add(&sIdCounter, 1);
-       sIdPartitionMap.Put(id, this);
 
        // it's safe to close the file
        fFD = dup(fd);
@@ -139,11 +136,33 @@ Partition::~Partition()
                        child->SetParent(NULL);
        }
 
-       sIdPartitionMap.Remove(id);
        close(fFD);
 }
 
 
+Partition *
+Partition::Lookup(partition_id id, NodeList *list)
+{
+       Partition *p;
+
+       if (list == NULL)
+               list = &gPartitions;
+
+       NodeIterator iterator = list->GetIterator();
+
+       while ((p = (Partition *)iterator.Next()) != NULL) {
+               if (p->id == id)
+                       return p;
+               if (!p->fChildren.IsEmpty()) {
+                       Partition *c = Lookup(id, &p->fChildren);
+                       if (c)
+                               return c;
+               }
+       }
+       return NULL;
+}
+
+
 void
 Partition::SetParent(Partition *parent)
 {
@@ -379,7 +398,7 @@ Partition::Scan(bool mountFileSystems, bool isBootDevice)
                Partition *child = NULL;
 
                while ((child = (Partition *)iterator.Next()) != NULL) {
-                       TRACE(("%p Partition::Scan(): scan child %p (start = %" 
B_PRId64
+                       TRACE(("%p Partition::Scan(): scan child %p (start = %" 
B_PRIdOFF
                                ", size = %" B_PRIdOFF ", parent = %p)!\n", 
this, child,
                                child->offset, child->size, child->Parent()));
 
@@ -439,16 +458,19 @@ add_partitions_for(int fd, bool mountFileSystems, bool 
isBootDevice)
        partition->block_size = 512;
        partition->size = partition->Size();
 
-       // add this partition to the list of partitions, if it contains
-       // or might contain a file system
+       // add this partition to the list of partitions
+       // temporarily for Lookup() to work
+       gPartitions.Add(partition);
+
+       // keep it, if it contains or might contain a file system
        if ((partition->Scan(mountFileSystems, isBootDevice) == B_OK
                        && partition->IsFileSystem())
                || (!partition->IsPartitioningSystem() && !mountFileSystems)) {
-               gPartitions.Add(partition);
                return B_OK;
        }
 
        // if not, we no longer need the partition
+       gPartitions.Remove(partition);
        delete partition;
        return B_OK;
 }
@@ -477,7 +499,7 @@ partition_data *
 create_child_partition(partition_id id, int32 index, off_t offset, off_t size,
        partition_id childID)
 {
-       Partition *partition = sIdPartitionMap.Get(id);
+       Partition *partition = Partition::Lookup(id);
        if (partition == NULL) {
                dprintf("creating partition failed: could not find 
partition.\n");
                return NULL;
@@ -515,7 +537,7 @@ get_child_partition(partition_id id, int32 index)
 partition_data *
 get_parent_partition(partition_id id)
 {
-       Partition *partition = sIdPartitionMap.Get(id);
+       Partition *partition = Partition::Lookup(id);
        if (partition == NULL) {
                dprintf("could not find parent partition.\n");
                return NULL;

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

Commit:      e2e1558a02e410c6c54b62014b2df6096a6f7949
URL:         http://cgit.haiku-os.org/haiku/commit/?id=e2e1558a02e4
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Thu Apr 21 00:37:24 2016 UTC

EFI: stub functions so we can call loader's main() function.

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

diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index c0c35a1..6e8564d 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -419,7 +419,7 @@ rule KernelArchitectureSetup architecture
                        -maccumulate-outgoing-args -Wno-error=unused-variable ;
                HAIKU_BOOT_C++FLAGS += -fpic -fno-stack-protector -fPIC 
-fshort-wchar -mno-red-zone
                        -maccumulate-outgoing-args -Wno-error=unused-variable ;
-               HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib 
-znocombreloc -nostartfiles ;
+               HAIKU_BOOT_LDFLAGS = -Bstatic -Bsymbolic -shared -nostdlib 
-znocombreloc -nostartfiles -no-undefined ;
        } else {
                HAIKU_BOOT_CCFLAGS += -fno-pic ;
                HAIKU_BOOT_C++FLAGS += -fno-pic ;
diff --git a/src/system/boot/platform/efi/Jamfile 
b/src/system/boot/platform/efi/Jamfile
index c125fab..38ee97d 100644
--- a/src/system/boot/platform/efi/Jamfile
+++ b/src/system/boot/platform/efi/Jamfile
@@ -20,6 +20,12 @@ local platform_src =
        relocation_func.cpp
        start.cpp
        console.cpp
+       video.cpp
+       debug.cpp
+       mmu.cpp
+       heap.cpp
+       menu.cpp
+       devices.cpp
        ;
 
 Includes [ FGristFiles $(efi_glue_src) $(platform_src) ]
@@ -36,6 +42,9 @@ BootMergeObject boot_platform_efi.o :
        : boot_platform_generic.a
        ;
 
-SEARCH on [ FGristFiles relocation_func.cpp ] = [ FDirName $(SUBDIR) arch 
$(TARGET_ARCH) ] ;
-LOCATE on [ FGristFiles $(efi_glue_src) ] = [ BuildFeatureAttribute gnuefi : 
libdir : path ] ;
-Depends [ FGristFiles $(efi_glue_src) ] : [ BuildFeatureAttribute gnuefi : 
libdir ] ;
+SEARCH on [ FGristFiles relocation_func.cpp ]
+       = [ FDirName $(SUBDIR) arch $(TARGET_ARCH) ] ;
+LOCATE on [ FGristFiles $(efi_glue_src) ]
+        = [ BuildFeatureAttribute gnuefi : libdir : path ] ;
+Depends [ FGristFiles $(efi_glue_src) ]
+       : [ BuildFeatureAttribute gnuefi : libdir ] ;
diff --git a/src/system/boot/platform/efi/console.cpp 
b/src/system/boot/platform/efi/console.cpp
index 47f1cd4..c3a1213 100644
--- a/src/system/boot/platform/efi/console.cpp
+++ b/src/system/boot/platform/efi/console.cpp
@@ -1,6 +1,7 @@
 /*
  * Copyright 2014-2016 Haiku, Inc. All rights reserved.
- * Copyright 2013 Fredrik Holmqvist, fredrik.holmqvist@xxxxxxxxx. All rights 
reserved.
+ * Copyright 2013 Fredrik Holmqvist, fredrik.holmqvist@xxxxxxxxx. All rights
+ * reserved.
  * Distributed under the terms of the MIT License.
  */
 
@@ -22,8 +23,10 @@ class Console : public ConsoleNode {
        public:
                Console();
 
-               virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer, 
size_t bufferSize);
-               virtual ssize_t WriteAt(void *cookie, off_t pos, const void 
*buffer, size_t bufferSize);
+               virtual ssize_t ReadAt(void *cookie, off_t pos, void *buffer,
+                       size_t bufferSize);
+               virtual ssize_t WriteAt(void *cookie, off_t pos, const void 
*buffer,
+                       size_t bufferSize);
 };
 
 
@@ -51,7 +54,8 @@ Console::ReadAt(void *cookie, off_t pos, void *buffer, size_t 
bufferSize)
 
 
 ssize_t
-Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t 
bufferSize)
+Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer,
+       size_t bufferSize)
 {
        const char *string = (const char *)buffer;
        CHAR16 ucsBuffer[bufferSize + 3];
@@ -67,7 +71,8 @@ Console::WriteAt(void *cookie, off_t /*pos*/, const void 
*buffer, size_t bufferS
                                //Not sure if we should keep going or abort for 
0.
                                //Keep going was easy anyway.
                                ucsBuffer[j] = 0;
-                               
kSystemTable->ConOut->OutputString(kSystemTable->ConOut, ucsBuffer);
+                               
kSystemTable->ConOut->OutputString(kSystemTable->ConOut,
+                                       ucsBuffer);
                                j = 0;
                                continue;
                        }
diff --git a/src/system/boot/platform/efi/debug.cpp 
b/src/system/boot/platform/efi/debug.cpp
new file mode 100644
index 0000000..0a40169
--- /dev/null
+++ b/src/system/boot/platform/efi/debug.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <string.h>
+
+#include <boot/platform.h>
+#include <boot/stage2.h>
+#include <boot/stdio.h>
+
+#include "efi_platform.h"
+
+
+extern "C" void
+dprintf(const char *format, ...)
+{
+}
+
+
+extern "C" void
+panic(const char *format, ...)
+{
+       va_list args;
+
+       platform_switch_to_text_mode();
+
+       puts("*** PANIC ***");
+
+       va_start(args, format);
+       vprintf(format, args);
+       va_end(args);
+
+       while (true)
+               kBootServices->Stall(1000000);
+}
+
+
+char*
+platform_debug_get_log_buffer(size_t *_size)
+{
+       return NULL;
+}
diff --git a/src/system/boot/platform/efi/devices.cpp 
b/src/system/boot/platform/efi/devices.cpp
new file mode 100644
index 0000000..de151c2
--- /dev/null
+++ b/src/system/boot/platform/efi/devices.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <boot/platform.h>
+#include <boot/stage2.h>
+
+
+status_t
+platform_add_boot_device(struct stage2_args *args, NodeList *devicesList)
+{
+       return B_ERROR;
+}
+
+
+status_t
+platform_add_block_devices(struct stage2_args *args, NodeList *devicesList)
+{
+       return B_ERROR;
+}
+
+
+status_t
+platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
+               NodeList *partitions, boot::Partition **_partition)
+{
+       panic("platform_get_boot_partition not implemented");
+       return B_ERROR;
+}
+
+
+status_t
+platform_register_boot_device(Node *device)
+{
+       panic("platform_register_boot_device not implemented");
+       return B_ERROR;
+}
diff --git a/src/system/boot/platform/efi/heap.cpp 
b/src/system/boot/platform/efi/heap.cpp
new file mode 100644
index 0000000..282dab2
--- /dev/null
+++ b/src/system/boot/platform/efi/heap.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <boot/platform.h>
+#include <boot/stage2.h>
+
+
+extern "C" void
+platform_release_heap(struct stage2_args *args, void *base)
+{
+       return;
+}
+
+
+extern "C" status_t
+platform_init_heap(struct stage2_args *args, void **_base, void **_top)
+{
+       return B_ERROR;
+}
diff --git a/src/system/boot/platform/efi/menu.cpp 
b/src/system/boot/platform/efi/menu.cpp
new file mode 100644
index 0000000..0b13b2d
--- /dev/null
+++ b/src/system/boot/platform/efi/menu.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <boot/menu.h>
+#include <boot/platform/generic/text_menu.h>
+
+#include "efi_platform.h"
+
+
+void
+platform_add_menus(Menu *menu)
+{
+       // No platform specific menus
+}
+
+
+void
+platform_update_menu_item(Menu *menu, MenuItem *item)
+{
+       platform_generic_update_text_menu_item(menu, item);
+}
+
+
+void
+platform_run_menu(Menu *menu)
+{
+       platform_generic_run_text_menu(menu);
+}
+
+
+size_t
+platform_get_user_input_text(Menu *menu, MenuItem *item, char *buffer,
+       size_t bufferSize)
+{
+       return platform_generic_get_user_input_text(menu, item, buffer,
+               bufferSize);
+}
diff --git a/src/system/boot/platform/efi/mmu.cpp 
b/src/system/boot/platform/efi/mmu.cpp
new file mode 100644
index 0000000..28140d7
--- /dev/null
+++ b/src/system/boot/platform/efi/mmu.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2016 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <boot/platform.h>
+#include <boot/stage2.h>
+
+
+extern "C" status_t
+platform_allocate_region(void **_virtualAddress, size_t size, uint8 protection,
+       bool exactAddress)
+{
+       panic("platform_allocate_region not implemented");
+       return B_ERROR;
+}
+
+
+extern "C" status_t
+platform_free_region(void *address, size_t size)
+{
+       panic("platform_free_region not implemented");
+       return B_ERROR;
+}
diff --git a/src/system/boot/platform/efi/start.cpp 
b/src/system/boot/platform/efi/start.cpp
index 09ddbf0..468baa1 100644
--- a/src/system/boot/platform/efi/start.cpp
+++ b/src/system/boot/platform/efi/start.cpp
@@ -5,7 +5,9 @@
  */
 
 
-#include <stdio.h>
+#include <boot/platform.h>
+#include <boot/stage2.h>
+#include <boot/stdio.h>
 
 #include "console.h"
 #include "efi_platform.h"
@@ -30,6 +32,27 @@ call_ctors(void)
 }
 
 
+extern "C" uint32
+platform_boot_options()
+{
+       return 0;
+}
+
+
+extern "C" void
+platform_start_kernel(void)
+{
+       panic("platform_start_kernel not implemented");
+}
+
+
+extern "C" void
+platform_exit(void)
+{
+       return;
+}
+
+
 /**
  * efi_main - The entry point for the EFI application
  * @image: firmware-allocated handle that identifies the image
@@ -38,16 +61,19 @@ call_ctors(void)
 extern "C" EFI_STATUS
 efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systemTable)
 {
+       stage2_args args;
+
        kSystemTable = systemTable;
        kBootServices = systemTable->BootServices;
        kRuntimeServices = systemTable->RuntimeServices;
 
+       memset(&args, 0, sizeof(stage2_args));
+
        call_ctors();
 
        console_init();
 
-       printf("Hello from EFI Loader for Haiku!\nPress any key to 
continue...\n");
-       console_wait_for_key();
+       main(&args);
 
        return EFI_SUCCESS;
 }
diff --git a/src/system/boot/platform/efi/video.cpp 
b/src/system/boot/platform/efi/video.cpp
new file mode 100644
index 0000000..4523bd5
--- /dev/null
+++ b/src/system/boot/platform/efi/video.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2016, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+
+
+#include <boot/platform.h>
+#include <boot/platform/generic/video.h>
+
+#include "efi_platform.h"
+
+
+extern "C" status_t
+platform_init_video(void)
+{
+       return B_ERROR;
+}
+
+
+extern "C" void
+platform_switch_to_logo(void)
+{
+}
+
+
+extern "C" void
+platform_blit4(addr_t frameBuffer, const uint8 *data,
+       uint16 width, uint16 height, uint16 imageWidth,
+       uint16 left, uint16 top)
+{
+       panic("platform_blit4 unsupported");
+       return;
+}
+
+
+extern "C" void
+platform_set_palette(const uint8 *palette)
+{
+       panic("platform_set_palette unsupported");
+       return;
+}

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

Commit:      c0002a79e77908016731c2a1f6ddba7ca29a1df7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c0002a79e779
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Thu Apr 21 01:04:28 2016 UTC

EFI: Implement heap

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

diff --git a/src/system/boot/platform/efi/heap.cpp 
b/src/system/boot/platform/efi/heap.cpp
index 282dab2..ade11ed 100644
--- a/src/system/boot/platform/efi/heap.cpp
+++ b/src/system/boot/platform/efi/heap.cpp
@@ -7,16 +7,34 @@
 #include <boot/platform.h>
 #include <boot/stage2.h>
 
+#include "efi_platform.h"
+
+
+#define STAGE_PAGES    0x2000 /* 32 MB */
+
+
+static EFI_PHYSICAL_ADDRESS staging;
+
 
 extern "C" void
 platform_release_heap(struct stage2_args *args, void *base)
 {
-       return;
+       if ((void*)staging != base)
+               panic("Attempt to release heap with wrong base address!");
+
+       kBootServices->FreePages(staging, STAGE_PAGES);
 }
 
 
 extern "C" status_t
 platform_init_heap(struct stage2_args *args, void **_base, void **_top)
 {
-       return B_ERROR;
+       if (kBootServices->AllocatePages(AllocateAnyPages, EfiLoaderData,
+                       STAGE_PAGES, &staging) != EFI_SUCCESS)
+               return B_NO_MEMORY;
+
+       *_base = (void*)staging;
+       *_top = (void*)((int8*)staging + STAGE_PAGES * PAGE_SIZE);
+
+       return B_OK;
 }

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

Commit:      c0bdc8bef58917882da6e66d57015afed6f8bd74
URL:         http://cgit.haiku-os.org/haiku/commit/?id=c0bdc8bef589
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Fri Apr 22 07:42:26 2016 UTC

bootloader: build objects in $(TARGET_BOOT_PLATFORM)

This separates the objects required for the various boot
loaders, allowing the build system to be able to build
for different targets alongside each other. Currently
only done for bios_ia32 vs efi, as both loaders will be
needed for the x86_64 images.

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

diff --git a/src/system/boot/Jamfile b/src/system/boot/Jamfile
index 72bb340..6e98fe4 100644
--- a/src/system/boot/Jamfile
+++ b/src/system/boot/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 DEFINES += _BOOT_MODE ;
 
 if $(TARGET_ARCH) = x86_64 && $(TARGET_BOOT_PLATFORM) != bios_ia32 {
diff --git a/src/system/boot/arch/x86/Jamfile b/src/system/boot/arch/x86/Jamfile
index 66fb94f..b1ca213 100644
--- a/src/system/boot/arch/x86/Jamfile
+++ b/src/system/boot/arch/x86/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot arch x86 ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 DEFINES += _BOOT_MODE ;
 
 local kernelArchSources =
diff --git a/src/system/boot/loader/Jamfile b/src/system/boot/loader/Jamfile
index 2884fe6..78a8611 100644
--- a/src/system/boot/loader/Jamfile
+++ b/src/system/boot/loader/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems amiga ;
 SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems apple ;
 SubDirHdrs $(HAIKU_TOP) src add-ons kernel partitioning_systems gpt ;
diff --git a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile 
b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
index ce7ec5e..7b94061 100644
--- a/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
+++ b/src/system/boot/loader/file_systems/amiga_ffs/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems amiga_ffs ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
 UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
 UsePrivateHeaders kernel storage ;
diff --git a/src/system/boot/loader/file_systems/bfs/Jamfile 
b/src/system/boot/loader/file_systems/bfs/Jamfile
index bf31e75..31e8f29 100644
--- a/src/system/boot/loader/file_systems/bfs/Jamfile
+++ b/src/system/boot/loader/file_systems/bfs/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems bfs ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateKernelHeaders ;
 UsePrivateHeaders file_systems shared storage ;
 
diff --git a/src/system/boot/loader/file_systems/fat/Jamfile 
b/src/system/boot/loader/file_systems/fat/Jamfile
index ec1ea39..1bd9238 100644
--- a/src/system/boot/loader/file_systems/fat/Jamfile
+++ b/src/system/boot/loader/file_systems/fat/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems fat ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 #UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
 #UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
 #UsePrivateHeaders [ FDirName storage ] ;
diff --git a/src/system/boot/loader/file_systems/hfs_plus/Jamfile 
b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
index 9617ab0..9fdadd3 100644
--- a/src/system/boot/loader/file_systems/hfs_plus/Jamfile
+++ b/src/system/boot/loader/file_systems/hfs_plus/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems hfs_plus ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
 UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
 UsePrivateHeaders kernel storage ;
diff --git a/src/system/boot/loader/file_systems/packagefs/Jamfile 
b/src/system/boot/loader/file_systems/packagefs/Jamfile
index d1953b1..8220f13 100644
--- a/src/system/boot/loader/file_systems/packagefs/Jamfile
+++ b/src/system/boot/loader/file_systems/packagefs/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems packagefs ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
 UsePrivateHeaders kernel shared storage support ;
 UseBuildFeatureHeaders zlib ;
diff --git a/src/system/boot/loader/file_systems/tarfs/Jamfile 
b/src/system/boot/loader/file_systems/tarfs/Jamfile
index c0dda86..29de6d3 100644
--- a/src/system/boot/loader/file_systems/tarfs/Jamfile
+++ b/src/system/boot/loader/file_systems/tarfs/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader file_systems tarfs ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ;
 UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
 UsePrivateHeaders kernel shared storage ;
diff --git a/src/system/boot/loader/net/Jamfile 
b/src/system/boot/loader/net/Jamfile
index a06a45a..5d3fd0e 100644
--- a/src/system/boot/loader/net/Jamfile
+++ b/src/system/boot/loader/net/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot loader net ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders kernel [ FDirName kernel boot platform 
$(TARGET_BOOT_PLATFORM) ] ;
 UsePrivateHeaders drivers ;
 
diff --git a/src/system/boot/platform/bios_ia32/Jamfile 
b/src/system/boot/platform/bios_ia32/Jamfile
index 3f573c0..0822156 100644
--- a/src/system/boot/platform/bios_ia32/Jamfile
+++ b/src/system/boot/platform/bios_ia32/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot platform bios_ia32 ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 SubDirHdrs $(HAIKU_TOP) headers private kernel boot platform 
$(TARGET_BOOT_PLATFORM) ;
 
 UsePrivateHeaders [ FDirName kernel disk_device_manager ] ;
diff --git a/src/system/boot/platform/efi/Jamfile 
b/src/system/boot/platform/efi/Jamfile
index 38ee97d..f9a2bdf 100644
--- a/src/system/boot/platform/efi/Jamfile
+++ b/src/system/boot/platform/efi/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot platform efi ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UsePrivateHeaders [ FDirName kernel boot ] ;
 UseBuildFeatureHeaders gnuefi ;
 UseBuildFeatureHeaders gnuefi : headersProtocol ;
diff --git a/src/system/boot/platform/generic/Jamfile 
b/src/system/boot/platform/generic/Jamfile
index 758d9a8..565f366 100644
--- a/src/system/boot/platform/generic/Jamfile
+++ b/src/system/boot/platform/generic/Jamfile
@@ -1,5 +1,7 @@
 SubDir HAIKU_TOP src system boot platform generic ;
 
+SetupFeatureObjectsDir $(TARGET_BOOT_PLATFORM) ;
+
 UseBuildFeatureHeaders zlib ;
 UsePrivateKernelHeaders ;
 
@@ -11,5 +13,5 @@ BootStaticLibrary boot_platform_generic :
        video_splash.cpp
 ;
 
-Includes [ FGristFiles video_splash.cpp ] 
+Includes [ FGristFiles video_splash.cpp ]
        : [ BuildFeatureAttribute zlib : headers ] ;

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

Commit:      96f4d68b2b1c6f981c8adcfd99a46e18ba0c60e7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=96f4d68b2b1c
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Wed Jun 22 06:35:44 2016 UTC

EFI: check for boot keys

* Only supports spacebar for the boot menu, and escape for
  enabling debug output. Shift keys will not work.

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

diff --git a/src/system/boot/platform/efi/console.cpp 
b/src/system/boot/platform/efi/console.cpp
index c3a1213..ebfd21f 100644
--- a/src/system/boot/platform/efi/console.cpp
+++ b/src/system/boot/platform/efi/console.cpp
@@ -215,6 +215,29 @@ console_init(void)
 }
 

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


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

Commit:      dbf1363b41466de954c4cf71f164375806ec21f4
URL:         http://cgit.haiku-os.org/haiku/commit/?id=dbf1363b4146
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Fri Jun 24 03:56:59 2016 UTC

EFI: naive platform_allocate_region() implementation

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

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

Commit:      325b1e378771d5046bdfe7f8472089246d1854b3
URL:         http://cgit.haiku-os.org/haiku/commit/?id=325b1e378771
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Fri Apr 25 03:03:59 2014 UTC

EFI: add support for graphics mode output

* We can now switch between graphics and text modes, and display
  the splash screen

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

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

Commit:      2da1cb75a40bc7785b07b90adef0c17b604160d2
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2da1cb75a40b
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Tue Aug 30 13:11:16 2016 UTC

EFI: device support for anyboot CDs.

I have tried to get normal ISOs working, but the bootloader doesn't
seem to detect any bootable partitions.

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

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

Commit:      b3215a62758dd9e0939ff152c863e6e6fdad5118
URL:         http://cgit.haiku-os.org/haiku/commit/?id=b3215a62758d
Author:      Henry Harrington <henry.harrington@xxxxxxxxx>
Date:        Tue Oct 21 19:14:45 2014 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Sun Nov 13 11:59:56 2016 UTC

EFI: preliminary support for starting the kernel.

Enough to let the kernel to print hello, but not much beyond that.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

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

Commit:      34a6dd672874183fd407787167d6c521ea972f5c
URL:         http://cgit.haiku-os.org/haiku/commit/?id=34a6dd672874
Author:      Henry Harrington <henry.harrington@xxxxxxxxx>
Date:        Wed Oct 22 01:13:45 2014 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Sun Nov 13 11:59:59 2016 UTC

EFI: Initialize/load the GDT.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

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

Commit:      21e3ac6cf52f91dba8217f15fc33dc1d45dffd40
URL:         http://cgit.haiku-os.org/haiku/commit/?id=21e3ac6cf52f
Author:      Henry Harrington <henry.harrington@xxxxxxxxx>
Date:        Wed Oct 22 03:01:23 2014 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Sun Nov 13 12:00:00 2016 UTC

vm: Try harder to allocate early physical pages.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

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

Commit:      82dcc31606c97c793b2189c4f8cc30ff5f8de44f
URL:         http://cgit.haiku-os.org/haiku/commit/?id=82dcc31606c9
Author:      Henry Harrington <henry.harrington@xxxxxxxxx>
Date:        Wed Oct 22 17:25:05 2014 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Sun Nov 13 12:00:00 2016 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.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

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

Commit:      6e6efaecdc518b9efb7118d6697439593003adf7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6e6efaecdc51
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Thu Apr 24 11:35:40 2014 UTC

EFI: add ACPI support

Also add support in the kernel to get the ACPI RSDP from the
bootloader, and pass onto the ACPI driver using get_boot_item.

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

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

Commit:      a1d0102ee4a83b2ce837228683dc807473edc7b6
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a1d0102ee4a8
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Sun Apr 26 05:22:39 2015 UTC

EFI: add support for HPET

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

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

Commit:      a7142a503761aef9adbf7b0bcbd0b9b55ff89317
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a7142a503761
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Tue Apr 28 22:54:08 2015 UTC

EFI: add cpu.cpp from bios_ia32

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

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

Commit:      ec239abcf5924471fd53f06e67ddb1264d063fd7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ec239abcf592
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Sun Apr 26 05:20:33 2015 UTC

EFI: implement mmu_map_physical_memory & mmu_free.

Also move cpu, acpi, hpet init into platform_start_kernel, as we
need an initialised heap for alllocating memory for recording
the mapped regions.

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

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

Commit:      a99a0c003d14a7ff1e03a49034f8736ee94d3396
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a99a0c003d14
Author:      Nick Smallbone <nick.smallbone@xxxxxxxxx>
Date:        Sat May  2 19:43:33 2015 UTC
Committer:   Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Commit-Date: Sun Nov 13 14:21:41 2016 UTC

EFI: add support for SMP.

Signed-off-by: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>

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

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

Revision:    hrev50684
Commit:      f4ff9cb02c1d292908407314ed023af25e0995da
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f4ff9cb02c1d
Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
Date:        Sun Nov 13 14:21:59 2016 UTC

Merge branch 'uefi-support'

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


Other related posts: