Scheduler with working threads.
Currently only one process but it is a start.
This commit is contained in:
parent
960cbf9519
commit
cb41953354
10 changed files with 136 additions and 5 deletions
41
zion/scheduler/context_switch.s
Normal file
41
zion/scheduler/context_switch.s
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
.global context_switch
|
||||
context_switch:
|
||||
push %rax
|
||||
push %rcx
|
||||
push %rdx
|
||||
push %rbx
|
||||
push %rbp
|
||||
push %rsi
|
||||
push %rdi
|
||||
push %r8
|
||||
push %r9
|
||||
push %r10
|
||||
push %r11
|
||||
push %r12
|
||||
push %r13
|
||||
push %r14
|
||||
push %r15
|
||||
mov %cr3, %rax
|
||||
push %rax
|
||||
|
||||
mov %rsp, (%rdi) # Save rsp to the prev task.
|
||||
mov (%rsi), %rsp # Load the next task's rsp.
|
||||
|
||||
pop %rax
|
||||
mov %rax, %cr3
|
||||
pop %r15
|
||||
pop %r14
|
||||
pop %r13
|
||||
pop %r12
|
||||
pop %r11
|
||||
pop %r10
|
||||
pop %r9
|
||||
pop %r8
|
||||
pop %rdi
|
||||
pop %rsi
|
||||
pop %rbp
|
||||
pop %rbx
|
||||
pop %rdx
|
||||
pop %rcx
|
||||
pop %rax
|
||||
retq
|
||||
Loading…
Add table
Add a link
Reference in a new issue