summaryrefslogtreecommitdiff
path: root/src/init/syscall.s
diff options
context:
space:
mode:
authordzwdz2021-08-12 19:17:29 +0200
committerdzwdz2021-08-12 19:17:29 +0200
commit38d1799046ca8148fc2aba871081fabda6082d2e (patch)
treeb6385e9e383d79f0c509187a6ce90517cc222ef0 /src/init/syscall.s
parenta0a4acb002f051d8a964659cb7aa9cd51740266a (diff)
init: preserve registers in _syscall()
Diffstat (limited to 'src/init/syscall.s')
-rw-r--r--src/init/syscall.s16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/init/syscall.s b/src/init/syscall.s
index 86d3523..78ce817 100644
--- a/src/init/syscall.s
+++ b/src/init/syscall.s
@@ -2,12 +2,20 @@
.global _syscall
.type _syscall, @function
_syscall:
- mov 4(%esp), %eax
- mov 8(%esp), %ebx
+ push %ebx // preserve registers
+ push %esi
+ push %edi
+
+// note: i could squeeze out another parameter out of %ebp
+ mov 16(%esp), %eax
+ mov 20(%esp), %ebx
mov %esp, %ecx
mov $_syscall_ret, %edx
- mov 12(%esp), %esi
- mov 16(%esp), %edi
+ mov 24(%esp), %esi
+ mov 28(%esp), %edi
sysenter
_syscall_ret:
+ pop %edi
+ pop %esi
+ pop %ebx
ret