System calls
Every call a program can make, generated from include/syscall.h. Programs use the koi_* wrappers in koi.h; the number is what goes in RAX.
int 0x40 RAX function number RDI, RSI, RDX, RCX arguments RAX result (all other registers are kept)
A note shared by several calls stands with the first of them. The structures and constants they use are in syscall.h itself.
0x00SYS_EXITkoi_exit(code), does not returnConsole and process.
0x01SYS_PUTCHARkoi_putchar(character)0x02SYS_PUTSkoi_print(text)0x03SYS_GETCHARkoi_getchar() -> key, blocking0x04SYS_READLINEkoi_readline(buffer, size) -> length0x05SYS_CLSkoi_cls()0x06SYS_SETCOLORkoi_color(foreground, background)0x07SYS_SETTHEMEkoi_theme(foreground, background, prompt, error)Set the shell colours; values outside 0-15 keep the current one. Returns foreground | background << 8 | prompt << 16 | error << 24. Saving is the caller's job.
0x08SYS_KEYPRESSEDkoi_keypressed() -> 1 when a key is ready, else 01 if a key is waiting (not taken).
0x09SYS_SLEEPkoi_sleep(milliseconds)Sleep without spinning. Keys arriving meanwhile stay buffered.
0x0ASYS_KEYEVENTkoi_keyevent(flags) -> key, key | KOI_KEY_RELEASED, or 0Key down/up events (unshifted identity, KOI_KEY_* for special keys). Returns 0 when none. Independent of the character queue. A program in a terminal gets none (its keys are the terminal's) unless it asks with KOI_KEYEVENT_SCREEN: it has a desktop window of its own, which has the keyboard (SDL).
0x0BSYS_GOTOXYkoi_gotoxy(point: column, row) -> 0Cursor position (columns, rows; see KOI_INFO_TEXT_COLUMNS/ROWS) and visibility.
0x0CSYS_CURSORkoi_cursor(visible) -> 00x10SYS_OPENkoi_open(path, mode) -> handleFiles. Handles are small non-negative integers; -1 means failure.
0x11SYS_CLOSEkoi_close(handle)0x12SYS_READkoi_read(handle, buffer, length) -> bytes read0x13SYS_WRITEkoi_write(handle, buffer, length) -> bytes written0x14SYS_SIZEkoi_filesize(handle) -> bytes0x15SYS_SEEKkoi_seek(handle, offset, whence) -> position, or -1Move the file position.
0x16SYS_REMOVEkoi_remove(path) -> 0, or -1Delete and rename.
0x17SYS_RENAMEkoi_rename(from, to) -> 0, or -10x18SYS_FINDFIRSTkoi_findfirst(pattern, KOI_FIND_DATA*) -> search, or -1Change this program's current drive (the shell's is unaffected). The directory resets to the root. Directory enumeration.
0x19SYS_FINDNEXTkoi_findnext(search, KOI_FIND_DATA*) -> 0, or -1 at the end0x1ASYS_FINDCLOSEkoi_findclose(search)0x1BSYS_EXISTSkoi_exists(path) -> 1 file, 2 directory, 0 none, -1 no volumeDoes a path exist?
0x1CSYS_MKDIRkoi_mkdir(path) -> 0, or -1Make a directory.
0x20SYS_ARGSkoi_arguments() -> command line tailEnvironment.
0x21SYS_VERSIONkoi_version() -> version, major in the high byte0x22SYS_SYSINFOkoi_uptime(item, index) -> value, or -1System information: one numeric and one text call, selected by item and index. Unknown items return -1.
0x23SYS_SYSTEXTkoi_systext(item, index, buffer, size) -> length, or -10x24SYS_ALLOCkoi_alloc(bytes) -> address, or 0Memory in whole pages, released automatically when the program exits.
0x25SYS_FREEkoi_free(address)0x30SYS_GFX_ENTERkoi_gfx_enter(KOI_SCREEN*) -> 0, or -1Graphics. A program takes the screen, draws into its buffer, presents, and gives it back; the console is restored exactly. Nothing appears until SYS_GFX_PRESENT. The KOI_SCREEN buffer may be written directly.
0x31SYS_GFX_LEAVEkoi_gfx_leave()0x32SYS_GFX_PRESENTkoi_gfx_present()0x33SYS_GFX_COLORkoi_gfx_color(red, green, blue) -> packed pixel0x34SYS_GFX_CLEARkoi_gfx_clear(colour)0x35SYS_GFX_PIXELkoi_gfx_pixel(point, colour)0x36SYS_GFX_LINEkoi_gfx_line(point, point, colour)0x37SYS_GFX_RECTkoi_gfx_rect(point, size, colour), outline0x38SYS_GFX_FILLkoi_gfx_fill(point, size, colour), filled0x39SYS_GFX_TEXTkoi_gfx_text(point, text, colour, background)0x3ASYS_GFX_PRESENT_RECTkoi_gfx_present_rect(point, size, flags)Present one rectangle (clipped).
0x3BSYS_GFX_TEXT_STYLEDkoi_gfx_text_styled(point, text, colour, packed)(point, text, colour, background | style << 32): bold, italic, underline.
0x3CSYS_GFX_SCISSORkoi_gfx_scissor(point, size), intersect the clip rectangle0x3DSYS_GFX_SCISSOR_RESETkoi_gfx_reset_scissor(), full-screen clipping0x3ESYS_GFX_DIMkoi_gfx_dim(point, size, keep)Darken a rectangle; `keep` out of 256.
0x3FSYS_GFX_BLITkoi_gfx_blit(point, size, pixels, stride)Copy a rectangle of pixels (stride in pixels).
0x40SYS_SOUND_PLAYkoi_sound_play(KOI_SOUND*) -> voice, or -1Sound. One 48 kHz stereo stream always runs; a sound gets a voice, or -1. Samples are not copied: keep the buffer until the sound ends. Voices stop when the program exits.
0x41SYS_SOUND_TONEkoi_sound_tone(hertz, milliseconds, volume) -> voice, or -10x42SYS_SOUND_STOPkoi_sound_stop(voice), -1 for all0x43SYS_SOUND_ACTIVEkoi_sound_active(voice) -> 1 while playing0x44SYS_SOUND_VOLUMEkoi_sound_volume(volume 0-255, or -1 to ask) -> volume0x45SYS_SOUND_PARAMSkoi_sound_params(voice, volume, pan) -> 0, or -10x46SYS_SOUND_WHEREkoi_sound_where(voice) -> frames playedChange volume or pan of a playing sound (-1 keeps).
0x48SYS_SOUND_SEEKkoi_sound_seek(voice, frame) -> 0, or -10x50SYS_MOUSEkoi_mouse(KOI_POINTER*) -> 1, 0 without a pointer, -1Pointer: one snapshot per call. `scroll` is a running total; callers subtract.
0x51SYS_MOUSE_PLACEkoi_mouse_place(point) -> 0, or -1Move the pointer.
0x52SYS_CHAINkoi_chain(command) -> 1, or 0 when fullChaining: run a command line after this program exits, most recent request first: koi_chain("MIZU Z:\\GAMES"); runs second koi_chain("DOOM"); runs first koi_exit(0); The program restarts fresh; pass state as arguments. SYS_RUN keeps the caller in memory instead.
0x53SYS_CLIP_PUTkoi_clip_put(text, length) -> length kept, or -1Clipboard: text in kernel memory, outliving the program. SYS_CLIP_GET with a null buffer returns the length.
0x54SYS_CLIP_GETkoi_clip_get(buffer, size) -> length, 0 when empty0x55SYS_LOGkoi_log(text) -> 0Log: programs write into the kernel log. SYS_LOG_BYTES adds a hex dump. SYS_SECTOR_READ reads a raw sector (no write counterpart).
0x59SYS_RUNkoi_run(command) -> exit code, or -1Run a command and return when it finishes (the caller stays in memory). A program holding the screen should give it back first.
0x5ASYS_GETENVkoi_getenv(name, buffer, size) -> length, or 00x5BSYS_ENVATkoi_env_at(index, name, size) -> length, or 00x5CSYS_LAYOUT_GESTUREkoi_layout_gesture(enabled) -> 0Environment, read-only for programs. SYS_GETENV returns the value length (0 if none); SYS_ENVAT lists by index (0 past the end). Enable the Alt+Shift layout switch while this program runs (reset on exit).
0x5DSYS_LOADkoi_capture(path, KOI_MODULE*) -> 0, or -10x5ESYS_UNLOADkoi_unload(base) -> 0, or -10x5FSYS_CAPTUREkoi_capture(line, buffer, size) -> bytes, or -1Loadable modules: load and relocate an image without running it and return its entry point. The caller calls it like a function; its meaning is the caller's (Mizu applications). Same format and ABI check as programs. SYS_LOAD fills a KOI_MODULE and returns 0, or -1 with the reason printed. SYS_UNLOAD frees by `base` (unknown bases, and modules a thread is still in, are refused). Run a command and collect its console output into the caller's buffer (no screen change). Returns the bytes collected, zero-terminated. The caller waits; commands that wait for a key are stopped. For programs that draw, use SYS_RUN.
0x60SYS_BREAKkoi_break(enabled) -> 0Whether Ctrl+C stops this program (0 makes it an ordinary character). Reset on exit.
0x61SYS_SOUND_OPENkoi_sound_open(rate, KOI_SOUND_SHAPE(bits, channels), volume) -> voice, or -1Streaming sound: open a stream and queue decoded frames (copied into a kernel ring). Fewer frames taken than offered means the ring is nearly full.
0x62SYS_SOUND_QUEUEkoi_sound_queue(voice, samples, frames) -> frames taken, or -10x63SYS_SOUND_SPACEkoi_sound_space(voice) -> frames of room, or -10x64SYS_SOUND_PAUSEkoi_sound_pause(voice, paused) -> 0, or -1Pause any voice; flush a stream's queue (for seeking).
0x66SYS_SOUND_FLUSHkoi_sound_flush(voice, frames heard so far) -> 0, or -10x67SYS_NET_RESOLVEkoi_net_resolve(name, &address) -> 0, or -1Network for programs: DNS and TCP. Calls block with a timeout and poll the network. Addresses in host order.
0x68SYS_TCP_CONNECTkoi_tcp_connect(address, port, timeout ms) -> handle, or -10x69SYS_TCP_SENDkoi_tcp_send(handle, data, KOI_NET_ARG(length, timeout))0x6ASYS_TCP_RECEIVEkoi_tcp_receive(handle, buffer, KOI_NET_ARG(size, timeout))0x6BSYS_TCP_CLOSEkoi_tcp_close(handle) -> 00x6CSYS_TCP_OPENkoi_tcp_open(handle) -> 1 while there is more to read0x6DSYS_TLS_CONNECTkoi_tls_connect(address, KOI_NET_ARG(port, timeout), name)TLS: the same calls over TLS. SYS_TLS_CONNECT also takes the host name (SNI and certificate check). SYS_TLS_CHECKED returns 1 when the server's identity was verified.
0x6ESYS_TLS_SENDkoi_tls_send(handle, data, KOI_NET_ARG(length, timeout))0x6FSYS_TLS_RECEIVEkoi_tls_receive(handle, buffer, KOI_NET_ARG(size, timeout))0x70SYS_TLS_CLOSEkoi_tls_close(handle) -> 00x71SYS_TLS_CHECKEDkoi_tls_checked(handle) -> 1 when the identity was verified0x72SYS_THREAD_STARTkoi_thread_start(entry, stack top, argument) -> 1 or 0Threads: same memory and files, own stack (provided by the program, top passed in). No protection between threads; use the lock in koi.h.
0x73SYS_THREAD_EXITkoi_thread_exit(), ends this thread0x74SYS_YIELDkoi_lock() -> 0Yield the rest of the time slice.
0x76SYS_SET_THREAD_POINTER(address) -> 0Set the calling thread's FS base (thread pointer), kept across switches (like arch_prctl(ARCH_SET_FS)).
0x77SYS_GPU_INFO(item) -> valuevirtio-gpu for programs (see kernel/virtio_gpu.h): SYS_GPU_INFO KOI_GPU_PRESENT, KOI_GPU_3D or KOI_GPU_CAPSETS SYS_GPU_COMMAND one command and its reply; returns the reply length or -1 (commands touching guest memory are refused) SYS_GPU_ATTACH backing memory for a resource; returns its address or 0 SYS_GPU_DETACH release it before unreferencing the resource
0x78SYS_GPU_COMMAND(request, request size, reply, reply size)0x79SYS_GPU_ATTACH(resource, size) -> address, or 00x7ASYS_GPU_DETACH(resource) -> 1, or 00x7BSYS_INTEL_INFOkoi_intel_info(item) -> valueIntel graphics for programs (see kernel/i915.h): SYS_INTEL_INFO KOI_INTEL_DEVICE (0 without a driver) or KOI_INTEL_GTT_SIZE SYS_INTEL_ALLOC `size` zeroed bytes; returns the CPU address, writes the GPU address to *gpu, or returns 0 SYS_INTEL_FREE by CPU address SYS_INTEL_EXEC run the batch at a GPU address (ends in MI_BATCH_BUFFER_END); returns a sequence or 0 SYS_INTEL_WAIT 1 when the sequence finished, 0 on timeout
0x7CSYS_INTEL_ALLOCkoi_intel_alloc(size, &gpu) -> address, or 00x7DSYS_INTEL_FREEkoi_intel_free(address) -> 1, or 00x7ESYS_INTEL_EXECkoi_intel_exec(gpu address) -> sequence, or 00x7FSYS_INTEL_WAITkoi_intel_wait(sequence, timeout ms) -> 1, or 00x81SYS_NET_INFOkoi_screen_set(KOI_NET_INFO*) -> 0, or -1Network settings: SYS_NET_INFO fill a KOI_NET_INFO SYS_NET_START DHCP again (may take seconds): 1 with an address, else 0 SYS_NET_SET static: address, netmask, gateway << 32 | dns; 1 when set Not saved across restarts.
0x88SYS_DEVICESkoi_devices(KOI_DEVICE_INFO*, max) -> countDevices on the PCI bus and the driver running each (Device Manager).
0x89SYS_SHA256koi_sha256(data, length, digest) -> 0SHA-256 of `length` bytes into 32 (the kernel's, for passwords).
0x8FSYS_CHDIRkoi_chdir(path) -> 1, 0, -1 or -2The command shell (COMMAND.EXE). SYS_CHDIR moves the one current drive and directory that programs and commands share ("X:" changes the drive): 1, or 0 no such drive, -1 not found, -2 not a directory. SYS_SETENV sets a variable, an empty value removes it: 1, or 0 when there is no room.
0x90SYS_SETENV(name, value) -> 1 or 00x91SYS_TCP_LISTENkoi_tcp_listen(port) -> handle, or -1Serving: listen on a port, then accept connections (with a timeout).
0x92SYS_TCP_ACCEPTkoi_tcp_accept(handle, timeout ms) -> handle, or -10x97SYS_RANDOMkoi_randomRandom bytes from the kernel's generator (the one TLS uses): for keys and nonces. At most 4096 per call. Returns the count, or -1.
0x9CSYS_GFX_SURFACEkoi_gfx_dim(operation, a, b)Surfaces: pixels of the program's own (a window's, say), drawn into with the SYS_GFX_* calls and copied onto the screen. Numbers from 1; 0 is the screen. NEW a: KOI_POINT(width, height), b: KOI_SCREEN* to fill -> number, or -1 FREE a: number -> 0, or -1 TARGET a: number (0: the screen) for this thread's drawing calls -> the one before, or -1 COPY a: number, b: KOI_POINT where, onto the current target (clipped) -> 0 ORIGIN a: number, b: KOI_POINT: drawing at that point lands at the surface's (0, 0), so a window draws in screen places -> 0, or -1 The kernel frees a program's surfaces when it ends.
0x9DSYS_MESSAGE_SENDkoi_message_send(program id, data, length) -> 1, 0 or -1Messages between programs (19): a mailbox per program; a program is addressed by its id (KOI_INFO_PROGRAM_ID, slot and generation, so a reused slot is not mistaken for it). Messages are 1 to 4096 bytes and arrive in order. SYS_MESSAGE_SEND: 1 sent, 0 the mailbox is full (try again), -1 no such program. SYS_MESSAGE_RECEIVE waits up to the timeout: the length, 0 nothing came, -1 the buffer was too small (the message is dropped); the sender's id goes to `from`. SYS_MESSAGE_NAME registers this program under a name or finds the one holding it (names starting MIZU. only for programs of the system; the desktop is MIZU.DESKTOP).
0x9ESYS_MESSAGE_RECEIVEkoi_message_receive(buffer, size, timeout ms, &from) -> length, 0 or -10x9FSYS_MESSAGE_NAMEkoi_name_register(KOI_NAME_*, name) -> 1 / id, or 00xA0SYS_TERMINALkoi_name_find(operation, a, b, c)Terminals (20): a window that a program (a shell) runs in. Everything the program and its children print comes to the window, which reads it with READ; keys the window passes with WRITE are what they read (a line is edited and echoed by the kernel). Ctrl+C (key 3) stops the program that has not turned it off; the shell gets it as a key. A program that draws on the screen is refused while attached to one. OPEN a: command line, b: KOI_POINT(columns, rows) -> terminal, or -1 READ a: terminal, b: buffer, c: size -> bytes (0 none yet), -1 the program ended and all it said has been read WRITE a: terminal, b: int keys, c: count -> keys taken SIZE a: terminal, b: KOI_POINT(columns, rows) -> 0 CLOSE a: terminal -> 0 (its programs stop at their next call)
0xA1SYS_TCP_STATUSkoi_tcp_status(handle) -> bytes | KOI_TCP_*A connection's state without waiting (21): the bytes waiting to be read in the low 32 bits, and flags. -1 for no such connection.
0xA2SYS_PIPE(operation, a, b, c)Pipes between programs (23). An end is a number the program owns until it closes it or ends. CREATE b: int[2] gets the reading and the writing end -> 0, or -1 READ b: end, c: buffer, d: size -> bytes, waiting for at least one; 0 once every writer has gone WRITE b: end, c: data, d: size -> bytes, waiting for room; -1 once every reader has gone CLOSE b: end -> 0 NEXT b: 0 stdin, 1 stdout, 2 stderr; c: an end, or 0 -> the next program this one starts gets it as that stream STANDARD b: 0, 1 or 2 -> this program's end for that stream, 0 if the stream is its terminal PENDING b: a reading end -> bytes waiting, -2 at the end, 0 none yet A program whose stdout is a pipe prints into it (SYS_PUTS and the rest); one whose stdin is a pipe reads its lines and keys from it.
0xA3SYS_SIGNAL(operation, a, b, c)Signals and process groups (24), Linux's signal numbers. A signal is acted on at the program's next system call. Handled ones are ORed into the word the program named (bit 1 << signal); ignored ones go; the rest end it with 128 + the signal, except CHLD, CONT, URG, WINCH and the stopping ones, which do nothing. Ctrl+C is SIGINT to the terminal's foreground group; a program that ends sends SIGCHLD to the one that started it. WATCH b: the word, c: handled mask, d: ignored mask -> 0 SEND b: a program's name, or -group, or 0 for its own group; c: the signal (0 to ask if it is there) -> 0, or -1 SELF -> its name (the pid) PARENT -> its parent's, 0 none GROUP b: a name, 0 itself -> its group SET_GROUP b: itself (0) or a child; c: a group, 0 its own -> 0 or -1 SESSION b: a name, 0 itself -> its session NEW_SESSION -> a session and group of its own, their name FOREGROUND -> its terminal's foreground group, 0 without a terminal SET_FOREGROUND b: a group -> 0, or -1
0xA4SYS_FUTEX(operation, word, value, milliseconds)A futex: threads of one program waiting on a word of its memory. WAIT b: the word (4 bytes), c: the value it must still hold, d: milliseconds at most (<= 0: a long while) -> 0 woken or the time ran out, -1 the word held another value WAKE b: the word, c: how many to wake -> how many were woken A wait may also end for no reason; the caller looks at the word again. Added in build 150 without a new interface version: before it, the call answers -1 for both, and a caller gives its turn away and looks again.
The system's own
Calls from 0x100 up are for the programs of the system itself (Setup, Updates, dosget, the desktop). The kernel refuses them to any program that was not read from the system image, and they are outside the frozen interface: they may change between versions.
0x100SYS_LOG_BYTESkoi_log_bytes(label, data, length) -> 00x101SYS_SECTOR_READkoi_sector_read(disk, lba, buffer) -> bytes read, or -10x102SYS_SECTOR_SIZEkoi_sector_size(disk) -> bytes per sector, or -1Disk count and sector size.
0x103SYS_SETCLOCKkoi_set_clock(date, time) -> 1, or 0Set the clock: (KOI_DATE_ARG(year, month, day), KOI_TIME_ARG(hour, minute, second)) -> 1, or 0 if invalid.
0x104SYS_SCREEN_SETkoi_gfx_enter(width, height, KOI_SCREEN*) -> 1, 0 or -1SYS_SCREEN_SET: change the screen size now (Intel Sandy Bridge, QEMU std VGA; modes that `screen` lists). Only the caller may hold the screen; if it does, *screen gets the new buffer. Not saved (use `screen WxH`). Returns 1 done, 0 not possible, -1 another program holds the screen.
0x105SYS_NET_STARTkoi_net_start() -> 1, or 00x106SYS_NET_SETkoi_net_set(address, netmask, gateway << 32 | dns) -> 1, or 00x107SYS_DISKSkoi_inject_key(KOI_DISK_INFO*, max) -> countInstalling onto a disk (Setup /I). SYS_DISKS every disk: KOI_DISK_INFO into `array`, up to `max` SYS_PARTITIONS partitions of disk `disk`: KOI_PARTITION_INFO SYS_INSTALL install as KOI_INSTALL says; blocks until done SYS_INSTALL_STATUS progress of a running SYS_INSTALL (from another thread)
0x108SYS_PARTITIONSkoi_partitions(disk, KOI_PARTITION_INFO*, max) -> count0x109SYS_INSTALLkoi_install(const KOI_INSTALL*) -> 0, or -10x10ASYS_INSTALL_STATUSkoi_install_status(KOI_INSTALL_STATUS*) -> 00x10BSYS_PKG_FETCH(server, path, buffer, size) -> bytes, or -1Packages (DOSGET.EXE). The kernel fetches from the package server, checks signatures with its own key, and writes system updates; the rest is the program's.
0x10CSYS_PKG_VERIFY(manifest, length, signature, sig length) -> 1 or 00x10DSYS_SYSTEM_UPDATE(const KOI_SYSTEM_UPDATE*) -> 1 or 00x10ESYS_DRIVERS_RELOAD() -> 0: load new drivers, start them0x10FSYS_PROGRAM_PATH(directory, 1 add or 0 remove) -> 1 or 00x110SYS_INPUT_INJECTkoi_inject_pointer(kind, a, b) -> 0, or -1Input from elsewhere (remote desktop), fed in as if typed or moved. KOI_INPUT_POINTER: (point, buttons | wheel << 8), absolute position. KOI_INPUT_KEY: (key, typed | KOI_KEY_RELEASED): `key` is the key's identity as in SYS_KEYEVENT, `typed` what it types (0 for none): a KOI_KEY_ value, a control code, or a character (Unicode, not passed through the layout).
0x111SYS_LOG_READkoi_log_read(offset, buffer, size) -> count; -2 dropped (see KOI_TRACE_LOG_START)The kernel log (what `log` shows) from `offset`: bytes copied, 0 at the end.
0x112SYS_PROFILEkoi_profile_mark(label, slow_ms) -> 0Turn profiler: marks the start of a unit of work; the one before, if it took `slow_ms` or more, is logged ("SLOW:") with where its time went.
0x113SYS_POINTER_SPRITEkoi_pointer_sprite(operation, data) -> 1, or 0Pointer drawn and moved by the kernel over the caller's screen level, so it moves while the program is busy. KOI_SPRITE_SHAPE: data = { width, height, pixels... } (at most 32 x 32; opaque where the top byte is set).
0x114SYS_POWERkoi_power(what) -> -1 if the machine stayed on: KOI_POWER_OFF or KOI_POWER_RESTART. File operations in progress end first, the rest wait; disk caches are written out.
0x115SYS_LAYOUTkoi_inject_pointerKeyboard layouts (kernel/layout.h): what a := KOI_LAYOUT_*. GET the one typing now, as two letters packed ('r' << 8 | 'u') LIST the set into b ("en ru el", size c) SET_LIST the set from b; 1 if any code was known SWITCH how to switch (b: KOI_LAYOUT_SWITCH_*, -1 asks) NEXT the next one in the set Not saved: the SYSTEM settings `layouts` and `layout_switch` are.
0x116SYS_SOUND_OUTPUTkoi_sound_outputSound outputs (the built-in device, USB ones plugged in): what a := COUNT how many NAME the name of output b into buffer c (64 bytes) CURRENT the one playing (an index) SELECT play through output b CHANGES a count that moves when one comes or goes
0x117SYS_TRACEkoi_traceFlight recorder: what the kernel did lately, as 32-byte records (time in microseconds since boot, kind, processor, task), and copies of it from around each hitch (a desktop turn over the threshold, or Ctrl+Alt+M: the last three seconds, kept by hand). What a := RECENT the newest records into c (KOI_TRACE_MAX), oldest first -> count HITCHES the kept hitches' headers into c (KOI_HITCH_KEEP) -> count HITCH hitch b's records into c (KOI_TRACE_MAX) -> count THRESHOLD set it to b ms (0: leave it) -> the threshold LINES log line times into c (KOI_LINE_MAX pairs: offset, time) -> count LOG_START the oldest log offset still kept after the boot part, and the boot part's length in c (two numbers) -> 0 NAMES the tasks' names now into c (KOI_TRACE_TASKS x 32 bytes) -> 0
0x118SYS_USB_DEVICESkoi_devices(KOI_USB_INFO*, max) -> countDevices on USB, hubs included, from every controller (Device Manager).