History log of /seL4-refos-master/tools/elfloader/include/elfloader_common.h
Revision Date Author Comments
# 9f904ed2 06-Mar-2020 Gerwin Klein <gerwin.klein@data61.csiro.au>

convert license headers to SPDX

Includes license review of 3rd-party files, adding missing upstream
headers, and moving the UNSW OZPLB license into its own file rather
than replicating it in the header.


# 4a9cb2e5 11-Dec-2019 Matthew <matt.phillips121@gmail.com>

Use appropriate compiler attributes

Clang does not support all of the same attributes as GCC. Need to use
compiler specific attributes


# 670e12b1 02-Dec-2019 Simon Shields <simon.shields@data61.csiro.au>

elfloader: clear bss at runtime

Currently, binary and EFI images do not zero the BSS section
before running the elfloader. This means that global variables
which we expect to be NULL at launch aren't.

Add a clear_bss function which does this for us, and call it
where appropriate.


# 6e8ec638 21-Oct-2019 Simon Shields <simon.shields@data61.csiro.au>

elfloader: pick serial driver at runtime

On ARM, each serial driver now has an ELFLOADER_DRIVER(...), which
contains information about the compatible strings the driver
matches, the driver type and an "init" function for the driver to do
setup.

hardware_gen is now used by the ELF loader to generate a list of
interesting devices at compile-time, which go in a header file
"devices_gen.h".

The ELFLOADER_DRIVERs are put into a special "_driver_list" section
by the linker, and accessed as an array via the special
__start__driver_list and __stop__driver_list linker symbols.

At boot, the ELF loader calls initialise_devices(), which does the
following:
for each device in devices_gen.h
for each driver in elfloader_drivers array
if (device compat matches driver compat)
call driver->init(device, driver)
end if
end for
end for

For serial drivers, the serial driver calls uart_set_out with
the elfloader_device that should be the output for the elfloader
from the driver->init function.

There is a 'common' plat_console_putchar implementation which uses
the dynamically picked uart output. This eliminates the need
for a lot of the platform-specific code we have.

This implementation could one day be replaced with a in-ELF loader
device tree. This could also (possibly) be used to handle dynamically
picking SMP core bringup mechanisms.

As all RISC-V platforms use SBI to provide a serial port, RISCV is
only modified to register the SBI putc implementation as the fputc
implementatin.


# 030d83bf 11-Nov-2019 Simon Shields <simon.shields@data61.csiro.au>

elfloader: improve EFI support

Rather than using a bunch of assembly code to relocate the
ELF loader, we use gnu-efi[1] to build an EFI executable.
This approach handles things like nested structs better, by including
a "proper" way to handle ELF relocations.

[1]: https://sourceforge.net/projects/gnu-efi/


# d3527237 10-Nov-2019 Axel Heider <axelheider@gmx.de>

output: introduce plat_console_putchar()

drop __fputc() and provide plat_console_putchar() instead. Duplicated
CR LF handling is removed from the platform code and happens centralized
in arch_write_char()


# afb5f848 17-Oct-2019 Damon Lee <Damon.Lee@data61.csiro.au>

elfloader: Prefer using the CPIO DTB if it exists

The elfloader will now prioritise passing through the DTB that's
included in the CPIO archive.


# e3fca944 13-Jun-2019 Anna Lyons <Anna.Lyons@data61.csiro.au>

elfloader: add option to place the user image last

The user image size is not always deterministic. Add an option to place
the user image at the end of memory, so that we can determine the list
of untyped objects (excluding the last) offline without needing to
calculate the user image size.

NB this option is not available on platforms that use EFI as more
virtual memory scaffolding is required to write to high addresses.


# c5735119 22-Nov-2018 Simon Shields <simon.shields@data61.csiro.au>

elfloader: pass DTB from bootloader to seL4 on ARM

On ARM, we expect the physical address of the dtb to be passed in r2 on
aarch32 or x0 on aarch64. RISC-V supplies a DTB in a1, but we currently
don't pass it to the kernel.

The elfloader then moves the dtb to immediately after where the
kernel is loaded in memory, and passes that address on to the kernel.

If there is no bootloader provided DTB, the elfloader will pass 0
to the kernel as the start address of the DTB.


# b9c25fc2 16-Apr-2019 Simon Shields <simon.shields@data61.csiro.au>

trivial: elfloader: add UNUSED macro


# 5ad25f75 30-Jan-2019 James Ye <james.ye@data61.csiro.au>

elfloader-tool: switch to new libcpio API


# 1f57b8aa 03-Apr-2018 Kent McLeod <Kent.Mcleod@data61.csiro.au>

elfloader: Remove ARM assumption

Rearranges the elfloader to place non ARM specific code into common locations and only
include ARM code if building for ARM. This enables the elfloader to be used for other
architectures in the future.