thermosphere: major refactor of memory map

- use recursive stage 1 page table (thanks @fincs for this idea)
- NULL now unmapped
- no identity mapping
- image + GICv2 now mapped at the same address for every platform
- tempbss mapped just after "real" bss, can now steal unused mem from
the latter
- no hardcoded VAs for other MMIO devices
- tegra: remove timers, use the generic timer instead
This commit is contained in:
TuxSH
2020-01-17 22:10:26 +00:00
parent 92a291cd41
commit 626f0ecb98
47 changed files with 795 additions and 469 deletions

View File

@@ -15,14 +15,26 @@
#include "irq.h"
#include "transport_interface.h"
extern const u8 __start__[];
#include "memory_map.h"
#include "mmu.h"
static void loadKernelViaSemihosting(void)
{
// Note: !! hardcoded addresses !!
size_t len = 1<<20; // max len
uintptr_t buf = (uintptr_t)__start__ + (1<<20);
uintptr_t buf = 0x60000000 + (1<<20);
long handle = -1, ret;
u64 *mmuTable = (u64 *)MEMORY_MAP_VA_TTBL;
mmu_map_block_range(
1, mmuTable, 0x40000000, 0x40000000, 0x40000000,
MMU_PTE_BLOCK_XN | MMU_PTE_BLOCK_INNER_SHAREBLE | MMU_PTE_BLOCK_MEMTYPE(MEMORY_MAP_MEMTYPE_NORMAL_UNCACHEABLE)
);
__tlb_invalidate_el2();
__dsb();
DEBUG("Loading kernel via semihosted file I/O... ");
handle = semihosting_file_open("test_kernel.bin", FOPEN_MODE_RB);
if (handle < 0) {
@@ -35,6 +47,11 @@ static void loadKernelViaSemihosting(void)
DEBUG("OK!\n");
semihosting_file_close(handle);
mmu_unmap_range(1, mmuTable, 0x40000000, 0x40000000);
__tlb_invalidate_el2();
__dsb();
currentCoreCtx->kernelEntrypoint = buf;
}