modus
Menu

The program extended_state

The extended state of each thread, kept by the kernel (docs/ARCHITECTURE.md, "The extended state of the processor").

The program starts as many threads as the machine has processors, plus two, so that threads share processors and move between them. Each thread fills every register of the widest level that it can use (zmm0 to zmm31 and k0 to k7, or ymm0 to ymm15, or xmm0 to xmm15), the x87 stack, the x87 control word and MXCSR with a pattern of its own, new at each pass; then it spins, enters the kernel, and gives its processor away, many times; then it compares each register with its pattern. A wrong bit is a failed check that names the thread, the register and the pass.

Each thread also checks the start state that the kernel gave it: the high halves of its ymm and zmm registers and its opmask registers are zero, the x87 control word is 0x037F and MXCSR is 0x1F80. A kernel that did not save the high halves would give a new thread the registers of another thread.

Then the main thread measures one empty kernel entry with each level of registers in use.

FactValue
Sourceprograms/extended_state
Boot imagein the boot image; the image is not built, so its size is not known
Importsnone
Imported bynone

Exports

ExportWhat it does
entry()

Read from the source of the module, as the build reads it to describe the exports (tools/kerneltool/describe.odin).

What the root service gives it

WhatValueAs the root service says
Grants{}Not named in grants_of: the grants of each other program.
Budget: pages, programs, threads{pages = 2048, programs = 1, threads = 32}The main thread and up to 31 threads that hold their registers.

Read from grants_of and things_of in programs/root/main.odin; budget_of in the same file adds the limits of processor time and of log records.