diff --git a/zion/CMakeLists.txt b/zion/CMakeLists.txt index 409e237..2e63927 100644 --- a/zion/CMakeLists.txt +++ b/zion/CMakeLists.txt @@ -69,7 +69,7 @@ target_link_libraries(zion # -mno-red-zone -- Don't put data below the stack pointer (clobbered by interrupts). # -mcmodel=kernel -- Assume the kernel code is running in the higher half. # -mgeneral-regs-only -- Prevent GCC from using a whole host of nonsense registers (that we have to enable). -set(_Z_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -c -ffreestanding -fno-rtti -fno-exceptions -fno-use-cxa-atexit -nostdlib -mabi=sysv -mno-red-zone -mcmodel=kernel -mgeneral-regs-only") +set(_Z_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} -c -ffreestanding -fno-rtti -fno-exceptions -fno-use-cxa-atexit -nostdlib -mabi=sysv -mno-red-zone -mcmodel=kernel -mgeneral-regs-only -Wall -Werror") set(_Z_LINK_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linker.ld") diff --git a/zion/boot/acpi.cpp b/zion/boot/acpi.cpp index 7bc1d51..b8edac1 100644 --- a/zion/boot/acpi.cpp +++ b/zion/boot/acpi.cpp @@ -96,6 +96,7 @@ bool checksum(uint8_t* addr, uint8_t num_bytes) { return check_cnt == 0; } +#if K_ACPI_DEBUG void dbgsz(const char* c, uint8_t cnt) { char cl[cnt + 1]; @@ -105,6 +106,7 @@ void dbgsz(const char* c, uint8_t cnt) { cl[cnt] = '\0'; dbgln(cl); } +#endif uint8_t* SdtDataStart(SdtHeader* sdt) { return reinterpret_cast(sdt) + sizeof(SdtHeader); @@ -157,8 +159,8 @@ void ParseMadt(SdtHeader* rsdt) { while (reinterpret_cast(entry) < max_addr) { switch (entry->type) { case 0: { - MadtLocalApic* local = reinterpret_cast(entry); #if K_ACPI_DEBUG + MadtLocalApic* local = reinterpret_cast(entry); dbgln("Local APIC (Proc id, id, flags): {x}, {x}, {x}", local->processor_id, local->apic_id, +local->flags); #endif @@ -177,9 +179,9 @@ void ParseMadt(SdtHeader* rsdt) { break; } case 2: { +#if K_ACPI_DEBUG MadtIoApicInterruptSource* src = reinterpret_cast(entry); -#if K_ACPI_DEBUG dbgln("IO Source (Bus, IRQ, GSI, flags): {x}, {x}, {x}, {x}", src->bus_source, src->irq_source, +src->global_system_interrupt, +src->flags); @@ -187,9 +189,9 @@ void ParseMadt(SdtHeader* rsdt) { break; } case 4: { +#if K_ACPI_DEBUG MadtLocalApicNonMaskable* lnmi = reinterpret_cast(entry); -#if K_ACPI_DEBUG dbgln("Local NMI (proc id, flags, lint#): {x}, {x}, {x}", lnmi->apic_processor_id, +lnmi->flags, lnmi->lint_num); #endif diff --git a/zion/common/gdt.cpp b/zion/common/gdt.cpp index 493c72f..855e9c5 100644 --- a/zion/common/gdt.cpp +++ b/zion/common/gdt.cpp @@ -41,7 +41,6 @@ static TaskStateSegment gTaskStateSegment; extern "C" void ReloadSegments(); uint64_t CreateSegment(uint64_t access, uint64_t flags) { - uint64_t base = 0; access &= 0xFF; flags &= 0xF0; flags |= 0xF; // For the highest 4 bits of the limit. diff --git a/zion/debug/debug.cpp b/zion/debug/debug.cpp index a401fdc..a2929d9 100644 --- a/zion/debug/debug.cpp +++ b/zion/debug/debug.cpp @@ -15,12 +15,6 @@ void dbgputchar(char c) { outb(COM1, c); } -void dbgcstr(const char* str) { - for (; *str != '\0'; str++) { - dbgputchar(*str); - } -} - void dbg(const glcr::StringView& str) { for (uint64_t i = 0; i < str.size(); i++) { dbgputchar(str[i]); diff --git a/zion/loader/init_loader.cpp b/zion/loader/init_loader.cpp index 367b4eb..7e1f16a 100644 --- a/zion/loader/init_loader.cpp +++ b/zion/loader/init_loader.cpp @@ -84,20 +84,6 @@ uint64_t LoadElfProgram(Process& dest_proc, uint64_t base, uint64_t offset) { return header->entry; } -bool streq(const char* a, const char* b) { - while (true) { - if (*a == '\0' && *b == '\0') return true; - if (*a == '\0' || *b == '\0') { - return false; - } - if (*a != *b) { - return false; - } - a++; - b++; - } -} - void DumpModules() { #if K_INIT_DEBUG const limine_module_response& resp = boot::GetModules(); @@ -188,7 +174,7 @@ void LoadInitProgram() { } // Start process. - const limine_file& init_prog = GetInitProgram("/sys/yellowstone"); + limine_file init_prog = GetInitProgram("/sys/yellowstone"); uint64_t entry = LoadElfProgram( *proc, reinterpret_cast(init_prog.address), init_prog.size); proc->CreateThread()->Start(entry, port_cap, 0);