From 38d1799046ca8148fc2aba871081fabda6082d2e Mon Sep 17 00:00:00 2001 From: dzwdz Date: Thu, 12 Aug 2021 19:17:29 +0200 Subject: init: preserve registers in _syscall() --- src/init/syscall.s | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/init/syscall.s') 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 -- cgit v1.2.3