#[repr(C)]pub struct X86_64Context {Show 27 fields
pub r15: u64,
pub r14: u64,
pub r13: u64,
pub r12: u64,
pub r11: u64,
pub r10: u64,
pub r9: u64,
pub r8: u64,
pub rdi: u64,
pub rsi: u64,
pub rbp: u64,
pub rbx: u64,
pub rdx: u64,
pub rcx: u64,
pub rax: u64,
pub rsp: u64,
pub rip: u64,
pub rflags: u64,
pub cs: u16,
pub ss: u16,
pub ds: u16,
pub es: u16,
pub fs: u16,
pub gs: u16,
pub cr3: u64,
pub fpu_state: *mut FpuState,
pub tls_base: u64,
}Expand description
x86_64 CPU context
Fields§
§r15: u64General purpose registers
r14: u64§r13: u64§r12: u64§r11: u64§r10: u64§r9: u64§r8: u64§rdi: u64§rsi: u64§rbp: u64§rbx: u64§rdx: u64§rcx: u64§rax: u64§rsp: u64Stack pointer
rip: u64Instruction pointer
rflags: u64CPU flags
cs: u16Segment registers
ss: u16§ds: u16§es: u16§fs: u16§gs: u16§cr3: u64Control registers
fpu_state: *mut FpuStateFloating point state pointer
tls_base: u64TLS base (FS base for user)
Implementations§
Source§impl X86_64Context
impl X86_64Context
Sourcepub fn new_user(entry_point: usize, stack_pointer: usize) -> Self
pub fn new_user(entry_point: usize, stack_pointer: usize) -> Self
Create a user-mode context for a process.
Uses Ring 3 segment selectors (CS=0x33, SS/DS/ES=0x2B) and enables interrupts (RFLAGS IF bit). The CR3 is set to the current page table so the process initially shares the kernel’s address space (with user-accessible mappings added separately).
Trait Implementations§
Source§impl Clone for X86_64Context
impl Clone for X86_64Context
Source§fn clone(&self) -> X86_64Context
fn clone(&self) -> X86_64Context
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for X86_64Context
impl Debug for X86_64Context
Source§impl Default for X86_64Context
impl Default for X86_64Context
Source§impl ThreadContext for X86_64Context
impl ThreadContext for X86_64Context
Source§fn init(
&mut self,
entry_point: usize,
stack_pointer: usize,
_kernel_stack: usize,
)
fn init( &mut self, entry_point: usize, stack_pointer: usize, _kernel_stack: usize, )
Initialize context for a new thread
Source§fn get_instruction_pointer(&self) -> usize
fn get_instruction_pointer(&self) -> usize
Get instruction pointer
Source§fn set_instruction_pointer(&mut self, ip: usize)
fn set_instruction_pointer(&mut self, ip: usize)
Set instruction pointer
Source§fn get_stack_pointer(&self) -> usize
fn get_stack_pointer(&self) -> usize
Get stack pointer
Source§fn set_stack_pointer(&mut self, sp: usize)
fn set_stack_pointer(&mut self, sp: usize)
Set stack pointer
Source§fn set_tls_base(&mut self, base: u64)
fn set_tls_base(&mut self, base: u64)
Set user TLS base for this context (FS/TP).
Source§fn get_kernel_stack(&self) -> usize
fn get_kernel_stack(&self) -> usize
Get kernel stack pointer
Source§fn set_kernel_stack(&mut self, sp: usize)
fn set_kernel_stack(&mut self, sp: usize)
Set kernel stack pointer
Source§fn set_return_value(&mut self, value: usize)
fn set_return_value(&mut self, value: usize)
Set return value (for syscalls, fork, etc.)
Source§fn clone_from(&mut self, other: &Self)
fn clone_from(&mut self, other: &Self)
Clone the context
Source§fn to_task_context(&self) -> TaskContext
fn to_task_context(&self) -> TaskContext
Convert to scheduler’s TaskContext
impl Send for X86_64Context
impl Sync for X86_64Context
Auto Trait Implementations§
impl Freeze for X86_64Context
impl RefUnwindSafe for X86_64Context
impl Unpin for X86_64Context
impl UnwindSafe for X86_64Context
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)