summaryrefslogtreecommitdiff
path: root/kernel/src/arch/x86_64/scheduling.asm
blob: 859f1e9f980f53c07e245d8d93c127e21ad5fdee (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

global context_switch
context_switch:
    mov rsp, rdi 
    pop rax
    mov cr3,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
    add rsp,16
    iretq

extern scheduler_timer_asm
global yield
yield:
    pop rax
    mov rdx, rsp
    mov rsp,[gs:16]
    push qword 0
    push rdx
    pushfq
    push qword 0x08
    push qword rax
    jmp scheduler_timer_asm