aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / kernel / svc / continuity_boot.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* continuity_boot.h -- K-7 TEST-ONLY mode selection and the kernel wiring of the |
| 18 | * continuity (cut 3-4) and Recovery Core (cut 5) code into the Store stage. |
| 19 | * |
| 20 | * Compiled only into the TEST image "make full CK_TEST_CONTINUITY=1" |
| 21 | * ($(OUT)/full-test-continuity[-mutant-<name>]/). The Makefile and |
| 22 | * continuity_boot.c refuse it together with CK_HARDWARE_STAGING, |
| 23 | * CK_QEMU_UNSAFE_DMA and CK_TEST_STORE_CRASH, and every default full image is |
| 24 | * checked to carry none of its code or strings. The image announces itself on |
| 25 | * the console and never counts toward anything but M4_CONTINUITY / M4_RECOVERY. |
| 26 | * |
| 27 | * Mode selection (contract K-7, DECIDED): the host writes one ASCII line into the |
| 28 | * last 4096-byte unit of the AIENOS partition (the rw-probe scratch unit, which |
| 29 | * the devices stage restores byte for byte, dev/nvme_bind.c ck_disk_rw_probe; the |
| 30 | * same carrier as svc/store_crash.h): |
| 31 | * AIENCONT v1 mode=<N>[ cp=<checkpoint>][ response=<64 hex>]\n |
| 32 | * mode uses the numbers of the Rust control block (store_qual.rs:27-48): |
| 33 | * 1 ordinary Store boot (formats a blank disk, commits a boot record): used by |
| 34 | * the harness to make "a formatted Store with data, no identity" |
| 35 | * 5 provision (formats a blank disk first, as the Rust mode 5) |
| 36 | * 6 resume 7 resume + remember 8 resume + commit with a crash point |
| 37 | * 9 Recovery Core inspect |
| 38 | * 10 inspect + repair-degraded-peer with `response` |
| 39 | * 11 inspect + provision-identity with `response` |
| 40 | * cp (mode 8 only): the C checkpoint where the kernel halts after printing |
| 41 | * "CHECKPOINT: <name>" (the host then kills QEMU): before_first_write, |
| 42 | * after_payload_objects, after_catalog, after_commit_record, after_first_flush, |
| 43 | * after_inactive_superblock, after_final_flush, before_anchor, after_anchor. |
| 44 | * Without a valid plan (or mode 1) the Store stage runs exactly as the default |
| 45 | * image does. A modes 5..11 boot runs INSTEAD of the boot-record commit: it |
| 46 | * writes only what the mode's own continuity or recovery action writes. |
| 47 | * |
| 48 | * The TEST operator key (0x0f x 32) lives only in continuity_boot.c, behind |
| 49 | * CK_TEST_CONTINUITY; every recovery boot prints "RECOVERY_OPERATOR_KEY: TEST-ONLY". */ |
| 50 | #ifndef AIENOS_CK_CONTINUITY_BOOT_H |
| 51 | #define AIENOS_CK_CONTINUITY_BOOT_H |
| 52 | #include "disk.h" |
| 53 | |
| 54 | #ifdef CK_TEST_CONTINUITY |
| 55 | /* Returns 1 when a modes 5..11 plan was found and run (the caller must not run |
| 56 | * the ordinary Store boot), else 0. *rc is 0 unless the harness itself failed. */ |
| 57 | int ck_cont_boot_stage(const disk_dev *d, int *rc); |
| 58 | /* Last Store opened by a continuity boot (NULL if none). */ |
| 59 | #endif |
| 60 | #endif |