Skip to main content

KernelOp

Enum KernelOp 

Source
#[repr(u16)]
pub enum KernelOp {
Show 35 variants MapAnonymous = 1, Munmap = 2, Mprotect = 3, ReadUser = 4, WriteUser = 5, Yield = 256, BlockThread = 257, ThreadCreate = 258, ThreadExit = 259, FutexWake = 260, GetTimeNs = 512, GetRandom = 513, VfsOpen = 1_024, VfsRead = 1_025, VfsWrite = 1_026, VfsStat = 1_027, VfsClose = 1_028, VfsSeek = 1_029, VfsTruncate = 1_030, VfsSync = 1_031, NetConnect = 1_280, NetListen = 1_281, NetAccept = 1_282, NetSend = 1_283, NetRecv = 1_284, NetClose = 1_285, NetUdpBind = 1_296, NetUdpSend = 1_297, NetUdpRecv = 1_298, SendSignal = 1_536, CheckSignals = 1_537, DebugPrint = 3_840, DomainExit = 4_096, GetDomainId = 4_097, GetParentId = 4_098,
}
Expand description

Kernel operation codes.

Discriminant values are stable across versions for ABI compatibility.

Variants§

§

MapAnonymous = 1

Map anonymous memory. Args: [addr_hint, len, prot, flags, 0]

§

Munmap = 2

Unmap memory. Args: [addr, len, 0, 0, 0]

§

Mprotect = 3

Change protection. Args: [addr, len, prot, 0, 0]

§

ReadUser = 4

Read from domain memory. Args: [user_addr, kernel_buf_id, len, 0, 0]

§

WriteUser = 5

Write to domain memory. Args: [user_addr, kernel_buf_id, len, 0, 0]

§

Yield = 256

Yield CPU. Args: [0, 0, 0, 0, 0]

§

BlockThread = 257

Block thread. Args: [timeout_ns, 0, 0, 0, 0]

§

ThreadCreate = 258

Create thread. Args: [entry, stack_top, arg, tls, flags]

§

ThreadExit = 259

Exit thread. Args: [exit_code, 0, 0, 0, 0]

§

FutexWake = 260

Wake futex waiters. Args: [addr, count, 0, 0, 0]

§

GetTimeNs = 512

Get time in nanoseconds. Args: [clock_id, 0, 0, 0, 0]

§

GetRandom = 513

Fill buffer with random bytes. Args: [user_buf, len, flags, 0, 0]

§

VfsOpen = 1_024

Open file. Args: [path_ptr, path_len, flags, mode, 0]

§

VfsRead = 1_025

Read file. Args: [handle, user_buf, len, offset, 0]

§

VfsWrite = 1_026

Write file. Args: [handle, user_buf, len, offset, 0]

§

VfsStat = 1_027

Stat file. Args: [handle, statbuf, 0, 0, 0]

§

VfsClose = 1_028

Close file. Args: [handle, 0, 0, 0, 0]

§

VfsSeek = 1_029

Seek. Args: [handle, offset, whence, 0, 0]

§

VfsTruncate = 1_030

Truncate. Args: [handle, length, 0, 0, 0]

§

VfsSync = 1_031

Sync to storage. Args: [handle, flags, 0, 0, 0]

§

NetConnect = 1_280

TCP connect. Args: [sockaddr_ptr, addrlen, 0, 0, 0]

§

NetListen = 1_281

TCP listen. Args: [sockaddr_ptr, addrlen, backlog, 0, 0]

§

NetAccept = 1_282

Accept connection. Args: [listener, peer_addr_ptr, peer_addrlen_ptr, 0, 0]

§

NetSend = 1_283

Send data. Args: [handle, user_buf, len, flags, 0]

§

NetRecv = 1_284

Receive data. Args: [handle, user_buf, len, flags, 0]

§

NetClose = 1_285

Close network handle. Args: [handle, 0, 0, 0, 0]

§

NetUdpBind = 1_296

Bind UDP socket. Args: [sockaddr_ptr, addrlen, 0, 0, 0]

§

NetUdpSend = 1_297

Send UDP datagram. Args: [handle, user_buf, len, dest_addr_ptr, dest_addrlen]

§

NetUdpRecv = 1_298

Receive UDP datagram. Args: [handle, user_buf, len, src_addr_ptr, src_addrlen_ptr]

§

SendSignal = 1_536

Send signal. Args: [target_domain, signum, 0, 0, 0]

§

CheckSignals = 1_537

Check pending signals. Args: [0, 0, 0, 0, 0]

§

DebugPrint = 3_840

Write to debug console. Args: [user_buf, len, 0, 0, 0]

§

DomainExit = 4_096

Terminate domain. Args: [exit_code, 0, 0, 0, 0]

§

GetDomainId = 4_097

Get domain ID. Args: [0, 0, 0, 0, 0]

§

GetParentId = 4_098

Get parent domain ID. Args: [0, 0, 0, 0, 0]

Implementations§

Source§

impl KernelOp

Source

pub fn from_u16(value: u16) -> Option<Self>

Create from raw opcode. Returns None for unrecognized values.

Source

pub const fn name(&self) -> &'static str

Operation name for diagnostics.

Source

pub const fn is_nonblocking(&self) -> bool

Whether this operation can be batched (doesn’t block or exit).

Trait Implementations§

Source§

impl Clone for KernelOp

Source§

fn clone(&self) -> KernelOp

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for KernelOp

Source§

impl Debug for KernelOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for KernelOp

Source§

impl PartialEq for KernelOp

Source§

fn eq(&self, other: &KernelOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for KernelOp

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.