syscall: add basic syscall entry
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
1b8fe6b24d
commit
c01b1d7eee
12 changed files with 154 additions and 15 deletions
48
amd64/arch/entry.S
Normal file
48
amd64/arch/entry.S
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
.intel_syntax noprefix
|
||||
|
||||
.global _syscall_enter
|
||||
_syscall_enter:
|
||||
swapgs
|
||||
/* save user stack */
|
||||
mov gs:[16], rsp
|
||||
/* load kernel stack */
|
||||
mov rsp, gs:[8]
|
||||
|
||||
/* save registers */
|
||||
push r15
|
||||
push r14
|
||||
push r13
|
||||
push r12
|
||||
push r11
|
||||
push r10
|
||||
push r9
|
||||
push r8
|
||||
push rsi
|
||||
push rdi
|
||||
push rdx
|
||||
push rbx
|
||||
push rax
|
||||
|
||||
call syscall
|
||||
|
||||
/* restore registers */
|
||||
pop rax
|
||||
pop rbx
|
||||
pop rdx
|
||||
pop rdi
|
||||
pop rsi
|
||||
pop r8
|
||||
pop r9
|
||||
pop r10
|
||||
pop r11
|
||||
pop r12
|
||||
pop r13
|
||||
pop r14
|
||||
pop r15
|
||||
|
||||
/* restore user stack */
|
||||
mov rsp, gs:[16]
|
||||
|
||||
swapgs
|
||||
sysretq
|
||||
Loading…
Reference in a new issue