Explain task_init
This commit is contained in:
parent
b9097759c8
commit
8b949ba1f1
@ -64,17 +64,17 @@ extern "C" fn switch_to_asm_exit(next_stack: *mut usize) {
|
||||
extern "C" fn task_init() {
|
||||
unsafe {
|
||||
asm!(
|
||||
"pop rcx",
|
||||
"pop rbx",
|
||||
"push 43",
|
||||
"push rcx",
|
||||
"pushfq",
|
||||
"pop rcx", // Get the user stack pointer
|
||||
"pop rbx", // Get the entry point
|
||||
"push 43", // Push the stack segment selector - same as data
|
||||
"push rcx", // Push the stack pointer
|
||||
"pushfq", // Get the flags into RAX
|
||||
"pop rax",
|
||||
"or rax, 0x200",
|
||||
"push rax",
|
||||
"push 51",
|
||||
"push rbx",
|
||||
"iretq",
|
||||
"or rax, 0x200", // Enable interrupts in the stored copy
|
||||
"push rax", // Push the flags
|
||||
"push 51", // Push the code selector
|
||||
"push rbx", // Push the entry point
|
||||
"iretq", // Return from the fake interrupt and enter user mode
|
||||
options(noreturn)
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user