Second Extended Filesystem (ext2) and other improvements (#33)
[lunaix-os.git] / lunaix-os / kernel / syscall.c
index 0d41470d8944ddff5b5ac0aba0da37309fb4ca28..cd3b80d9f8e743d97c72a28cea4dbfea004ce96e 100644 (file)
@@ -1,13 +1,19 @@
-#include <lunaix/syscall.h>
-#include <arch/x86/interrupts.h>
 #include <lunaix/process.h>
-#include <lunaix/sched.h>
-#include <lunaix/syslog.h>
+#include <lunaix/kpreempt.h>
 
-LOG_MODULE("SYSCALL")
+typedef reg_t (*syscall_fn)(reg_t p1, reg_t p2, reg_t p3, reg_t p4, reg_t p5);
 
-extern void syscall_hndlr(isr_param* param);
+reg_t
+dispatch_syscall(void* syscall_fnptr, 
+                 reg_t p1, reg_t p2, reg_t p3, reg_t p4, reg_t p5)
+{
+    reg_t ret_val;
+    
+    thread_stats_update_entering(true);
+    
+    set_preemption();
+    ret_val = ((syscall_fn)syscall_fnptr)(p1, p2, p3, p4, p5);
+    no_preemption();
 
-void syscall_install() {
-    intr_subscribe(LUNAIX_SYS_CALL, syscall_hndlr);
+    return ret_val;
 }
\ No newline at end of file