pub fn try_enter_usermode() -> Result<(), KernelError>Expand description
Attempt to enter user mode with the embedded init binary.
This function:
- Retrieves the physical memory offset from BOOT_INFO
- Allocates physical frames for user code and stack
- Maps them at user-accessible virtual addresses in the current page tables
- Copies the embedded INIT_CODE machine code to the code page
- Sets up the per-CPU kernel_rsp for syscall/interrupt return
- Transitions to Ring 3 via iretq
On success, this function does not return (enters user mode). On failure, returns a KernelError for the caller to log.