diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index db2087e..d227ee1 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -30,8 +30,8 @@ LOAD_PROFILE(${ARCH} ${SYSTEM}) ADD_EXECUTABLE(kernel ${PLATFORM_SRCS} ${ISA_SRCS} ${GENERIC_SRCS}) SET(CMAKE_ASM-ATT_COMPILE_OBJECT " -g -x assembler-with-cpp -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_ASM_FLAGS} ${PLATFORM_ASM_FLAGS} -c -o ") -SET(CMAKE_C_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}") -SET(CMAKE_CXX_FLAGS "-g -w -Werror -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}") +SET(CMAKE_C_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -std=c11 -ffreestanding -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_C_FLAGS} ${PLATFORM_C_FLAGS}") +SET(CMAKE_CXX_FLAGS "-g --all-warnings -Werror -Wno-error=reorder -Wno-unused -Wno-unused-variable -fno-use-cxa-atexit -ffreestanding -fno-rtti -fno-exceptions -std=gnu++17 -ffunction-sections -fdata-sections -I../../ -I../../libk/include/ -I../../kernel/src/include/ ${ISA_CXX_FLAGS} ${PLATFORM_CXX_FLAGS}") SET_TARGET_PROPERTIES(kernel PROPERTIES LINK_FLAGS "-T ../../kernel/${PLATFORM_LAYOUT} -N ${ISA_LINKER_FLAGS} ${PLATFORM_LINKER_FLAGS} -nostdlib -nodefaultlibs -Wl,--gc-sections -ffreestanding") TARGET_LINK_LIBRARIES(kernel gcc) diff --git a/kernel/arch/arm/interrupt.cpp b/kernel/arch/arm/interrupt.cpp index 782176e..ba6737a 100644 --- a/kernel/arch/arm/interrupt.cpp +++ b/kernel/arch/arm/interrupt.cpp @@ -22,7 +22,7 @@ void print_regdump(cpu_state *state) { (*out << " returnAddr: ").puti(state->returnAddr); *out << "\n"; } -extern "C" void panic2(char *msg, cpu_state *state); +extern "C" void panic2(const char *msg, cpu_state *state); extern "C" cpu_state *handleINT(int number, cpu_state *state) { *out << "Interrupt"; out->puti(number); @@ -49,7 +49,7 @@ extern "C" cpu_state *handleINT(int number, cpu_state *state) { } return new_cpu; } -extern "C" void panic2(char *msg, cpu_state *state) { +extern "C" void panic2(const char *msg, cpu_state *state) { out->setColor(Color::RED); *out << "KERNEL PANIC: " << msg << "\n"; print_regdump(state); diff --git a/kernel/hw/3ds9/vectorinit/vectorinit.cpp b/kernel/hw/3ds9/vectorinit/vectorinit.cpp index e4fed9d..9eb7c53 100644 --- a/kernel/hw/3ds9/vectorinit/vectorinit.cpp +++ b/kernel/hw/3ds9/vectorinit/vectorinit.cpp @@ -37,7 +37,7 @@ IRQ_IO::~IRQ_IO() {} void* IRQ_IO::handleIRQ(void *data) { //Call IRQ handlers until all IRQs are done. int bit; - while(bit=__builtin_ffs(*((volatile int*)0x10001004))) { + while((bit=__builtin_ffs(*((volatile int*)0x10001004)))) { data = handlers[bit-1](data); *((volatile int*)0x10001004)=(1<<(bit-1)); } diff --git a/kernel/src/cppstubs.cpp b/kernel/src/cppstubs.cpp index 177390b..e92e96c 100644 --- a/kernel/src/cppstubs.cpp +++ b/kernel/src/cppstubs.cpp @@ -23,4 +23,5 @@ extern "C" int __cxa_guard_acquire(__guard *g) { } extern "C" int __cxa_guard_release(__guard *g) { *(char *)g = 1; + return 0; } diff --git a/kernel/src/include/base.hpp b/kernel/src/include/base.hpp index f6862c6..54c7c4e 100644 --- a/kernel/src/include/base.hpp +++ b/kernel/src/include/base.hpp @@ -12,7 +12,7 @@ void setMainTTY(TTY *obj); /** * Halts the kernel due to a unresolvable error */ -extern "C" void panic(const char* s); +extern "C" __attribute__((noreturn)) void panic(const char* s); #if !defined(__LITTLE_ENDIAN__) || !defined(__BIG_ENDIAN__) #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ diff --git a/kernel/src/pmm.cpp b/kernel/src/pmm.cpp index 474428c..a4580d9 100644 --- a/kernel/src/pmm.cpp +++ b/kernel/src/pmm.cpp @@ -42,13 +42,13 @@ auto PMM::operator,(size_t no_pages) -> phys_t { PMM_ent *curr=head; while(curr) { //Is curr+n pages free? - if((curr->val+((no_pages-1)*page_size)) in this) { + if((curr->val+((no_pages-1)*page_size)) in *this) { //We're onto something bool notfound=false; phys_t i; size_t j; for(i=curr->val,j=0; j