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

set_kernel_stack

Function set_kernel_stack 

Source
pub fn set_kernel_stack(stack_top: u64)
Expand description

Update the kernel stack pointer in the TSS (RSP0).

Called during context switch to set the stack used for Ring 3 -> Ring 0 transitions (interrupts, syscalls). Must be called with interrupts disabled.

§Safety

The TSS is a static initialized during boot. Modifying privilege_stack_table[0] via raw pointer is safe because this is only called from the scheduler with interrupts disabled, ensuring no concurrent access.