#endif
+/*
+ * arch_syscall_init — Register the syscall entry point(s) for this
+ * architecture (e.g. INT 0x80 + SYSENTER on x86).
+ * Called once from the generic syscall_init().
+ */
+void arch_syscall_init(void);
+
#endif /* ARCH_SYSCALL_H */
#include "hal/cpu_features.h"
+#include "interrupts.h"
#include "console.h"
#include <stdint.h>
static uint8_t sysenter_stack[4096] __attribute__((aligned(16)));
static int sysenter_enabled = 0;
-void x86_sysenter_init(void) {
+static void x86_sysenter_init(void);
+
+/* Generic syscall_handler defined in src/kernel/syscall.c */
+extern void syscall_handler(struct registers*);
+
+void arch_syscall_init(void) {
+ register_interrupt_handler(128, syscall_handler);
+ x86_sysenter_init();
+}
+
+static void x86_sysenter_init(void) {
const struct cpu_features* f = hal_cpu_get_features();
if (!f->has_sysenter) {
kprintf("[SYSENTER] CPU does not support SYSENTER/SYSEXIT.\n");
#include "shm.h"
#include "socket.h"
-#if defined(__i386__)
-extern void x86_sysenter_init(void);
-#endif
#include "elf.h"
#include "stat.h"
#include "vmm.h"
}
void syscall_init(void) {
-#if defined(__i386__)
- register_interrupt_handler(128, syscall_handler);
- x86_sysenter_init();
-#endif
+ arch_syscall_init();
}