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() {
|
extern "C" fn task_init() {
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!(
|
asm!(
|
||||||
"pop rcx",
|
"pop rcx", // Get the user stack pointer
|
||||||
"pop rbx",
|
"pop rbx", // Get the entry point
|
||||||
"push 43",
|
"push 43", // Push the stack segment selector - same as data
|
||||||
"push rcx",
|
"push rcx", // Push the stack pointer
|
||||||
"pushfq",
|
"pushfq", // Get the flags into RAX
|
||||||
"pop rax",
|
"pop rax",
|
||||||
"or rax, 0x200",
|
"or rax, 0x200", // Enable interrupts in the stored copy
|
||||||
"push rax",
|
"push rax", // Push the flags
|
||||||
"push 51",
|
"push 51", // Push the code selector
|
||||||
"push rbx",
|
"push rbx", // Push the entry point
|
||||||
"iretq",
|
"iretq", // Return from the fake interrupt and enter user mode
|
||||||
options(noreturn)
|
options(noreturn)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user