⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module usermode

Module usermode 

Source
Expand description

User-mode entry point for x86_64

Provides enter_usermode() which pushes the iretq frame and transitions the CPU from Ring 0 to Ring 3. Also provides map_user_page() for creating user-accessible page table entries through the bootloader’s physical memory mapping.

enter_usermode_returnable() is a variant that saves the boot context (callee-saved registers, RSP, CR3) so that sys_exit can restore it and effectively “return” to the caller, allowing sequential user-mode program execution during bootstrap.

Structs§

ForkChildRegs
All GPRs needed to resume a forked child in user mode.

Functions§

boot_return_to_kernel
Restore the boot context saved by enter_usermode_returnable and return to the bootstrap code.
enter_forked_child_returnable
Enter user mode for a forked child, restoring ALL GPRs from regs.
enter_usermode
Enter user mode for the first time via iretq.
enter_usermode_returnable
Enter user mode with the ability to return when the process exits.
has_boot_return_context
Check whether a boot return context is available.
try_enter_usermode
Attempt to enter user mode with the embedded init binary.