RegCube — reference (hives, keys, syscalls, persistence)¶
RegCube is the kernel-owned string configuration store: named hives, each holding key → value maps. Userland reads and writes through dedicated syscalls; persistence to disk is optional (explicit flush/load paths). It is not a programming language, not per-file metadata, and not a full ACID database — it is a deliberately small policy and capability registry for the OS and services.
Why “hive”? The name borrows the Registry “hive” metaphor (Windows-style top-level partitions) so contributors can guess the shape: several named buckets instead of one flat global keyspace. P1Start hives are much simpler than the Windows Registry: string keys, string values, in-memory primary, INI-like file export.
Related: file-types-open-pipeline.md (future handler overrides and MIME policy), settings-control-pattern.md (daemon / ctl / GUI), syscalls-reference.md syscall numbers.
1. Terminology¶
Term |
Meaning |
|---|---|
Hive |
Top-level namespace string, e.g. |
Key |
Lookup string under a hive. Under |
Value |
UTF-8-ish string stored as |
RCB payload |
Text serialization: sections |
Invariant: the kernel is authoritative; userland caches (e.g. deskgui RegCubeClient) are advisory and must be write-through on set (see §7).
2. Syscalls (userland ABI)¶
Implemented in src/sys/regcube.rs, exposed in src/kernel/syscalls.rs. libc/SDK wrappers: SDK/lib/cstd/src/sys.rs (sys_regcube_*).
# |
Name |
Role |
|---|---|---|
104 |
|
|
105 |
|
|
106 |
|
Serializes entire in-memory RegCube to a VFS path (see |
107 |
|
Reads a file, parses RCB text, merges into hives (overwrites keys present in file). |
All hive/key/value strings must be NUL-terminated in the C calling convention. Do not store large blobs; typical getters use ≤256 byte buffers in clients (see §8).
3. Persistence format (.rcb / text merge)¶
Kernel helper RegCube::generate_rcb_payload() (src/sys/regcube.rs) emits:
One line per hive:
[HIVE_NAME]Then
key=valuelines (no quoting rules; values are raw strings)Lines starting with
;or#are ignored on parse (comments)Empty lines ignored
parse_rcb_payload merges into memory; it is suitable for shipping defaults or operator snapshots, not for high-frequency logging.
4. Bootstrap — where initial values come from¶
Stage |
Source |
What it seeds |
|---|---|---|
UEFI / early kernel |
|
Loads |
Services |
|
Publish |
Operator |
|
Merges RCB snapshots at runtime. |
5. Hive catalog (what each hive is for)¶
Hive |
Purpose |
Typical consumers |
|---|---|---|
|
Machine-wide policy — time, display, network mode, input stack, power, region, Lua policy, game-engine prefs, wallet stub metadata, and much of the desktop chrome (theme/mouse/wallpaper/audio keys used by deskgui). |
Init, daemons, |
|
Extension (without leading dot in CSV) → human description string (from |
Legacy/shell UX, |
|
Extension → handler token or path hint ( |
|
|
PCI |
Kernel/platform PCI bring-up, diagnostics. |
|
Advertised font/emoji stack capabilities (bitmap/ttf engines, counts). |
Diagnostics, Settings/regedit visibility — not the live font loader config. |
|
Advertised i18n/Bidi capabilities. |
Same as fonts — capability flags, not user locale source of truth (locale lives under |
Not a real hive (avoid): foundation-debt called out HIVE_SYSTEM_CACHE / VFS_DIR:* writes from older deskgui listing paths — do not treat as a SSOT; directory listing should stay RAM caches in the app (see docs/foundation-debt.md / platform-docs mirror).
6. HIVE_LOCAL_MACHINE — topic prefixes (naming convention)¶
New keys should use topic/subkey (lower case, / separators), matching existing services:
Prefix |
Owned by / theme |
Examples |
|---|---|---|
|
Init, stack selection |
|
|
Kernel + ps2d policy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
See lua-scripting-architecture.md §3 ( |
|
Optional |
|
|
|
Proposed / partial — see game-engine-architecture.md §4.2. |
Flat keys (deskgui chrome): theme_preset, mouse_sens_x, wallpaper_*, audio_*, … — listed in apps/deskgui/src/regcube_client.rs snapshot_for_editor. Prefer topic/subkey for new services; migrating old flat keys is a separate cleanup.
7. Strategy A — single façade in deskgui¶
Problem it solves: split-brain — some UI code calling sys_regcube_* directly while other code used mocks.
Rule: under apps/deskgui/src/, compositor-facing RegCube access should go through RegCubeClient (apps/deskgui/src/regcube_client.rs).
CI: scripts/check_no_os_registry_deskgui.ps1 fails if banned legacy registry strings reappear.
8. RegCubeClient contract (summary)¶
Reads:
get_string/get_optional/get_f32— cache first; on miss, syscall 104, insert on success (string getters).Writes:
set_string/set_f32— syscall 105 first, then update cache (write-through).Invalidation:
invalidate_hive(hive)drops cache entries for that hive only (no kernel call).Flush / load: pass through syscalls 106 / 107.
Buffer reality: syscall get path uses 256-byte stack buffers — keep values short (status strings, decimals, short paths).
9. Ecosystem settings pattern (required)¶
For control domains (time, display, network, power, game runtime, …):
p1-<domain>svcowns transitions and background policy.<domain>ctlCLI and Settings GUI are frontends.Both converge on the same RegCube keys documented here and in domain docs.
No hidden second source of truth for persisted policy.
10. Operational keys — quick index¶
The table below merges common keys; domain docs are authoritative for semantics.
Hive |
Key(s) |
Used by |
|---|---|---|
|
|
Init, |
|
|
Kernel boot, deskgui; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Optional |
|
|
Planned — game-engine-architecture.md. |
|
Theme / mouse / wallpaper / audio / |
|
|
per extension |
|
|
per extension |
Seeded associations; future overrides — file-types-open-pipeline.md. |
|
|
|
|
capability keys |
Boot advertisement; regedit. |
11. Edge cases¶
Case |
Policy |
|---|---|
Get failure |
Returns default / empty / |
Concurrent writers |
Last writer wins at kernel; clients must write-through cache on set. |
Oversized values |
Fixed small buffers in many callers — do not store blobs; use a file path in RegCube if needed. |
Typos in hive names |
Unrelated hive → empty namespace; keys appear missing. Stick to this document’s literals. |
12. See also¶
system-architecture.md — where RegCube sits in the stack
time-and-clock.md — wall-clock service and keys
settings-control-pattern.md — daemon / ctl / GUI pattern
ecosystem-philosophy.md — platform SSOT rules
media-types.md — MIME tables vs RegCube file associations (different layers)
Legacy narrative:
docs/foundation-debt.md§4.x (regedit / cache debt)
13. Changelog (document)¶
When |
What |
|---|---|
Current |
Expanded hive catalog, terminology, syscalls, persistence, bootstrap, |
(When you add a hive or a stable service key, update §5, §6, or §10 in the same PR.)