Changeset cfdeedc in mainline for boot/arch/ia64


Ignore:
Timestamp:
2018-10-21T23:12:23Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf05c74
Parents:
d59718e
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-21 22:53:48)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-21 23:12:23)
Message:

Keep kernel in ELF format

By keeping kernel in an ELF file (instead of converting it to
a flat binary), we can use the information it contains, like
symbol table and debug info.

We can also later implement more advanced functionality, like
loading kernel at multiple discontiguous blocks, or loading
a position-independent kernel at a randomized address.

Currently the functionality is quite restricted, to keep changes
to a minimum. Code in boot/generic/src/kernel.c validates that
the kernel image was built with the same addresses as the boot
loader uses, giving an extra level of sanity checking compared
to a flat binary.

Location:
boot/arch/ia64
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/ia64/Makefile.inc

    rd59718e rcfdeedc  
    6161        generic/src/tar.c \
    6262        generic/src/gzip.c \
     63        generic/src/kernel.c \
    6364        generic/src/payload.c
    6465
  • boot/arch/ia64/include/arch/arch.h

    rd59718e rcfdeedc  
    3636#define LOADER_ADDRESS  0x4400000
    3737#define KERNEL_ADDRESS  0x4800000
     38#define KERNEL_VADDRESS 0xe000000004800000
    3839
    3940#define STACK_SIZE                   8192
  • boot/arch/ia64/src/main.c

    rd59718e rcfdeedc  
    4444#include <errno.h>
    4545#include <payload.h>
     46#include <kernel.h>
    4647
    4748#define DEFAULT_MEMORY_BASE             0x4000000ULL
     
    182183            (uintptr_t) kernel_start, NULL);
    183184
    184         printf("Booting the kernel ...\n");
    185         jump_to_kernel(&bootinfo, kernel_start);
     185        uintptr_t entry = check_kernel(kernel_start);
     186
     187        // FIXME: kernel's entry point is linked at a different address than
     188        //        where it is run from.
     189        entry = entry - KERNEL_VADDRESS + KERNEL_ADDRESS;
     190
     191        printf("Booting the kernel at %p...\n", (void *) entry);
     192        jump_to_kernel(&bootinfo, (void *) entry);
    186193}
Note: See TracChangeset for help on using the changeset viewer.