Task

Task #

A Task capability represents a schedulable object which may receive CPU time, i.e. a thread or process. A schedulable Task has an associated VSpace, CSpace, IPC buffer, and stores its registers and other state.

Operations #

Task::CONFIGURE #

Configures a task’s associated CSpace, VSpace, and IPC buffer address. The caller must ensure that the provided IPC buffer address is mapped into the appropriate VSpace.

Parameters #

Register Details
r0 IPC buffer virtual address

Capabilities #

CSlot Usage Type Details
0 In CSpace CSpace to assign to this task
1 In VSpace VSpace to assign to this task

Results #

Error code Meaning
NONE Success
INVALID_PARAM IPC buffer address is not page-aligned
INVALID_PARAM IPC buffer is not mapped in the given VSpace

Task::READ_REGISTERS #

TODO

Task::WRITE_REGISTERS #

Writes the registers associated with this task. The task must be in a suspended or unconfigured state before invoking this operation.

Parameters #

The layout of the CPU context structure is arch-specific.

Register Details
r0 Pointer to CPU context struct

Capabilities #

This operation accepts no capabilities.

Results #

Error code Meaning
NONE Success
INVALID_PARAM The provided context structure is not mapped in the caller’s VSpace

Task::READ_TLS_BASE #

TODO

Task::WRITE_TLS_BASE #

Writes the arch-specific TLS base register. The task must be in a suspended or unconfigured state before invoking this operation.

Parameters #

The meaning and usage of the TLS base register is arch-specific and subject to userspace policy.

Register Details
r0 Value of the TLS base register

Capabilities #

This operation accepts no capabilities.

Results #

Error code Meaning
NONE Success

Task::SET_FAULT #

Configures the endpoint for reporting faults from this task. See the faults page for further details.

Parameters #

This operation accepts no parameters.

Capabilities #

CSlot Usage Type Details
0 In Endpoint Fault endpoint

Results #

Error code Meaning
NONE Success
INVALID_CTYPE The provided capability is not an endpoint
INVALID_CSLOT The invoked task already has a fault handler

Task::RESET_FAULT #

Removes the configured fault endpoint from this task, if any.

Parameters #

This operation accepts no parameters.

Capabilities #

This operation accepts no capabilities.

Results #

This operation always succeeds.

Error code Meaning
NONE Success

Task::SUSPEND #

Suspends this task, causing it to be ineligible for further scheduling. The task is guaranteed to be suspended before this operation completes, even if it is currently running on another core.

Parameters #

This operation accepts no parameters.

Capabilities #

This operation accepts no capabilities.

Results #

This operation always succeeds.

Error code Meaning
NONE Success

Task::RESUME #

Resumes this task, making it eligible to be scheduled at an unspecified point in the future. Note that tasks are only scheduled if they have been configured with an appropriate VSpace, CSpace, and IPC buffer; otherwise this function will have no effect (the task will instead be resumed as soon as the appropriate configure call is made).

Parameters #

This operation accepts no parameters.

Capabilities #

This operation accepts no capabilities.

Results #

This operation always succeeds.

Error code Meaning
NONE Success