[feat] 100Hz task switch
This commit is contained in:
@@ -5,7 +5,19 @@
|
||||
// rsi = new_rsp (value of new stack pointer)
|
||||
//
|
||||
// Saves/restores callee-saved registers only.
|
||||
// On first switch into a new task, ret lands on task_entry_trampoline.
|
||||
// The caller-saved registers are already saved on the task's stack
|
||||
// by the ISR stub (for preemptive switching) or are not in use
|
||||
// (for the initial switch).
|
||||
//
|
||||
// For preemptive switching:
|
||||
// - Timer IRQ fires, ISR stub pushes rax-r11 + trap_frame
|
||||
// - C code runs (isr_dispatch → timer handler → scheduler)
|
||||
// - context_switch saves/restores callee-saved regs + switches RSP
|
||||
// - On return, C code unwinds, isr_common pops rax-r11 + iretq
|
||||
//
|
||||
// For new tasks:
|
||||
// - task_create sets up a fake trap_frame on the stack
|
||||
// - context_switch pops callee-saved regs, returns into task_entry_trampoline
|
||||
.global context_switch
|
||||
context_switch:
|
||||
push rbx
|
||||
|
||||
Reference in New Issue
Block a user