Chain kernel frame pointer list with user-space.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-05-20 20:16:34 +02:00
parent 4e3692cf88
commit 834789d006
2 changed files with 9 additions and 2 deletions

View File

@ -33,7 +33,9 @@ syscall_handler:
sti
movl $0, global_errno # Reset errno
pushq %rbp
movq %rsp, %rbp
# Make sure the requested system call is valid, if not, then fix it.
cmp SYSCALL_MAX, %rax
@ -41,8 +43,8 @@ syscall_handler:
valid_syscall:
# Read a system call function pointer.
xorq %rbp, %rbp
movq syscall_list(%rbp,%rax,8), %rax
xorq %r11, %r11
movq syscall_list(%r11,%rax,8), %rax
# Oh how nice, user-space put the parameters in: rdi, rsi, rdx, rcx, r8, r9

View File

@ -33,6 +33,7 @@ syscall_handler:
sti
movl $0, global_errno # Reset errno
pushl %ebp
# Grant ourselves kernel permissions to the data segment.
@ -53,6 +54,10 @@ valid_syscall:
xorl %ebp, %ebp
movl syscall_list(%ebp,%eax,4), %eax
# Point the %ebp register to the pushed user-space %ebp above.
movl %esp, %ebp
addl $4, %ebp
# Call the system call.
pushl %esi
pushl %edi