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:
kindis the operation, and the values are its arguments, in the order of its form. Then it enters the kernel with thesyscallinstruction. The kernel executes the commands of the ring in their order, and gives one completion record for each:kindis aStatus, and the values are the results, in the order that each operation states. A completion with the statusOkhas 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 bitCOMMAND_NAMES_ERROR_DETAILSalso 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 withBad_Operationand the error recordUnknown_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/systemcalls each operation with a procedure of its own (system.memory_create) or withsystem.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.
| Number | Operation | Parameters | Result |
|---|---|---|---|
| 1 | Log | log, address, length, level: , runs, form: | |
| 2 | Memory_Create | budget, pages, flags: | memory handle |
| 3 | Memory_Map | memory, process, address, flags: , first, pages | address |
| 4 | Memory_Unmap | process, address | |
| 5 | Memory_Size | memory | pages |
| 6 | Process_Create | budget, name, name_length | process handle |
| 7 | Process_Start | process, entry, stack, context | |
| 8 | Process_Stop | process, outcome: , error: Error_Record | |
| 9 | Process_State | process, report: | state: , cause: , outcome: , entries, slot, serial |
| 10 | Handle_Give | target, handle, rights: | the handle in the target |
| 11 | Handle_Close | handle | |
| 12 | Interrupt_Read | interrupt | count |
| 13 | Device_Create | machine, kind: , a, b | handle, address, value |
| 14 | Inspect | machine, kind: , index, address, size | bytes written |
| 15 | Machine_Stop | machine, code | |
| 16 | Thread_Create | budget, entry, stack, parameter, weight, request | thread handle |
| 17 | Thread_Stop | thread | |
| 18 | Thread_State | thread | state: , stop count, area bytes, components, form |
| 19 | Word_Wait | words: , count | |
| 20 | Word_Wake | word, count | threads woken |
| 21 | Budget_Create | budget, pages, processes, threads, processor, log_records | budget handle |
| 22 | Budget_Read | budget | pages, processes, threads, processor, log_records, processor time, refused |
| 23 | Handle_State | handle, memory | kind: , rights: , through, holdings |
| 24 | Handle_Revoke | handle, process | holdings ended |
| 25 | Memory_Physical | machine, memory | device address |
| 26 | Process_Module | process, record: | |
| 27 | Strategy_Set | machine, strategy: | the strategy before |
| 28 | Memory_Commit | memory, budget, ranges: , count, flags: | pages changed |
| 29 | Memory_Protect | ranges: , count, flags: , process | pages changed |
| 30 | Fault_Handler_Set | thread, end: , kinds: , process | |
| 31 | Fault_Answer | thread, serial, answer: , process | |
| 32 | Events_Set | machine, memory, rules: , count, records | ring bytes, processors |
| 33 | Thread_Control | thread, number, command: , address, size, source | see the command |
| 34 | Guest_Run | process, registers: , processor | kind: , a, b, c, next, exit code, exit information |
| 35 | Log_Read | memory, process, serial, after, records: , count | copied, 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 atCONTEXT_LOG.address,length: the bytes of the record, in memory that the process can read. For the formText, the text, at mostLOG_TEXT_BYTES_MOSTbytes. A text longer thanLOG_TEXT_CAPACITYcontinues in the next records (Log_Record,more). For the form , a up to the end of its values: fromLOG_FACT_HEAD_BYTEStoLOG_FACT_CALL_BYTES_MOSTbytes. The kernel cuts the values in parts ofLOG_FACT_VALUE_CAPACITYbytes and writes one record of each part, in a row, each with the module hash and the key, andmorebut on the last; it writesvalue_count,partandpart_countof each, and reads no other field.level: aLog_Level, fromInfo(0) to (3).runs: the count of the value runs of the text, at mostLOG_CALL_RUN_LIMIT; 0 is a plain text. The runs (value_kinds.Value_Run_In_Call) follow thelengthbytes of the text ataddress. 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 isText, so a writer of text gives five arguments.
Results: none.
Statuses
Bad_Handle,No_Right:logis not a log handle with Write.Bad_Address:lengthis aboveLOG_TEXT_BYTES_MOST, or the process cannot read the text and its runs. For a fact:lengthis belowLOG_FACT_HEAD_BYTESor aboveLOG_FACT_CALL_BYTES_MOST, or the process cannot read the bytes.Bad_Operation:levelis above ,runsis aboveLOG_CALL_RUN_LIMIT,formnames 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.
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). AContiguousobject has no frame list; anUncommittedobject pays its frame list only, and at least one page.pages: the count of pages, from 1; at mostMEMORY_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, andMemory_Commitpays them later; with no other flag;Large_Pages:Contiguous, in one run aligned on 2 MiB, withpagesa multiple ofLARGE_PAGE_PAGES, so that a mapping uses large pages.
Results: the memory handle.
Statuses
Bad_Handle,No_Right:budgetis not a budget handle with Spend.Bad_Operation:pagesis 0, or above the limit; a flag that the kernel does not know;Uncommittedwith another flag;Large_Pageswith a count that is not a multiple ofLARGE_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})
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 withWrite, Execute to map withExecute.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 belowUSER_ENDand over no other mapping. 0: the kernel chooses the lowest free place fromCHOSEN_BASE, with a page with no mapping before and after it, on 2 MiB for an object ofLarge_Pagesthat is mapped by whole large pages. WithAt_Address_Zero, the address is 0.flags: a :Write,Execute,No_Access(the pages fault untilMemory_Protectgives them access),Receive_Handles(this process agrees to receive handles through this memory object fromHandle_Give),At_Address_Zero, orWrite_Combining(device memory ofDevice_Kind.Memorythat is write-combining, not uncached). No flag: read only. The kernel refuses any other bit.WritewithExecuteneedsNo_Access: no page is writable and executable. Such a switching mapping getsWrite,ExecuteorNo_AccessfromMemory_Protectfor the whole mapping, and the kernel switches each page betweenWriteandExecuteat the fault of the guest.WritewithExecuteandAt_Address_Zeroare guest memory: only for another process that no thread ran (a guest), whichProcess_Startthen refuses.first: the first page of the object.pages: the count of pages, or 0 for each page fromfirstto the end of the object.
Results: the address of the first page.
Statuses
Bad_Handle,No_Right:memoryorprocessis 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 writerStarter(). The error kind isStarter_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 isObject_Shared.Bad_Address: the pages are not inside the object; the address is not a multiple of 4096, is below 4096 with noAt_Address_Zero, is not 0 with it, ends aboveUSER_END, or meets another mapping.Bad_Operation:WritewithExecuteand with noNo_Access;Write_Combiningon memory that is not device memory ofDevice_Kind.Memory, or withExecute; or a flag that the kernel does not know, which it refuses before it reads the handles; or, with the IOMMU in use,memoryis device memory over the registers of a device with a domain andprocessnames 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})
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, belowTHREAD_AREA_BASE: the thread areas and the time page stay.
Results: none.
Statuses
Bad_Handle,No_Right:processis not a process handle with Control.No_Right: also, the process unmaps in itself a mapping that meets a module record of the writerStarter(). The error kind isStarter_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.
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:memoryis not a memory handle.
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 theOWN_LOG_PAGESpages 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 atProcess_Start, and for each page table of the process after.name,name_length: the name of the process, at mostPROCESS_NAME_BYTES_MOSTbytes, 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:budgetis not a budget handle with Spend.Bad_Address:name_lengthis abovePROCESS_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.
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 stateCreated.entry: the address of the first instruction, belowUSER_END.stack: the top of the stack, from 8 toUSER_END; the thread starts with its stack pointer atstackminus 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 theContextof the process (CONTEXT_ADDRESS); the kernel does not read it.
Results: none.
Statuses
Bad_Handle,No_Right:processis not a process handle with Control.Bad_State: the process is not in the stateCreated, is a guest (Guest_Run), or holds guest memory: a mapping at the address 0, or one withWriteandExecute(Memory_Map).Bad_Address:entryorstackis 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 hasTHREAD_CAPACITYthreads.No_Memory: no free run of page frames for the thread area.
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 thanNone:Done,Failed,RefusedorStopped_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 andoutcomeisFailedorRefused, and the copied record must have a known non-zerokindand a knownunit. ForDone,Stopped_On_Request, and any holder stop,errormust be 0.
Results: none.
Statuses
Bad_Handle,No_Right:processis not a process handle with Control.Bad_Address:erroris non-zero and names bytes that the caller cannot read.Bad_Operation:outcomenames no valid outcome for the target,erroris 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
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 notFault,Not_CommittedorCannot_Return.
Results
- 1. the
Process_Stateof the process:Created,Ready(one of its threads is ready),WaitingorStopped; - 2. its :
Nonewhile it runs; - 3. its :
Nonewhile it runs, and for each stop cause butItself; - 4. its kernel entries since its start;
- 5. its process slot: the index that
Inspectwith the kindProcesstakes for it; - 6. its process serial, as
Process_Report.process_serialgives 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:processis not a process handle with Read.Bad_Address: the process cannot write the atreport.
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 withoutReceive_Handlesnever receives handles through it. The kernel keeps, with the copy, the memory object that it came through:Handle_Stateproves 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 ofhandlethat are also inrights. 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:handleortargetnames nothing;targetis a handle of another kind; or it is a memory object that no other process maps, or that two other processes map withReceive_Handles.No_Right:handlehas not Give, the process handletargethas not Control, ortargetis a memory object that another process maps withoutReceive_Handles.Bad_State: the target process is stopped; orhandlenames 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})
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_Closedwhen 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:handlenames nothing.
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:interruptis not an interrupt handle with Read.
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:athe first port, below 65536, andbthe count, from 1 to 65536 minusa: a ports handle with Give; the threads of the process use the ports withinandout;Interrupt:aa line of the 8259, from 1 to 15: an interrupt handle with Give and Read;Memory:athe physical address, a multiple of 4096, andbthe 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: asMemory, 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:athe 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,ais 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. the handle;
- 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; forMemory: the of the device whose base address register starts ata(empty with no IOMMU in use, and always empty forDisplay_Memory); - 3. for
Messageonly: 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:machineis not the machine handle with Devices.Bad_Address: the ports, the line or the range of memory is out of its range.Bad_Operation:kindisNoneor a kind that the kernel does not know; orDisplay_Memoryover a range that does not hold the framebuffer of the firmware: the error record has the kindBad_Valuefora, 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.
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 ;indexis not read;Process: the of the process slotindex;Processor: the of the processorindex;Boot: the ;Mappings: the of the page table:index0 for the kernel half of the addresses, another value for the half of the process that asks;Modules: the of the process slotindex;Process_Mappings,Threads,Stop: the reports of a developer tool for the process slotindex: , , ;Pages: the of the process that asks, for the address that it wrote in the record;indexmust 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:sizeis 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:machineis not the machine handle with Inspect.Bad_Address:sizeis below the size of the report, or the process cannot write the memory.Bad_Operation:kindisNoneor a kind that the kernel does not know; forPages,indexis not 0, or the address in the record is not a multiple of 4096, or its 64 pages passUSER_END.
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 toMACHINE_STOP_CODE_MOST: the machine gives it to its host.
Statuses
Bad_Handle,No_Right:machineis not the machine handle with Stop.Bad_Operation:codeis aboveMACHINE_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.
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, belowUSER_END.stack: the top of the stack, from 8 toUSER_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 isWEIGHT_FULLunless the holder of the machine lowered it; 0 is that limit. A weight above it is refused. While the share policy of the processscheduleris 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 toREQUEST_LIMIT; 0 isREQUEST_DEFAULT. The delay that the thread asks for under EEVDF (weights and requests).
Results: the thread handle.
Statuses
Bad_Handle,No_Right:budgetis not a budget handle with Spend.Bad_Operation:weightis above the limit of a new thread, orrequestaboveREQUEST_LIMIT.Bad_Address:entryorstackis out of its range.Bad_State: the process stops.No_Slot: the thread table of the kernel is full, the process hasTHREAD_CAPACITYthreads, 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)
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:threadis not a thread handle with Control.
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. its
Process_State:Ready,WaitingorStopped. A thread that a stop holds isReadywhen its wait ended, and runs only when its stop count is 0; - 2. its stop count (
Thread_Control); - 3. the bytes of the extended state area of a thread on this machine;
- 4. its components: the bits of XCR0 (0 x87, 1 SSE, 2 AVX, 5 to 7 AVX-512);
- 5. its :
With_Headerwhen the area has the header ofxsaveat byte 512,Legacywhen it is the 512 bytes offxsave.
Statuses
Bad_Handle,No_Right:threadis not a thread handle with Read.
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 ofcountrecordsWord: 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 ofvalue).count: the words of this command. One entry holds at mostWORD_WAIT_CAPACITYwords in all its commands.
Results: none.
Statuses
No_Slot: the entry would hold more thanWORD_WAIT_CAPACITYwords.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)
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)
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 ofbudget.log_records: records of the log in each second, which move to the new budget.
Results: the budget handle.
Statuses
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. the pages that it can still pay;
- 2. the process slots that it can still pay;
- 3. the thread slots that it can still pay;
- 4. its limit of processor time: microseconds in each second;
- 5. the log records of each second that it holds: its amount, after the budgets that came from it;
- 6. the microseconds of processor time that its threads used since it was made;
- 7. the log records that the kernel refused to it.
Statuses
Bad_Handle,No_Right:budgetis not a budget handle with Read.
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. the
Object_Kindof the object; - 2. the
Rightsof the handle; - 3. 1 when the handle came through the memory object of
memory, else 0; - 4. the count of the holdings that came from this handle, in all processes: what
Handle_Revokeends.
Statuses
Bad_Handle:handlenames nothing, ormemoryis not a memory handle.
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:handlenames nothing, orprocessis not a process handle.No_Right: the process handle has not Control.
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:machineormemoryis 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 isUncommitted, 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.
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 mostPROCESS_MODULE_CAPACITYrecords, and no two of them share an address. The kernel does not read the fieldwriter.
Results: none.
Statuses
Bad_Handle,No_Right:processis not a process handle with Control.No_Right: also, the process replaces or removes in itself a record of the writerStarter. The error kind isStarter_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 passesUSER_END; it meets another record; or a record of size 0 names a base that no record has.No_Slot: the process hasPROCESS_MODULE_CAPACITYrecords.
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,FairorEevdf.
Results: the before.
Statuses
Bad_Handle,No_Right:machineis not the machine handle with Schedule.Bad_Operation:strategyisNoneor a strategy that the kernel does not know.
before, status := system.strategy_set(machine, .Eevdf)
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 withUncommitted.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 withDecommit.ranges,count: a table ofcountrecords , from 1 toRANGE_TABLE_CAPACITY, in increasing order, with no overlap, inside the object, with at mostRANGE_TABLE_PAGE_LIMITpages in all.flags: a :Decommit, or none.
Results: the count of pages that changed.
Statuses
Bad_Handle,No_Right:memoryis not a memory handle with Write;budgetis not a budget handle with Commit or Spend.Bad_Handle:budgetnames another budget than the budget of the object.Bad_Operation:countis 0 or aboveRANGE_TABLE_CAPACITY; a flag that the kernel does not know; the table has more thanRANGE_TABLE_PAGE_LIMITpages; the object was not madeUncommitted.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: aDecommitof an object that another process names, or that has more than one mapping.
changed, status := system.memory_commit(memory, ranges[:])
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 ofcountrecordsAddress_Range, from 1 toRANGE_TABLE_CAPACITY. Each range is inside one mapping of this process, belowTHREAD_AREA_BASE.flags: a withinPROTECT_FLAGS_KNOWN(Receive_Handlesis refused). A protection can only take away what the mapping was made with:Writeneeds a mapping made withWrite,Executeone made withExecute.No_Accesstakes no other flag, andWritewithExecuteis refused.process: 0 for this process, or a process handle with Control of a process in the stateCreatedwith 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:countis 0 or aboveRANGE_TABLE_CAPACITY; a flag that the kernel does not know;WritewithExecute, orNo_Accesswith another flag; more than the mapping was made with; one table names a mapping whole and in part; more thanRANGE_TABLE_PAGE_LIMITpages; read only, or a part, of a switching mapping: the switch of a page gives itWriteorExecutewhatever 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;processnames a process that a thread ran.Bad_Handle,No_Right:processis not 0 and not a process handle with Control.
changed, status := system.memory_protect(ranges[:], {})
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 ofFAULT_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 kindsDebugandBreakpointof that process become records of the ring of this thread, before the fault handler of the process itself, and each faulting thread waits for aFault_Answerwith the same handle.kindsis then 0 or the whole ofFAULT_KINDS_DEBUGGER: the debugger takes both kinds.endEndends 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:endnames no ; a kind that the kernel never delivers; kinds with the end of the delivery; withprocess, kinds that are not 0 and not the whole ofFAULT_KINDS_DEBUGGER.Bad_Handle,No_Right:threadis not a thread handle with Control;processis 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; withprocess: the process is the caller, it stopped, it has another debugger, the thread is the debug handler of another process, or, forEnd, the caller is not its debugger.
status := system.fault_handler_set(kinds = {.Page_Fault, .Breakpoint})
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: thethreadand theserialof 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 whereThread_Controlwrote;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. OnlyResume: a debugger stops a process withProcess_Stopand the right Control. After aDebugfault of an execute breakpoint,Resumeat 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:answeris notResumeorStop;Stopwithprocess.Bad_Handle,No_Right:processis 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 noprocessfor a fault that went to the debugger of the process; withprocess, the caller is not the debugger. Also forResumeafter a fault kind that does not resume by itself (fault_kind_resumes) whenThread_Controlwrote neither the registers nor the extended state of the thread since its fault: the thread still waits, andStopends it.
status := system.fault_answer(record, .Resume)
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 madeContiguous(not the registers of a device), with room for one ring ofEVENT_RING_HEAD_BYTESplusrecordstimes 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 ofcountrecords , from 1 toEVENT_RULE_CAPACITY.records: the records of each ring: a power of two fromEVENT_RING_RECORDS_LEASTtoEVENT_RING_RECORDS_MOST.
Results
- 1. the bytes of one event ring;
- 2. the count of processors: the count of rings.
Statuses
Bad_Handle,No_Right:machineis not the machine handle with Events, ormemorynot a memory handle with Write; the process of a rule is not a process handle with Read.Bad_State:memoryis 0 and the caller has no table; or another process has the table: one table at a time.No_Slot:countis aboveEVENT_RULE_CAPACITY.Bad_Operation:countis 0;recordsis 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.
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 forWrite_ScheduleandWrite_Placement. Or 0, and thennumbernames 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 thennumbernames 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_Setwith that handle first), and thennumbernames 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_CountersandRead_Counterstake the machine handle with Counters only;Stop_Countersreads no handle.number: the number of the thread whenthreadis 0; the machine number of the thread (Thread_Report.machine_number) whenthreadis 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:sizeis 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. ForRead_Memory,sizeis the count of bytes to read, at mostTHREAD_MEMORY_READ_LIMIT.source: forRead_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:commandisNoneor 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); aWrite_Schedulethrough 0 or a thread handle with a weight above the weight of the thread or a request above its request; aWrite_Schedulewith a weight aboveWEIGHT_FULL, a request aboveREQUEST_LIMIT, or a weight limit or a new-thread weight limit aboveWEIGHT_FULL, changes nothing; aWrite_Process_Schedulewith a new-thread weight limit aboveWEIGHT_FULLchanges nothing; aWrite_Breakpointswith a breakpoint that a thread cannot have (thread_breakpoints_refusal) changes nothing; aRead_Memoryof more thanTHREAD_MEMORY_READ_LIMITbytes; aWrite_Placementthatthread_placement_after_writerefuses 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_CountersorRead_Counterson a machine whose processors have no counters that the kernel uses, with the error kindUnsupported.Bad_Handle,No_Right:threadis 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 givesBad_Handle. A process handle with no Debug givesNo_Right, and a process handle with a command of the schedule or of the placementBad_Handle. A command of the schedule of a process,Start_CountersorRead_Counterswith 0 or with a handle that is not the machine handle givesBad_Handle; the machine handle with no Counters givesNo_RightforStart_CountersandRead_Counters.Bad_State: no live process has the slot and the serial ofnumber, for a command of the schedule of a process; no live thread of this process hasnumber; no live thread of the machine has the machine numbernumber; 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; aStopaboveTHREAD_STOP_COUNT_LIMITor of a thread that ends; aResumeat the count 0; through a process handle with Debug: the caller is not the debugger of the process, the process is the caller, or aResumeof a thread that the debugger did not stop; aRead_Countersof a thread that does not count.Bad_Address:sizeis too small, or the process cannot read or write the memory; aRead_Memorywhose first byte the process of the thread cannot read, or whose range is not belowUSER_END.
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 stateCreated, 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 toGUEST_PROCESSOR_CAPACITY - 1.
Results
- 1. the of the exit;
- 2. to 4. the values of the exit kind:
a,bandc( says what each one holds); - 5. the address of the instruction after the one that exited, for
Port_Write,Port_Read,HaltandCpuid, and for an exitOtherofrdmsr,wrmsr,rdtscorrdtscp; else 0; - 6. the exit code of the processor (the AMD manual, volume 2, appendix C): what an exit
Otherwas; - 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 isUnsupported; the record has a field that its rules refuse (guest_registers_refusal); orprocessoris past the last guest processor.Bad_Handle,No_Right:processis 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, ®isters)
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, asProcess_Stategives them.after: an own number (Log_Record.own_number), modulo 2^32: the first record to copy. Anafterpast the count of the records of the process gives no record (own_log_window).records: the address ofcountrecords that the process can write.count: the records that fit atrecords, at mostOWN_LOG_RECORD_CAPACITY.
Results
- 1. the records copied, in the order of their own numbers;
- 2. the own records from
afterthat the ring no longer keeps: the process wrote more records after them than the ring holds; - 3. the records that the ring keeps from the first one copied to the last one: more than the first result when
countis too small.
Statuses
Bad_Handle,No_Right:memoryis not a handle of the memory of the log with Read.Bad_Operation:processis 0 or past the process slots, orcountis aboveOWN_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 thecountrecords atrecords.
results, status := system.call(.Log_Read, u64(log_memory), slot, serial, after, u64(uintptr(&rows[0])), u64(len(rows)))
The status of a completion
The result kind of a kernel operation: the
kindof its completion record.The kernel writes one completion for each command of the kernel ring;
src/library/modus/systemgives it back as the second result of each wrapper (system.Statusis this type). WithOkthe 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 eachOperationlists its statuses and when each comes. See status.Example:
memory, status := system.memory_create(1 << 20)givesBad_Operation: the count is aboveMEMORY_PAGE_LIMIT.
The comment above Status in src/library/modus/contract/operation/operation.odin.
| Number | Status | What the contract says |
|---|---|---|
| 0 | Ok | The operation ran: the values of the completion are its results. |
| 1 | Bad_Operation | An 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. |
| 2 | Bad_Handle | A 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. |
| 3 | Bad_Address | An 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. |
| 4 | No_Memory | No 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. |
| 5 | No_Slot | A 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. |
| 6 | Bad_State | The 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. |
| 7 | No_Right | The 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. |
| 8 | No_Budget | The 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 bytesuniti6488 bytesoperationi64168 bytesargumenti64248 bytesvaluei64328 byteslimiti64408 bytesfoundi64488 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.
Info0Debug1Warning2Error3
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.
Text0Fact1
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 0Contiguousbit 1Uncommittedbit 2Large_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 0Executebit 1No_Accessbit 2Receive_Handlesbit 3At_Address_Zerobit 4Write_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.
None0Done1Failed2Refused3Stopped_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 bytesvectoru3244 bytesinstructionu6488 bytesaddressu64168 bytesmoduleModule_Record2488 bytesframe_countu641128 bytesframes[16]Stop_Frame120768 bytesprocess_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.
None0Created1Ready2Waiting3Stopped4
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.
None0Itself1Holder2Last_Thread_Ended3Handles_Closed4Fault5Not_Committed6Cannot_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 0Readbit 1Writebit 2Executebit 3Controlbit 4Inspectbit 5Devicesbit 6Stopbit 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.
None0Ports1Interrupt2Memory3Message4Display_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.
None0System1Process2Processor3Boot4Mappings5Modules6Process_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 bytesvalueu6488 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.
None0Memory1Process2Interrupt3Ports4Machine5Thread6Budget7
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 bytessizeu6488 byteshash[32]u81632 bytesreplaces[32]u84832 byteswriteru64808 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.
None0Round_Robin1Fair2Eevdf3
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 bytespage_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 bytespage_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.
Set0End1
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 0Debugbit 1Breakpointbit 3Invalid_Opcodebit 6Segment_Not_Presentbit 11Stack_Faultbit 12General_Protectionbit 13Page_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.
None0Resume1Stop2
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 bytesflagsbit_set[Event_Rule_Flag; u32]44 bytesprocessu6488 bytesdetailu64168 bytesleast_nanosecondsu64248 bytesone_inu64328 bytesreserved[3]u644024 bytes
An enum of the package operation on u64: 8 bytes, 22 members. What Thread_Control does.
None0Stop1Resume2Read_Registers3Write_Registers4Read_Extended_State5Write_Extended_State6Read_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 bytesrbxu6488 bytesrcxu64168 bytesrdxu64248 bytesrsiu64328 bytesrdiu64408 bytesrbpu64488 bytesrspu64568 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.
None0Port_Write1Port_Read2Halt3Cpuid4Memory5Interrupted6Shutdown7
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 bytestimeu6488 bytesprocessu8161 bytesthreadu8171 byteslevelLog_Level181 bytesmoreu8191 bytesprocess_serialu32204 bytesown_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 bytesrecordu3284 bytestemplate_offsetu32124 bytestemplate_countu32164 bytespackage_offsetu32204 bytespackage_countu32244 bytesreservedu32284 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 byteskeyu64328 bytesvalue_countu16402 bytespartu8421 bytespart_countu8431 bytesreserved[4]u8444 bytesvalues[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.
None0Too_Small1Bad_Magic2Unknown_Version3Unknown_Feature4Unknown_Machine5Bad_Table6Bad_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).
Process0Starter1
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 bytesprocessors_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 0Windowsbit 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 bytespage_countu6488 bytesfree_pagesu64168 bytesprocess_slotsu64248 bytesregion_countu64328 bytesentriesu64408 bytesinterruptsu64488 bytesbudget_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 bytesstop_causeu3244 bytesstop_outcomeu3284 bytesname[32]u81232 bytes- padding444 bytes
mapped_pagesu64488 byteshandle_countu64568 bytesrun_timeu64648 bytesentriesu64728 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 bytesbusy_timeu6488 bytessameu64168 bytesapic_idu64248 bytesstrategyStrategy324 bytesqueuedu32364 bytespicksu64408 bytespreemptionsu64488 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 bytesstage_countu6488 bytesstages[12]Boot_Stage16768 bytesrange_countu647848 bytesranges[64]Boot_Range7921536 bytesfirmware_rangesu6423288 bytesfirmware_vendor[32]u8233632 bytesfirmware_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 bytesruns[96]Mapping_Run82304 bytespagesu6423128 byteswrite_pagesu6423208 bytesexecute_pagesu6423288 byteswrite_execute_pagesu6423368 bytesguard_pagesu6423448 bytesguards_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 bytesmodules[16]Module_Record81408 bytesprocess_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 bytescountu6488 bytesmappings[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 bytescountu6488 bytesthreads[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 bytespresentu6488 bytesmappedu64168 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 bytesrequestu3244 bytesweight_limitu3284 bytesnew_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
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.
Legacy0With_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 bytesserialu6488 bytesaddressu64168 bytesaccessu64248 bytesinstructionu64328 byteskindu64408 byteserror_codeu64488 bytesreservedu64568 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 byteskindu3284 bytesprocessoru32124 bytesprocessu32164 bytesthreadu32204 bytesprocess_serialu64248 bytesdetailu64328 bytesvalue_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 bytescyclesu6488 bytescache_missesu64168 bytesbranch_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 bytesrbxu6488 bytesrcxu64168 bytesrdxu64248 bytesrsiu64328 bytesrdiu64408 bytesrbpu64488 bytesrspu64568 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.
None0External_Interrupt1Non_Maskable_Interrupt2Exception3Software_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,.
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.
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.
CONTEXT_LOG constant of the package operation
CONTEXT_LOG :: 14
The roles of the handles that the system fixes for each process.
LOG_TEXT_BYTES_MOST constant of the package operation
LOG_TEXT_BYTES_MOST :: 4096
The bytes of the text of one Log operation.
LOG_TEXT_CAPACITY constant of the package operation
LOG_TEXT_CAPACITY :: 168
The bytes of text in one log record.
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.
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.
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.
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.
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.
log_records global variable of the package kernel
log_records: [^]op.Log_Record
A global variable with no comment in its source.
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.
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.
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.
No_Memory type of the package compositor
No_Memory :: struct {...}
The compositor has no memory for its frame.
Write type of the package storage_service
Write :: struct {...}
A type with no comment in its source.
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.
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.
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.
name_length global variable of the package unlock
name_length: int
A global variable with no comment in its source.
PROCESS_NAME_BYTES_MOST constant of the package operation
PROCESS_NAME_BYTES_MOST :: 31
The bytes of the name of a process (Process_Create).
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.
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.
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.
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.
WEIGHT_FULL constant of the package operation
WEIGHT_FULL :: 1024
The weight of a thread created with the weight 0: the most.
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.
REQUEST_DEFAULT constant of the package operation
REQUEST_DEFAULT :: 3000
Microseconds: the request of a thread created with the request 0.
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.
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.
PROCESS_MODULE_CAPACITY constant of the package operation
PROCESS_MODULE_CAPACITY :: 16
The module records of one process: its own module, the modules that.
RANGE_TABLE_CAPACITY constant of the package operation
RANGE_TABLE_CAPACITY :: 256
The ranges of one Memory_Commit or Memory_Protect.
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.
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.
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.
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.
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.
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.
EVENT_RULE_CAPACITY constant of the package operation
EVENT_RULE_CAPACITY :: 16
The rules of one event table.
EVENT_RING_RECORDS_LEAST constant of the package operation
EVENT_RING_RECORDS_LEAST :: 16
The fewest records of one event ring.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
GUEST_PROCESSOR_CAPACITY constant of the package operation
GUEST_PROCESSOR_CAPACITY :: 4
The guest processors that one guest process can have: Guest_Run names.
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.
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.
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.
