summaryrefslogtreecommitdiff
path: root/kernel/cpu/int_syscall.s
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/cpu/int_syscall.s')
-rw-r--r--kernel/cpu/int_syscall.s35
1 files changed, 35 insertions, 0 deletions
diff --git a/kernel/cpu/int_syscall.s b/kernel/cpu/int_syscall.s
new file mode 100644
index 0000000..b2c0de9
--- /dev/null
+++ b/kernel/cpu/int_syscall.s
@@ -0,0 +1,35 @@
+.intel_syntax noprefix
+.global int_syscall
+.extern syscall_functions
+int_syscall:
+push ebp
+mov ebp,esp
+push edi
+push esi
+push ebx
+
+mov edx,DWORD PTR [ebp+0x8] # reg_t*
+mov eax,DWORD PTR [edx+0x20] # syscall number
+mov eax,DWORD PTR [eax*4+syscall_functions] # function pointer
+
+mov edi,DWORD PTR [edx+0x4]
+push edi
+mov edi,DWORD PTR [edx+0x8]
+push edi
+mov edi,DWORD PTR [edx+0x18]
+push edi
+mov edi,DWORD PTR [edx+0x1c]
+push edi
+mov edi,DWORD PTR [edx+0x14]
+push edi
+call eax
+add esp,0x20
+mov edx,DWORD PTR [ebp+0x8] # reg_t*
+mov DWORD PTR [edx+0x20],eax
+lea esp,[ebp-0xc]
+
+pop ebx
+pop esi
+pop edi
+pop ebp
+ret