[Zion] Compile kernel with -Wall -Werror.
This commit is contained in:
parent
4e25a7e3b9
commit
6d108f6965
|
@ -69,7 +69,7 @@ target_link_libraries(zion
|
||||||
# -mno-red-zone -- Don't put data below the stack pointer (clobbered by interrupts).
|
# -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.
|
# -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).
|
# -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")
|
set(_Z_LINK_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linker.ld")
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,7 @@ bool checksum(uint8_t* addr, uint8_t num_bytes) {
|
||||||
return check_cnt == 0;
|
return check_cnt == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if K_ACPI_DEBUG
|
||||||
void dbgsz(const char* c, uint8_t cnt) {
|
void dbgsz(const char* c, uint8_t cnt) {
|
||||||
char cl[cnt + 1];
|
char cl[cnt + 1];
|
||||||
|
|
||||||
|
@ -105,6 +106,7 @@ void dbgsz(const char* c, uint8_t cnt) {
|
||||||
cl[cnt] = '\0';
|
cl[cnt] = '\0';
|
||||||
dbgln(cl);
|
dbgln(cl);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t* SdtDataStart(SdtHeader* sdt) {
|
uint8_t* SdtDataStart(SdtHeader* sdt) {
|
||||||
return reinterpret_cast<uint8_t*>(sdt) + sizeof(SdtHeader);
|
return reinterpret_cast<uint8_t*>(sdt) + sizeof(SdtHeader);
|
||||||
|
@ -157,8 +159,8 @@ void ParseMadt(SdtHeader* rsdt) {
|
||||||
while (reinterpret_cast<uint64_t>(entry) < max_addr) {
|
while (reinterpret_cast<uint64_t>(entry) < max_addr) {
|
||||||
switch (entry->type) {
|
switch (entry->type) {
|
||||||
case 0: {
|
case 0: {
|
||||||
MadtLocalApic* local = reinterpret_cast<MadtLocalApic*>(entry);
|
|
||||||
#if K_ACPI_DEBUG
|
#if K_ACPI_DEBUG
|
||||||
|
MadtLocalApic* local = reinterpret_cast<MadtLocalApic*>(entry);
|
||||||
dbgln("Local APIC (Proc id, id, flags): {x}, {x}, {x}",
|
dbgln("Local APIC (Proc id, id, flags): {x}, {x}, {x}",
|
||||||
local->processor_id, local->apic_id, +local->flags);
|
local->processor_id, local->apic_id, +local->flags);
|
||||||
#endif
|
#endif
|
||||||
|
@ -177,9 +179,9 @@ void ParseMadt(SdtHeader* rsdt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
|
#if K_ACPI_DEBUG
|
||||||
MadtIoApicInterruptSource* src =
|
MadtIoApicInterruptSource* src =
|
||||||
reinterpret_cast<MadtIoApicInterruptSource*>(entry);
|
reinterpret_cast<MadtIoApicInterruptSource*>(entry);
|
||||||
#if K_ACPI_DEBUG
|
|
||||||
dbgln("IO Source (Bus, IRQ, GSI, flags): {x}, {x}, {x}, {x}",
|
dbgln("IO Source (Bus, IRQ, GSI, flags): {x}, {x}, {x}, {x}",
|
||||||
src->bus_source, src->irq_source, +src->global_system_interrupt,
|
src->bus_source, src->irq_source, +src->global_system_interrupt,
|
||||||
+src->flags);
|
+src->flags);
|
||||||
|
@ -187,9 +189,9 @@ void ParseMadt(SdtHeader* rsdt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
|
#if K_ACPI_DEBUG
|
||||||
MadtLocalApicNonMaskable* lnmi =
|
MadtLocalApicNonMaskable* lnmi =
|
||||||
reinterpret_cast<MadtLocalApicNonMaskable*>(entry);
|
reinterpret_cast<MadtLocalApicNonMaskable*>(entry);
|
||||||
#if K_ACPI_DEBUG
|
|
||||||
dbgln("Local NMI (proc id, flags, lint#): {x}, {x}, {x}",
|
dbgln("Local NMI (proc id, flags, lint#): {x}, {x}, {x}",
|
||||||
lnmi->apic_processor_id, +lnmi->flags, lnmi->lint_num);
|
lnmi->apic_processor_id, +lnmi->flags, lnmi->lint_num);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -41,7 +41,6 @@ static TaskStateSegment gTaskStateSegment;
|
||||||
extern "C" void ReloadSegments();
|
extern "C" void ReloadSegments();
|
||||||
|
|
||||||
uint64_t CreateSegment(uint64_t access, uint64_t flags) {
|
uint64_t CreateSegment(uint64_t access, uint64_t flags) {
|
||||||
uint64_t base = 0;
|
|
||||||
access &= 0xFF;
|
access &= 0xFF;
|
||||||
flags &= 0xF0;
|
flags &= 0xF0;
|
||||||
flags |= 0xF; // For the highest 4 bits of the limit.
|
flags |= 0xF; // For the highest 4 bits of the limit.
|
||||||
|
|
|
@ -15,12 +15,6 @@ void dbgputchar(char c) {
|
||||||
outb(COM1, c);
|
outb(COM1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dbgcstr(const char* str) {
|
|
||||||
for (; *str != '\0'; str++) {
|
|
||||||
dbgputchar(*str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dbg(const glcr::StringView& str) {
|
void dbg(const glcr::StringView& str) {
|
||||||
for (uint64_t i = 0; i < str.size(); i++) {
|
for (uint64_t i = 0; i < str.size(); i++) {
|
||||||
dbgputchar(str[i]);
|
dbgputchar(str[i]);
|
||||||
|
|
|
@ -84,20 +84,6 @@ uint64_t LoadElfProgram(Process& dest_proc, uint64_t base, uint64_t offset) {
|
||||||
return header->entry;
|
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() {
|
void DumpModules() {
|
||||||
#if K_INIT_DEBUG
|
#if K_INIT_DEBUG
|
||||||
const limine_module_response& resp = boot::GetModules();
|
const limine_module_response& resp = boot::GetModules();
|
||||||
|
@ -188,7 +174,7 @@ void LoadInitProgram() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start process.
|
// Start process.
|
||||||
const limine_file& init_prog = GetInitProgram("/sys/yellowstone");
|
limine_file init_prog = GetInitProgram("/sys/yellowstone");
|
||||||
uint64_t entry = LoadElfProgram(
|
uint64_t entry = LoadElfProgram(
|
||||||
*proc, reinterpret_cast<uint64_t>(init_prog.address), init_prog.size);
|
*proc, reinterpret_cast<uint64_t>(init_prog.address), init_prog.size);
|
||||||
proc->CreateThread()->Start(entry, port_cap, 0);
|
proc->CreateThread()->Start(entry, port_cap, 0);
|
||||||
|
|
Loading…
Reference in New Issue