ScarletAbi

Struct ScarletAbi 

Source
pub struct ScarletAbi {
    pub tls_pointer: Option<usize>,
    pub clear_child_tid_ptr: Option<usize>,
}

Fields§

§tls_pointer: Option<usize>

TLS (Thread Local Storage) pointer for this task

§clear_child_tid_ptr: Option<usize>

clear_child_tid pointer for thread exit notification (Linux-compatible)

Implementations§

Source§

impl ScarletAbi

Source

pub fn tls_pointer(&self) -> Option<usize>

Get the TLS pointer for this task

Source

pub fn set_tls_pointer(&mut self, ptr: usize)

Set the TLS pointer for this task

Source

pub fn clear_tls_pointer(&mut self)

Clear the TLS pointer for this task

Source

pub fn set_clear_child_tid(&mut self, ptr: usize)

Set the clear_child_tid pointer for thread exit notification

Source

pub fn on_task_exit(&mut self, task: &Task)

Handle task exit with TLS cleanup (Linux-compatible)

Source§

impl ScarletAbi

Source

fn setup_arguments_on_stack( &self, task: &Task, argv: &[&str], envp: &[&str], initial_sp: usize, ) -> Result<(usize, usize), &'static str>

Setup argc, argv, and envp on the user stack following Unix conventions

Standard Unix stack layout (from high to low addresses):

[high addresses]
envp strings (null-terminated)
argv strings (null-terminated)
envp[] array (null-terminated pointer array)
argv[] array (null-terminated pointer array)
argc (integer)
[low addresses - returned stack pointer]
§Arguments
  • task - The task to set up arguments for
  • argv - Command line arguments
  • envp - Environment variables
  • initial_sp - Initial stack pointer from setup_user_stack
§Returns

Tuple of (new stack pointer, argv array pointer)

Source

fn write_to_stack_memory( &self, task: &Task, vaddr: usize, data: &[u8], ) -> Result<(), &'static str>

Write bytes to stack memory using virtual memory translation

Source

fn write_string_to_stack( &self, task: &Task, vaddr: usize, string: &str, ) -> Result<(), &'static str>

Write a null-terminated string to stack memory

Source

fn normalize_path_to_absolute_scarlet(&self, path_value: &str) -> String

Normalize path string to absolute Scarlet namespace format

This ensures all paths in PATH-like variables are absolute and in the proper Scarlet namespace format.

Trait Implementations§

Source§

impl AbiModule for ScarletAbi

Source§

fn name() -> &'static str

Source§

fn get_name(&self) -> String

Source§

fn clone_boxed(&self) -> Box<dyn AbiModule + Send + Sync>

Clone this ABI module into a boxed trait object Read more
Source§

fn handle_syscall( &mut self, trapframe: &mut Trapframe, ) -> Result<usize, &'static str>

Source§

fn can_execute_binary( &self, file_object: &KernelObject, file_path: &str, current_abi: Option<&(dyn AbiModule + Send + Sync)>, ) -> Option<u8>

Determine if a binary can be executed by this ABI and return confidence Read more
Source§

fn get_runtime_config( &self, file_object: &KernelObject, file_path: &str, ) -> Option<RuntimeConfig>

Get userland runtime configuration for executing binaries Read more
Source§

fn execute_binary( &self, file_object: &KernelObject, argv: &[&str], envp: &[&str], task: &Task, trapframe: &mut Trapframe, ) -> Result<(), &'static str>

Binary execution (each ABI supports its own binary format) Read more
Source§

fn choose_load_address(&self, elf_type: u16, target: LoadTarget) -> Option<u64>

Choose base address for ELF loading (ABI-specific strategy) Read more
Source§

fn normalize_env_to_scarlet(&self, envp: &mut Vec<String>)

Convert environment variables from this ABI to Scarlet canonical format (in-place) Read more
Source§

fn denormalize_env_from_scarlet(&self, envp: &mut Vec<String>)

Convert environment variables from Scarlet canonical format to this ABI’s format (in-place) Read more
Source§

fn setup_overlay_environment( &self, target_vfs: &Arc<VfsManager>, base_vfs: &Arc<VfsManager>, system_path: &str, config_path: &str, ) -> Result<(), &'static str>

Setup overlay environment for this ABI (read-only base + writable layer) Read more
Source§

fn setup_shared_resources( &self, target_vfs: &Arc<VfsManager>, base_vfs: &Arc<VfsManager>, ) -> Result<(), &'static str>

Setup shared resources accessible across all ABIs Read more
Source§

fn on_task_exit(&mut self, task: &Task)

Hook invoked as part of Task::exit cleanup for the current task Read more
Source§

fn set_tls_pointer(&mut self, ptr: usize)

Set the TLS (Thread Local Storage) pointer for this task Read more
Source§

fn get_tls_pointer(&self) -> Option<usize>

Get the TLS (Thread Local Storage) pointer for this task Read more
Source§

fn set_clear_child_tid(&mut self, ptr: usize)

Set the clear_child_tid pointer for thread exit notification Read more
Source§

fn on_task_cloned( &mut self, _parent_task: &Task, _child_task: &Task, _flags: CloneFlags, ) -> Result<(), &'static str>

Hook invoked after Task::clone_task creates the child
Source§

fn get_task_namespace(&self) -> Arc<TaskNamespace>

Get the task namespace for this ABI. Read more
Source§

fn initialize_from_existing_handles( &mut self, _task: &Task, ) -> Result<(), &'static str>

Handle conversion when switching ABIs
Source§

fn get_interpreter_path(&self, requested_interpreter: &str) -> String

Override interpreter path (for ABI compatibility) Read more
Source§

fn get_default_cwd(&self) -> &str

Get default working directory for this ABI
Source§

fn handle_event( &self, _event: Event, _target_task_id: u32, ) -> Result<(), &'static str>

Handle incoming event from EventManager Read more
Source§

impl Clone for ScarletAbi

Source§

fn clone(&self) -> ScarletAbi

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for ScarletAbi

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Copy for ScarletAbi

Auto Trait Implementations§

§

impl Freeze for ScarletAbi

§

impl RefUnwindSafe for ScarletAbi

§

impl Send for ScarletAbi

§

impl Sync for ScarletAbi

§

impl Unpin for ScarletAbi

§

impl UnwindSafe for ScarletAbi

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.