interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / svc / pi5_fact.h

48 lines · 2525 bytes Raw Blame History
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/* pi5_fact.h -- the Pi 5 Cortex fact stage (PI5-5, CK_PI5_FACT, QUALIFICATION ONLY).
18 *
19 * After the Store stage opened the sealed Store through the Slot 1 recovery path, this stage does what
20 * the service lifecycle's `remember` and `facts` verbs do (core/lifecycle.c, QEMU rows 179-181), with
21 * the same Cortex records on the same journal ('CJ' chunks, one record = one sealed transaction):
22 * - a fact request from the card (core/fact_req.h): open or create the journal, append one CX_CLAIM
23 * about the owner subject, read it back, print it with the Store generation that committed it;
24 * - no request: replay the journal, re-check every digest and the chain, print each fact with the
25 * Store generation it was committed at. A disk with no journal prints "none" and writes nothing.
26 * The Store not being open (wrong recovery secret) prints the refusal and recalls nothing. */
27#ifndef AIENOS_CK_PI5_FACT_H
28#define AIENOS_CK_PI5_FACT_H
29#include "store_sealed.h"
30#include "../core/fact_req.h"
31
32enum { CK_FACT_MODE_REMEMBER = 1, CK_FACT_MODE_RECALL = 2, CK_FACT_MODE_NOSTORE = 3 };
33
34struct ck_fact_result {
35 int mode; /* CK_FACT_MODE_* */
36 uint64_t records; /* Cortex records in the journal after the stage */
37 uint64_t shown; /* facts printed */
38 uint64_t last_id; /* newest fact id (0: none) */
39 uint64_t last_gen; /* Store generation that committed the newest fact */
40 int chain_ok;
41};
42
43/* s: the open writable Store, or NULL when the Store is not open. req: the card request (state FOUND
44 * remembers it; any other state recalls). Returns 0 when the stage did what the mode says; <0 on a
45 * Cortex or Store failure (printed). NULL s returns 0 with mode NOSTORE (a refusal, not a failure of
46 * this stage). */
47int ck_pi5_fact_run(ss_store *s, const struct ck_fact_req_boot *req, struct ck_fact_result *out);
48#endif