summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Arch/x86/Interrupts.h18
-rw-r--r--Kernel/Syscall.cpp70
2 files changed, 48 insertions, 40 deletions
diff --git a/Kernel/Arch/x86/Interrupts.h b/Kernel/Arch/x86/Interrupts.h
index d9d9b8285b..63a666f33d 100644
--- a/Kernel/Arch/x86/Interrupts.h
+++ b/Kernel/Arch/x86/Interrupts.h
@@ -15,13 +15,17 @@ class GenericInterruptHandeler;
extern "C" void interrupt_common_asm_entry();
-#define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(isr_number) \
- extern "C" void interrupt_##isr_number##_asm_entry(); \
- asm(".globl interrupt_" #isr_number "_asm_entry\n" \
- "interrupt_" #isr_number "_asm_entry:\n" \
- " pushw $" #isr_number "\n" \
- " pushw $0\n" \
- " jmp interrupt_common_asm_entry\n");
+#define GENERATE_GENERIC_INTERRUPT_HANDLER_ASM_ENTRY(isr_number) \
+ 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" \
+ "interrupt_" #isr_number "_asm_entry:\n" \
+ " pushw $" #isr_number "\n" \
+ " pushw $0\n" \
+ " jmp interrupt_common_asm_entry\n"); \
+ }
void register_interrupt_handler(u8 number, void (*handler)());
void register_user_callable_interrupt_handler(u8 number, void (*handler)());
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index 77efffc0c7..49da400045 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -16,43 +16,47 @@ namespace Kernel {
extern "C" void syscall_handler(TrapFrame*) __attribute__((used));
extern "C" void syscall_asm_entry();
-// clang-format off
+static void syscall_asm_entry_dummy() __attribute__((used));
+NEVER_INLINE void syscall_asm_entry_dummy()
+{
+ // clang-format off
#if ARCH(I386)
-asm(
- ".globl syscall_asm_entry\n"
- "syscall_asm_entry:\n"
- " pushl $0x0\n"
- " pusha\n"
- " pushl %ds\n"
- " pushl %es\n"
- " pushl %fs\n"
- " pushl %gs\n"
- " pushl %ss\n"
- " mov $" __STRINGIFY(GDT_SELECTOR_DATA0) ", %ax\n"
- " mov %ax, %ds\n"
- " mov %ax, %es\n"
- " mov $" __STRINGIFY(GDT_SELECTOR_PROC) ", %ax\n"
- " mov %ax, %fs\n"
- " cld\n"
- " xor %esi, %esi\n"
- " xor %edi, %edi\n"
- " pushl %esp \n" // set TrapFrame::regs
- " subl $" __STRINGIFY(TRAP_FRAME_SIZE - 4) ", %esp \n"
- " movl %esp, %ebx \n"
- " pushl %ebx \n" // push pointer to TrapFrame
- " call enter_trap_no_irq \n"
- " movl %ebx, 0(%esp) \n" // push pointer to TrapFrame
- " call syscall_handler \n"
- " movl %ebx, 0(%esp) \n" // push pointer to TrapFrame
- " jmp common_trap_exit \n");
+ asm(
+ ".globl syscall_asm_entry\n"
+ "syscall_asm_entry:\n"
+ " pushl $0x0\n"
+ " pusha\n"
+ " pushl %ds\n"
+ " pushl %es\n"
+ " pushl %fs\n"
+ " pushl %gs\n"
+ " pushl %ss\n"
+ " mov $" __STRINGIFY(GDT_SELECTOR_DATA0) ", %ax\n"
+ " mov %ax, %ds\n"
+ " mov %ax, %es\n"
+ " mov $" __STRINGIFY(GDT_SELECTOR_PROC) ", %ax\n"
+ " mov %ax, %fs\n"
+ " cld\n"
+ " xor %esi, %esi\n"
+ " xor %edi, %edi\n"
+ " pushl %esp \n" // set TrapFrame::regs
+ " subl $" __STRINGIFY(TRAP_FRAME_SIZE - 4) ", %esp \n"
+ " movl %esp, %ebx \n"
+ " pushl %ebx \n" // push pointer to TrapFrame
+ " call enter_trap_no_irq \n"
+ " movl %ebx, 0(%esp) \n" // push pointer to TrapFrame
+ " call syscall_handler \n"
+ " movl %ebx, 0(%esp) \n" // push pointer to TrapFrame
+ " jmp common_trap_exit \n");
#elif ARCH(X86_64)
asm(
- ".globl syscall_asm_entry\n"
- "syscall_asm_entry:\n"
- " cli\n"
- " hlt\n");
+ ".globl syscall_asm_entry\n"
+ "syscall_asm_entry:\n"
+ " cli\n"
+ " hlt\n");
#endif
-// clang-format on
+ // clang-format on
+}
namespace Syscall {