modus
Menu
On this page

Kernel operations

What a process can ask the kernel: 35 operations. The parameters and the result of each are the words of the comment of the contract: "(parameters) -> result", then its text; the contract has no other form of them.

What a process asks the kernel. A thread asks for an operation with one command record in its kernel ring: kind is the operation, and the values are its arguments, in the order of its form. Then it enters the kernel with the syscall instruction. The kernel executes the commands of the ring in their order, and gives one completion record for each: kind is a Status, and the values are the results, in the order that each operation states. A completion with the status Ok has the results; with another status the operation failed, and the values of its completion are an : the argument that was wrong, its value, and what the kernel found (the errors of the kernel). A command whose kind has the bit COMMAND_NAMES_ERROR_DETAILS also receives one error detail for each other wrong argument, in the table of error details that its last value names. The kind 0 (None) and each kind past the last operation name no operation: the kernel refuses the command with Bad_Operation and the error record Unknown_Operation, and changes nothing.

A handle argument names an object of this process by the number that a grant or an operation gave. When the handle names no object of the kind that the operation needs, the status is Bad_Handle; when it names the object but has not the right that the operation needs, No_Right. The rights that each operation needs are in bold.

src/library/modus/system calls each operation with a procedure of its own (system.memory_create) or with system.call.

The comment above Operation in src/library/modus/contract/operation/operation.odin.

The table gives the number and the form of each operation; a name leads to the operation under the table, with its text, the statuses that its text names, and its line in the contract.

NumberOperationParametersResult
1Loglog, address, length, level: , runs, form:
2Memory_Createbudget, pages, flags: memory handle
3Memory_Mapmemory, process, address, flags: , first, pagesaddress
4Memory_Unmapprocess, address
5Memory_Sizememorypages
6Process_Createbudget, name, name_lengthprocess handle
7Process_Startprocess, entry, stack, context
8Process_Stopprocess, outcome: , error: Error_Record
9Process_Stateprocess, report: state: , cause: , outcome: , entries, slot, serial
10Handle_Givetarget, handle, rights: the handle in the target
11Handle_Closehandle
12Interrupt_Readinterruptcount
13Device_Createmachine, kind: , a, bhandle, address, value
14Inspectmachine, kind: , index, address, sizebytes written
15Machine_Stopmachine, code
16Thread_Createbudget, entry, stack, parameter, weight, requestthread handle
17Thread_Stopthread
18Thread_Statethreadstate: , stop count, area bytes, components, form
19Word_Waitwords: , count
20Word_Wakeword, countthreads woken
21Budget_Createbudget, pages, processes, threads, processor, log_recordsbudget handle
22Budget_Readbudgetpages, processes, threads, processor, log_records, processor time, refused
23Handle_Statehandle, memorykind: , rights: , through, holdings
24Handle_Revokehandle, processholdings ended
25Memory_Physicalmachine, memorydevice address
26Process_Moduleprocess, record:
27Strategy_Setmachine, strategy: the strategy before
28Memory_Commitmemory, budget, ranges: , count, flags: pages changed
29Memory_Protectranges: , count, flags: , processpages changed
30Fault_Handler_Setthread, end: , kinds: , process
31Fault_Answerthread, serial, answer: , process
32Events_Setmachine, memory, rules: , count, recordsring bytes, processors
33Thread_Controlthread, number, command: , address, size, sourcesee the command
34Guest_Runprocess, registers: , processorkind: , a, b, c, next, exit code, exit information
35Log_Readmemory, process, serial, after, records: , countcopied, lost, total

Read from src/library/modus/contract/operation/operation.odin.

Each operation

Log

Log(log, address, length, level: , runs, form: )

Writes one text or one log fact on the log of the kernel: records of the log, which a reader with the memory of the log reads, and one line [name] text on the serial port. The kernel sets the time, the process and the thread of each record, so a process cannot write a record of another process. The operation writes the records only; the tick of the first processor writes their line on the serial port after it, so a Log never waits for the lines of other processes.

Arguments

  • log: the log handle, with Write. Each process has it in its context at CONTEXT_LOG.
  • address, length: the bytes of the record, in memory that the process can read. For the form Text, the text, at most LOG_TEXT_BYTES_MOST bytes. A text longer than LOG_TEXT_CAPACITY continues in the next records (Log_Record, more). For the form , a up to the end of its values: from LOG_FACT_HEAD_BYTES to LOG_FACT_CALL_BYTES_MOST bytes. The kernel cuts the values in parts of LOG_FACT_VALUE_CAPACITY bytes and writes one record of each part, in a row, each with the module hash and the key, and more but on the last; it writes value_count, part and part_count of each, and reads no other field.
  • level: a Log_Level, from Info (0) to (3).
  • runs: the count of the value runs of the text, at most LOG_CALL_RUN_LIMIT; 0 is a plain text. The runs (value_kinds.Value_Run_In_Call) follow the length bytes of the text at address. A run says which bytes of the text are one value, and its kind: a reader of the log shows each value in the color of its kind. The text is written whole in every case: if a run is wrong, the record is plain. A fact has no runs: 0.
  • form: a . 0 is Text, so a writer of text gives five arguments.

Results: none.

Statuses

  • Bad_Handle, No_Right: log is not a log handle with Write.
  • Bad_Address: length is above LOG_TEXT_BYTES_MOST, or the process cannot read the text and its runs. For a fact: length is below LOG_FACT_HEAD_BYTES or above LOG_FACT_CALL_BYTES_MOST, or the process cannot read the bytes.
  • Bad_Operation: level is above , runs is above LOG_CALL_RUN_LIMIT, form names no , or a fact has runs.
  • No_Budget: the budget of the process accepted all the records of its amount in this second (Budget_Amounts, log_records). No other budget counts the record, so the refusal says nothing of what other processes wrote. A fact counts one record for each of its parts.
Number
1
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:258

Memory_Create

Memory_Create(budget, pages, flags: ) -> memory handle

Makes a memory object of pages pages of 4096 bytes, and gives a handle to it with each right of memory: Give, Read, Write and Execute. The memory is zero. The budget pays now, so an access to the memory never fails for lack of memory.

Arguments

  • budget: a budget handle with Spend. It pays now for each page and for the frame list of the object (memory_cost). A Contiguous object has no frame list; an Uncommitted object pays its frame list only, and at least one page.
  • pages: the count of pages, from 1; at most MEMORY_PAGE_LIMIT (1 GiB) for an object that is not contiguous.
  • flags: a :
    • Frames_Now: each page gets its page frame now, not at its first use (a page on first use);
    • Contiguous: the frames follow each other in physical memory and do not move, for a device;
    • Uncommitted: no page is paid now, and Memory_Commit pays them later; with no other flag;
    • Large_Pages: Contiguous, in one run aligned on 2 MiB, with pages a multiple of LARGE_PAGE_PAGES, so that a mapping uses large pages.

Results: the memory handle.

Statuses

  • Bad_Handle, No_Right: budget is not a budget handle with Spend.
  • Bad_Operation: pages is 0, or above the limit; a flag that the kernel does not know; Uncommitted with another flag; Large_Pages with a count that is not a multiple of LARGE_PAGE_PAGES.
  • No_Budget: the budget cannot pay.
  • No_Slot: the table of the memory objects of the kernel is full, or the handle table of the process.
  • No_Memory: a contiguous object finds no free run of its length, though the budget can pay.
memory, status := system.memory_create(16, flags = {.Frames_Now})
Number
2
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:296

Memory_Map

Memory_Map(memory, process, address, flags: , first, pages) -> address

Maps pages of a memory object in this process or in another process, and gives the address of the first page.

Arguments

  • memory: a memory handle with Read, and Write to map with Write, Execute to map with Execute.
  • process: 0 for this process, or a process handle with Control.
  • address: the address of the first page: a multiple of 4096, at least 4096, with the mapping below USER_END and over no other mapping. 0: the kernel chooses the lowest free place from CHOSEN_BASE, with a page with no mapping before and after it, on 2 MiB for an object of Large_Pages that is mapped by whole large pages. With At_Address_Zero, the address is 0.
  • flags: a : Write, Execute, No_Access (the pages fault until Memory_Protect gives them access), Receive_Handles (this process agrees to receive handles through this memory object from Handle_Give), At_Address_Zero, or Write_Combining (device memory of Device_Kind.Memory that is write-combining, not uncached). No flag: read only. The kernel refuses any other bit. Write with Execute needs No_Access: no page is writable and executable. Such a switching mapping gets Write, Execute or No_Access from Memory_Protect for the whole mapping, and the kernel switches each page between Write and Execute at the fault of the guest. Write with Execute and At_Address_Zero are guest memory: only for another process that no thread ran (a guest), which Process_Start then refuses.
  • first: the first page of the object.
  • pages: the count of pages, or 0 for each page from first to the end of the object.

Results: the address of the first page.

Statuses

  • Bad_Handle, No_Right: memory or process is not a handle of its kind with its rights.
  • No_Right: also, the process maps in itself at addresses that meet a module record of the writer Starter (). The error kind is Starter_Module. The kernel checks it before the other mappings. An address that the kernel chooses meets no such record.
  • Bad_State: the process is stopped; a part of the object has a protection of its own (Memory_Protect): such an object has one mapping only; guest memory for this process, or for a process that a thread ran; or device memory with a live mapping of another cache type (no cache, Write_Combining, or the entry of a screen) through this object or another object whose physical pages meet its pages. The error kind is Object_Shared.
  • Bad_Address: the pages are not inside the object; the address is not a multiple of 4096, is below 4096 with no At_Address_Zero, is not 0 with it, ends above USER_END, or meets another mapping.
  • Bad_Operation: Write with Execute and with no No_Access; Write_Combining on memory that is not device memory of Device_Kind.Memory, or with Execute; or a flag that the kernel does not know, which it refuses before it reads the handles; or, with the IOMMU in use, memory is device memory over the registers of a device with a domain and process names another process: only the holder of the registers maps them, so that its mappings keep the domain of the device.
  • No_Slot: the process has 128 mappings, or the kernel finds no free place for the address that it chooses.
  • No_Budget, No_Memory: the budget of the process that receives the mapping cannot pay its page tables, or no page frame is free.
address, status := system.memory_map(memory, flags = {.Write})
Number
3
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:330

Memory_Unmap

Memory_Unmap(process, address)

Removes the mapping that starts at an address, in this process or in another process. The memory object ends when no handle and no mapping names it.

Arguments

  • process: 0 for this process, or a process handle with Control.
  • address: the first byte of a mapping, below THREAD_AREA_BASE: the thread areas and the time page stay.

Results: none.

Statuses

  • Bad_Handle, No_Right: process is not a process handle with Control.
  • No_Right: also, the process unmaps in itself a mapping that meets a module record of the writer Starter (). The error kind is Starter_Module.
  • Bad_State: the process is stopped.
  • Bad_Address: no mapping starts at the address, or it is a thread area or the time page.
Number
4
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:383

Memory_Size

Memory_Size(memory) -> pages

Gives the count of pages of a memory object.

Arguments

  • memory: a memory handle, with any rights.

Results: the count of pages.

Statuses

  • Bad_Handle: memory is not a memory handle.
Number
5
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:402

Process_Create

Process_Create(budget, name, name_length) -> process handle

Makes a process, in the state Created, and gives a handle to it with Give, Read and Control. The process has no memory and no handle: its addresses hold the time page only. Process_Start starts it.

Arguments

  • budget: a budget handle with Spend. It pays for one process slot, for the page tables of the process, and for the OWN_LOG_PAGES pages of its own log ring, which return to it when the slot of the process is free. The process keeps it: it pays for its first thread at Process_Start, and for each page table of the process after.
  • name, name_length: the name of the process, at most PROCESS_NAME_BYTES_MOST bytes, in memory that the process can read: the reports and the log show it. Each byte is a printable character of ASCII or the space (32 to 126): a name starts each line of the log on the serial port.

Results: the process handle.

Statuses

  • Bad_Handle, No_Right: budget is not a budget handle with Spend.
  • Bad_Address: name_length is above PROCESS_NAME_BYTES_MOST, or the process cannot read the name.
  • Bad_Operation: a byte of the name is outside 32 to 126.
  • No_Budget: the budget has no process slot or no page left, or it cannot pay the page tables or the own log ring.
  • No_Slot: the table of the processes of the kernel is full, or the handle table of the process.
Number
6
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:414

Process_Start

Process_Start(process, entry, stack, context)

Starts a process that Process_Create made: its first thread runs at entry, and the process goes from Created to Ready. The budget of the process pays for the thread, as Thread_Create does. The first thread gets the limit of a new thread of the calling thread (new_thread_weight_limit_of_creation: the smaller of the new-thread weight limit of the calling thread and the one of its process) and the limit of its placement (): a process does not leave a limit by a process that it starts.

Arguments

  • process: a process handle with Control, of a process in the state Created.
  • entry: the address of the first instruction, below USER_END.
  • stack: the top of the stack, from 8 to USER_END; the thread starts with its stack pointer at stack minus 8, as after a call.
  • context: the value of the first register of the thread. By the rule of the system it is the address of the Context of the process (CONTEXT_ADDRESS); the kernel does not read it.

Results: none.

Statuses

  • Bad_Handle, No_Right: process is not a process handle with Control.
  • Bad_State: the process is not in the state Created, is a guest (Guest_Run), or holds guest memory: a mapping at the address 0, or one with Write and Execute (Memory_Map).
  • Bad_Address: entry or stack is out of its range.
  • No_Budget: the budget of the process has no thread slot left, or it cannot pay for the thread area or its page tables.
  • No_Slot: the thread table of the kernel is full, or the process has THREAD_CAPACITY threads.
  • No_Memory: no free run of page frames for the thread area.
Number
7
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:439

Process_Stop

Process_Stop(process, outcome: , error: Error_Record)

Stops a process: this one or another one. Each of its threads ends, and the operation returns when no thread of the process runs an instruction any more. The process is Stopped with its stop cause and its stop outcome, which Process_State gives. Its handles, its mappings and its memory end when its last thread left its processor. A process that is stopped already keeps its first stop cause and outcome.

The kernel records the stop cause from the target, never from the argument: Itself when the target is the process that asks (by 0 or by a handle that names it), Holder for another process. Only a process that stops itself says what its work gave: a holder cannot forge the end of another process .

Arguments

  • process: 0 for this process, or a process handle with Control. With 0, the thread that asks ends with its process: the operation does not return.
  • outcome: for a stop of this process, the word of a other than None: Done, Failed, Refused or Stopped_On_Request. For a stop of another process, 0.
  • error: 0, or the address of a readable in the caller. A non-zero address is allowed only when the target is this process and outcome is Failed or Refused, and the copied record must have a known non-zero kind and a known unit. For Done, Stopped_On_Request, and any holder stop, error must be 0.

Results: none.

Statuses

  • Bad_Handle, No_Right: process is not a process handle with Control.
  • Bad_Address: error is non-zero and names bytes that the caller cannot read.
  • Bad_Operation: outcome names no valid outcome for the target, error is non-zero when disallowed, or the copied error record has an invalid kind or unit. Nothing changes: the target runs on.

See: The stop of a process: its stop cause and its stop outcome in the repository

Number
8
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:468

Process_State

Process_State(process, report: ) -> state: , cause: , outcome: , entries, slot, serial

Gives the state of a process, its stop cause and its stop outcome, its count of kernel entries, and its place in the reports of Inspect. With an address, the kernel also writes there where the process stopped on a fault. A reader takes the first three results through stop_of_words.

The root service states facts of a process that it started by that place: the disk process page names each disk process by its slot and its serial, which the reports of Inspect give too (modus:contract/disk_process_page).

Arguments

  • process: a process handle with Read.
  • report: 0, or the address of a that the process can write: the instruction, the address of a page fault, the module and the stack trace of the fault that stopped the process. All zero while the process runs, or when its stop cause is not Fault, Not_Committed or Cannot_Return.

Results

  1. 1. the Process_State of the process: Created, Ready (one of its threads is ready), Waiting or Stopped;
  2. 2. its : None while it runs;
  3. 3. its : None while it runs, and for each stop cause but Itself;
  4. 4. its kernel entries since its start;
  5. 5. its process slot: the index that Inspect with the kind Process takes for it;
  6. 6. its process serial, as Process_Report.process_serial gives it: the slot and the serial name this process and no later one. The kernel keeps both until the last handle of the process closes.

Statuses

  • Bad_Handle, No_Right: process is not a process handle with Read.
  • Bad_Address: the process cannot write the at report.
Number
9
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:498

Handle_Give

Handle_Give(target, handle, rights: ) -> the handle in the target

Copies a handle into a process, with a part of its rights: a grant never adds a right. The kernel records where the copy came from (its origin): Handle_Revoke of the given handle ends the copy, and when the given handle closes, the copy comes from the origin of the given handle.

Arguments

  • target: where the copy goes:
    • 0: this process, with no right needed;
    • a process handle with Control: that process;
    • a memory handle: the one other process that maps this memory with Map_Flag.Receive_Handles. A process that holds or maps this memory without Receive_Handles never receives handles through it. The kernel keeps, with the copy, the memory object that it came through: Handle_State proves it to the receiver.
  • handle: the handle to give, with Give when the target is another process.
  • rights: the rights of the copy are the rights of handle that are also in rights. A process handle that goes to the process that it names also loses Control and Give: a process never holds the authority of its starter over itself, so it cannot give it to a child that would change its module records (the writer of a module record).

Results: the number of the copy in the target process.

Statuses

  • Bad_Handle: handle or target names nothing; target is a handle of another kind; or it is a memory object that no other process maps, or that two other processes map with Receive_Handles.
  • No_Right: handle has not Give, the process handle target has not Control, or target is a memory object that another process maps without Receive_Handles.
  • Bad_State: the target process is stopped; or handle names a memory object with a protection of its own on a part (Memory_Protect), and the target is another process.
  • No_Slot: the handle table of the target process is full.
copy, status := system.give(process, memory, {.Read})
Number
10
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:530

Handle_Close

Handle_Close(handle)

Closes a handle of this process. What came from it (its copies and its mappings) comes from its origin now. The object ends when nothing names it:

  • a memory object, when no handle and no mapping names it;
  • a budget, when its last handle closes: what it holds returns to the budget that it came from, which pays for its objects;
  • a process: it stops with the stop cause Handles_Closed when its last handle closes;
  • the event table of the machine, when the last machine handle with Events of its process closes.

Arguments

  • handle: any handle of this process.

Results: none.

Statuses

  • Bad_Handle: handle names nothing.
Number
11
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:565

Interrupt_Read

Interrupt_Read(interrupt) -> count

Gives the count of the interrupts of a line or of a message interrupt since the last read, and sets it to 0. Each interrupt also adds 1 to the events word of the threads of the process that holds the handle, and wakes them.

Arguments

  • interrupt: an interrupt handle with Read.

Results: the count of interrupts.

Statuses

  • Bad_Handle, No_Right: interrupt is not an interrupt handle with Read.
Number
12
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:584

Device_Create

Device_Create(machine, kind: , a, b) -> handle, address, value

Makes a handle to a part of the machine, for a device service.

Arguments

  • machine: the machine handle, with Devices.
  • kind, a, b: a and its two values:
    • Ports: a the first port, below 65536, and b the count, from 1 to 65536 minus a: a ports handle with Give; the threads of the process use the ports with in and out;
    • Interrupt: a a line of the 8259, from 1 to 15: an interrupt handle with Give and Read;
    • Memory: a the physical address, a multiple of 4096, and b the count of pages of the registers of a device: a memory handle with Give, Read and Write, mapped with no cache. The range meets no memory that the firmware gave as free or as loaded;
    • Display_Memory: as Memory, for the video memory of a display: the range must hold the address of the framebuffer of the firmware; the mapping has the page attribute of that framebuffer, not "no cache", and the object has no requester for the IOMMU;
    • Message: a the physical address where a memory base address register of the device starts: a message interrupt (MSI-X) of the first processor, for that device: an interrupt handle with Give and Read. With interrupt remapping in use, the entry of the message names that device, and the unit refuses the message to every other device; with none, a is not read. Behind a conventional bridge, the entry names the requester that the devices there share, and it is present only while their one domain lives (Memory_Physical).

Results

  1. 1. the handle;
  2. 2. for Message: the address that the device writes: the remappable form of the entry with interrupt remapping of Intel in use, else the compatible form of the first processor; for Memory: the of the device whose base address register starts at a (empty with no IOMMU in use, and always empty for Display_Memory);
  3. 3. for Message only: the value that the device writes there: 0 in the remappable form; the index of the entry in the interrupt table of the device with interrupt remapping of AMD in use; else the vector.

Statuses

  • Bad_Handle, No_Right: machine is not the machine handle with Devices.
  • Bad_Address: the ports, the line or the range of memory is out of its range.
  • Bad_Operation: kind is None or a kind that the kernel does not know; or Display_Memory over a range that does not hold the framebuffer of the firmware: the error record has the kind Bad_Value for a, with the address of that framebuffer as its limit.
  • No_Slot: no free memory object, no free message interrupt (MESSAGE_CAPACITY), or the handle table of the process is full.
Number
13
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:598

Inspect

Inspect(machine, kind: , index, address, size) -> bytes written

Writes a report of the kernel into memory of the process. Each has its report:

  • System: a ; index is not read;
  • Process: the of the process slot index;
  • Processor: the of the processor index;
  • Boot: the ;
  • Mappings: the of the page table: index 0 for the kernel half of the addresses, another value for the half of the process that asks;
  • Modules: the of the process slot index;
  • Process_Mappings, Threads, Stop: the reports of a developer tool for the process slot index: , , ;
  • Pages: the of the process that asks, for the address that it wrote in the record; index must be 0.

A slot or a processor with no process, or out of the table, gives a report of zeros.

Arguments

  • machine: the machine handle, with Inspect.
  • kind, index: the report, as above.
  • address, size: the memory of the report: size is at least the size of the report, and the process can write it.

Results: the bytes written: the size of the report.

Statuses

  • Bad_Handle, No_Right: machine is not the machine handle with Inspect.
  • Bad_Address: size is below the size of the report, or the process cannot write the memory.
  • Bad_Operation: kind is None or a kind that the kernel does not know; for Pages, index is not 0, or the address in the record is not a multiple of 4096, or its 64 pages pass USER_END.
Number
14
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:641

Machine_Stop

Machine_Stop(machine, code)

Stops the machine: the kernel writes kernel: the machine stops with code <code> on the log, then stops each processor. The operation does not return.

Arguments

  • machine: the machine handle, with Stop.
  • code: the code of the stop, from 0 to MACHINE_STOP_CODE_MOST: the machine gives it to its host.

Statuses

  • Bad_Handle, No_Right: machine is not the machine handle with Stop.
  • Bad_Operation: code is above MACHINE_STOP_CODE_MOST. A code that the host cannot receive whole is refused: else a code of 256 would end the machine with 0, the code of a normal end.
Number
15
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:673

Thread_Create

Thread_Create(budget, entry, stack, parameter, weight, request) -> thread handle

Starts a new thread of this process, and gives a handle to it with Give, Read, Write, Control and Inspect. The thread is ready at once: it starts at entry with parameter in its first register, and its stack pointer at stack minus 8.

Arguments

  • budget: a budget handle with Spend. It pays for the thread slot and for the thread area: the thread record, the kernel ring and a page with no memory. The budget of the process pays for the page tables of the area.
  • entry: the address of the first instruction, below USER_END.
  • stack: the top of the stack, from 8 to USER_END.
  • parameter: any value.
  • weight: from 1 to the limit of a new thread: the smaller of the new-thread weight limit of the calling thread () and the one of its process (, new_thread_weight_limit_of_creation). Each is WEIGHT_FULL unless the holder of the machine lowered it; 0 is that limit. A weight above it is refused. While the share policy of the process scheduler is on, it writes the process weight divided by 32 there, so the limit can be 32: a process that passes a weight reads its own schedule first, or passes 0. The share of the thread under the strategies that use weights. A weight can only be lower than the weight of a thread created with 0. The new thread gets that limit as its weight limit and as its own new-thread weight limit (thread_schedule_of_new_thread). It also gets the limit of the placement of the calling thread, as its set of processors and as its limit ().
  • request: microseconds, from 1 to REQUEST_LIMIT; 0 is REQUEST_DEFAULT. The delay that the thread asks for under EEVDF (weights and requests).

Results: the thread handle.

Statuses

  • Bad_Handle, No_Right: budget is not a budget handle with Spend.
  • Bad_Operation: weight is above the limit of a new thread, or request above REQUEST_LIMIT.
  • Bad_Address: entry or stack is out of its range.
  • Bad_State: the process stops.
  • No_Slot: the thread table of the kernel is full, the process has THREAD_CAPACITY threads, or its handle table is full.
  • No_Budget: the budget has no thread slot left, or it cannot pay for the thread area or its page tables.
  • No_Memory: no free run of page frames for the thread area.
thread, status := system.thread_start(worker, nil)
Number
16
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:687

Thread_Stop

Thread_Stop(thread)

Ends a thread: the calling thread, or a thread that a handle names, of this process or of another one. A thread on another processor leaves it at once, and the operation returns after it left. The other threads of its process get an event. A process with no thread left stops, with the stop cause Last_Thread_Ended and no stop outcome.

Arguments

  • thread: 0 for the calling thread, which ends: the operation does not return. Else a thread handle with Control.

Results: none. A thread that ended already stays as it is.

Statuses

  • Bad_Handle, No_Right: thread is not a thread handle with Control.
Number
17
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:731

Thread_State

Thread_State(thread) -> state: , stop count, area bytes, components, form

Gives the state of a thread, and what a holder of the thread needs for Thread_Control.

Arguments

  • thread: a thread handle with Read.

Results

  1. 1. its Process_State: Ready, Waiting or Stopped. A thread that a stop holds is Ready when its wait ended, and runs only when its stop count is 0;
  2. 2. its stop count (Thread_Control);
  3. 3. the bytes of the extended state area of a thread on this machine;
  4. 4. its components: the bits of XCR0 (0 x87, 1 SSE, 2 AVX, 5 to 7 AVX-512);
  5. 5. its : With_Header when the area has the header of xsave at byte 512, Legacy when it is the 512 bytes of fxsave.

Statuses

  • Bad_Handle, No_Right: thread is not a thread handle with Read.
Number
18
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:747

Word_Wait

Word_Wait(words: , count)

Adds words to the wait of this kernel entry: the one way to wait for something else than a time. A thread that asks for a wait when it enters the kernel waits at the end of the entry while each word of its list holds its value. The wait ends when Word_Wake names one of its words, or at its deadline. The kernel names a word by its page frame, so two processes that map one memory object wait on one word. If a word does not hold its value already, the wait ends at once: no wake is lost between a read of the word and the wait.

Arguments

  • words: the address of count records Word: each one is the address of a word of 32 bits, a multiple of 4 that the process can read, and the value that the word holds while the thread waits (the low 32 bits of value).
  • count: the words of this command. One entry holds at most WORD_WAIT_CAPACITY words in all its commands.

Results: none.

Statuses

  • No_Slot: the entry would hold more than WORD_WAIT_CAPACITY words.
  • Bad_Address: the process cannot read the table or a word, or a word is not a multiple of 4. The entry then does not wait.
system.word_wait(&ready, 0, deadline)
Number
19
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:767

Word_Wake

Word_Wake(word, count) -> threads woken

Ends the wait of at most count threads that wait on a word. A thread that put the word in the wait of its entry and does not wait yet counts too: it does not wait, and reads its words again.

Arguments

  • word: the address of a word of 32 bits, a multiple of 4 that the process can read.
  • count: the most threads to wake.

Results: the count of threads woken.

Statuses

  • Bad_Address: the process cannot read the word, or its address is not a multiple of 4.
system.word_wake(&ready)
Number
20
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:794

Budget_Create

Budget_Create(budget, pages, processes, threads, processor, log_records) -> budget handle

Makes a budget from a budget, and gives a handle to it with Give, Read, Spend and Commit (Budget_Amounts says what each amount is). The pages, the process slots, the thread slots and the log records of each second move from budget to the new budget. The processor time is a limit for each second, for the new budget and each budget that comes from it. When the last handle to the new budget closes, what it holds returns to budget, which pays for its objects.

Arguments

  • budget: a budget handle with Spend.
  • pages, processes, threads: what moves to the new budget.
  • processor: microseconds of processor time in each second, on all the processors together: at most the limit of budget.
  • log_records: records of the log in each second, which move to the new budget.

Results: the budget handle.

Statuses

  • Bad_Handle, No_Right: budget is not a budget handle with Spend.
  • No_Budget: budget holds less than an amount that moves, or a limit is above its own.
  • No_Slot: the table of the budgets of the kernel is full, or the handle table of the process.
Number
21
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:812

Budget_Read

Budget_Read(budget) -> pages, processes, threads, processor, log_records, processor time, refused

Gives what a budget can still pay, its limits, and what it used.

Arguments

  • budget: a budget handle with Read.

Results

  1. 1. the pages that it can still pay;
  2. 2. the process slots that it can still pay;
  3. 3. the thread slots that it can still pay;
  4. 4. its limit of processor time: microseconds in each second;
  5. 5. the log records of each second that it holds: its amount, after the budgets that came from it;
  6. 6. the microseconds of processor time that its threads used since it was made;
  7. 7. the log records that the kernel refused to it.

Statuses

  • Bad_Handle, No_Right: budget is not a budget handle with Read.
Number
22
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:834

Handle_State

Handle_State(handle, memory) -> kind: , rights: , through, holdings

Gives the kind and the rights of a handle of this process, and proves where it came from. A process that receives the number of a handle from another process, in a ring, proves with this operation that the other process gave the handle through that ring (Handle_Give with the memory of the ring as its target). Without the proof, the other process can name a handle that the receiver holds for itself.

Arguments

  • handle: any handle of this process.
  • memory: 0, or a memory handle with any rights: the memory of the ring.

Results

  1. 1. the Object_Kind of the object;
  2. 2. the Rights of the handle;
  3. 3. 1 when the handle came through the memory object of memory, else 0;
  4. 4. the count of the holdings that came from this handle, in all processes: what Handle_Revoke ends.

Statuses

  • Bad_Handle: handle names nothing, or memory is not a memory handle.
Number
23
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:854

Handle_Revoke

Handle_Revoke(handle, process) -> holdings ended

Ends each holding that came from a handle. A holding is a handle or a mapping. The origin of a handle that Handle_Give made is the handle that was given; the origin of a mapping is the memory handle that was mapped. When a handle closes, what came from it comes from its origin. The operation ends each holding that came from the handle, and what came from those holdings, in any process. The handle stays, and the mappings of the process that revokes stay. A process that lost a holding gets an event. A thread that uses memory that its process lost stops its process on a page fault.

Arguments

  • handle: any handle of this process, with any rights: the process that holds it is the origin of what came from it.
  • process: 0 for each process, or a process handle with Control: only the holdings in that process.

Results: the count of the holdings that ended.

Statuses

  • Bad_Handle: handle names nothing, or process is not a process handle.
  • No_Right: the process handle has not Control.
Number
24
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:875

Memory_Physical

Memory_Physical(machine, memory) -> device address

Gives the address that a device uses for the first page of a memory object, so that a device service gives it to its device, which reads and writes the memory with no processor (direct memory access). For an object whose pages follow each other in physical memory and do not move (an object created Contiguous or Large_Pages, or the registers of a device), it is the physical address of the first page.

When the IOMMU is in use, the call is also the declaration: each page of the object, which is not device memory, becomes memory that each device whose registers the caller holds by a handle can read, and write only while the caller holds a handle with Write to the object. A process that holds no such handle declares nothing. An object that is not contiguous then has a device window: its pages get their frames now, and the devices see them in their order from the address that the call gives, at 2^38 or above: a device that gives fewer than 39 bits of address must get contiguous objects only (Device_Create says whether the unit of a device gives windows: ). The pages leave the device when the process closes or loses its last handle to the object, when it holds neither a handle nor a mapping of the registers of the device, when the object ends, or when the process stops . The devices behind a conventional bridge share one domain: it lives while the caller holds the registers of each of them.

Arguments

  • machine: the machine handle, with Physical.
  • memory: a memory handle with Read.

Results: the device address: the physical address, or the address of the window.

Statuses

  • Bad_Handle, No_Right: machine or memory is not a handle of its kind with its right.
  • Bad_Operation: the pages of the object are not contiguous, and no IOMMU is in use or the caller holds the registers of no device: they get their frames at their first use, from anywhere.
  • Bad_Operation: also, with the IOMMU in use, a contiguous object ends above 2^38 or above the address width of the unit of a device; or an object that is not contiguous is Uncommitted, larger than 128 MiB (iommu.WINDOW_SIZE), or declared to a device whose unit gives no windows.
  • Bad_State: another process declared memory to the same device, and it still holds or maps its registers; or the device is behind a conventional bridge, and the caller does not hold the registers of each device behind that bridge, which all share its requester and its domain (the log names the device that it misses).
  • No_Slot: the caller holds the registers of more than 4 devices, or the 32 slots of the devices of the kernel are in use.
  • No_Budget: the budget of the caller cannot pay for a page of the tables of the device.

See: Architecture: Device grant and interrupts

Number
25
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:896

Process_Module

Process_Module(process, record: )

Records a module that a loader put in a process, in the module records of the process. The kernel does not read the module: the record is what the loader asserts. The kernel names the module of the address of a fault with it, and Inspect gives the records (). The kernel writes the writer of the record (): Process when the process records a module in itself, Starter when another process does it through the process handle. A process cannot replace or remove a record of the writer Starter, and cannot map or unmap where such a record is, so the record names the code that its starter put there (the writer of a module record).

Arguments

  • process: 0 for this process, or a process handle with Control.
  • record: the address of a that the process can read. A record with the base of a record that exists replaces it; a record with the size 0 removes the record of its base. A process has at most PROCESS_MODULE_CAPACITY records, and no two of them share an address. The kernel does not read the field writer.

Results: none.

Statuses

  • Bad_Handle, No_Right: process is not a process handle with Control.
  • No_Right: also, the process replaces or removes in itself a record of the writer Starter. The error kind is Starter_Module: the fix is with the holder of the process handle.
  • Bad_State: the process is stopped.
  • Bad_Address: the process cannot read the record; the module passes USER_END; it meets another record; or a record of size 0 names a base that no record has.
  • No_Slot: the process has PROCESS_MODULE_CAPACITY records.
Number
26
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:937

Strategy_Set

Strategy_Set(machine, strategy: ) -> the strategy before

Changes the scheduling strategy of the machine while it runs: no thread stops, and none is lost. The state of the strategy of each thread starts from zero (the change of strategy).

Arguments

  • machine: the machine handle, with Schedule.
  • strategy: Round_Robin, Fair or Eevdf.

Results: the before.

Statuses

  • Bad_Handle, No_Right: machine is not the machine handle with Schedule.
  • Bad_Operation: strategy is None or a strategy that the kernel does not know.
before, status := system.strategy_set(machine, .Eevdf)
Number
27
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:966

Memory_Commit

Memory_Commit(memory, budget, ranges: , count, flags: ) -> pages changed

Commits the pages of ranges of an object made with Uncommitted: the budget pays one page for each page that was not committed, and each gets a frame at its first use. With Decommit, the committed pages of the ranges are no longer paid: their frames and their pages return at once to the budget of the object, and a page committed again is zero (the virtual memory of a process).

Arguments

  • memory: a memory handle with Write, of an object made with Uncommitted.
  • budget: a handle to the budget of the object, with Commit or Spend. Write on the object does not spend the budget of its maker: to let another process commit, give it the object and a budget handle with Commit only (who pays a commit). Not read with Decommit.
  • ranges, count: a table of count records , from 1 to RANGE_TABLE_CAPACITY, in increasing order, with no overlap, inside the object, with at most RANGE_TABLE_PAGE_LIMIT pages in all.
  • flags: a : Decommit, or none.

Results: the count of pages that changed.

Statuses

  • Bad_Handle, No_Right: memory is not a memory handle with Write; budget is not a budget handle with Commit or Spend.
  • Bad_Handle: budget names another budget than the budget of the object.
  • Bad_Operation: count is 0 or above RANGE_TABLE_CAPACITY; a flag that the kernel does not know; the table has more than RANGE_TABLE_PAGE_LIMIT pages; the object was not made Uncommitted.
  • Bad_Address: the process cannot read the table, or the ranges are not in order, overlap, or pass the end of the object.
  • No_Budget: the budget cannot pay the table: nothing changes.
  • Bad_State: a Decommit of an object that another process names, or that has more than one mapping.
changed, status := system.memory_commit(memory, ranges[:])
Number
28
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:986

Memory_Protect

Memory_Protect(ranges: , count, flags: , process) -> pages changed

Changes the protection of pages of mappings of this process, or of a guest: read only (no flag), Write, Execute, or No_Access. A switching mapping (guest memory mapped with Write, Execute and No_Access) takes only Write, Execute or No_Access, for the whole mapping: the kernel then switches each page between Write and Execute at the fault of the guest, never both at once (a guest). Each processor that runs a thread of the process forgets the old translations before the operation returns (one shoot-down). A table is done whole or not at all (protection and the shoot-down).

Arguments

  • ranges, count: a table of count records Address_Range, from 1 to RANGE_TABLE_CAPACITY. Each range is inside one mapping of this process, below THREAD_AREA_BASE.
  • flags: a within PROTECT_FLAGS_KNOWN (Receive_Handles is refused). A protection can only take away what the mapping was made with: Write needs a mapping made with Write, Execute one made with Execute. No_Access takes no other flag, and Write with Execute is refused.
  • process: 0 for this process, or a process handle with Control of a process in the state Created with no thread: a guest, or a process that will be one.

A range that is a part of a mapping, not its whole, takes away from the protection of the mapping now: it cannot get more. It needs an object with a frame list that only this process names, with one mapping; while a part has its own protection, the object is not mapped again and not given (Bad_State). At most RANGE_TABLE_PAGE_LIMIT pages change in one call.

Results: the count of pages that changed.

Statuses

  • Bad_Operation: count is 0 or above RANGE_TABLE_CAPACITY; a flag that the kernel does not know; Write with Execute, or No_Access with another flag; more than the mapping was made with; one table names a mapping whole and in part; more than RANGE_TABLE_PAGE_LIMIT pages; read only, or a part, of a switching mapping: the switch of a page gives it Write or Execute whatever such a protection said.
  • Bad_Address: the process cannot read the table; a range is not on whole pages, is empty, or is not inside one mapping; the mapping is a thread area or the time page; a part of a mapping of a contiguous object.
  • Bad_State: a part of a mapping of an object that another process names, or that has another mapping; process names a process that a thread ran.
  • Bad_Handle, No_Right: process is not 0 and not a process handle with Control.
changed, status := system.memory_protect(ranges[:], {})
Number
29
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1023

Fault_Handler_Set

Fault_Handler_Set(thread, end: , kinds: , process)

Makes a thread of this process the fault handler of the process: the faults of the chosen kinds of the other threads of the process become records of the fault ring in the thread record of the handler, in place of a stop. The thread of a fault waits for Fault_Answer. A page fault is delivered only below THREAD_AREA_BASE. A fault of a kind that the handler did not ask for stops the process as with no handler. A new handler replaces the one before, and its ring starts empty.

Arguments

  • thread: 0 for the calling thread, or a thread handle with Control of a live thread of this process.
  • end: a : End (1) ends the delivery, and each fault stops the process again; Set (0) sets the handler.
  • kinds: the to deliver, or 0 for page faults only, so that a handler of pages never gets a kind that it does not know. Only the kinds of FAULT_KINDS_DELIVERED.
  • process: 0, or a process handle with Debug of another process. Then the thread becomes the debug handler of that process: the caller is its debugger. The faults of the kinds Debug and Breakpoint of that process become records of the ring of this thread, before the fault handler of the process itself, and each faulting thread waits for a Fault_Answer with the same handle. kinds is then 0 or the whole of FAULT_KINDS_DEBUGGER: the debugger takes both kinds. end End ends the debugging (the detach). A process has one debugger at a time, and a thread is the debug handler of one process and not the fault handler of its own.

The debugging ends at the detach, when the debug handler thread ends, when the last handle of the debugger to the process with Debug closes or is revoked, and when the process stops. The kernel then removes the breakpoints of each thread of the process and the trap flag that the debugger wrote, takes back the stops that the debugger made, and resumes each thread that waits for its answer: a debugger that ends never holds and never stops the process.

When a thread of the process waits for an answer, a new handler or the end of the delivery ends the ring that holds its record: the process stops with the stop cause Fault_Unanswered, as when the handler thread ends, and the operation gives Ok.

Results: none.

Statuses

  • Bad_Operation: end names no ; a kind that the kernel never delivers; kinds with the end of the delivery; with process, kinds that are not 0 and not the whole of FAULT_KINDS_DEBUGGER.
  • Bad_Handle, No_Right: thread is not a thread handle with Control; process is not a process handle with Debug.
  • Bad_State: the thread is not a live thread of this process; the thread is the debug handler of a process and would become the fault handler of its own, or the reverse; with process: the process is the caller, it stopped, it has another debugger, the thread is the debug handler of another process, or, for End, the caller is not its debugger.
status := system.fault_handler_set(kinds = {.Page_Fault, .Breakpoint})
Number
30
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1067

Fault_Answer

Fault_Answer(thread, serial, answer: , process)

Answers a thread of this process that waits in the fault ring, by the two values of its .

Arguments

  • thread, serial: the thread and the serial of the record.
  • answer: a :
    • Resume: the thread continues with its registers, at the instruction of its record (the faulting instruction again, or the next one after a trap), or where Thread_Control wrote;
    • Stop: the process stops as with no handler: the stop cause and the stop report of the fault.
  • process: 0, or the process handle with Debug of the process that the caller debugs: the answer is for a thread of that process, whose record came to the debug handler. Only Resume: a debugger stops a process with Process_Stop and the right Control. After a Debug fault of an execute breakpoint, Resume at the same instruction sets the resume flag of the thread, so that the instruction runs once and the breakpoint stays.

Results: none.

Statuses

  • Bad_Operation: answer is not Resume or Stop; Stop with process.
  • Bad_Handle, No_Right: process is not a process handle with Debug.
  • Bad_State: no thread with that number waits for the fault of that serial: a wrong answer, a second answer, or an answer from another process; an answer with no process for a fault that went to the debugger of the process; with process, the caller is not the debugger. Also for Resume after a fault kind that does not resume by itself (fault_kind_resumes) when Thread_Control wrote neither the registers nor the extended state of the thread since its fault: the thread still waits, and Stop ends it.
status := system.fault_answer(record, .Resume)
Number
31
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1117

Events_Set

Events_Set(machine, memory, rules: , count, records) -> ring bytes, processors

Gives the event table of the machine: the kernel writes an into the event ring of the processor of each kernel event that a rule accepts. A new table replaces the table of the caller. The table also ends when its process ends, and when the last machine handle of its process with Events closes or is revoked: the table lives while the right that made it lives.

Arguments

  • machine: the machine handle, with Events.
  • memory: a memory handle with Write of an object made Contiguous (not the registers of a device), with room for one ring of EVENT_RING_HEAD_BYTES plus records times 64 bytes for each processor, one after the other from its first byte. 0: the caller takes its table away; when the operation returns, no processor writes in the old memory object.
  • rules, count: a table of count records , from 1 to EVENT_RULE_CAPACITY.
  • records: the records of each ring: a power of two from EVENT_RING_RECORDS_LEAST to EVENT_RING_RECORDS_MOST.

Results

  1. 1. the bytes of one event ring;
  2. 2. the count of processors: the count of rings.

Statuses

  • Bad_Handle, No_Right: machine is not the machine handle with Events, or memory not a memory handle with Write; the process of a rule is not a process handle with Read.
  • Bad_State: memory is 0 and the caller has no table; or another process has the table: one table at a time.
  • No_Slot: count is above EVENT_RULE_CAPACITY.
  • Bad_Operation: count is 0; records is not a power of two in its range; the object is not contiguous, is the registers of a device, or is too small for the rings; a rule that the kernel refuses (its kind, its flags, its reserved values, its least duration or its one in N).
  • Bad_Address: the process cannot read the table of rules.
Number
32
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1149

Thread_Control

Thread_Control(thread, number, command: , address, size, source) -> see the command

Controls a thread: holds it and releases it, reads its registers and its extended state, and writes them (the control of a thread). Stop and Resume change the stop count of the thread: it runs only while the count is 0. The registers and the extended state are read and written only while the thread is held: its stop count is above 0, or it waits for an answer of the fault ring. It also reads and writes the schedule of a thread: its weight and its request (), also while the thread runs (the schedule of a live thread). And it reads and writes the placement of a thread: the processors that can run it (), also while the thread runs (the placement of a thread). Two more commands read and write the schedule of a process (): the new-thread weight limit of all the threads of one process at once, through the machine handle only. Three commands count the events of the processor for the code of the calling thread (, the counters of a thread).

Arguments

  • thread: a thread handle with the rights of the command (thread_control_rights): Inspect, and Write too for a write of the registers or of the extended state; Control for Write_Schedule and Write_Placement. Or 0, and then number names a live thread of this process (Thread_Record.number, Fault_Record.thread). Or, for the two commands of the schedule and the two commands of the placement only, the machine handle with Schedule and Inspect (thread_control_machine_rights), and then number names any thread of the machine. A thread of another process needs a handle. Or the process handle with Debug of the process that the caller debugs (Fault_Handler_Set with that handle first), and then number names a live thread of that process, for each command but the two of the schedule and the two of the placement (thread_control_takes_debug_handle). The two commands of the schedule of a process take the machine handle with Schedule and Inspect only. The three commands of the thread counters act on the calling thread (thread_control_counts_the_caller): Start_Counters and Read_Counters take the machine handle with Counters only; Stop_Counters reads no handle.
  • number: the number of the thread when thread is 0; the machine number of the thread (Thread_Report.machine_number) when thread is the machine handle. For the two commands of the schedule of a process: the slot of the process in the low 32 bits and its serial (Process_Report.process_serial) in the high 32 bits (process_slot_and_serial). Not read by the three commands of the thread counters.
  • command: a .
  • address, size: the memory of the command that reads or writes: size is at least the size of a , of the extended state area (Thread_State), of a , of a , of a or of a , and the process can read it, or write it for a read of the thread. For Read_Memory, size is the count of bytes to read, at most THREAD_MEMORY_READ_LIMIT.
  • source: for Read_Memory, the address of the first byte in the process of the thread.

Results: what the command gives: the stop count, or the bytes written and the components. Read_Memory gives the count of bytes that it copied.

Statuses

  • Bad_Operation: command is None or a command that the kernel does not know; a write of values that a thread of a process cannot hold changes nothing (thread_registers_refusal, extended_state_refusal); a Write_Schedule through 0 or a thread handle with a weight above the weight of the thread or a request above its request; a Write_Schedule with a weight above WEIGHT_FULL, a request above REQUEST_LIMIT, or a weight limit or a new-thread weight limit above WEIGHT_FULL, changes nothing; a Write_Process_Schedule with a new-thread weight limit above WEIGHT_FULL changes nothing; a Write_Breakpoints with a breakpoint that a thread cannot have (thread_breakpoints_refusal) changes nothing; a Read_Memory of more than THREAD_MEMORY_READ_LIMIT bytes; a Write_Placement that thread_placement_after_write refuses changes nothing: through 0 or a thread handle a set with a processor that the set of the thread does not have, and for each writer a set or a limit with no processor that the machine has; Start_Counters or Read_Counters on a machine whose processors have no counters that the kernel uses, with the error kind Unsupported.
  • Bad_Handle, No_Right: thread is not a thread handle with the rights of the command, and not the machine handle with the rights of a command of the schedule or of the placement. The machine handle with another command gives Bad_Handle. A process handle with no Debug gives No_Right, and a process handle with a command of the schedule or of the placement Bad_Handle. A command of the schedule of a process, Start_Counters or Read_Counters with 0 or with a handle that is not the machine handle gives Bad_Handle; the machine handle with no Counters gives No_Right for Start_Counters and Read_Counters.
  • Bad_State: no live process has the slot and the serial of number, for a command of the schedule of a process; no live thread of this process has number; no live thread of the machine has the machine number number; the thread or its process ended, also for a read or a write of a schedule or of a placement of a thread that ends; a read or a write of the registers or of the breakpoints of a thread that is not held, or of the calling thread; a Stop above THREAD_STOP_COUNT_LIMIT or of a thread that ends; a Resume at the count 0; through a process handle with Debug: the caller is not the debugger of the process, the process is the caller, or a Resume of a thread that the debugger did not stop; a Read_Counters of a thread that does not count.
  • Bad_Address: size is too small, or the process cannot read or write the memory; a Read_Memory whose first byte the process of the thread cannot read, or whose range is not below USER_END.
Number
33
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1183

Guest_Run

Guest_Run(process, registers: , processor) -> kind: , a, b, c, next, exit code, exit information

Runs one guest processor of a process on the calling thread, until an exit that the kernel does not handle itself, and gives that exit (a guest). The process is a guest: a process that Process_Create made and that no thread ran. Its addresses are the guest physical addresses: Memory_Map with its handle gives the guest memory. The first run makes the process a guest: the time page leaves it, the OWN_LOG_PAGES pages of its own log ring return to its budget (a guest writes no log record), and Process_Start of it gives Bad_State after. The first run of each guest processor takes two pages from the budget of the process. A guest processor starts in 16-bit real mode, with each segment at base 0, unless the record asks for the load of another mode.

A guest has up to GUEST_PROCESSOR_CAPACITY guest processors. One thread runs one guest processor at a time; several threads of the caller run several guest processors of one guest at once. The record can ask for one event to deliver at the entry (). The kernel delivers an External_Interrupt only when the guest takes interrupts: else it opens the interrupt window, and the run ends with Interrupt_Window when the guest takes interrupts again.

The kernel gives a page on first use of a mapping of the guest its frame when the guest touches it, and enters the guest again: that exit does not end the operation. A page of a mapping made with Write, Execute and No_Access is writable or executable, never both: a fault that asks it for the other access switches that page, and does not end the operation either. The operation ends at each other exit, with the exit in its results.

Arguments

  • process: a process handle with Control, of a process in the state Created, with no thread, which is not the caller.
  • registers: the address of a record that the process can read and write. The kernel reads it before the entry, and writes the registers of the guest processor there after the exit. The process answers an exit by a change of the record before the next run.
  • processor: the index of the guest processor, from 0 to GUEST_PROCESSOR_CAPACITY - 1.

Results

  1. 1. the of the exit;
  2. 2. to 4. the values of the exit kind: a, b and c ( says what each one holds);
  3. 5. the address of the instruction after the one that exited, for Port_Write, Port_Read, Halt and Cpuid, and for an exit Other of rdmsr, wrmsr, rdtsc or rdtscp; else 0;
  4. 6. the exit code of the processor (the AMD manual, volume 2, appendix C): what an exit Other was;
  5. 7. the first exit information of the processor.

Statuses

  • Bad_Operation: the processors of the machine have no virtualization support that the kernel uses (AMD SVM with nested paging), and the error kind is Unsupported; the record has a field that its rules refuse (guest_registers_refusal); or processor is past the last guest processor.
  • Bad_Handle, No_Right: process is not a process handle with Control.
  • Bad_State: the process is the caller, was started, stopped, or another thread runs this guest processor now.
  • Bad_Address: the process cannot read and write the record.
  • No_Budget: at the first run of the guest processor, the budget of the process cannot pay its two pages.
exit, status := system.guest_run(guest, &registers)
Number
34
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1263

Log_Read

Log_Read(memory, process, serial, after, records: , count) -> copied, lost, total

Copies the records of the own log ring of one process: the last OWN_LOG_RECORD_CAPACITY records that the process wrote, which only its own records push out. The ring lives until the slot of the process is free: after its stop, while a handle names it, it is still read. The log service reads the own records of a caller with it, and the records of a process whose handle a starter lends. The kernel copies whole records under the log lock, so no copy is torn, and gives them to the caller after the lock. A guest has no own log ring after its first Guest_Run.

Arguments

  • memory: a handle of the memory of the log (ROOT_LOG_RECORDS) with Read. Its holder reads each record of the whole log, so a copy of an own log ring gives it no new fact.
  • process, serial: the process slot and the process serial of the process, as Process_State gives them.
  • after: an own number (Log_Record.own_number), modulo 2^32: the first record to copy. An after past the count of the records of the process gives no record (own_log_window).
  • records: the address of count records that the process can write.
  • count: the records that fit at records, at most OWN_LOG_RECORD_CAPACITY.

Results

  1. 1. the records copied, in the order of their own numbers;
  2. 2. the own records from after that the ring no longer keeps: the process wrote more records after them than the ring holds;
  3. 3. the records that the ring keeps from the first one copied to the last one: more than the first result when count is too small.

Statuses

  • Bad_Handle, No_Right: memory is not a handle of the memory of the log with Read.
  • Bad_Operation: process is 0 or past the process slots, or count is above OWN_LOG_RECORD_CAPACITY.
  • Bad_State: the slot holds no process with this serial and an own log ring: the slot is free, another process has it, or the process is a guest.
  • Bad_Address: the process cannot write the count records at records.
results, status := system.call(.Log_Read, u64(log_memory), slot, serial, after, u64(uintptr(&rows[0])), u64(len(rows)))

See: The own log ring of a process in the repository

Number
35
Statuses that its text names
Source
src/library/modus/contract/operation/operation.odin:1318

The status of a completion

The result kind of a kernel operation: the kind of its completion record.

The kernel writes one completion for each command of the kernel ring; src/library/modus/system gives it back as the second result of each wrapper (system.Status is this type). With Ok the values of the completion are the results of the operation. With another status the operation failed, and the values are an : which argument was wrong, its value, and what the kernel found. A status says which class of mistake it is; the error record says which one. The comment of each Operation lists its statuses and when each comes. See status.

Example: memory, status := system.memory_create(1 << 20) gives Bad_Operation: the count is above MEMORY_PAGE_LIMIT.

The comment above Status in src/library/modus/contract/operation/operation.odin.

NumberStatusWhat the contract says
0OkThe operation ran: the values of the completion are its results.
1Bad_OperationAn argument has a value that the operation never takes. A kind, a flag or a command that the kernel does not know, a count of 0 or above its limit, a combination that the operation refuses (Write with Execute). The same call with the same arguments fails again: it is a mistake of the caller.
2Bad_HandleA handle argument names no object of the kind that the operation needs. The handle number is 0 where 0 is not allowed, was never given, was closed, or names an object of another kind. Each operation that takes a handle can give it.
3Bad_AddressAn address argument is wrong. The process cannot read or write the memory that it names, the address is not aligned as the operation needs, or a range is outside its object, below 4096 or above USER_END, or meets another mapping.
4No_MemoryNo page frame is free, though the budget can pay. A contiguous run of the length asked does not exist, or a page table finds no frame. Memory_Create, Memory_Map, Process_Start and Thread_Create give it. Another try can pass after other objects end.
5No_SlotA table of fixed capacity is full. The handle table of a process, the 128 mappings of a process, the threads of a process (THREAD_CAPACITY), the module records (PROCESS_MODULE_CAPACITY), the words of a wait (WORD_WAIT_CAPACITY), the message interrupts (MESSAGE_CAPACITY), the rules of an event table, or a table of the kernel. Another try can pass after a slot frees.
6Bad_StateThe object is not in a state where the operation applies. The process is stopped or not created, the thread is not held or ended, no thread waits for the fault that an answer names, another process has the event table, the memory object has a protection of its own. The arguments are right; the moment is wrong.
7No_RightThe handle names the object, but it does not have the right for this operation. The Handle_State of the handle gives the rights that it has. No operation adds a right: a process that needs it asks the holder of a handle with that right for a new grant. A process also gets it when it changes a module record of its starter in itself, or maps or unmaps over it (): only a holder of its process handle does that.
8No_BudgetThe budget cannot pay for the operation. The budget, or a budget above it, does not hold the pages, the process slot or the thread slot that the operation takes; or for Log, the budget accepted all the records of its amount in this second. See Budget_Amounts.

Read from src/library/modus/contract/operation/operation.odin.

Error_Record struct

A struct of the package errors: 56 bytes, aligned on 8 bytes, 0 bytes of padding. The error record: what a call that failed says about why, as seven integers.

  • kindi6408 bytes
  • uniti6488 bytes
  • operationi64168 bytes
  • argumenti64248 bytes
  • valuei64328 bytes
  • limiti64408 bytes
  • foundi64488 bytes

Log_Level enum

An enum of the package operation on u8: 1 bytes, 4 members. The log: records of text, each with its process and its level.

  • Info0
  • Debug1
  • Warning2
  • Error3

Log_Record_Form enum

An enum of the package operation on u8: 1 bytes, 2 members. The form of a log record: what its bytes after the name of the process hold.

  • Text0
  • Fact1

Memory_Flags bit set

A bit set of the package operation of Memory_Flag: 8 bytes, 4 bits. An alias of bit_set[Memory_Flag; u64]. The flags of one Memory_Create.

  • Frames_Nowbit 0
  • Contiguousbit 1
  • Uncommittedbit 2
  • Large_Pagesbit 3

Map_Flags bit set

A bit set of the package operation of Map_Flag: 8 bytes, 6 bits. An alias of bit_set[Map_Flag; u64]. The flags of one Memory_Map or Memory_Protect.

  • Writebit 0
  • Executebit 1
  • No_Accessbit 2
  • Receive_Handlesbit 3
  • At_Address_Zerobit 4
  • Write_Combiningbit 5

Stop_Outcome enum

An enum of the package operation on u32: 4 bytes, 5 members. What a process says about its work when it stops itself.

  • None0
  • Done1
  • Failed2
  • Refused3
  • Stopped_On_Request4

Stop_Report struct

A struct of the package operation: 960 bytes, aligned on 8 bytes, 0 bytes of padding. Where a process stopped on a fault (Process_State).

  • causeu3204 bytes
  • vectoru3244 bytes
  • instructionu6488 bytes
  • addressu64168 bytes
  • moduleModule_Record2488 bytes
  • frame_countu641128 bytes
  • frames[16]Stop_Frame120768 bytes
  • process_serialu648888 bytes

and 2 more

Process_State enum

An enum of the package operation on u32: 4 bytes, 5 members. The state of a process or of a thread.

  • None0
  • Created1
  • Ready2
  • Waiting3
  • Stopped4

Stop_Cause enum

An enum of the package operation on u32: 4 bytes, 9 members. Why a process stopped: the kernel records it at every stop, and no process chooses or forges it.

  • None0
  • Itself1
  • Holder2
  • Last_Thread_Ended3
  • Handles_Closed4
  • Fault5
  • Not_Committed6
  • Cannot_Return7

and 1 more

Rights bit set

A bit set of the package operation of Right: 4 bytes, 15 bits. An alias of bit_set[Right; u32]. The rights of one handle, as a set: bit n is the Right n.

  • Givebit 0
  • Readbit 1
  • Writebit 2
  • Executebit 3
  • Controlbit 4
  • Inspectbit 5
  • Devicesbit 6
  • Stopbit 7

and 7 more

Device_Kind enum

An enum of the package operation on u64: 8 bytes, 6 members. The kind of a part of the machine that Device_Create gives to a device service.

  • None0
  • Ports1
  • Interrupt2
  • Memory3
  • Message4
  • Display_Memory5

Inspect_Kind enum

An enum of the package operation on u64: 8 bytes, 11 members. What Inspect writes: the kind of a report of the kernel, and what its index argument names.

  • None0
  • System1
  • Process2
  • Processor3
  • Boot4
  • Mappings5
  • Modules6
  • Process_Mappings7

and 3 more

Word struct

A struct of the package operation: 16 bytes, aligned on 8 bytes, 0 bytes of padding. One word of a word wait: the address of 32 bits of memory, and the value that they hold while the thread waits.

  • addressu6408 bytes
  • valueu6488 bytes

Object_Kind enum

An enum of the package operation on u8: 1 bytes, 9 members. The kind of the object that a handle names.

  • None0
  • Memory1
  • Process2
  • Interrupt3
  • Ports4
  • Machine5
  • Thread6
  • Budget7

and 1 more

Module_Record struct

A struct of the package operation: 88 bytes, aligned on 8 bytes, 0 bytes of padding. A module record: one module that a loader put in a process (Process_Module).

  • baseu6408 bytes
  • sizeu6488 bytes
  • hash[32]u81632 bytes
  • replaces[32]u84832 bytes
  • writeru64808 bytes

Strategy enum

An enum of the package operation on u32: 4 bytes, 4 members. The scheduling strategy of the machine: the rule that orders the ready threads of each run queue.

  • None0
  • Round_Robin1
  • Fair2
  • Eevdf3

Page_Range struct

A struct of the package operation: 16 bytes, aligned on 8 bytes, 0 bytes of padding. A range of pages of a memory object (Memory_Commit).

  • firstu6408 bytes
  • page_countu6488 bytes

Commit_Flags bit set

A bit set of the package operation of Commit_Flag: 8 bytes, 1 bits. An alias of bit_set[Commit_Flag; u64]. The flags of one Memory_Commit: {} commits, {.Decommit} decommits.

  • Decommitbit 0

Address_Range struct

A struct of the package operation: 16 bytes, aligned on 8 bytes, 0 bytes of padding. A range of addresses of the process (Memory_Protect).

  • addressu6408 bytes
  • page_countu6488 bytes

Fault_Handler_Action enum

An enum of the package operation on u64: 8 bytes, 2 members. What Fault_Handler_Set does, in its argument end.

  • Set0
  • End1

Fault_Kinds bit set

A bit set of the package operation of Fault_Kind: 8 bytes, 11 bits. An alias of bit_set[Fault_Kind; u64]. A set of fault kinds, by their vectors: the form of the argument of Fault_Handler_Set (fault_kinds_of_argument).

  • Divide_Errorbit 0
  • Debugbit 1
  • Breakpointbit 3
  • Invalid_Opcodebit 6
  • Segment_Not_Presentbit 11
  • Stack_Faultbit 12
  • General_Protectionbit 13
  • Page_Faultbit 14

and 3 more

Fault_Answer_Kind enum

An enum of the package operation on u64: 8 bytes, 3 members. The answer for a thread that waits in the fault ring.

  • None0
  • Resume1
  • Stop2

Event_Rule struct

A struct of the package operation: 64 bytes, aligned on 8 bytes, 0 bytes of padding. One rule of the event table.

  • kindu3204 bytes
  • flagsbit_set[Event_Rule_Flag; u32]44 bytes
  • processu6488 bytes
  • detailu64168 bytes
  • least_nanosecondsu64248 bytes
  • one_inu64328 bytes
  • reserved[3]u644024 bytes

Thread_Control_Command enum

An enum of the package operation on u64: 8 bytes, 22 members. What Thread_Control does.

  • None0
  • Stop1
  • Resume2
  • Read_Registers3
  • Write_Registers4
  • Read_Extended_State5
  • Write_Extended_State6
  • Read_Schedule7

and 14 more

Guest_Registers struct

A struct of the package operation: 240 bytes, aligned on 8 bytes, 0 bytes of padding. The registers of a guest processor that Guest_Run takes and gives: the general registers, the instruction address, the flags, the control registers, and the 64-bit system state that a system writes through model-specific registers (the targets of syscall, the bases of fs and gs), and the interrupt shadow.

  • raxu6408 bytes
  • rbxu6488 bytes
  • rcxu64168 bytes
  • rdxu64248 bytes
  • rsiu64328 bytes
  • rdiu64408 bytes
  • rbpu64488 bytes
  • rspu64568 bytes

and 30 more

Guest_Exit_Kind enum

An enum of the package operation on u64: 8 bytes, 12 members. What ended a run of a guest processor: the first result of Guest_Run.

  • None0
  • Port_Write1
  • Port_Read2
  • Halt3
  • Cpuid4
  • Memory5
  • Interrupted6
  • Shutdown7

and 4 more

Log_Record struct

A struct of the package operation: 256 bytes, aligned on 8 bytes, 0 bytes of padding. One record of the log of the kernel: one text, or a part of a longer text, of one thread, with its time and its level.

  • sequenceu6408 bytes
  • timeu6488 bytes
  • processu8161 bytes
  • threadu8171 bytes
  • levelLog_Level181 bytes
  • moreu8191 bytes
  • process_serialu32204 bytes
  • own_numberu32244 bytes

and 6 more

Fact struct

A struct of the package module: 32 bytes, aligned on 8 bytes, 0 bytes of padding. One row of the table Facts: one fact type that the module writes.

  • keyu6408 bytes
  • recordu3284 bytes
  • template_offsetu32124 bytes
  • template_countu32164 bytes
  • package_offsetu32204 bytes
  • package_countu32244 bytes
  • reservedu32284 bytes

Log_Fact_Call struct

A struct of the package operation: 1216 bytes, aligned on 8 bytes, 0 bytes of padding. The bytes that a writer gives to Log of the form Fact: the head of a fact, then each value byte of its fact type, up to LOG_FACT_VALUES_MOST.

  • module_hash[32]u8032 bytes
  • keyu64328 bytes
  • value_countu16402 bytes
  • partu8421 bytes
  • part_countu8431 bytes
  • reserved[4]u8444 bytes
  • values[1168]u8481168 bytes

Error enum

An enum of the package module on u32: 4 bytes, 16 members. What is not valid in a module file: the result of header, validate and rebase, and Load_Error.file_error at the stage Read.

  • None0
  • Too_Small1
  • Bad_Magic2
  • Unknown_Version3
  • Unknown_Feature4
  • Unknown_Machine5
  • Bad_Table6
  • Bad_Segment7

and 8 more

Module_Writer enum

An enum of the package operation on u64: 8 bytes, 2 members. Who wrote a module record (Module_Record.writer).

  • Process0
  • Starter1

Thread_Placement struct

A struct of the package operation: 16 bytes, aligned on 8 bytes, 0 bytes of padding. The placement of a thread: the processors that can run it, and the most that this set can be.

  • processorsu6408 bytes
  • processors_limitu6488 bytes

Device_Memory_Facts bit set

A bit set of the package operation of Device_Memory_Fact: 8 bytes, 2 bits. An alias of bit_set[Device_Memory_Fact; u64].

  • Domainbit 0
  • Windowsbit 1

System_Report struct

A struct of the package operation: 288 bytes, aligned on 8 bytes, 0 bytes of padding. The state of the whole machine: the memory, the slots, the counts of the kernel and of its locks.

  • timeu6408 bytes
  • page_countu6488 bytes
  • free_pagesu64168 bytes
  • process_slotsu64248 bytes
  • region_countu64328 bytes
  • entriesu64408 bytes
  • interruptsu64488 bytes
  • budget_pagesu64568 bytes

and 6 more

Process_Report struct

A struct of the package operation: 176 bytes, aligned on 8 bytes, 4 bytes of padding. The state of one process slot: its state, its name, its counts and what its budget still holds.

  • stateProcess_State04 bytes
  • stop_causeu3244 bytes
  • stop_outcomeu3284 bytes
  • name[32]u81232 bytes
  • padding444 bytes
  • mapped_pagesu64488 bytes
  • handle_countu64568 bytes
  • run_timeu64648 bytes
  • entriesu64728 bytes

and 8 more

Processor_Report struct

A struct of the package operation: 120 bytes, aligned on 8 bytes, 0 bytes of padding. The state of one processor: what it runs, its scheduler and its frame cache.

  • processu6408 bytes
  • busy_timeu6488 bytes
  • sameu64168 bytes
  • apic_idu64248 bytes
  • strategyStrategy324 bytes
  • queuedu32364 bytes
  • picksu64408 bytes
  • preemptionsu64488 bytes

and 8 more

Boot_Report struct

A struct of the package operation: 2720 bytes, aligned on 8 bytes, 0 bytes of padding. How the machine started: the stages and their times, the memory that the firmware gave, the framebuffer, the sizes of the kernel and of the boot image, and the trust record of the boot program.

  • timeu6408 bytes
  • stage_countu6488 bytes
  • stages[12]Boot_Stage16768 bytes
  • range_countu647848 bytes
  • ranges[64]Boot_Range7921536 bytes
  • firmware_rangesu6423288 bytes
  • firmware_vendor[32]u8233632 bytes
  • firmware_revisionu6423688 bytes

and 16 more

Mapping_Report struct

A struct of the package operation: 2376 bytes, aligned on 8 bytes, 0 bytes of padding. What the page table says, as the kernel reads it from the table itself.

  • run_countu6408 bytes
  • runs[96]Mapping_Run82304 bytes
  • pagesu6423128 bytes
  • write_pagesu6423208 bytes
  • execute_pagesu6423288 bytes
  • write_execute_pagesu6423368 bytes
  • guard_pagesu6423448 bytes
  • guards_expectedu6423528 bytes

and 2 more

Module_Report struct

A struct of the package operation: 1424 bytes, aligned on 8 bytes, 0 bytes of padding. The module records of one process, in the order of their addresses.

  • countu6408 bytes
  • modules[16]Module_Record81408 bytes
  • process_serialu6414168 bytes

Process_Mapping_Report struct

A struct of the package operation: 8208 bytes, aligned on 8 bytes, 0 bytes of padding. The mappings of one process, in the order of their addresses.

  • process_serialu6408 bytes
  • countu6488 bytes
  • mappings[128]Process_Mapping168192 bytes

Thread_Table_Report struct

A struct of the package operation: 2576 bytes, aligned on 8 bytes, 0 bytes of padding. The threads of one process, with the state of the scheduler of each.

  • process_serialu6408 bytes
  • countu6488 bytes
  • threads[32]Thread_Report162560 bytes

Page_Report struct

A struct of the package operation: 24 bytes, aligned on 8 bytes, 0 bytes of padding. Which of 64 pages of the process that asks have a page frame, and which are mapped.

  • addressu6408 bytes
  • presentu6488 bytes
  • mappedu64168 bytes

Thread_Schedule struct

A struct of the package operation: 16 bytes, aligned on 4 bytes, 0 bytes of padding. The schedule of a thread: the two values that a process sets for the scheduling strategies.

  • weightu3204 bytes
  • requestu3244 bytes
  • weight_limitu3284 bytes
  • new_thread_weight_limitu32124 bytes

Process_Schedule struct

A struct of the package operation: 4 bytes, aligned on 4 bytes, 0 bytes of padding. The schedule of a process: the value that bounds each creation by any thread of one process at once.

  • new_thread_weight_limitu3204 bytes

Extended_State_Layout enum

An enum of the package operation on u64: 8 bytes, 2 members. The layout of the extended state area of a thread on this machine: the result 5 of Thread_State.

  • Legacy0
  • With_Header1

Fault_Record struct

A struct of the package operation: 64 bytes, aligned on 8 bytes, 0 bytes of padding. One fault that the kernel gave to the fault handler of a process, in the fault ring of the thread record of the handler.

  • threadu6408 bytes
  • serialu6488 bytes
  • addressu64168 bytes
  • accessu64248 bytes
  • instructionu64328 bytes
  • kindu64408 bytes
  • error_codeu64488 bytes
  • reservedu64568 bytes

Event_Record struct

A struct of the package operation: 64 bytes, aligned on 8 bytes, 0 bytes of padding. One kernel event, in the event ring of the processor where it came.

  • timeu6408 bytes
  • kindu3284 bytes
  • processoru32124 bytes
  • processu32164 bytes
  • threadu32204 bytes
  • process_serialu64248 bytes
  • detailu64328 bytes
  • value_0u64408 bytes

and 2 more

Thread_Counters struct

A struct of the package operation: 32 bytes, aligned on 8 bytes, 0 bytes of padding. The counts of the events of the processor for the code of one thread, in user mode only, since its last Start_Counters (Read_Counters).

  • instructions_retiredu6408 bytes
  • cyclesu6488 bytes
  • cache_missesu64168 bytes
  • branch_missesu64248 bytes

Thread_Registers struct

A struct of the package operation: 176 bytes, aligned on 8 bytes, 0 bytes of padding. The general registers, the instruction address and the flags of a thread that Thread_Control holds.

  • raxu6408 bytes
  • rbxu6488 bytes
  • rcxu64168 bytes
  • rdxu64248 bytes
  • rsiu64328 bytes
  • rdiu64408 bytes
  • rbpu64488 bytes
  • rspu64568 bytes

and 14 more

Thread_Breakpoints struct

A struct of the package operation: 64 bytes, aligned on 8 bytes, 0 bytes of padding. The breakpoints of one thread, as Read_Breakpoints and Write_Breakpoints of Thread_Control give and take them.

  • breakpoints[4]Thread_Breakpoint064 bytes

Guest_Inject_Kind enum

An enum of the package operation on u8: 1 bytes, 5 members. An event that Guest_Run delivers to the guest at its entry: an interrupt of a device that the process models, or an exception of an instruction that the process ran in place of the guest.

  • None0
  • External_Interrupt1
  • Non_Maskable_Interrupt2
  • Exception3
  • Software_Interrupt4

COMMAND_NAMES_ERROR_DETAILS constant of the package operation

COMMAND_NAMES_ERROR_DETAILS :: u32(1) << 31

The table of error details of a kernel command (Module contract,.

src/library/modus/contract/operation/error_details.odin:17

memory_create procedure of the package system

memory_create :: proc "contextless" (page_count: u64, budget: Handle = 0, flags: op.Memory_Flags = {}, error: ^errors. = nil) -> (memory: Handle, status: Status)

memory_create makes a memory object.

src/library/modus/system/system.odin:449

call procedure of the package system

call :: proc "contextless" (operation: op.Operation, values: ..u64) -> (results: [7]u64, status: Status)

call executes one kernel operation and gives its results and its status.

src/library/modus/system/system.odin:115

CONTEXT_LOG constant of the package operation

CONTEXT_LOG :: 14

The roles of the handles that the system fixes for each process.

src/library/modus/contract/operation/operation.odin:3804

LOG_TEXT_BYTES_MOST constant of the package operation

LOG_TEXT_BYTES_MOST :: 4096

The bytes of the text of one Log operation.

src/library/modus/contract/operation/operation.odin:3395

LOG_TEXT_CAPACITY constant of the package operation

LOG_TEXT_CAPACITY :: 168

The bytes of text in one log record.

src/library/modus/contract/operation/operation.odin:3386

LOG_FACT_HEAD_BYTES constant of the package operation

LOG_FACT_HEAD_BYTES :: 48

The bytes of a fact before its values: the least length of a fact.

src/library/modus/contract/operation/operation.odin:3528

LOG_FACT_CALL_BYTES_MOST constant of the package operation

LOG_FACT_CALL_BYTES_MOST :: LOG_FACT_HEAD_BYTES + LOG_FACT_VALUES_MOST

The most bytes of Log of the form Fact.

src/library/modus/contract/operation/operation.odin:3547

LOG_FACT_VALUE_CAPACITY constant of the package operation

LOG_FACT_VALUE_CAPACITY :: 144

The bytes of the values of one record of a log fact: the fields of its.

src/library/modus/contract/operation/operation.odin:3492

LOG_CALL_RUN_LIMIT constant of the package operation

LOG_CALL_RUN_LIMIT :: 32

The value runs that one Log operation takes, after its text.

src/library/modus/contract/operation/operation.odin:3392

Value_Run_In_Call type of the package value_kinds

Value_Run_In_Call :: struct {...}

A value run of a text that is longer than one record: the text of one Log.

src/library/modus/contract/value_kinds/value_kinds.odin:98

log_records global variable of the package kernel

log_records: [^]op.Log_Record

A global variable with no comment in its source.

src/modulus/serial.odin:109

memory_cost procedure of the package operation

memory_cost :: proc "contextless" (page_count: u64) -> u64

memory_cost gives the pages that Memory_Create takes from a budget for an.

src/library/modus/contract/operation/operation.odin:2972

MEMORY_PAGE_LIMIT constant of the package operation

MEMORY_PAGE_LIMIT :: MEMORY_LIST_ENTRIES * MEMORY_LIST_ENTRIES

The pages of one memory object: 1 GiB.

src/library/modus/contract/operation/operation.odin:2942

LARGE_PAGE_PAGES constant of the package operation

LARGE_PAGE_PAGES :: 512

The pages of 4096 bytes of one large page (2 MiB): one entry of the page directory of the processor.

src/library/modus/contract/operation/operation.odin:3005

No_Memory type of the package compositor

No_Memory :: struct {...}

The compositor has no memory for its frame.

src/modules/system/compositor/facts.odin:843

Write type of the package storage_service

Write :: struct {...}

A type with no comment in its source.

src/modules/system/storage/engine.odin:590

CHOSEN_BASE constant of the package operation

CHOSEN_BASE :: 0x0000_1000_0000_0000

Where the kernel puts a mapping with no given address: Memory_Map with the address 0 takes the lowest free place from here, and below MODULE_BASE.

src/library/modus/contract/operation/operation.odin:77

THREAD_AREA_BASE constant of the package operation

THREAD_AREA_BASE :: 0x0000_7FFF_FFF4_0000

The thread areas: one per thread, THREAD_AREA_PAGES pages each.

src/library/modus/contract/operation/operation.odin:105

OWN_LOG_PAGES constant of the package operation

OWN_LOG_PAGES :: 4

The pages of the own log ring of a process: the kernel keeps a copy of.

src/library/modus/contract/operation/operation.odin:3426

name_length global variable of the package unlock

name_length: int

A global variable with no comment in its source.

src/modules/system/unlock/main.odin:253

PROCESS_NAME_BYTES_MOST constant of the package operation

PROCESS_NAME_BYTES_MOST :: 31

The bytes of the name of a process (Process_Create).

src/library/modus/contract/operation/operation.odin:3414

new_thread_weight_limit_of_creation procedure of the package operation

new_thread_weight_limit_of_creation :: proc "contextless" (thread_value, process_value: u32) -> u32

new_thread_weight_limit_of_creation gives the limit of a thread that a.

src/library/modus/contract/operation/operation.odin:1496

CONTEXT_ADDRESS constant of the package operation

CONTEXT_ADDRESS :: 0x0000_7FFF_FFF0_0000

The address of the context of the process (Context): the starter maps one.

src/library/modus/contract/operation/operation.odin:97

stop_of_words procedure of the package operation

stop_of_words :: proc "contextless" (state_word: u64, cause_word: u64, outcome_word: u64) -> (state: Process_State, cause: Stop_Cause, outcome: Stop_Outcome, ok: bool)

stop_of_words is the one border of the first three results of.

src/library/modus/contract/operation/stop_cause.odin:62

Message type of the package machine_wire

Message :: enum u32 {...}

What a mesh frame carries.

src/library/modus/contract/machine_wire/frame.odin:38

Pages type of the package manual_pages

Pages :: struct {...}

A valid file: the reads below take it.

src/library/modus/contract/manual_pages/manual_pages.odin:78

MACHINE_STOP_CODE_MOST constant of the package operation

MACHINE_STOP_CODE_MOST :: 255

The largest code of Machine_Stop: the host receives one byte.

src/library/modus/contract/operation/operation.odin:3083

WEIGHT_FULL constant of the package operation

WEIGHT_FULL :: 1024

The weight of a thread created with the weight 0: the most.

src/library/modus/contract/operation/operation.odin:1394

thread_schedule_of_new_thread procedure of the package operation

thread_schedule_of_new_thread :: proc "contextless" (new_thread_weight_limit: u32, weight, request: u64) -> (schedule: Thread_Schedule, ok: bool)

thread_schedule_of_new_thread gives the schedule of a thread that.

src/library/modus/contract/operation/operation.odin:1517

REQUEST_DEFAULT constant of the package operation

REQUEST_DEFAULT :: 3000

Microseconds: the request of a thread created with the request 0.

src/library/modus/contract/operation/operation.odin:1395

WORD_WAIT_CAPACITY constant of the package operation

WORD_WAIT_CAPACITY :: 64

The words of the wait of one kernel entry, in all its Word_Wait.

src/library/modus/contract/operation/operation.odin:1872

WINDOW_SIZE constant of the package iommu

WINDOW_SIZE :: u64(1) << 27

128 MiB: the largest object that is not contiguous that a device gets.

src/modulus/iommu/iommu.odin:576

PROCESS_MODULE_CAPACITY constant of the package operation

PROCESS_MODULE_CAPACITY :: 16

The module records of one process: its own module, the modules that.

src/library/modus/contract/operation/operation.odin:1749

RANGE_TABLE_CAPACITY constant of the package operation

RANGE_TABLE_CAPACITY :: 256

The ranges of one Memory_Commit or Memory_Protect.

src/library/modus/contract/operation/operation.odin:3006

RANGE_TABLE_PAGE_LIMIT constant of the package operation

RANGE_TABLE_PAGE_LIMIT :: 65536

The pages of all the ranges of one Memory_Commit or Memory_Protect (256 MiB): the kernel walks each page with.

src/library/modus/contract/operation/operation.odin:3009

PROTECT_FLAGS_KNOWN constant of the package operation

PROTECT_FLAGS_KNOWN :: u64(1) << u64(Map_Flag.Write) | u64(1) << u64(Map_Flag.Execute) | u64(1) << u64(Map_Flag.No_Access)

The flags that Memory_Protect knows, as the word of its argument: protection bits only.

src/library/modus/contract/operation/operation.odin:3063

FAULT_KINDS_DELIVERED constant of the package operation

FAULT_KINDS_DELIVERED :: u64(1 << 0 | 1 << 1 | 1 << 3 | 1 << 6 | 1 << 11 | 1 << 12 | 1 << 13 | 1 << 14 | 1 << 16 | 1 << 17 | 1 << 19)

The vectors of the kinds above: the kinds that Fault_Handler_Set takes.

src/library/modus/contract/operation/operation.odin:2012

FAULT_KINDS_DEBUGGER constant of the package operation

FAULT_KINDS_DEBUGGER :: FAULT_KINDS_TRAPS

The kinds that the debugger of a process takes (Fault_Handler_Set with a.

src/library/modus/contract/operation/operation.odin:2018

fault_kind_resumes procedure of the package operation

fault_kind_resumes :: proc "contextless" (vector: u64) -> bool

fault_kind_resumes says if Fault_Answer accepts Resume for a fault of a.

src/library/modus/contract/operation/operation.odin:2060

EVENT_RING_HEAD_BYTES constant of the package operation

EVENT_RING_HEAD_BYTES :: size_of(Event_Ring)

The bytes of the head of one event ring, before its records.

src/library/modus/contract/operation/operation.odin:2877

EVENT_RULE_CAPACITY constant of the package operation

EVENT_RULE_CAPACITY :: 16

The rules of one event table.

src/library/modus/contract/operation/operation.odin:2809

EVENT_RING_RECORDS_LEAST constant of the package operation

EVENT_RING_RECORDS_LEAST :: 16

The fewest records of one event ring.

src/library/modus/contract/operation/operation.odin:2819

EVENT_RING_RECORDS_MOST constant of the package operation

EVENT_RING_RECORDS_MOST :: 1 << 20

The most records of one event ring: 2^20 records of 64 bytes, 64 MiB for.

src/library/modus/contract/operation/operation.odin:2822

thread_control_rights procedure of the package operation

thread_control_rights :: proc "contextless" (command: Thread_Control_Command) -> Rights

thread_control_rights gives the rights that a thread handle needs for a.

src/library/modus/contract/operation/operation.odin:2338

thread_control_machine_rights procedure of the package operation

thread_control_machine_rights :: proc "contextless" (command: Thread_Control_Command) -> (rights: Rights, taken: bool)

thread_control_machine_rights says if a command of Thread_Control also.

src/library/modus/contract/operation/operation.odin:2369

thread_control_takes_debug_handle procedure of the package operation

thread_control_takes_debug_handle :: proc "contextless" (command: Thread_Control_Command) -> bool

thread_control_takes_debug_handle says if a command of Thread_Control.

src/library/modus/contract/operation/operation.odin:2387

thread_control_counts_the_caller procedure of the package operation

thread_control_counts_the_caller :: proc "contextless" (command: Thread_Control_Command) -> bool

thread_control_counts_the_caller says if a command of Thread_Control is a.

src/library/modus/contract/operation/operation.odin:2285

process_slot_and_serial procedure of the package operation

process_slot_and_serial :: proc "contextless" (slot, serial: u64) -> u64

process_slot_and_serial gives the number of the two commands of the.

src/library/modus/contract/operation/operation.odin:1504

THREAD_MEMORY_READ_LIMIT constant of the package operation

THREAD_MEMORY_READ_LIMIT :: 4096

The most bytes of one Read_Memory of Thread_Control: one page.

src/library/modus/contract/operation/operation.odin:2410

thread_registers_refusal procedure of the package operation

thread_registers_refusal :: proc "contextless" (registers: ^Thread_Registers) -> (refusal: Thread_Write_Refusal, value: u64)

thread_registers_refusal says what a write of the registers of a thread.

src/library/modus/contract/operation/operation.odin:2614

extended_state_refusal procedure of the package operation

extended_state_refusal :: proc "contextless" (area: []u8, components: u64, mxcsr_mask: u32, with_header: bool) -> (refusal: Thread_Write_Refusal, value: u64)

extended_state_refusal says what a write of an extended state area.

src/library/modus/contract/operation/operation.odin:2649

thread_breakpoints_refusal procedure of the package operation

thread_breakpoints_refusal :: proc "contextless" (breakpoints: ^Thread_Breakpoints) -> (refusal: Thread_Write_Refusal, value: u64)

thread_breakpoints_refusal says what a write of the breakpoints of a.

src/library/modus/contract/operation/operation.odin:2455

thread_placement_after_write procedure of the package operation

thread_placement_after_write :: proc "contextless" (written, held: Thread_Placement, machine_processors: u64, by_machine: bool) -> (after: Thread_Placement, refusal: Thread_Write_Refusal, most: u64)

thread_placement_after_write gives the placement that a thread has after.

src/library/modus/contract/operation/operation.odin:1609

THREAD_STOP_COUNT_LIMIT constant of the package operation

THREAD_STOP_COUNT_LIMIT :: 1 << 16

The highest stop count of a thread: Thread_Control Stop gives.

src/library/modus/contract/operation/operation.odin:2531

GUEST_PROCESSOR_CAPACITY constant of the package operation

GUEST_PROCESSOR_CAPACITY :: 4

The guest processors that one guest process can have: Guest_Run names.

src/library/modus/contract/operation/guest_registers.odin:9

guest_registers_refusal procedure of the package operation

guest_registers_refusal :: proc "contextless" (registers: Guest_Registers) -> bool

guest_registers_refusal says if Guest_Run refuses a registers record.

src/library/modus/contract/operation/guest_registers.odin:226

OWN_LOG_RECORD_CAPACITY constant of the package operation

OWN_LOG_RECORD_CAPACITY :: OWN_LOG_PAGES * 4096 / size_of(Log_Record)

The records that an own log ring keeps.

src/library/modus/contract/operation/operation.odin:3430

ROOT_LOG_RECORDS constant of the package operation

ROOT_LOG_RECORDS :: 3

The handle 3: the memory of the records of the log of the kernel, with.

src/library/modus/contract/operation/operation.odin:3972

own_log_window procedure of the package operation

own_log_window :: proc "contextless" (written: u64, after: u32) -> (first: u64, lost: u64, total: u64)

own_log_window gives which records of an own log ring a reader receives.

src/library/modus/contract/operation/log_ring.odin:62

Status type of the package system

Status :: op.Status

The status of a kernel operation: op.Status.

src/library/modus/system/system.odin:41