pub enum HostFunction {
CapCall,
CapSend,
KernelAlloc,
MemFree,
CapRevoke,
Declassify,
ThreadCreate,
ThreadConfigure,
ThreadResume,
ThreadSuspend,
ThreadDestroy,
}Expand description
All host functions that cross the trust boundary (EROS-style 6 operations)
Corresponds to Lean: inductive HostFunctionId
EROS consolidation (13 -> 6):
- CapInvoke -> CapCall (synchronous capability invocation)
- CapDelegate, CapAccept -> User-space protocol over CapSend
- IpcSend -> CapSend (async message send)
- IpcReceive -> Removed (mailbox read via CapCall)
- MemAlloc, ResourceCreate, ResourceAccess -> KernelAlloc
- MemFree -> MemFree (keep separate for safety)
- CapRevoke -> CapRevoke (kernel operation)
- WorkflowStart, WorkflowStep -> Removed (user-space library)
- Declassify -> Declassify (IFC operation)
Variants§
CapCall
Synchronous capability invocation (replaces cap_invoke)
Corresponds to Lean: | cap_call
CapSend
Async message send (replaces ipc_send; delegation is user-space protocol)
Corresponds to Lean: | cap_send
KernelAlloc
Kernel resource allocation (replaces mem_alloc, resource_create)
Corresponds to Lean: | kernel_alloc
MemFree
Memory deallocation (keep separate for safety)
Corresponds to Lean: | mem_free
CapRevoke
Capability revocation
Corresponds to Lean: | cap_revoke
Declassify
Controlled information declassification (IFC operation)
Corresponds to Lean: | declassify
ThreadCreate
Create new thread (requires ThreadControl capability)
Corresponds to Lean: | thread_create
ThreadConfigure
Configure thread bindings (requires ThreadControl capability)
Corresponds to Lean: | thread_configure
ThreadResume
Resume suspended thread (requires ThreadControl capability)
Corresponds to Lean: | thread_resume
ThreadSuspend
Suspend running thread (requires ThreadControl capability)
Corresponds to Lean: | thread_suspend
ThreadDestroy
Terminate thread (requires ThreadControl capability)
Corresponds to Lean: | thread_destroy
Implementations§
Source§impl HostFunction
impl HostFunction
Sourcepub const CAP_INVOKE: HostFunction = HostFunction::CapCall
👎Deprecated: Use HostFunction::CapCall instead (EROS consolidation)
pub const CAP_INVOKE: HostFunction = HostFunction::CapCall
Use HostFunction::CapCall instead (EROS consolidation)
Legacy alias: CapInvoke -> CapCall
Sourcepub const IPC_SEND: HostFunction = HostFunction::CapSend
👎Deprecated: Use HostFunction::CapSend instead (EROS consolidation)
pub const IPC_SEND: HostFunction = HostFunction::CapSend
Use HostFunction::CapSend instead (EROS consolidation)
Legacy alias: IpcSend -> CapSend
Sourcepub const MEM_ALLOC: HostFunction = HostFunction::KernelAlloc
👎Deprecated: Use HostFunction::KernelAlloc instead (EROS consolidation)
pub const MEM_ALLOC: HostFunction = HostFunction::KernelAlloc
Use HostFunction::KernelAlloc instead (EROS consolidation)
Legacy alias: MemAlloc -> KernelAlloc
Source§impl HostFunction
impl HostFunction
Sourcepub fn is_effectful(&self) -> bool
pub fn is_effectful(&self) -> bool
Check if this host function is effectful
All host functions cross the trust boundary, so all are effectful.
Corresponds to Lean: def is_effectful_host_call
Sourcepub fn is_declassify(&self) -> bool
pub fn is_declassify(&self) -> bool
Check if this is a declassify operation
Corresponds to Lean: def is_declassify
Sourcepub fn is_cap_operation(&self) -> bool
pub fn is_cap_operation(&self) -> bool
Check if this is a capability operation (may modify kernel.revocation)
Corresponds to Lean: def is_cap_operation
Sourcepub fn is_mem_operation(&self) -> bool
pub fn is_mem_operation(&self) -> bool
Check if this is a memory operation (modifies ghost state)
Corresponds to Lean: def is_mem_operation
Sourcepub fn execute(
&self,
state: &State,
hc: &HostCall,
result: &HostResult,
) -> Result<State, StepError>
pub fn execute( &self, state: &State, hc: &HostCall, result: &HostResult, ) -> Result<State, StepError>
Execute the host function
Corresponds to Lean: def KernelExecHost
§Errors
Returns StepError::PluginNotFound if the caller plugin does not exist.
Returns StepError::HostCallPreconditionFailed if function-specific preconditions are not met.
Returns StepError::ActorNotFound if a destination actor does not exist (CapSend).
Returns StepError::QuotaExceeded if the allocation would exceed the plugin’s memory quota (KernelAlloc).
Returns StepError::AddressAlreadyFreed if the address is already freed (MemFree).
Returns StepError::CapabilityTargetsAddress if a valid capability targets the address (MemFree).
Returns StepError::CapabilityNotFound if the capability does not exist (CapRevoke).
Sourcepub fn execute_mut(
&self,
state: &mut State,
hc: &HostCall,
result: &HostResult,
) -> Result<(), StepError>
pub fn execute_mut( &self, state: &mut State, hc: &HostCall, result: &HostResult, ) -> Result<(), StepError>
Execute the host function (mutating version).
Same validation as execute but modifies &mut State in place.
Sourcepub fn is_thread_operation(&self) -> bool
pub fn is_thread_operation(&self) -> bool
Check if this is a thread operation (requires ThreadControl capability)
Corresponds to Lean: thread_create/configure/resume/suspend/destroy
Trait Implementations§
Source§impl Clone for HostFunction
impl Clone for HostFunction
Source§fn clone(&self) -> HostFunction
fn clone(&self) -> HostFunction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HostFunction
impl Debug for HostFunction
Source§impl Hash for HostFunction
impl Hash for HostFunction
Source§impl PartialEq for HostFunction
impl PartialEq for HostFunction
Source§fn eq(&self, other: &HostFunction) -> bool
fn eq(&self, other: &HostFunction) -> bool
self and other values to be equal, and is used by ==.