Run a thread by using `iret`
(context_addr: usize)
| 193 | |
| 194 | /// Run a thread by using `iret` |
| 195 | pub 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 | |
| 227 | extern "x86-interrupt" fn breakpoint_handler( |
| 228 | stack_frame: InterruptStackFrame) |
no outgoing calls
no test coverage detected