Fixed compiler warnings

This commit is contained in:
Alex 2022-12-21 20:05:57 +02:00
parent 48e8f0c513
commit cddf0426e3
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
28 changed files with 483 additions and 81 deletions

View File

@ -301,7 +301,7 @@ namespace APIC
APIC::~APIC() {} APIC::~APIC() {}
void Timer::OnInterruptReceived(TrapFrame *Frame) {} void Timer::OnInterruptReceived(TrapFrame *Frame) { UNUSED(Frame); }
void Timer::OneShot(uint32_t Vector, uint64_t Miliseconds) void Timer::OneShot(uint32_t Vector, uint64_t Miliseconds)
{ {

View File

@ -85,6 +85,7 @@ namespace GlobalDescriptorTable
{0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0},
0, 0,
0, 0,
0,
}; };
void *CPUStackPointer[MAX_CPU]; void *CPUStackPointer[MAX_CPU];

View File

@ -487,6 +487,7 @@ namespace InterruptDescriptorTable
void Init(int Core) void Init(int Core)
{ {
UNUSED(Core);
static int once = 0; static int once = 0;
if (!once++) if (!once++)
{ {

View File

@ -6,6 +6,7 @@ int Entry(void *Info);
void _start(void *Raw) void _start(void *Raw)
{ {
UNUSED(Raw);
error("ERROR! INVALID BOOT PROTOCOL!"); error("ERROR! INVALID BOOT PROTOCOL!");
while (1) while (1)
asmv("hlt"); asmv("hlt");

View File

@ -28,26 +28,65 @@ static const char *PageFaultDescriptions[8] = {
SafeFunction void DivideByZeroExceptionHandler(CHArchTrapFrame *Frame) SafeFunction void DivideByZeroExceptionHandler(CHArchTrapFrame *Frame)
{ {
fixme("Divide by zero exception\n"); fixme("Divide by zero exception\n");
UNUSED(Frame);
} }
SafeFunction void DebugExceptionHandler(CHArchTrapFrame *Frame) SafeFunction void DebugExceptionHandler(CHArchTrapFrame *Frame)
{ {
CrashHandler::EHPrint("\eDD2920System crashed!\n"); CrashHandler::EHPrint("\eDD2920System crashed!\n");
CrashHandler::EHPrint("Kernel triggered debug exception.\n"); CrashHandler::EHPrint("Kernel triggered debug exception.\n");
UNUSED(Frame);
}
SafeFunction void NonMaskableInterruptExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("NMI exception");
UNUSED(Frame);
}
SafeFunction void BreakpointExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Breakpoint exception");
UNUSED(Frame);
}
SafeFunction void OverflowExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Overflow exception");
UNUSED(Frame);
}
SafeFunction void BoundRangeExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Bound range exception");
UNUSED(Frame);
} }
SafeFunction void NonMaskableInterruptExceptionHandler(CHArchTrapFrame *Frame) { fixme("NMI exception"); }
SafeFunction void BreakpointExceptionHandler(CHArchTrapFrame *Frame) { fixme("Breakpoint exception"); }
SafeFunction void OverflowExceptionHandler(CHArchTrapFrame *Frame) { fixme("Overflow exception"); }
SafeFunction void BoundRangeExceptionHandler(CHArchTrapFrame *Frame) { fixme("Bound range exception"); }
SafeFunction void InvalidOpcodeExceptionHandler(CHArchTrapFrame *Frame) SafeFunction void InvalidOpcodeExceptionHandler(CHArchTrapFrame *Frame)
{ {
CrashHandler::EHPrint("\eDD2920System crashed!\n"); CrashHandler::EHPrint("\eDD2920System crashed!\n");
CrashHandler::EHPrint("Kernel tried to execute an invalid opcode.\n"); CrashHandler::EHPrint("Kernel tried to execute an invalid opcode.\n");
UNUSED(Frame);
}
SafeFunction void DeviceNotAvailableExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Device not available exception");
UNUSED(Frame);
}
SafeFunction void DoubleFaultExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Double fault exception");
UNUSED(Frame);
}
SafeFunction void CoprocessorSegmentOverrunExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Coprocessor segment overrun exception");
UNUSED(Frame);
}
SafeFunction void InvalidTSSExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Invalid TSS exception");
UNUSED(Frame);
}
SafeFunction void SegmentNotPresentExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Segment not present exception");
UNUSED(Frame);
} }
SafeFunction void DeviceNotAvailableExceptionHandler(CHArchTrapFrame *Frame) { fixme("Device not available exception"); }
SafeFunction void DoubleFaultExceptionHandler(CHArchTrapFrame *Frame) { fixme("Double fault exception"); }
SafeFunction void CoprocessorSegmentOverrunExceptionHandler(CHArchTrapFrame *Frame) { fixme("Coprocessor segment overrun exception"); }
SafeFunction void InvalidTSSExceptionHandler(CHArchTrapFrame *Frame) { fixme("Invalid TSS exception"); }
SafeFunction void SegmentNotPresentExceptionHandler(CHArchTrapFrame *Frame) { fixme("Segment not present exception"); }
SafeFunction void StackFaultExceptionHandler(CHArchTrapFrame *Frame) SafeFunction void StackFaultExceptionHandler(CHArchTrapFrame *Frame)
{ {
CPU::x64::SelectorErrorCode SelCode = {.raw = Frame->ErrorCode}; CPU::x64::SelectorErrorCode SelCode = {.raw = Frame->ErrorCode};
@ -229,10 +268,38 @@ SafeFunction void PageFaultExceptionHandler(CHArchTrapFrame *Frame)
} }
#endif #endif
} }
SafeFunction void x87FloatingPointExceptionHandler(CHArchTrapFrame *Frame) { fixme("x87 floating point exception"); } SafeFunction void x87FloatingPointExceptionHandler(CHArchTrapFrame *Frame)
SafeFunction void AlignmentCheckExceptionHandler(CHArchTrapFrame *Frame) { fixme("Alignment check exception"); } {
SafeFunction void MachineCheckExceptionHandler(CHArchTrapFrame *Frame) { fixme("Machine check exception"); } fixme("x87 floating point exception");
SafeFunction void SIMDFloatingPointExceptionHandler(CHArchTrapFrame *Frame) { fixme("SIMD floating point exception"); } UNUSED(Frame);
SafeFunction void VirtualizationExceptionHandler(CHArchTrapFrame *Frame) { fixme("Virtualization exception"); } }
SafeFunction void SecurityExceptionHandler(CHArchTrapFrame *Frame) { fixme("Security exception"); } SafeFunction void AlignmentCheckExceptionHandler(CHArchTrapFrame *Frame)
SafeFunction void UnknownExceptionHandler(CHArchTrapFrame *Frame) { fixme("Unknown exception"); } {
fixme("Alignment check exception");
UNUSED(Frame);
}
SafeFunction void MachineCheckExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Machine check exception");
UNUSED(Frame);
}
SafeFunction void SIMDFloatingPointExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("SIMD floating point exception");
UNUSED(Frame);
}
SafeFunction void VirtualizationExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Virtualization exception");
UNUSED(Frame);
}
SafeFunction void SecurityExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Security exception");
UNUSED(Frame);
}
SafeFunction void UnknownExceptionHandler(CHArchTrapFrame *Frame)
{
fixme("Unknown exception");
UNUSED(Frame);
}

View File

@ -110,6 +110,7 @@ namespace CrashHandler
SafeFunction void CrashKeyboardDriver::OnInterruptReceived(void *Frame) SafeFunction void CrashKeyboardDriver::OnInterruptReceived(void *Frame)
#endif #endif
{ {
UNUSED(Frame);
uint8_t scanCode = inb(0x60); uint8_t scanCode = inb(0x60);
if (scanCode == KEY_D_TAB || if (scanCode == KEY_D_TAB ||
scanCode == KEY_D_LCTRL || scanCode == KEY_D_LCTRL ||

View File

@ -20,5 +20,6 @@ namespace CrashHandler
SafeFunction void DisplayConsoleScreen(CRData data) SafeFunction void DisplayConsoleScreen(CRData data)
{ {
EHPrint("TODO"); EHPrint("TODO");
UNUSED(data);
} }
} }

View File

@ -11,7 +11,7 @@ using namespace UniversalAsynchronousReceiverTransmitter;
static inline __no_instrument_function void uart_wrapper(char c, void *unused) static inline __no_instrument_function void uart_wrapper(char c, void *unused)
{ {
UART(COM1).Write(c); UART(COM1).Write(c);
(void)unused; UNUSED(unused);
} }
static inline __no_instrument_function void WritePrefix(DebugLevel Level, const char *File, int Line, const char *Function) static inline __no_instrument_function void WritePrefix(DebugLevel Level, const char *File, int Line, const char *Function)

View File

@ -197,6 +197,7 @@ namespace Driver
{ {
SmartCriticalSection(DriverInterruptLock); SmartCriticalSection(DriverInterruptLock);
((int (*)(void *))(Handle))(Data); ((int (*)(void *))(Handle))(Data);
UNUSED(Frame);
} }
DriverInterruptHook::DriverInterruptHook(int Interrupt, void *Address, void *ParamData) : Interrupts::Handler(Interrupt) DriverInterruptHook::DriverInterruptHook(int Interrupt, void *Address, void *ParamData) : Interrupts::Handler(Interrupt)

View File

@ -69,25 +69,35 @@ void *Drivermemset(void *Destination, int Value, unsigned long Size)
void DriverNetSend(unsigned int DriverID, unsigned char *Data, unsigned short Size) void DriverNetSend(unsigned int DriverID, unsigned char *Data, unsigned short Size)
{ {
DumpData("DriverNetSend", Data, Size); DumpData("DriverNetSend", Data, Size);
UNUSED(DriverID);
} }
void DriverNetReceive(unsigned int DriverID, unsigned char *Data, unsigned short Size) void DriverNetReceive(unsigned int DriverID, unsigned char *Data, unsigned short Size)
{ {
DumpData("DriverNetReceive", Data, Size); DumpData("DriverNetReceive", Data, Size);
UNUSED(DriverID);
} }
void DriverAHCIDiskRead(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port) void DriverAHCIDiskRead(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port)
{ {
DumpData("DriverDiskRead", Data, SectorCount * 512); DumpData("DriverDiskRead", Data, SectorCount * 512);
UNUSED(DriverID);
UNUSED(Sector);
UNUSED(Port);
} }
void DriverAHCIDiskWrite(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port) void DriverAHCIDiskWrite(unsigned int DriverID, unsigned long Sector, unsigned char *Data, unsigned int SectorCount, unsigned char Port)
{ {
DumpData("DriverDiskWrite", Data, SectorCount * 512); DumpData("DriverDiskWrite", Data, SectorCount * 512);
UNUSED(DriverID);
UNUSED(Sector);
UNUSED(Port);
} }
char *DriverPCIGetDeviceName(unsigned int VendorID, unsigned int DeviceID) char *DriverPCIGetDeviceName(unsigned int VendorID, unsigned int DeviceID)
{ {
UNUSED(VendorID);
UNUSED(DeviceID);
return (char *)"Unknown"; return (char *)"Unknown";
} }

View File

@ -16,6 +16,8 @@ namespace Driver
{ {
DriverCode Driver::DriverLoadBindInput(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf) DriverCode Driver::DriverLoadBindInput(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf)
{ {
UNUSED(DrvExtHdr);
UNUSED(IsElf);
Memory::Tracker *Tracker = new Memory::Tracker; Memory::Tracker *Tracker = new Memory::Tracker;
Fex *fex = (Fex *)Tracker->RequestPages(TO_PAGES(Size)); Fex *fex = (Fex *)Tracker->RequestPages(TO_PAGES(Size));
memcpy(fex, (void *)DriverAddress, Size); memcpy(fex, (void *)DriverAddress, Size);

View File

@ -16,6 +16,7 @@ namespace Driver
{ {
DriverCode Driver::DriverLoadBindInterrupt(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf) DriverCode Driver::DriverLoadBindInterrupt(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf)
{ {
UNUSED(IsElf);
Memory::Tracker *Tracker = new Memory::Tracker; Memory::Tracker *Tracker = new Memory::Tracker;
Fex *fex = (Fex *)Tracker->RequestPages(TO_PAGES(Size)); Fex *fex = (Fex *)Tracker->RequestPages(TO_PAGES(Size));
memcpy(fex, (void *)DriverAddress, Size); memcpy(fex, (void *)DriverAddress, Size);

View File

@ -16,6 +16,7 @@ namespace Driver
{ {
DriverCode Driver::DriverLoadBindPCI(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf) DriverCode Driver::DriverLoadBindPCI(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf)
{ {
UNUSED(IsElf);
for (unsigned long Vidx = 0; Vidx < sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.VendorID) / sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.VendorID[0]); Vidx++) for (unsigned long Vidx = 0; Vidx < sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.VendorID) / sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.VendorID[0]); Vidx++)
for (unsigned long Didx = 0; Didx < sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.DeviceID) / sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.DeviceID[0]); Didx++) for (unsigned long Didx = 0; Didx < sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.DeviceID) / sizeof(((FexExtended *)DrvExtHdr)->Driver.Bind.PCI.DeviceID[0]); Didx++)
{ {

View File

@ -17,6 +17,9 @@ namespace Driver
DriverCode Driver::DriverLoadBindProcess(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf) DriverCode Driver::DriverLoadBindProcess(void *DrvExtHdr, uintptr_t DriverAddress, size_t Size, bool IsElf)
{ {
fixme("Process driver: %s", ((FexExtended *)DrvExtHdr)->Driver.Name); fixme("Process driver: %s", ((FexExtended *)DrvExtHdr)->Driver.Name);
UNUSED(Size);
UNUSED(DriverAddress);
UNUSED(IsElf);
return DriverCode::NOT_IMPLEMENTED; return DriverCode::NOT_IMPLEMENTED;
} }
} }

View File

@ -346,8 +346,10 @@ void operator delete[](void *Pointer)
void operator delete(void *Pointer, long unsigned int Size) void operator delete(void *Pointer, long unsigned int Size)
{ {
HeapFree(Pointer); HeapFree(Pointer);
UNUSED(Size);
} }
void operator delete[](void *Pointer, long unsigned int Size) void operator delete[](void *Pointer, long unsigned int Size)
{ {
HeapFree(Pointer); HeapFree(Pointer);
UNUSED(Size);
} }

View File

@ -30,63 +30,313 @@ __ubsan_handle_pointer_overflow_abort
__ubsan_handle_cfi_check_fail __ubsan_handle_cfi_check_fail
*/ */
extern void __asan_report_load1(void *unknown) { ubsan("load1"); } extern void __asan_report_load1(void *unknown)
extern void __asan_report_load2(void *unknown) { ubsan("load2"); } {
extern void __asan_report_load4(void *unknown) { ubsan("load4"); } ubsan("load1");
extern void __asan_report_load8(void *unknown) { ubsan("load8"); } UNUSED(unknown);
extern void __asan_report_load16(void *unknown) { ubsan("load16"); } }
extern void __asan_report_load_n(void *unknown, uintptr_t size) { ubsan("loadn"); }
extern void __asan_report_store1(void *unknown) { ubsan("store1"); } extern void __asan_report_load2(void *unknown)
extern void __asan_report_store2(void *unknown) { ubsan("store2"); } {
extern void __asan_report_store4(void *unknown) { ubsan("store4"); } ubsan("load2");
extern void __asan_report_store8(void *unknown) { ubsan("store8"); } UNUSED(unknown);
extern void __asan_report_store16(void *unknown) { ubsan("store16"); } }
extern void __asan_report_store_n(void *unknown, uintptr_t size) { ubsan("storen"); }
extern void __asan_report_load1_noabort(void *unknown) { ubsan("load1"); } extern void __asan_report_load4(void *unknown)
extern void __asan_report_load2_noabort(void *unknown) { ubsan("load2"); } {
extern void __asan_report_load4_noabort(void *unknown) { ubsan("load4"); } ubsan("load4");
extern void __asan_report_load8_noabort(void *unknown) { ubsan("load8"); } UNUSED(unknown);
extern void __asan_report_load16_noabort(void *unknown) { ubsan("load16"); } }
extern void __asan_report_load_n_noabort(void *unknown, uintptr_t size) { ubsan("loadn"); }
extern void __asan_report_store1_noabort(void *unknown) { ubsan("store1"); } extern void __asan_report_load8(void *unknown)
extern void __asan_report_store2_noabort(void *unknown) { ubsan("store2"); } {
extern void __asan_report_store4_noabort(void *unknown) { ubsan("store4"); } ubsan("load8");
extern void __asan_report_store8_noabort(void *unknown) { ubsan("store8"); } UNUSED(unknown);
extern void __asan_report_store16_noabort(void *unknown) { ubsan("store16"); } }
extern void __asan_report_store_n_noabort(void *unknown, uintptr_t size) { ubsan("storen"); }
extern void __asan_stack_malloc_0(uintptr_t size) { ubsan("stack malloc 0"); } extern void __asan_report_load16(void *unknown)
extern void __asan_stack_malloc_1(uintptr_t size) { ubsan("stack malloc 1"); } {
extern void __asan_stack_malloc_2(uintptr_t size) { ubsan("stack malloc 2"); } ubsan("load16");
extern void __asan_stack_malloc_3(uintptr_t size) { ubsan("stack malloc 3"); } UNUSED(unknown);
extern void __asan_stack_malloc_4(uintptr_t size) { ubsan("stack malloc 4"); } }
extern void __asan_stack_malloc_5(uintptr_t size) { ubsan("stack malloc 5"); }
extern void __asan_stack_malloc_6(uintptr_t size) { ubsan("stack malloc 6"); }
extern void __asan_stack_malloc_7(uintptr_t size) { ubsan("stack malloc 7"); }
extern void __asan_stack_malloc_8(uintptr_t size) { ubsan("stack malloc 8"); }
extern void __asan_stack_malloc_9(uintptr_t size) { ubsan("stack malloc 9"); }
extern void __asan_stack_free_0(void *ptr, uintptr_t size) { ubsan("stack free 0"); } extern void __asan_report_load_n(void *unknown, uintptr_t size)
extern void __asan_stack_free_1(void *ptr, uintptr_t size) { ubsan("stack free 1"); } {
extern void __asan_stack_free_2(void *ptr, uintptr_t size) { ubsan("stack free 2"); } ubsan("loadn");
extern void __asan_stack_free_3(void *ptr, uintptr_t size) { ubsan("stack free 3"); } UNUSED(unknown);
extern void __asan_stack_free_4(void *ptr, uintptr_t size) { ubsan("stack free 4"); } UNUSED(size);
extern void __asan_stack_free_5(void *ptr, uintptr_t size) { ubsan("stack free 5"); } }
extern void __asan_stack_free_6(void *ptr, uintptr_t size) { ubsan("stack free 6"); }
extern void __asan_stack_free_7(void *ptr, uintptr_t size) { ubsan("stack free 7"); }
extern void __asan_stack_free_8(void *ptr, uintptr_t size) { ubsan("stack free 8"); }
extern void __asan_stack_free_9(void *ptr, uintptr_t size) { ubsan("stack free 9"); }
extern void __asan_poison_stack_memory(void *addr, uintptr_t size) { ubsan("poison stack memory"); } extern void __asan_report_store1(void *unknown)
extern void __asan_unpoison_stack_memory(void *addr, uintptr_t size) { ubsan("unpoison stack memory"); } {
ubsan("store1");
UNUSED(unknown);
}
extern void __asan_report_store2(void *unknown)
{
ubsan("store2");
UNUSED(unknown);
}
extern void __asan_report_store4(void *unknown)
{
ubsan("store4");
UNUSED(unknown);
}
extern void __asan_report_store8(void *unknown)
{
ubsan("store8");
UNUSED(unknown);
}
extern void __asan_report_store16(void *unknown)
{
ubsan("store16");
UNUSED(unknown);
}
extern void __asan_report_store_n(void *unknown, uintptr_t size)
{
ubsan("storen");
UNUSED(unknown);
UNUSED(size);
}
extern void __asan_report_load1_noabort(void *unknown)
{
ubsan("load1");
UNUSED(unknown);
}
extern void __asan_report_load2_noabort(void *unknown)
{
ubsan("load2");
UNUSED(unknown);
}
extern void __asan_report_load4_noabort(void *unknown)
{
ubsan("load4");
UNUSED(unknown);
}
extern void __asan_report_load8_noabort(void *unknown)
{
ubsan("load8");
UNUSED(unknown);
}
extern void __asan_report_load16_noabort(void *unknown)
{
ubsan("load16");
UNUSED(unknown);
}
extern void __asan_report_load_n_noabort(void *unknown, uintptr_t size)
{
ubsan("loadn");
UNUSED(unknown);
UNUSED(size);
}
extern void __asan_report_store1_noabort(void *unknown)
{
ubsan("store1");
UNUSED(unknown);
}
extern void __asan_report_store2_noabort(void *unknown)
{
ubsan("store2");
UNUSED(unknown);
}
extern void __asan_report_store4_noabort(void *unknown)
{
ubsan("store4");
UNUSED(unknown);
}
extern void __asan_report_store8_noabort(void *unknown)
{
ubsan("store8");
UNUSED(unknown);
}
extern void __asan_report_store16_noabort(void *unknown)
{
ubsan("store16");
UNUSED(unknown);
}
extern void __asan_report_store_n_noabort(void *unknown, uintptr_t size)
{
ubsan("storen");
UNUSED(unknown);
UNUSED(size);
}
extern void __asan_stack_malloc_0(uintptr_t size)
{
ubsan("stack malloc 0");
UNUSED(size);
}
extern void __asan_stack_malloc_1(uintptr_t size)
{
ubsan("stack malloc 1");
UNUSED(size);
}
extern void __asan_stack_malloc_2(uintptr_t size)
{
ubsan("stack malloc 2");
UNUSED(size);
}
extern void __asan_stack_malloc_3(uintptr_t size)
{
ubsan("stack malloc 3");
UNUSED(size);
}
extern void __asan_stack_malloc_4(uintptr_t size)
{
ubsan("stack malloc 4");
UNUSED(size);
}
extern void __asan_stack_malloc_5(uintptr_t size)
{
ubsan("stack malloc 5");
UNUSED(size);
}
extern void __asan_stack_malloc_6(uintptr_t size)
{
ubsan("stack malloc 6");
UNUSED(size);
}
extern void __asan_stack_malloc_7(uintptr_t size)
{
ubsan("stack malloc 7");
UNUSED(size);
}
extern void __asan_stack_malloc_8(uintptr_t size)
{
ubsan("stack malloc 8");
UNUSED(size);
}
extern void __asan_stack_malloc_9(uintptr_t size)
{
ubsan("stack malloc 9");
UNUSED(size);
}
extern void __asan_stack_free_0(void *ptr, uintptr_t size)
{
ubsan("stack free 0");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_1(void *ptr, uintptr_t size)
{
ubsan("stack free 1");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_2(void *ptr, uintptr_t size)
{
ubsan("stack free 2");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_3(void *ptr, uintptr_t size)
{
ubsan("stack free 3");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_4(void *ptr, uintptr_t size)
{
ubsan("stack free 4");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_5(void *ptr, uintptr_t size)
{
ubsan("stack free 5");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_6(void *ptr, uintptr_t size)
{
ubsan("stack free 6");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_7(void *ptr, uintptr_t size)
{
ubsan("stack free 7");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_8(void *ptr, uintptr_t size)
{
ubsan("stack free 8");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_stack_free_9(void *ptr, uintptr_t size)
{
ubsan("stack free 9");
UNUSED(ptr);
UNUSED(size);
}
extern void __asan_poison_stack_memory(void *addr, uintptr_t size)
{
ubsan("poison stack memory");
UNUSED(addr);
UNUSED(size);
}
extern void __asan_unpoison_stack_memory(void *addr, uintptr_t size)
{
ubsan("unpoison stack memory");
UNUSED(addr);
UNUSED(size);
}
extern void __asan_before_dynamic_init(const char *module_name)
{
ubsan("before dynamic init");
UNUSED(module_name);
}
extern void __asan_before_dynamic_init(const char *module_name) { ubsan("before dynamic init"); }
extern void __asan_after_dynamic_init(void) { ubsan("after dynamic init"); } extern void __asan_after_dynamic_init(void) { ubsan("after dynamic init"); }
extern void __asan_register_globals(void *unknown, size_t size) { ubsan("register_globals"); } extern void __asan_register_globals(void *unknown, size_t size)
{
ubsan("register_globals");
UNUSED(unknown);
UNUSED(size);
}
extern void __asan_unregister_globals(void) { ubsan("unregister_globals"); } extern void __asan_unregister_globals(void) { ubsan("unregister_globals"); }
extern void __asan_init(void) { ubsan("init"); } extern void __asan_init(void) { ubsan("init"); }
@ -291,4 +541,5 @@ void __ubsan_handle_dynamic_type_cache_miss(struct dynamic_type_cache_miss_data
{ {
if (UBSANMsg(data->location.file, data->location.line, data->location.column)) if (UBSANMsg(data->location.file, data->location.line, data->location.column))
ubsan("Dynamic type cache miss."); ubsan("Dynamic type cache miss.");
UNUSED(ptr);
} }

View File

@ -320,7 +320,6 @@ namespace FileSystem
if (strcmp(Path, ".") == 0) if (strcmp(Path, ".") == 0)
{ {
FILE *file = new FILE; FILE *file = new FILE;
FileStatus filestatus = FileStatus::OK;
file->Node = Parent; file->Node = Parent;
if (unlikely(!file->Node)) if (unlikely(!file->Node))
file->Status = FileStatus::NOT_FOUND; file->Status = FileStatus::NOT_FOUND;
@ -336,7 +335,6 @@ namespace FileSystem
Parent = Parent->Parent; Parent = Parent->Parent;
FILE *file = new FILE; FILE *file = new FILE;
FileStatus filestatus = FileStatus::OK;
file->Node = Parent; file->Node = Parent;
if (!file->Node) if (!file->Node)
file->Status = FileStatus::NOT_FOUND; file->Status = FileStatus::NOT_FOUND;

View File

@ -13,10 +13,15 @@ EXTERNC void fprintf(FILE *stream, const char *Format, ...)
va_start(args, Format); va_start(args, Format);
vprintf_(Format, args); vprintf_(Format, args);
va_end(args); va_end(args);
UNUSED(stream);
} }
// TODO: Implement proper fputs // TODO: Implement proper fputs
EXTERNC void fputs(const char *s, FILE *stream) { printf_("%s", s); } EXTERNC void fputs(const char *s, FILE *stream)
{
printf_("%s", s);
UNUSED(stream);
}
static struct cag_option ConfigOptions[] = { static struct cag_option ConfigOptions[] = {
{.identifier = 'a', {.identifier = 'a',

View File

@ -358,8 +358,8 @@ static inline __no_instrument_function void append_termination_with_gadget(outpu
// only takes pointers to functions with an extra argument // only takes pointers to functions with an extra argument
static inline __no_instrument_function void putchar_wrapper(char c, void *unused) static inline __no_instrument_function void putchar_wrapper(char c, void *unused)
{ {
(void)unused;
putchar(c); putchar(c);
UNUSED(unused);
} }
static inline __no_instrument_function output_gadget_t discarding_gadget(void) static inline __no_instrument_function output_gadget_t discarding_gadget(void)

View File

@ -15,7 +15,7 @@ static inline SafeFunction __no_instrument_function void profiler_uart_wrapper(c
bool renable = EnableProfiler; bool renable = EnableProfiler;
EnableProfiler = false; EnableProfiler = false;
UART(COM2).Write(c); UART(COM2).Write(c);
(void)unused; UNUSED(unused);
if (renable) if (renable)
EnableProfiler = true; EnableProfiler = true;
} }

View File

@ -41,7 +41,7 @@ struct gcov_info
static inline SafeFunction __no_instrument_function void gcov_uart_wrapper(char c, void *unused) static inline SafeFunction __no_instrument_function void gcov_uart_wrapper(char c, void *unused)
{ {
UART(COM2).Write(c); UART(COM2).Write(c);
(void)unused; UNUSED(unused);
} }
// TODO: Implement // TODO: Implement
@ -60,8 +60,12 @@ EXTERNC SafeFunction __no_instrument_function void __gcov_flush(void)
EXTERNC SafeFunction __no_instrument_function void __gcov_merge_add(gcov_type *counters, unsigned int n_counters) EXTERNC SafeFunction __no_instrument_function void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
{ {
UNUSED(counters);
UNUSED(n_counters);
} }
EXTERNC SafeFunction __no_instrument_function void __gcov_merge_single(gcov_type *counters, unsigned int n_counters) EXTERNC SafeFunction __no_instrument_function void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
{ {
UNUSED(counters);
UNUSED(n_counters);
} }

View File

@ -9,11 +9,13 @@ using namespace UniversalAsynchronousReceiverTransmitter;
static inline SafeFunction __no_instrument_function void gprof_uart_wrapper(char c, void *unused) static inline SafeFunction __no_instrument_function void gprof_uart_wrapper(char c, void *unused)
{ {
UART(COM2).Write(c); UART(COM2).Write(c);
(void)unused; UNUSED(unused);
} }
EXTERNC SafeFunction __no_instrument_function void mcount(unsigned long frompc, unsigned long selfpc) EXTERNC SafeFunction __no_instrument_function void mcount(unsigned long frompc, unsigned long selfpc)
{ {
// TODO: Implement // TODO: Implement
/* https://docs.kernel.org/trace/ftrace-design.html */ /* https://docs.kernel.org/trace/ftrace-design.html */
UNUSED(frompc);
UNUSED(selfpc);
} }

View File

@ -11,6 +11,7 @@ static int sys_exit(SyscallsFrame *Frame, int code)
trace("Userspace thread %s(%lld) exited with code %#llx", TaskManager->GetCurrentThread()->Name, TaskManager->GetCurrentThread()->ID, code); trace("Userspace thread %s(%lld) exited with code %#llx", TaskManager->GetCurrentThread()->Name, TaskManager->GetCurrentThread()->ID, code);
TaskManager->GetCurrentThread()->ExitCode = code; TaskManager->GetCurrentThread()->ExitCode = code;
TaskManager->GetCurrentThread()->Status = Tasking::TaskStatus::Terminated; TaskManager->GetCurrentThread()->Status = Tasking::TaskStatus::Terminated;
UNUSED(Frame);
return 0; return 0;
} }
@ -20,23 +21,31 @@ static int sys_print(SyscallsFrame *Frame, char Char, int Index)
#ifdef DEBUG #ifdef DEBUG
Display->SetBuffer(Index); Display->SetBuffer(Index);
#endif #endif
UNUSED(Frame);
return ret; return ret;
} }
static uintptr_t sys_request_pages(SyscallsFrame *Frame, size_t Count) static uintptr_t sys_request_pages(SyscallsFrame *Frame, size_t Count)
{ {
UNUSED(Frame);
return (uintptr_t)TaskManager->GetCurrentThread()->Memory->RequestPages(Count); return (uintptr_t)TaskManager->GetCurrentThread()->Memory->RequestPages(Count);
} }
static int sys_free_pages(SyscallsFrame *Frame, uintptr_t Address, size_t Count) static int sys_free_pages(SyscallsFrame *Frame, uintptr_t Address, size_t Count)
{ {
TaskManager->GetCurrentThread()->Memory->FreePages((void *)Address, Count); TaskManager->GetCurrentThread()->Memory->FreePages((void *)Address, Count);
UNUSED(Frame);
return 0; return 0;
} }
static int sys_kernelctl(SyscallsFrame *Frame, int Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4) static int sys_kernelctl(SyscallsFrame *Frame, int Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4)
{ {
fixme("KernelCTL: %lld", Command); fixme("KernelCTL: %lld", Command);
UNUSED(Arg1);
UNUSED(Arg2);
UNUSED(Arg3);
UNUSED(Arg4);
UNUSED(Frame);
return 0; return 0;
} }

View File

@ -90,6 +90,9 @@ namespace InterProcessCommunication
handle->Listening = 1; handle->Listening = 1;
handle->Error = IPCSuccess; handle->Error = IPCSuccess;
// FIXME: ID is not used.
UNUSED(ID);
return IPCError{IPCSuccess}; return IPCError{IPCSuccess};
} }

View File

@ -45,12 +45,14 @@ namespace Tasking
bool Security::UntrustToken(Token token) bool Security::UntrustToken(Token token)
{ {
fixme("UntrustToken->false"); fixme("UntrustToken->false");
UNUSED(token);
return false; return false;
} }
bool Security::DestroyToken(Token token) bool Security::DestroyToken(Token token)
{ {
fixme("DestroyToken->false"); fixme("DestroyToken->false");
UNUSED(token);
return false; return false;
} }

View File

@ -546,6 +546,12 @@ namespace CPU
asmv("cpuid" asmv("cpuid"
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
: "a"(Function)); : "a"(Function));
#else
UNUSED(Function);
UNUSED(eax);
UNUSED(ebx);
UNUSED(ecx);
UNUSED(edx);
#endif #endif
} }
@ -556,9 +562,11 @@ namespace CPU
: :
: "r"(Address) : "r"(Address)
: "memory"); : "memory");
#else
UNUSED(Address);
#endif #endif
} }
/** @brief EXPERIMENTAL IMPLEMENTATION */ /** @brief EXPERIMENTAL IMPLEMENTATION */
namespace Intel namespace Intel
{ {
@ -3066,7 +3074,7 @@ namespace CPU
/* @brief Enable Protection Keys for Supervisor Mode Pages */ /* @brief Enable Protection Keys for Supervisor Mode Pages */
uint32_t PKS : 1; uint32_t PKS : 1;
/** @brief Reserved */ /** @brief Reserved */
uint64_t Reserved2 : 7; // TODO: This could be wrong uint64_t Reserved2 : 7; // TODO: This could be wrong
}; };
uint64_t raw; uint64_t raw;
} CR4; } CR4;

View File

@ -94,8 +94,22 @@ namespace Disk
PartitionStyle Style = PartitionStyle::Unknown; PartitionStyle Style = PartitionStyle::Unknown;
size_t Index = 0; size_t Index = 0;
size_t Read(size_t Offset, size_t Count, uint8_t *Buffer) { return 0; } size_t Read(size_t Offset, size_t Count, uint8_t *Buffer)
size_t Write(size_t Offset, size_t Count, uint8_t *Buffer) { return 0; } {
return 0;
UNUSED(Offset);
UNUSED(Count);
UNUSED(Buffer);
}
size_t Write(size_t Offset, size_t Count, uint8_t *Buffer)
{
return 0;
UNUSED(Offset);
UNUSED(Count);
UNUSED(Buffer);
}
Partition() {} Partition() {}
~Partition() {} ~Partition() {}
}; };
@ -111,8 +125,22 @@ namespace Disk
bool MechanicalDisk = false; bool MechanicalDisk = false;
size_t UniqueIdentifier = 0xdeadbeef; size_t UniqueIdentifier = 0xdeadbeef;
size_t Read(size_t Offset, size_t Count, uint8_t *Buffer) { return 0; } size_t Read(size_t Offset, size_t Count, uint8_t *Buffer)
size_t Write(size_t Offset, size_t Count, uint8_t *Buffer) { return 0; } {
return 0;
UNUSED(Offset);
UNUSED(Count);
UNUSED(Buffer);
}
size_t Write(size_t Offset, size_t Count, uint8_t *Buffer)
{
return 0;
UNUSED(Offset);
UNUSED(Count);
UNUSED(Buffer);
}
Drive() Drive()
{ // TODO: Allocate buffer { // TODO: Allocate buffer
} }

View File

@ -58,12 +58,12 @@ namespace UniversalAsynchronousReceiverTransmitter
* @param Char the sent character. * @param Char the sent character.
*/ */
virtual void OnSent(uint8_t Char) {} virtual void OnSent(uint8_t Char) { UNUSED(Char); }
/** /**
* @brief Called when a character is received. * @brief Called when a character is received.
* @param Char the received character. * @param Char the received character.
*/ */
virtual void OnReceived(uint8_t Char) {} virtual void OnReceived(uint8_t Char) { UNUSED(Char); }
}; };
} }