1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:07:45 +00:00

Kernel: Allow building the kernel with -O0

Unfortunately the kernel doesn't run with -O0 but at least it can be
successfully built with this change.
This commit is contained in:
Gunnar Beutner 2021-05-28 16:08:51 +02:00 committed by Linus Groh
parent b06d01f040
commit 4fca9ee060
2 changed files with 48 additions and 40 deletions

View file

@ -17,11 +17,15 @@ extern "C" void interrupt_common_asm_entry();
#define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(isr_number) \ #define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(isr_number) \
extern "C" void interrupt_##isr_number##_asm_entry(); \ extern "C" void interrupt_##isr_number##_asm_entry(); \
static void interrupt_##isr_number##_asm_entry_dummy() __attribute__((used)); \
NEVER_INLINE void interrupt_##isr_number##_asm_entry_dummy() \
{ \
asm(".globl interrupt_" #isr_number "_asm_entry\n" \ asm(".globl interrupt_" #isr_number "_asm_entry\n" \
"interrupt_" #isr_number "_asm_entry:\n" \ "interrupt_" #isr_number "_asm_entry:\n" \
" pushw $" #isr_number "\n" \ " pushw $" #isr_number "\n" \
" pushw $0\n" \ " pushw $0\n" \
" jmp interrupt_common_asm_entry\n"); " jmp interrupt_common_asm_entry\n"); \
}
void register_interrupt_handler(u8 number, void (*handler)()); void register_interrupt_handler(u8 number, void (*handler)());
void register_user_callable_interrupt_handler(u8 number, void (*handler)()); void register_user_callable_interrupt_handler(u8 number, void (*handler)());

View file

@ -16,6 +16,9 @@ namespace Kernel {
extern "C" void syscall_handler(TrapFrame*) __attribute__((used)); extern "C" void syscall_handler(TrapFrame*) __attribute__((used));
extern "C" void syscall_asm_entry(); extern "C" void syscall_asm_entry();
static void syscall_asm_entry_dummy() __attribute__((used));
NEVER_INLINE void syscall_asm_entry_dummy()
{
// clang-format off // clang-format off
#if ARCH(I386) #if ARCH(I386)
asm( asm(
@ -53,6 +56,7 @@ asm(
" hlt\n"); " hlt\n");
#endif #endif
// clang-format on // clang-format on
}
namespace Syscall { namespace Syscall {