MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / launch_thread

Function launch_thread

kernel/src/interrupts.rs:195–225  ·  view source on GitHub ↗

Run a thread by using `iret`

(context_addr: usize)

Source from the content-addressed store, hash-verified

193
194/// Run a thread by using `iret`
195pub fn launch_thread(context_addr: usize) -> ! {
196 unsafe {
197 asm!("mov rsp, rdi", // Set the stack to the Context address
198
199 // Pop scratch registers from new stack
200 "pop r15",
201 "pop r14",
202 "pop r13",
203
204 "pop r12",
205 "pop r11",
206 "pop r10",
207 "pop r9",
208
209 "pop r8",
210 "pop rbp",
211 "pop rsi",
212 "pop rdi",
213
214 "pop rdx",
215 "pop rcx",
216 "pop rbx",
217 "pop rax",
218 // Enable interrupts
219 "sti",
220 // Interrupt return
221 "iretq",
222 in("rdi") context_addr,
223 options(noreturn));
224 }
225}
226
227extern "x86-interrupt" fn breakpoint_handler(
228 stack_frame: InterruptStackFrame)

Callers 5

sys_receiveFunction · 0.85
sys_sendFunction · 0.85
sys_yieldFunction · 0.85
sys_closeFunction · 0.85
sys_await_interruptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected