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 / core / handoff_check.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 | /* handoff_check.h -- pure validator of the loader -> kernel handoff record |
| 18 | * (docs/BOOT_HANDOFF_CONTRACT.md section 6, CHANDOF3). No I/O, no |
| 19 | * globals the caller can see; host tested by tests/test_handoff.c. */ |
| 20 | #ifndef AIENOS_CK_HANDOFF_CHECK_H |
| 21 | #define AIENOS_CK_HANDOFF_CHECK_H |
| 22 | |
| 23 | #include "handoff.h" |
| 24 | |
| 25 | /* Largest memory map copy a loader may hand over (efi_main.c MAP_BYTES). */ |
| 26 | #define CK_HANDOFF_MAP_MAX (64u << 10) |
| 27 | /* Smallest UEFI descriptor stride the kernel parses (struct ck_efi_desc, |
| 28 | * mm/frames.h). */ |
| 29 | #define CK_HANDOFF_DESC_MIN 40u |
| 30 | /* UEFI EFI_MEMORY_DESCRIPTOR_VERSION. */ |
| 31 | #define CK_HANDOFF_DESC_VERSION 1u |
| 32 | |
| 33 | /* Returns 0 when h is an acceptable CHANDOF3 record. Otherwise returns -1 |
| 34 | * and sets *why to the refusal reason without the "handoff: " prefix |
| 35 | * (for example "bad magic"); the kernel panics with "handoff: <why>". |
| 36 | * *why may point at a static buffer overwritten by the next call. */ |
| 37 | int ck_handoff_check(const struct ck_handoff *h, const char **why); |
| 38 | |
| 39 | #endif |