summaryrefslogtreecommitdiff
path: root/kernel/src/arch/x86_64/asm/syscall.asm
blob: 34b1058ef6fc55f8b47edaf42476b76ff7d127be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56


global syscall_handler
extern syscall_handler_c
syscall_handler:
    swapgs 
    mov qword [gs:0],rsp
    mov rsp, qword [gs:8]
    push qword (0x18 | 3)
    push qword [gs:0]
    push qword r11
    push qword (0x20 | 3)
    push qword rcx
    push qword 0
    push qword 0
    push r15
    push r14
    push r13
    push r12
    push r11
    push r10
    push r9
    push r8
    push rbp
    push rdi
    push rsi
    push rdx
    push rcx
    push rbx
    push rax
    mov rax,cr3
    push rax
    mov rdi,rsp
    call syscall_handler_c
    pop rax
    pop rax
    pop rbx
    pop rcx
    pop rdx
    pop rsi
    pop rdi
    pop rbp
    pop r8
    pop r9
    pop r10
    pop r11
    pop r12
    pop r13
    pop r14
    pop r15
    cli
    mov rsp, qword [gs:0] 
    swapgs
    o64 sysret

section .rodata