BREADBYTECODE 1.0.0 DOCUMENTATION

(Rough Draft)

This page was generated from https://github.com/ostracod/breadsystem-spec at 7/1/2020, 10:11 PM EDT.

BreadBytecode is the programming language provided by BreadSystem for applications. This document describes the syntax and instructions of BreadBytecode.

DATA TYPES AND STRUCTURES

All integers in BreadBytecode are stored in little-endian order. All signed integers use two's complement to express negative values. All floating point numbers are stored in the IEEE 754 format.

List of primitive data types:

Subcomponents of u8:

Version number = [
    u32 major,
    u32 minor,
    u32 patch
]
Frame length = [
    u64 alpha length,
    u64 beta length
]
Dependency attributes = [
    u1 x5 unused bits,
    u1 is optional,
    u1 is implemented,
    u1 is guarded
]

A dependency may only be implemented or guarded if the dependency is an interface.

Public function attributes = [
    u32 interface index,
    s32 arbiter index
]
Guard function attributes = [
    u32 interface index
]
Interface function attributes = [
    s32 arbiter index
]

The interface index and arbiter index are indexes to dependency regions. If the arbiter index is -1, the function does not have an arbiter.

Argument permissions are automatically granted by the system for input and output heap allocations.

Argument permission = [
    u16 pointer argument index,
    u2 permission type,
    u2 permission recipient,
    u1 unused bit,
    u1 permission is recursive,
    u1 permission has infinite propagation count,
    u1 permission is temporary
]

Argument permission types:

Argument permission recipients:

Argument permission flags:

File types:

Directory types:

Stack trace = [
    Array of instruction locations
]

Instruction locations in a stack trace are ordered from deepest to most shallow.

Instruction location = [
    Pointer to agent,
    u64 function index,
    u64 instruction index
]

The function index is an index to a function region.

Region = [
    u16 region type,
    u8 length of region data size,
    Region data size,
    Region data
]

The length of region data size is measured in bytes. This value may be 1, 2, 4, or 8.

ATOMIC REGIONS

These regions do not contain any subregions.

fileFormatVer region type = 0x0000

Specifies the format version number of a bytecode application file or interface file.

depVer region type = 0x0001

Specifies the version number of a dependency.

globalFrameLen region type = 0x0100

Specifies the global frame length of a bytecode application.

localFrameLen region type = 0x0101

Specifies the local frame length of a function.

argFrameLen region type = 0x0102

Specifies the argument frame length of a function.

depAttrs region type = 0x0200

Specifies the attributes of a dependency.

pubFuncAttrs region type = 0x0202

Specifies the attributes of a public function in a bytecode application file.

guardFuncAttrs region type = 0x0203

Specifies the attributes of a guard function in a bytecode application file.

ifaceFuncAttrs region type = 0x0204

Specifies the attributes of a function in an interface file.

name region type = 0x0300

Specifies the name of an entity.

path region type = 0x0301

Specifies the path of an entity.

desc region type = 0x0302

Specifies a human-readable description of an entity.

depIndexes region type = 0x0400

Specifies an array of u32 indexes in the deps region.

jmpTable region type = 0x0401

Specifies an array of u64 indexes in the instrs region.

argPerms region type = 0x0402

Specifies the array of argument permissions for a function.

instrs region type = 0x0500

Specifies the array of bytecode instructions for a function.

appData region type = 0x0600

Specifies the unstructured blob of immutable data for a bytecode application.

COMPOSITE REGIONS

These regions consist of an array of subregions.

pathDep region type = 0x8000

Defines a dependency with a path.

Required subregions:

verDep region type = 0x8001

Defines a bundle dependency with a version.

Required subregions:

ifaceDep region type = 0x8002

Defines an application dependency with a set of interfaces.

Required subregions:

privFunc region type = 0x8100

Defines a private function in a bytecode application file.

Required subregions:

pubFunc region type = 0x8101

Defines a public function in a bytecode application file.

Required subregions:

guardFunc region type = 0x8102

Defines a guard function in a bytecode application file.

Required subregions:

ifaceFunc region type = 0x8103

Defines a function in an interface file.

Required subregions:

deps region type = 0x8200

Defines an array of dependencies in a bytecode application file or interface file.

Required subregions:

appFuncs region type = 0x8201

Defines an array of functions in a bytecode application file.

Required subregions:

ifaceFuncs region type = 0x8202

Defines an array of functions in an interface file.

Required subregions:

appFile region type = 0x8300

Defines a bytecode application file.

Required subregions:

ifaceFile region type = 0x8301

Defines an interface file.

Required subregions:

A bytecode application file consists of a single appFile region. An interface file consists of a single ifaceFile region.

MEMORY LAYOUT

Every thread has its own stack containing one or more frames. Each frame contains two separate regions:

For pointer safety, the beta region cannot store pointers, and the alpha region cannot store generic data.

The alpha and beta regions each have their own indexing systems. In the alpha region, each index refers to a distinct pointer. In the beta region, each index refers to a byte offset.

The lengths of alpha and beta regions in a frame remain fixed after they are allocated.

Each frame has one of three types:

After the stack is initialized, it contains a single global frame. This frame is never removed.

To invoke a function, the calling function must perform the following steps:

  1. Allocate an argument frame.
  2. Populate the argument frame with arguments.
  3. Call the function and wait for invocation to finish.
  4. Read return values from the argument frame.

An invoked function follows the steps below:

  1. Read arguments from the argument frame provided by the calling function.
  2. Perform the desired set of operations.
  3. Store return values in the argument frame provided by the calling function.
  4. Return control to the calling function.

Every application has access to the unified system heap, which provides automatic garbage collection. Heap allocations contains alpha and beta regions in the same fashion as frames. However, a heap allocation may be resized after it is created.

Every heap allocation is associated with protected read and write abilities. An agent must have sufficient permissions to access a heap allocation.

Heap allocations are also associated with the following metadata:

The default sentry type for a new heap allocation is 0x0000. A "sentry allocation" is a heap allocation whose sentry type is non-zero. The purpose of a sentry allocation is to provide a handle for a resource while restricting read/write access to underlying data.

System sentry types:

A vessel may either be a path or an agent sentry. A null agent sentry represents the system. For example, if the system created a heap allocation, the result of allocCreator will be null.

INSTRUCTION SYNTAX

Instruction = [
    u16 opcode,
    u8 argument amount,
    Array of arguments
]
Argument prefix = [
    u4 reference type,
    u4 data type
]

Reference types:

Data types:

When an argument has a pointer data type, the argument references an alpha region. When an argument has a non-pointer data type, the argument references a beta region.

Constant argument = [
    Argument prefix,
    Constant value
]

A constant pointer argument does not supply any inline constant value. All constant pointers are null.

Frame argument = [
    Argument prefix,
    Frame index as nested argument
]
Application data argument = [
    Argument prefix,
    Application data index as nested argument
]
Heap allocation argument = [
    Argument prefix,
    Pointer as nested argument,
    Allocation index as nested argument
]

SYSTEM ERRORS

genericErr error code = 0x0000

Thrown if a problem occurs which cannot be described by a more specific error code.

noImplErr error code = 0x0001

Thrown if no implementation is available for the given operation. This includes the following circumstances:

typeErr error code = 0x0002

Thrown if a value or resource has the wrong type. This includes the following circumstances:

numRangeErr error code = 0x0003

Thrown if a number argument is not in an acceptable range. This includes the following circumstances:

indexErr error code = 0x0004

Thrown if an index argument is out of bounds or refers to an invalid item. This includes the following circumstances:

nullErr error code = 0x0005

Thrown if a pointer argument has an unexpected null value.

dataErr error code = 0x0006

Thrown if an argument data structure contains malformed data. This includes the following circumstances:

argFrameErr error code = 0x0007

Thrown when invoking a function if the next argument frame has invalid structure.

missingErr error code = 0x0008

Thrown if a necessary resource does not exist. This includes the following circumstances:

stateErr error code = 0x0009

Thrown when trying to use a resource which is in an invalid state. This includes the following circumstances:

compatErr error code = 0x000A

Thrown if a resource has the wrong version or interfaces. This includes the following circumstances:

permErr error code = 0x000B

Thrown if the current agent has insufficient permissions to perform an action. This includes the following circumstances:

capacityErr error code = 0x000C

Thrown if the system has insufficient hardware resources for the operation.

throttleErr error code = 0x000D

Thrown if the current thread should terminate prematurely. This includes the following circumstances:

MEMORY INSTRUCTIONS

wrt dest, value

Writes a value from one memory location to another.

newArgFrame aLen, bLen

Creates a new argument frame to feed into the next function invocation.

newAlloc dest, aLen, bLen

Creates a new heap allocation.

copyAlloc dest, alloc

Copies an existing heap allocation.

allocALen dest, alloc

Retrieves the alpha region length of a heap allocation.

setAllocALen alloc, len

Modifies the alpha region length of a heap allocation. Either truncates existing values or appends additional null pointers.

allocBLen dest, alloc

Retrieves the beta region length of a heap allocation.

setAllocBLen alloc, len

Modifies the beta region length of a heap allocation. Either truncates existing values or appends additional zeroes.

setAllocLen alloc, aLen, bLen

Modifies both alpha and beta region lengths in the given heap allocation. This instruction may be more efficient that consecutive invocations of setAllocALen and setAllocBLen.

allocCreator dest, alloc

Retrieves the sentry of the agent which created the given heap allocation. The result is null if the allocation was created by the system.

allocSType dest, alloc

Retrieves the sentry type of a heap allocation.

setAllocSType alloc, sType

Modifies the sentry type of a heap allocation. The sentry type must be within the range of u16.

JUMP INSTRUCTIONS

jmp instrIndex

Jumps control flow to another instruction within the current function.

jmpZ instrIndex, cond

Jumps control flow to another instruction if the given value is zero.

jmpNZ instrIndex, cond

Jumps control flow to another instruction if the given value is not zero.

jmpTable tableIndex

Jumps control flow to another instruction. Uses the jump table of the current function to look up an instruction index.

ERROR INSTRUCTIONS

setErrJmp instrIndex

Configures an error handler within the current function. If an error is thrown, control flow will jump to the error handler.

clrErrJmp

Removes any error handler from the current function. If an error is thrown, it will be passed to the invoking function.

throw code, msg, data

Throws an error which will be handled by the invoking function. The error code must be in the range of u16.

rethrow err

Throws the given error again without resetting its stack trace.

err dest

Retrieves the last error which was caught in the current function invocation. The result will be null if no error has been caught by an error handler.

threadErr dest, thread

Retrieves the unhandled error which terminated the given thread. The result will be null if the given thread was not terminated by an unhandled error.

agentInitErr dest, agent

Retrieves the unhandled error which terminated the init function of the given agent. The result will be null if the given agent does not conform to the initable interface, or if the init function of the given agent was not terminated by an unhandled error.

errCode dest, err

Retrieves the error code of the given error.

errMsg dest, err

Retrieves a human-readable description of the given error.

errData dest, err

Retrieves the data associated with the given error.

errAgent dest, err

Retrieves the sentry of the agent which threw the given error.

errTrace dest, err

Retrieves a stack trace for the given error.

FUNCTION HANDLE INSTRUCTIONS

indexFuncHandle dest, funcIndex

Retrieves a function handle for a private or public function in the current agent.

ifaceFuncHandle dest, agent, ifacePath, funcName

Retrieves a function handle for a public function in the given agent.

funcHandleIsPub dest, funcHandle

Retrieves whether the given function handle is public.

funcHandleAgent dest, funcHandle

Retrieves the agent to which the given function handle belongs.

funcHandleIface dest, funcHandle

Retrieves the path of the interface to which the given function handle belongs. The result is null if the function is private.

funcHandleName dest, funcHandle

Retrieves the function name of the given function handle. The result is null if the function is private.

funcHandleIndex dest, funcHandle

Retrieves the function index of the given function handle.

FUNCTION INVOCATION INSTRUCTIONS

callIndex funcIndex

Synchronously invokes a function which is defined in the current agent. The function runs in the current thread.

callHandle funcHandle

Synchronously invokes the given function handle. The function runs in the current thread.

ret

Exits the current function and returns control flow to the invoking function.

caller dest

Retrieves the sentry of the agent which invoked the current function.

guardCaller dest

Retrieves the agent which invoked the public function corresponding to the current guard function.

guardImplementer dest

Retrieves the agent which implements the public function corresponding to the current guard function.

funcMemPrio dest

Retrieves the memory priority of the current function invocation.

setFuncMemPrio prio

Modifies the memory priority of the current function invocation. The priority must be in the range of u16.

funcCorePrio dest

Retrieves the core priority of the current function invocation.

setFuncCorePrio prio

Modifies the core priority of the current function invocation. The priority must be in the range of u16.

THREAD INSTRUCTIONS

callIndexAsync dest, funcIndex

Asynchronously invokes a function which is defined in the current agent. The function runs in a new thread.

callHandleAsync dest, funcHandle

Asynchronously invokes the given function handle. The function runs in a new thread.

thisThread dest

Retrieves a sentry for the current thread.

threads dest

Retrieves a list of all threads in the current agent.

threadAgent dest, thread

Retrieves a sentry of the agent to which the given thread belongs.

threadFuncHandle dest, thread

Retrieves a function handle for the base function in the given thread.

quitThread

Terminates the current thread.

threadHasQuit dest, thread

Retrieves whether the given thread has quit.

killThread thread

Terminates the given thread. The thread must be in the current agent.

BITWISE INSTRUCTIONS

bNot dest, value

Performs bitwise NOT with the given value.

bOr dest, value1, value2

Performs bitwise OR with the given values.

bAnd dest, value1, value2

Performs bitwise AND with the given values.

bXor dest, value1, value2

Performs bitwise XOR with the given values.

bLeft dest, value1, value2

Performs bitshift left with the given values.

bRight dest, value1, value2

Performs bitshift right with the given values.

LOGICAL INSTRUCTIONS

lNot dest, value

Performs logical NOT with the given value.

lOr dest, value1, value2

Performs logical OR with the given values.

lAnd dest, value1, value2

Performs logical AND with the given values.

lXor dest, value1, value2

Performs logical XOR with the given values.

COMPARISON INSTRUCTIONS

equ dest, value1, value2

Determines whether the given values are equal.

nEqu dest, value1, value2

Determines whether the given values are not equal.

gre dest, value1, value2

Determines whether the first value is greater than the second value.

nGre dest, value1, value2

Determines whether the first value is not greater than the second value.

ARITHMETIC INSTRUCTIONS

add dest, value1, value2

Performs addition with the given values.

sub dest, value1, value2

Performs subtraction with the given values.

mul dest, value1, value2

Performs multiplication with the given values.

div dest, value1, value2

Performs division with the given values.

mod dest, value1, value2

Performs the modulo operation with the given values.

BUFFER INSTRUCTIONS

wrtBuff dest, buff, len

Copies a sequence of bytes or pointers between memory locations.

equBuff dest, buff1, len1, buff2, len2

Determines whether two sequences of bytes or pointers are equal.

findBuff dest, buff1, buff2, len2, strideOffset, strideCount

Searches for the second buffer in the first buffer. After each comparison, the search position changes by strideOffset. If strideOffset is positive, the position moves forward. If strideOffset is negative, the position moves backward. The result is the number of strides until the second buffer is found. If the second buffer is not found after strideCount strides, the result is -1.

fillBuff dest, len1, buff, len2

Fills the first buffer with copies of the second buffer. If len1 is not a multiple of len2, the last copy of the second buffer will be truncated.

TEXT INSTRUCTIONS

cmpText dest, text1, text2

Determines the lexicographical ordering of two text heap allocations according to character values. The result is -1 if the first text is before the second text, 0 if the first text equals the second text, and 1 if the first text is after the second text.

textToNum dest, text, base

Converts the given text heap allocation to a number.

numToText dest, num, base

Converts the given number to a text heap allocation.

textToUpper text

Converts the given text heap allocation to uppercase.

textToLower text

Converts the given text heap allocation to lowercase.

splitText dest, text, delim

Splits the given text heap allocation into a list of text heap allocations.

joinText dest, textList, delim

Joins the given list of text heap allocations into a single text heap allocation.

HIGHER-LEVEL MATHEMATIC INSTRUCTIONS

rand dest, min, max

Generates a pseudo-random number.

sin dest, value

Performs sine with the given value.

cos dest, value

Performs cosine with the given value.

tan dest, value

Performs tangent with the given value.

asin dest, value

Performs inverse sine with the given value.

acos dest, value

Performs inverse cosine with the given value.

atan dest, value

Performs inverse tangent with the given value.

pow dest, base, exp

Performs exponentiation with the given values.

log dest, base, value

Performs a logarithm with the given value.

LAUNCH OPTION INSTRUCTIONS

newLaunchOpt dest

Creates a new launch options sentry with default values.

launchOptIsRef dest, launchOpt

Retrieves whether the launched agent will be a reference of the current agent.

setLaunchOptIsRef launchOpt, isRef

Modifies whether the launched agent will be a reference of the current agent.

launchOptMemQuota dest, launchOpt

Retrieves the memory quota size of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

setLaunchOptMemQuota launchOpt, size

Modifies the memory quota size of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

launchOptMemPrio dest, launchOpt

Retrieves the memory priority of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

setLaunchOptMemPrio launchOpt, prio

Modifies the memory priority of the launched agent with respect to the current agent. The priority must be in the range of u16. This option is only valid if the launched agent is configured to be a life child of the launcher.

launchOptCoreQuota dest, launchOpt

Retrieves the core quota load of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

setLaunchOptCoreQuota launchOpt, load

Modifies the core quota load of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

launchOptCorePrio dest, launchOpt

Retrieves the core priority of the launched agent with respect to the current agent. This option is only valid if the launched agent is configured to be a life child of the launcher.

setLaunchOptCorePrio launchOpt, prio

Modifies the core priority of the launched agent with respect to the current agent. The priority must be in the range of u16. This option is only valid if the launched agent is configured to be a life child of the launcher.

AGENT INSTRUCTIONS

launch dest, appPath, launchOpt

Launches the given application. launchOpt may be left null for default launch options.

findOrLaunch dest, appPath, launchOpt

Finds an agent running the given application. If such an agent does not exist, launches the application. launchOpt may be left null for default launch options.

thisAgent dest

Retrieves the sentry of the current agent.

allAgents dest

Retrieves a list of all active agent sentries.

quitAgent

Terminates the current agent.

agentHasQuit dest, agent

Retrieves whether the given agent has quit.

agentAppPath dest, agent

Retrieves the application file path of the given agent.

agentLauncher dest, agent

Retrieves the agent which launched the given agent. The result is null if the agent was launched by the system.

agentRefs dest, agent

Retrieves a list of agent references of agent.

agentIsRef dest, agent

Retrieves whether agent is a reference of the current agent.

setAgentIsRef agent, isRef

Modifies whether agent is a reference of the current agent.

agentIsColl dest, agent

Retrieves whether the given agent is collectable when it is not a reference to any agent.

setAgentIsColl isColl

Modifies whether the current agent is collectable when it is not a reference to any agent.

throttleAgent agent

Requests for the given agent to reduce memory usage

killAgent agent

Requests for the given agent to terminate.

MUTEX INSTRUCTIONS

newMutex dest

Creates a new mutex for cross-thread and cross-agent mutual exclusion.

lockMutex mutex

Acquires an exclusive lock on the given mutex. If the mutex is already locked, synchronously waits until the lock is released.

lockMutexNoWait dest, mutex

Acquires an exclusive lock on the given mutex. If the mutex was already locked, another lock will not be acquired.

relMutex mutex

Releases an exclusive lock on the given mutex.

VOLUME INSTRUCTIONS

allVols dest

Retrieves a list of all available volume names.

renameVol oldName, newName

Modifies the name of a volume.

volDriver dest, vol

Retrieves the agent which is the volume driver for the given volume.

ejectVol vol

Indicates to the system that the given volume will soon be physically disconnected.

volIsFormatted dest, vol

Retrieves whether the given volume has been formatted.

formatVol vol

Formats the given volume, erasing any old content.

isVolClient dest, vol

Retrieves whether the current agent is a volume client of the given volume.

setIsVolClient vol, isClient

Modifies whether the current agent is a volume client of the given volume.

isVolDriver dest

Retrieves whether the current agent is a volume driver.

setIsVolDriver isDriver

Modifies whether the current agent is a volume driver.

VOLUME ITEM INSTRUCTIONS

vItemExists dest, path

Retrieves whether a volume item with the given path exists.

vItemIsDir dest, path

Retrieves whether the given volume item is a directory or a file. The result is 1 if the volume item is a directory, and 0 if the volume item is a file.

vItemIsSLink dest, path

Retrieves whether the given volume item is a soft link.

moveVItem destPath, srcPath

Moves the given volume item from one path to another.

FILE INSTRUCTIONS

newFile path, type

Creates a new empty file.

copyFile destPath, srcPath

Creates a copy of the given file.

delFile path

Deletes the given file.

fileType dest, path

Retrieves the type of the given file.

setFileType path, type

Modifies the type of the given file.

openFile dest, path

Opens the given file for reading and writing.

flushFile fileHandle

Persists any cached file modifications to storage.

closeFile fileHandle

Frees resources associated with the given file handle. Flushes any cached file modifications.

fileIsOpen dest, fileHandle

Retrieves whether the given file handle is open.

fileSize dest, fileHandle

Retrieves the size of the contents in the given file.

setFileSize fileHandle, size

Modifies the size of the contents in the given file. Truncates data or appends zeroes as necessary.

readFile dest, fileHandle, offset, size

Reads a sequences of bytes from the given file into a buffer.

wrtFile fileHandle, offset, buff, size

Writes a sequences of bytes from the given buffer into a file.

DIRECTORY INSTRUCTIONS

newDir path, type

Creates a new directory.

copyDir destPath, srcPath

Recursively creates a copy of the given directory and its contents.

delDir path

Recursively deletes the given directory and its contents.

dirType dest, path

Retrieves the type of the given directory.

setDirType path, type

Modifies the type of the given directory.

dirItems dest, path

Retrieves a list of volume item names in the given directory.

SOFT LINK INSTRUCTIONS

newSLink path1, path2

Creates a soft link between the given paths.

sLinkPath dest, path

Retrieves the path to which a soft link points.

setSLinkPath path1, path2

Modifies the path to which a soft link points.

PATH INSTRUCTIONS

depPath dest, depIndex

Retrieves the path of the given dependency. This path is resolved by the system when the application launches. If the dependency path could not be resolved, the result is null.

splitPath tailDest, headDest, path

Splits the given path into parent directory and name components.

joinPath dest, tail, head

Joins the given parent directory and name components into a single path.

pathVol dest, path

Retrieves the volume name of a path.

setPathVol dest, path, vol

Sets the volume name in a path.

searchPaths dest, path

Retrieves the search paths associated with the given volume item.

setSearchPaths path, searchPaths

Modifies the search paths associated with the given volume item.

COMPATIBILITY INSTRUCTIONS

verMeetsReq dest, ver, reqVer

Retrieves whether the first version number satisfies the requirement of the second version number.

bytecodeVer dest

Retrieves the bytecode format version number of the current runtime environment.

hasOpcode dest, opcode

Retrieves whether the given opcode is available in the current runtime environment.

bundleVer dest, path

Retrieves the version number of the given application or interface file with respect to its bundle. The result is null if the file is not a member of a bundle.

bundleVers dest, path

Retrieves the version numbers available in an application or interface bundle.

bundleVerPath dest, path, ver

Retrieves the path of an application or interface file with the given bundle version.

appIfaces dest, appPath

Retrieves a list of interface paths to which the given application conforms. The result list may contain paths to interface files and interface bundles.

appHasIface dest, appPath, ifacePath

Retrieves whether the given application conforms to an interface.

appIfaceVer dest, appPath, ifacePath

Retrieves the version number of the interface to which the given application conforms.

PROTAB INSTRUCTIONS

newProtab dest, data

Creates a new protab sentry. The current agent will be the arbiter for the new protab.

protabArbiter dest, protab

Retrieves the arbiter vessel associated with the given protab.

protabData dest, protab

Retrieves the data associated with the given protab.

PERMISSION INSTRUCTIONS

hasPerm dest, vessel, protab

Retrieves whether the given vessel holds permission for the given protab.

perms dest, vessel, protab

Retrieves a list of permission sentries for the protab in the given vessel. The result will be null if the vessel does not hold permission for the given protab.

permHolder dest, perm

Retrieves the vessel which holds the given permission. The result will be null if the permission is not held by any vessel.

permIsImplicit dest, perm

Retrieves whether the given permission is implicit.

precedingPerms dest, perm

Retrieves the preceding permissions associated with the given permission.

permPropCount dest, perm

Retrieves the remaining propagation count of the given permission. The result is -1 if the propagation count is infinite.

permProtab dest, perm

Retrieves the protab associated with the given permission.

newPerm dest, protab, propCount, precedingPerms

Creates a new permission. propCount may be -1 to indicate an infinite propagation count.

givePerm vessel, perm, propCount

Grants the given permission to the given vessel. propCount may be -1 to indicate an infinite propagation count.

delPerm perm, shouldRecur

Deletes the given permission from its vessel. If shouldRecur is true, recursively removes descendant permissions based on preceding permission.

LIFE PARENT INSTRUCTIONS

lifeChildren dest, vessel

Retrieves a list of life children of the given vessel.

lifeParents dest, vessel

Retrieves a list of life parents of the given vessel.

isLifeChild dest, vessel1, vessel2

Retrieves whether vessel1 is a life child of vessel2.

setIsLifeChild vessel1, vessel2, isChild

Modifies whether vessel1 is a life child of vessel2.

launcherIsLifeParent dest, appPath

Retrieves whether a launcher of appPath will be assigned as a life parent of the launched agent.

setLauncherIsLifeParent appPath, isParent

Modifies whether a launcher of appPath will be assigned as a life parent of the launched agent.

MEMORY QUOTA INSTRUCTIONS

memQuota dest, child, parent

Retrieves the maximum allowed memory usage of the given life child with respect to the given parent.

setMemQuota child, parent, size

Modifies the maximum allowed memory usage of the given life child with respect to the given parent.

memPrio dest, child, parent

Retrieves the memory priority of the given life child with respect to the given parent.

setMemPrio child, parent, prio

Modifies the memory priority of the given life child with respect to the given parent. The priority must be in the range of u16.

memSizeUsed dest, vessel

Retrieves the amount of memory used by the given vessel.

memSizeLeft dest, vessel

Retrieves the amount of memory left which the given vessel can use.

CORE QUOTA INSTRUCTIONS

coreQuota dest, child, parent

Retrieves the maximum allowed core usage of the given life child with respect to the given parent.

setCoreQuota child, parent, load

Modifies the maximum allowed core usage of the given life child with respect to the given parent. The load must be between 0 and 1 inclusive.

corePrio dest, child, parent

Retrieves the core priority of the given life child with respect to the given parent.

setCorePrio child, parent, prio

Modifies the core priority of the given life child with respect to the given parent. The priority must be in the range of u16.

coreLoadUsed dest, vessel

Retrieves the amount of core load used by the given vessel.

coreLoadLeft dest, vessel

Retrieves the amount of core load left which the given vessel can use.

VOLUME QUOTA INSTRUCTIONS

volQuota dest, path

Retrieves the maximum allowed storage size of a volume item.

setVolQuota path, size

Modifies the maximum allowed storage size of a volume item.

volSizeUsed dest, path

Retrieves the amount of storage used by the given volume item.

volSizeLeft dest, path

Retrieves the amount of storage left which the given volume item can use.

VESSEL MIRROR INSTRUCTIONS

vesselMirror dest, vessel

Retrieves the vessel from which vessel is a mirror. If there is no mirror, the result is null.

setVesselMirror vessel1, vessel2

Configures vessel1 as a mirror of vessel2.

clrVesselMirror vessel

Removes vessel as a mirror of any other vessel.

SYSTEM PROTAB INSTRUCTIONS

allocReadProtab dest, alloc

Retrieves the protab to directly read a heap allocation.

allocWrtProtab dest, alloc

Retrieves the protab to directly modify a heap allocation.

sentryReadProtab dest, sentry

Retrieves the protab to read a sentry allocation through associated instructions and functions.

sentryWrtProtab dest, sentry

Retrieves the protab to modify a sentry allocation through associated instructions and functions.

vItemReadProtab dest, path

Retrieves the protab to read a volume item.

vItemWrtProtab dest, path

Retrieves the protab to modify a volume item.

launchProtab dest, path

Retrieves the protab to launch an application.

permControlProtab dest, vessel

Retrieves the protab to manage the permissions of a vessel.

lifeControlProtab dest, vessel

Retrieves the protab to manage the memory and CPU usage of a vessel.

volDriverProtab dest

Retrieves the protab to be a volume driver.

adminProtab dest

Retrieves the protab to be a system administrator.