Syscalls
Every function in <zuzu/zuzu.h>, grouped as in the header. Syscalls are listed by number; library helpers built on them follow each group.
Basics
| Number |
Name |
Selector |
Summary |
0x00 |
Quit |
|
Ends the calling task. |
0x01 |
Yield |
|
Gives up the rest of the caller's timeslice. |
0x02 |
Sleep |
|
Blocks the calling task for at least ms milliseconds. |
0x07 |
WaitOn |
|
Waits until h has something to report, or timeout milliseconds pass. |
| helper |
BenchDump |
|
Prints the kernel's benchmark counters to the kernel console (CONFIG_ZUZU_BENCH builds only; a no-op otherwise). |
| helper |
BenchReset |
|
Clears the kernel's benchmark counters (CONFIG_ZUZU_BENCH builds only; a no-op otherwise). |
| helper |
PtrIsErr |
|
Tells whether a pointer returned by MemMap() or MemMapAnon() is an error. |
Handles
| Number |
Name |
Selector |
Summary |
0x08 |
HandleClose |
MNGHNDL_CLOSE (2) |
Closes a handle. |
0x08 |
HandleDestroy |
MNGHNDL_DESTROY (4) |
Closes a handle and, for a space, tears the space down. |
0x08 |
HandleDuplicate |
MNGHNDL_DUPLICATE (0) |
Creates a second handle to the same object, with the same or fewer permissions. |
0x08 |
HandleGrant |
MNGHNDL_GRANT (5) |
Copies a handle into another space's handle table. |
0x08 |
HandleQueryAt |
MNGHNDL_QUERY (3) |
Reads one property of a handle or the object behind it. |
0x08 |
HandleRestrict |
MNGHNDL_RESTRICT (1) |
Removes permissions from a handle. |
| helper |
HandleDup |
|
HandleDuplicate() that stores the new handle in out. |
| helper |
HandleGrantTo |
|
HandleGrant() that stores the target's handle value in out. |
| helper |
HandleIsAlive |
|
Tells whether a handle is live and its object has not died. |
| helper |
HandleQuery |
|
HandleQueryAt() for properties that take no index. |
| helper |
HandleQuerySize |
|
Reads the size in bytes of a memory object. |
| helper |
HandleQueryValue |
|
HandleQuery() that stores the value in out. |
Tasks
| Number |
Name |
Selector |
Summary |
0x04 |
CreateTask |
OBJECT_TASK (0) |
Creates a task in a space. |
0x0C |
TaskGetRegs |
MNGTASK_GET_REGS (7) |
Reads the user registers of a faulted or suspended task. |
0x0C |
TaskKill |
MNGTASK_KILL (1) |
Terminates another task, as if it had called Quit(ERR_DEAD). |
0x0C |
TaskResume |
MNGTASK_RESUME (6) |
Lets a suspended task run again, or continues a faulted task. |
0x0C |
TaskSetMaxPriority |
MNGTASK_SET_MAX_PRIO (3) |
Sets the highest priority a task may give itself; lowers its base priority if needed. |
0x0C |
TaskSetPriority |
MNGTASK_SET_PRIORITY (2) |
Sets a task's base priority. |
0x0C |
TaskSetRegs |
MNGTASK_SET_REGS (8) |
Writes the user registers of a faulted or suspended task. |
0x0C |
TaskSetTimeSlice |
MNGTASK_SET_TIMESLICE (4) |
Sets how long a task runs before same-priority tasks get a turn. |
0x0C |
TaskStart |
MNGTASK_START (0) |
Starts a task created by CreateTask(). |
0x0C |
TaskSuspend |
MNGTASK_SUSPEND (5) |
Stops a task until TaskResume(). |
| helper |
FormatToTaskWait |
|
Unpacks the registers of a WaitOn() on a task. |
| helper |
WaitOnTask |
|
Waits for a task to exit or fault. |
Spaces
| Number |
Name |
Selector |
Summary |
0x04 |
CreateSpace |
OBJECT_SPACE (1) |
Creates an empty space. |
| helper |
FormatToSpaceWait |
|
Unpacks the registers of a WaitOn() on a space. |
| helper |
WaitOnSpace |
|
Waits until a space has no live tasks left. |
Memory and DMA
| Number |
Name |
Selector |
Summary |
0x04 |
CreateMem |
OBJECT_MEMORY (4) |
Creates a memory object that can be mapped, shared, injected and used for DMA. |
0x0B |
DmaAdopt |
MNGMEM_DMAADOPT (7) |
Returns a fresh handle to the memory behind an existing DMA mapping. |
0x0B |
DmaMap |
MNGMEM_DMAMAP (4) |
Lets a device reach part of a memory object by DMA. |
0x0B |
DmaSync |
MNGMEM_DMASYNC (6) |
Makes cached memory and a device agree before or after a transfer. |
0x0B |
DmaUnmap |
MNGMEM_DMAUNMAP (5) |
Removes a DMA mapping and releases its hold on the memory. |
0x0B |
MemInjectObj |
MNGMEM_INJECTOBJ (3) |
Maps part of a memory object into another space, typically one being set up. |
0x0B |
MemMap |
MNGMEM_MAP (0) |
Maps a memory object into the caller's address space. |
0x0B |
MemMapAnon |
MNGMEM_MAP (0) (HANDLE_ANON) |
Maps fresh zeroed memory, backed by no object, into the caller's address space. |
0x0B |
MemProtect |
MNGMEM_PROTECT (2) |
Changes the protection of a range of the caller's mapped memory. |
0x0B |
MemUnmap |
MNGMEM_UNMAP (1) |
Removes a mapping made by MemMap() or MemMapAnon(). |
| helper |
FormatToDmaMap |
|
Unpacks the registers of a DMA map call. |
| helper |
MemInjectBytes |
|
Copies bytes into another space at a fixed address. |
IPC
| Number |
Name |
Selector |
Summary |
0x04 |
CreatePort |
OBJECT_PORT (2) |
Creates a port: something callers Call() and a server receives on. |
0x05 |
CallTimeout |
|
Sends a message to a port and blocks until the server replies, or until a timeout. |
0x06 |
Reply |
|
Answers the call the caller is holding. |
0x06 |
ReplyRecv |
|
Answers the call in hand (if any), then waits for the next one, in one syscall. |
0x06 |
ReplyTo |
(ticket in r3) |
Answers a call parked with Hold(). |
0x0D |
Hold |
|
Parks the call in hand so the server can receive others, and returns a ticket for it. |
| helper |
Call |
|
Call() with no timeout: blocks until the server replies. |
| helper |
CallPort |
|
Call() that stores the reply length and any granted handle. |
| helper |
CallPortTimeout |
|
CallTimeout() that stores the reply length and any granted handle. |
| helper |
FormatToPortWait |
|
Unpacks the registers of a receive on a port. |
| helper |
ReplyRecvPort |
|
ReplyRecv() with the result unpacked. |
| helper |
WaitOnPort |
|
Waits for a call on a port. |
Events
| Number |
Name |
Selector |
Summary |
0x04 |
CreateEvent |
OBJECT_EVENT (3) |
Creates an event: 31 bits that can be signalled and waited on. |
0x08 |
IrqRearm |
MNGHNDL_IRQ_REARM (6) |
Unmasks a device's interrupt line after BindIrq() delivered it. |
0x09 |
Signal |
|
Sets bits on an event and wakes waiters. |
0x0A |
Bind |
EVENT_PORT (3), EVENT_TASK (4), EVENT_SPACE (5) |
Has the kernel set an event bit when a port, task or space needs attention. |
0x0A |
BindIrq |
EVENT_IRQ (2) |
Delivers a device's interrupt as an event bit. |
0x0A |
BindMemMgmt |
EVENT_MEMMGMT (1) |
Subscribes an event to the kernel's memory-pressure notifications. |
| helper |
FormatToEventWait |
|
Unpacks the registers of a WaitOn() on an event. |
| helper |
WaitOnEvent |
|
Waits for bits on an event, then clears them. |