diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-09-02 14:01:46 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-09-02 14:06:16 +0300 |
| commit | d9b427cab53849c503306af1ebebed30c35fb81f (patch) | |
| tree | 1ac2fee12c2bede1a1ef722a59c4d94faf213e2d /arch/riscv64/init/init.c | |
| parent | 9398194058eeb365bfc985b31b4049ccfd44ac45 (diff) | |
| download | kmi-d9b427cab53849c503306af1ebebed30c35fb81f.tar.gz kmi-d9b427cab53849c503306af1ebebed30c35fb81f.zip | |
reserve more space for fw
+ Doesn't seem to be specified anywhere, but I'll stick with 2MB for
now, working on the assumption that the FW is at the start of the
physical RAM.
Possible TODOs: generate apos.its automatically from init.elf,
allocate root_branch statically?
Diffstat (limited to 'arch/riscv64/init/init.c')
| -rw-r--r-- | arch/riscv64/init/init.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/riscv64/init/init.c b/arch/riscv64/init/init.c index 2c71ea4..c91d192 100644 --- a/arch/riscv64/init/init.c +++ b/arch/riscv64/init/init.c @@ -33,9 +33,14 @@ static void init_bootmem() { size_t flags = VM_V | VM_X | VM_R | VM_W; - extern char *__init_start; - root_branch = (struct vmem *)align_down( - (uintptr_t)&__init_start - SZ_4K, SZ_4K); + extern char *__init_end; + extern char *__kernel_size; + uintptr_t top = (uintptr_t)&__init_end + (uintptr_t)&__kernel_size; + + /* this could be risky, as we might overwrite some bits of initrd or fdt + * if they're allocated too close to the kernel payload. + * @todo Allocate root_branch statically? */ + root_branch = (struct vmem *)align_up(top, SZ_4K); /* direct mapping (temp) */ for (size_t i = 0; i < CSTACK_PAGE; ++i) |
