Optimize x86_64 system calls.
This commit is contained in:
parent
951b6edccd
commit
4e3692cf88
1 changed files with 0 additions and 16 deletions
|
@ -35,15 +35,6 @@ syscall_handler:
|
||||||
movl $0, global_errno # Reset errno
|
movl $0, global_errno # Reset errno
|
||||||
pushq %rbp
|
pushq %rbp
|
||||||
|
|
||||||
# Grant ourselves kernel permissions to the data segment.
|
|
||||||
movl %ds, %ebp
|
|
||||||
pushq %rbp
|
|
||||||
movw $0x10, %bp
|
|
||||||
movl %ebp, %ds
|
|
||||||
movl %ebp, %es
|
|
||||||
movl %ebp, %fs
|
|
||||||
movl %ebp, %gs
|
|
||||||
|
|
||||||
# Make sure the requested system call is valid, if not, then fix it.
|
# Make sure the requested system call is valid, if not, then fix it.
|
||||||
cmp SYSCALL_MAX, %rax
|
cmp SYSCALL_MAX, %rax
|
||||||
jae fix_syscall
|
jae fix_syscall
|
||||||
|
@ -58,13 +49,6 @@ valid_syscall:
|
||||||
# Call the system call.
|
# Call the system call.
|
||||||
callq *%rax
|
callq *%rax
|
||||||
|
|
||||||
# Restore the previous permissions to data segment.
|
|
||||||
popq %rbp
|
|
||||||
movl %ebp, %ds
|
|
||||||
movl %ebp, %es
|
|
||||||
movl %ebp, %fs
|
|
||||||
movl %ebp, %gs
|
|
||||||
|
|
||||||
# Return to user-space, system call result in %rax:%rdx, errno in %ecx.
|
# Return to user-space, system call result in %rax:%rdx, errno in %ecx.
|
||||||
popq %rbp
|
popq %rbp
|
||||||
movl global_errno, %ecx
|
movl global_errno, %ecx
|
||||||
|
|
Loading…
Reference in a new issue