diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-28 18:09:09 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-28 18:09:09 +0100 |
commit | f7ddd1a356f58298d703b11e862d3d6127e67080 (patch) | |
tree | 92f681646a569dfbcdc8a4df277ee48da4e46868 /loader_stage1.c | |
parent | 6321cd922cb665ca5bfb9bc2025701b07c076894 (diff) | |
download | rpi-MMU-example-f7ddd1a356f58298d703b11e862d3d6127e67080.tar.gz rpi-MMU-example-f7ddd1a356f58298d703b11e862d3d6127e67080.zip |
rewrite the stage 1 of bootloader in a more compact and (mostly) load-addr-independent way
Diffstat (limited to 'loader_stage1.c')
-rw-r--r-- | loader_stage1.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/loader_stage1.c b/loader_stage1.c deleted file mode 100644 index aca439c..0000000 --- a/loader_stage1.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stddef.h> -#include <stdint.h> -#include <global.h> - -#define STAGE2_ADDR ((volatile char*) 0x4000) - -// There's one tricky thing about managing executable's own code. -// Mainly, symbols are visible to c code as extern chars, but the actual -// values are their adresses... see the code below -extern char - __stage2_start, - __stage2_end, - __stage2_size; - -__attribute__((section(".text.stage1main"))) -void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags) -{ - // stage2 of the bootloader is part of executable; - // copy it over to it's destination place - // TODO implement a memcpy() somewhere and use it instead of loops - for (size_t i = 0; i < (size_t) &__stage2_size; i++) - STAGE2_ADDR[i] = (&__stage2_start)[i]; - - // jump to stage2 - ((void(*)(uint32_t, uint32_t, uint32_t))STAGE2_ADDR)(r0, r1, atags); -} |