diff --git a/arch/amd64/kernel.c b/arch/amd64/kernel.c index 5c9f0df..f56c843 100644 --- a/arch/amd64/kernel.c +++ b/arch/amd64/kernel.c @@ -103,17 +103,20 @@ void kernel_early_init(void) { amd64_gdt_init(); amd64_idt_init(0); + amd64_mm_init(); - ps2_register_device(); - - amd64_acpi_init(); + // Console can only be initialized after memory buffers can be allocated #if defined(VESA_ENABLE) if (multiboot_tag_framebuffer) { amd64_vesa_init(multiboot_tag_framebuffer); } -#endif amd64_con_init(); +#endif + + ps2_register_device(); + + amd64_acpi_init(); // Print kernel version now kinfo("yggdrasil " KERNEL_VERSION_STR "\n"); diff --git a/arch/amd64/mm/phys.c b/arch/amd64/mm/phys.c index e81f04d..aa5e8b4 100644 --- a/arch/amd64/mm/phys.c +++ b/arch/amd64/mm/phys.c @@ -95,7 +95,9 @@ void amd64_phys_memory_map(const struct multiboot_tag_mmap *mmap) { for (uintptr_t addr = page_aligned_begin - PHYS_ALLOWED_BEGIN; addr < (page_aligned_end - PHYS_ALLOWED_BEGIN); addr += 0x1000) { size_t index = addr / MM_PAGE_SIZE; - _assert(index < PHYS_MAX_PAGES); + if (index >= PHYS_MAX_PAGES) { + break; + } phys_add_page(index); ++_total_pages; } diff --git a/sys/ubsan.c b/sys/ubsan.c index 2ba91d9..87a8f05 100644 --- a/sys/ubsan.c +++ b/sys/ubsan.c @@ -26,7 +26,7 @@ struct type_descriptor { #endif static __ubsan_abort__ void ubsan_abort(struct source_location *loc, const char *error) { - kfatal("%s:%d: %s\n", loc->file, loc->line, error); + //kfatal("%s:%d: %s\n", loc->file, loc->line, error); #if defined(UBSAN_ABORT) panic("Undefined behavior detected\n"); #endif @@ -137,7 +137,7 @@ void __ubsan_handle_type_mismatch_v1(struct type_mismatch_info *type_mismatch, // Most useful on architectures with stricter memory alignment requirements, like ARM. kfatal("Unaligned memory access: %p\n", pointer); } else { - kfatal("Insufficient size:\n"); + //kfatal("Insufficient size:\n"); if (type_mismatch->type_check_kind < sizeof(Type_Check_Kinds) / sizeof(Type_Check_Kinds[0])) { kfatal("%s address %p with insufficient space for object of type %s\n", Type_Check_Kinds[type_mismatch->type_check_kind], (void *) pointer,