diff options
author | Freya Murphy <freya@freyacat.org> | 2024-02-03 14:36:26 -0500 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-02-03 14:41:52 -0500 |
commit | 8e74123683072deed9ecd29e76037a16a47e3295 (patch) | |
tree | 2a4d6394688ed23b9360ff87c8d9861ab40da01d /src/arch/amd64/mboot.c | |
parent | refactor exception panic (diff) | |
download | corn-8e74123683072deed9ecd29e76037a16a47e3295.tar.gz corn-8e74123683072deed9ecd29e76037a16a47e3295.tar.bz2 corn-8e74123683072deed9ecd29e76037a16a47e3295.zip |
alloc on write paging, -O3 compile works, 'volatile' is the story of my life
Diffstat (limited to '')
-rw-r--r-- | src/arch/amd64/mboot.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/arch/amd64/mboot.c b/src/arch/amd64/mboot.c index 34424a0..771e911 100644 --- a/src/arch/amd64/mboot.c +++ b/src/arch/amd64/mboot.c @@ -68,13 +68,13 @@ struct mboot_tag_mmap { struct mboot_tag_old_rsdp { uint32_t type; uint32_t size; - uint8_t rsdp[]; + char rsdp[]; }; struct mboot_tag_new_rsdp { uint32_t type; uint32_t size; - uint8_t rsdp[]; + char rsdp[]; }; struct mboot_tag_cmdline { @@ -96,11 +96,10 @@ struct mboot_tag_framebuffer { }; static void read_symbols( - struct boot_info *shim_info, - struct mboot_tag_elf_sections *sections + volatile struct boot_info *shim_info, + volatile struct mboot_tag_elf_sections *sections ) { - - shim_info->symbol_table = sections->sections; + shim_info->symbol_table = (void * volatile) sections->sections; // struct mboot_elf_section_header *section = // (struct mboot_elf_section_header *) (layout->elf_section_headers); @@ -136,19 +135,19 @@ static void read_symbols( } static void read_cmdline( - struct boot_info *shim_info, - struct mboot_tag_cmdline *cmdline + volatile struct boot_info *shim_info, + volatile struct mboot_tag_cmdline *cmdline ) { uint32_t size = cmdline->size - 8; if (size >= CMDLINE_MAX) size = CMDLINE_MAX; // truncate :( - memcpy(shim_info->cmdline, cmdline->cmdline, size); + memcpyv(shim_info->cmdline, cmdline->cmdline, size); shim_info->cmdline[size] = '\0'; } static void read_framebuffer( - struct boot_info *shim_info, - struct mboot_tag_framebuffer *framebuffer + volatile struct boot_info *shim_info, + volatile struct mboot_tag_framebuffer *framebuffer ) { shim_info->fb.addr = framebuffer->framebuffer_addr; shim_info->fb.width = framebuffer->framebuffer_width; @@ -168,8 +167,8 @@ static const char *segment_type[] = { }; static void read_memory_map( - struct boot_info *shim_info, - struct mboot_tag_mmap *map + volatile struct boot_info *shim_info, + volatile struct mboot_tag_mmap *map ) { int idx = 0; uintptr_t i = (uintptr_t)map->entries; @@ -200,31 +199,31 @@ static void read_memory_map( } static void read_old_rsdp( - struct boot_info *shim_info, - struct mboot_tag_old_rsdp *rsdp + volatile struct boot_info *shim_info, + volatile struct mboot_tag_old_rsdp *rsdp ) { if (shim_info->acpi_table != NULL) return; // xsdp is newer and has been loaded - shim_info->acpi_table = rsdp->rsdp; + shim_info->acpi_table = (void *volatile) rsdp->rsdp; } static void read_new_rsdp( - struct boot_info *shim_info, - struct mboot_tag_new_rsdp *rsdp + volatile struct boot_info *shim_info, + volatile struct mboot_tag_new_rsdp *rsdp ) { - shim_info->acpi_table = rsdp->rsdp; + shim_info->acpi_table = (void *volatile) rsdp->rsdp; } void mboot_load_info( long mboot_magic, - const void *mboot_data_ptr, - struct boot_info *shim_info + volatile const void *mboot_data_ptr, + volatile struct boot_info *shim_info ) { if (mboot_magic != MBOOT_HEADER_MAGIC) panic("invalid multiboot magic"); - memset(shim_info, 0, sizeof(struct boot_info)); + memsetv(shim_info, 0, sizeof(struct boot_info)); struct mboot_info *mboot_info = (struct mboot_info *) mboot_data_ptr; const char *mboot_end = ((char *) mboot_info) + mboot_info->total_size; |