mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:07:35 +00:00
Kernel: Tell compiler about invisible calls
This makes the Kernel build cleanly with -Wmissing-declarations.
This commit is contained in:
parent
8a41ce5cc7
commit
936d5dcc01
3 changed files with 47 additions and 28 deletions
|
@ -29,8 +29,9 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <Kernel/Arch/i386/CPU.h>
|
#include <Kernel/Arch/i386/CPU.h>
|
||||||
#include <Kernel/Arch/i386/ProcessorInfo.h>
|
|
||||||
#include <Kernel/Arch/i386/ISRStubs.h>
|
#include <Kernel/Arch/i386/ISRStubs.h>
|
||||||
|
#include <Kernel/Arch/i386/ProcessorInfo.h>
|
||||||
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/Interrupts/APIC.h>
|
#include <Kernel/Interrupts/APIC.h>
|
||||||
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
||||||
#include <Kernel/Interrupts/IRQHandler.h>
|
#include <Kernel/Interrupts/IRQHandler.h>
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include <Kernel/VM/PageDirectory.h>
|
#include <Kernel/VM/PageDirectory.h>
|
||||||
#include <Kernel/IO.h>
|
|
||||||
#include <LibC/mallocdefs.h>
|
#include <LibC/mallocdefs.h>
|
||||||
|
|
||||||
//#define PAGE_FAULT_DEBUG
|
//#define PAGE_FAULT_DEBUG
|
||||||
|
@ -58,6 +58,13 @@ static Descriptor s_idt[256];
|
||||||
|
|
||||||
static GenericInterruptHandler* s_interrupt_handler[GENERIC_INTERRUPT_HANDLERS_COUNT];
|
static GenericInterruptHandler* s_interrupt_handler[GENERIC_INTERRUPT_HANDLERS_COUNT];
|
||||||
|
|
||||||
|
// The compiler can't see the calls to these functions inside assembly.
|
||||||
|
// Declare them, to avoid dead code warnings.
|
||||||
|
extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread);
|
||||||
|
extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapFrame* trap);
|
||||||
|
extern "C" u32 do_init_context(Thread* thread, u32 flags);
|
||||||
|
extern "C" void pre_init_finished(void);
|
||||||
|
extern "C" void post_init_finished(void);
|
||||||
extern "C" void handle_interrupt(TrapFrame*);
|
extern "C" void handle_interrupt(TrapFrame*);
|
||||||
|
|
||||||
#define EH_ENTRY(ec, title) \
|
#define EH_ENTRY(ec, title) \
|
||||||
|
@ -337,7 +344,7 @@ void breakpoint_handler(TrapFrame* trap)
|
||||||
asm("movl %%cr4, %%eax" \
|
asm("movl %%cr4, %%eax" \
|
||||||
: "=a"(cr4)); \
|
: "=a"(cr4)); \
|
||||||
klog() << "CR0=" << String::format("%x", cr0) << " CR2=" << String::format("%x", cr2) << " CR3=" << String::format("%x", cr3) << " CR4=" << String::format("%x", cr4); \
|
klog() << "CR0=" << String::format("%x", cr0) << " CR2=" << String::format("%x", cr2) << " CR3=" << String::format("%x", cr3) << " CR4=" << String::format("%x", cr4); \
|
||||||
Processor::halt(); \
|
Processor::halt(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
EH(2, "Unknown error")
|
EH(2, "Unknown error")
|
||||||
|
@ -917,14 +924,14 @@ String Processor::features_string() const
|
||||||
};
|
};
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (u32 flag = 1; flag < sizeof(m_features) * 8; flag <<= 1) {
|
for (u32 flag = 1; flag < sizeof(m_features) * 8; flag <<= 1) {
|
||||||
if ((static_cast<u32>(m_features) & flag) != 0) {
|
if ((static_cast<u32>(m_features) & flag) != 0) {
|
||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
auto str = feature_to_str(static_cast<CPUFeature>(flag));
|
auto str = feature_to_str(static_cast<CPUFeature>(flag));
|
||||||
builder.append(str, strlen(str));
|
builder.append(str, strlen(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
@ -1176,7 +1183,7 @@ extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapF
|
||||||
(void)trap;
|
(void)trap;
|
||||||
|
|
||||||
#ifdef CONTEXT_SWITCH_DEBUG
|
#ifdef CONTEXT_SWITCH_DEBUG
|
||||||
dbg() << "switch_context <-- from " << VirtualAddress(from_thread) << " " << *from_thread << " to " << VirtualAddress(to_thread) << " " << *to_thread << " (context_first_init)";
|
dbg() << "switch_context <-- from " << VirtualAddress(from_thread) << " " << *from_thread << " to " << VirtualAddress(to_thread) << " " << *to_thread << " (context_first_init)";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ASSERT(to_thread == Thread::current());
|
ASSERT(to_thread == Thread::current());
|
||||||
|
@ -1300,7 +1307,6 @@ u32 Processor::init_context(Thread& thread, bool leave_crit)
|
||||||
return stack_top;
|
return stack_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" u32 do_init_context(Thread* thread, u32 flags)
|
extern "C" u32 do_init_context(Thread* thread, u32 flags)
|
||||||
{
|
{
|
||||||
ASSERT_INTERRUPTS_DISABLED();
|
ASSERT_INTERRUPTS_DISABLED();
|
||||||
|
@ -1646,7 +1652,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg, bool async)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Processor::smp_broadcast(void(*callback)(void*), void* data, void(*free_data)(void*), bool async)
|
void Processor::smp_broadcast(void (*callback)(void*), void* data, void (*free_data)(void*), bool async)
|
||||||
{
|
{
|
||||||
auto& msg = smp_get_from_pool();
|
auto& msg = smp_get_from_pool();
|
||||||
msg.type = ProcessorMessage::CallbackWithData;
|
msg.type = ProcessorMessage::CallbackWithData;
|
||||||
|
@ -1656,7 +1662,7 @@ void Processor::smp_broadcast(void(*callback)(void*), void* data, void(*free_dat
|
||||||
smp_broadcast_message(msg, async);
|
smp_broadcast_message(msg, async);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Processor::smp_broadcast(void(*callback)(), bool async)
|
void Processor::smp_broadcast(void (*callback)(), bool async)
|
||||||
{
|
{
|
||||||
auto& msg = smp_get_from_pool();
|
auto& msg = smp_get_from_pool();
|
||||||
msg.type = ProcessorMessage::CallbackWithData;
|
msg.type = ProcessorMessage::CallbackWithData;
|
||||||
|
|
|
@ -282,11 +282,6 @@ char* strstr(const char* haystack, const char* needle)
|
||||||
return const_cast<char*>(haystack);
|
return const_cast<char*>(haystack);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] void __cxa_pure_virtual()
|
|
||||||
{
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void* realloc(void* p, size_t s)
|
void* realloc(void* p, size_t s)
|
||||||
{
|
{
|
||||||
return krealloc(p, s);
|
return krealloc(p, s);
|
||||||
|
@ -297,6 +292,13 @@ void free(void* p)
|
||||||
return kfree(p);
|
return kfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Functions that are automatically called by the C++ compiler.
|
||||||
|
// Declare them first, to tell the silly compiler that they are indeed being used.
|
||||||
|
[[noreturn]] void __stack_chk_fail();
|
||||||
|
[[noreturn]] void __stack_chk_fail_local();
|
||||||
|
extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
|
||||||
|
[[noreturn]] void __cxa_pure_virtual();
|
||||||
|
|
||||||
[[noreturn]] void __stack_chk_fail()
|
[[noreturn]] void __stack_chk_fail()
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
@ -312,4 +314,9 @@ extern "C" int __cxa_atexit(void (*)(void*), void*, void*)
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void __cxa_pure_virtual()
|
||||||
|
{
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,12 @@ namespace Kernel {
|
||||||
[[noreturn]] static void init_stage2();
|
[[noreturn]] static void init_stage2();
|
||||||
static void setup_serial_debug();
|
static void setup_serial_debug();
|
||||||
|
|
||||||
|
// boot.S expects these functions precisely this this. We declare them here
|
||||||
|
// to ensure the signatures don't accidentally change.
|
||||||
|
extern "C" void init_finished(u32 cpu);
|
||||||
|
extern "C" [[noreturn]] void init_ap(u32 cpu, Processor* processor_info);
|
||||||
|
extern "C" [[noreturn]] void init();
|
||||||
|
|
||||||
VirtualConsole* tty0;
|
VirtualConsole* tty0;
|
||||||
|
|
||||||
static Processor s_bsp_processor; // global but let's keep it "private"
|
static Processor s_bsp_processor; // global but let's keep it "private"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue