bootboot: fix two issues in bootboot proto

This commit is contained in:
pitust 2021-11-06 14:36:29 +00:00
parent 6cbc63a32c
commit db61f6914d
2 changed files with 6 additions and 3 deletions

View File

@ -135,8 +135,6 @@ void bootboot_load(char *config) {
/// Memory mappings ///
pagemap_t pmap = new_pagemap(4);
BOOTBOOT* bootboot = (BOOTBOOT*)ext_mem_alloc_type_aligned(4096, MEMMAP_BOOTLOADER_RECLAIMABLE, 4096);
map_page(pmap, struct_vaddr, (uint64_t)(size_t)bootboot, VMM_FLAG_PRESENT | VMM_FLAG_WRITE, false);
/// Load kernel ///
uint64_t entry, top, slide, rangecount, physbase, virtbase = 0;
@ -194,6 +192,11 @@ void bootboot_load(char *config) {
printv("bootboot: mapping framebuffer to %X\n", fb_vaddr);
printv("bootboot: the init stack is %X bytes\n", init_stack_size);;
/// Bootboot structure ///
BOOTBOOT* bootboot = (BOOTBOOT*)ext_mem_alloc_type_aligned(4096, MEMMAP_BOOTLOADER_RECLAIMABLE, 4096);
map_page(pmap, struct_vaddr, (uint64_t)(size_t)bootboot, VMM_FLAG_PRESENT | VMM_FLAG_WRITE, false);
/// Environment ///
{
map_page(pmap, env_vaddr, (uint64_t)(size_t)env, VMM_FLAG_PRESENT | VMM_FLAG_WRITE, false);

View File

@ -11,7 +11,7 @@ INITRD_HANDLER(cpio);
INITRD_HANDLER(auto) {
#define DETECT_FAILED panic("bootboot: cannot read file `%s`: cannot detect initrd type (only ustar, cpio and jamesm is supported).", path)
if (file.size < 4) DETECT_FAILED;
if (!memcmp(file.data, "ELF\x7f", 4)) {
if (!memcmp(file.data, "\x7f""ELF", 4)) {
if (strcmp("sys/core", path) == 0) {
printv("bootboot: using ELF as initrd to open sys/core\n");
return file;