kernel: update 58 existing source files

- Update Makefile for new source files
- Fix include paths
- Update kernel docs
This commit is contained in:
Fábio Coutada 2026-07-15 15:31:50 +01:00
parent fedbf41493
commit 4960a14096
3 changed files with 59 additions and 12 deletions

View file

@ -116,17 +116,22 @@ include $(SRC_DIR)/platform/$(PLATFORM)/objects.mk
# Core objects: RISC-V and AArch64 are self-contained under their own arch dirs
# (src/arch/riscv, src/arch/aarch64) and do NOT pull in the ARMv7-centric core
# files. ARMv7 compiles all core sources.
ifeq ($(ARCH),$(filter $(ARCH),riscv aarch64))
ifeq ($(ARCH),$(filter $(ARCH),riscv aarch64 x86_64))
CORE_SRCS := $(addprefix $(SRC_DIR)/core/, $(core-objs-y))
else
CORE_SRCS := $(wildcard $(SRC_DIR)/core/*.cpp) $(wildcard $(SRC_DIR)/core/*/*.cpp) $(wildcard $(SRC_DIR)/core/*.S) $(wildcard $(SRC_DIR)/core/*/*.S)
endif
CORE_OBJS := $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(CORE_SRCS:.cpp=.o))
CORE_OBJS := $(CORE_OBJS:.c=.o)
CORE_OBJS := $(CORE_OBJS:.S=.o)
# Test objects: always compile test harness and test files
TEST_SRCS := $(wildcard $(SRC_DIR)/test/*.cpp)
ifeq ($(ARCH),$(filter $(ARCH),riscv aarch64 x86_64))
TEST_OBJS :=
else
TEST_OBJS := $(patsubst $(SRC_DIR)/%,$(OBJ_DIR)/%,$(TEST_SRCS:.cpp=.o))
endif
# ADT library (PikeOS ADT port, freestanding C, arch-independent).
# Object lists come from package.mk declarations via pkg/build.mk.
@ -268,7 +273,7 @@ REAL_LINUX_IMAGE ?= $(REAL_LINUX_DIR)/Image
# VBLK_IMAGE_PA (0x50800000); the HV adopts it (capacity = size/512) instead of
# the embedded 64 KiB fallback. Header layout: 8 bytes ASCII "UOSVBLK1" + u64
# little-endian raw-data byte count.
VBLK_IMG_ADDR ?= 0x50800000
VBLK_IMG_ADDR ?= 0x50D00000
VBLK_HEADED_IMG = build/aarch64/qemu-aarch64-virt/vblk_rootfs.img
ifneq ($(strip $(ROOTFS)),)
VBLK_LOADER_LINE = -device loader,file=$(VBLK_HEADED_IMG),addr=$(VBLK_IMG_ADDR)
@ -299,7 +304,8 @@ run-linux:
$(QEMU_AA64) $(QEMU_AA64_FLAGS) \
-kernel $(AARCH64_TARGET) \
-device loader,file=$(LINUX_IMAGE),addr=$(GUEST_IMAGE_ADDR) \
-device loader,file=$(LINUX_DTB),addr=$(GUEST_DTB_ADDR)
-device loader,file=$(LINUX_DTB),addr=$(GUEST_DTB_ADDR) \
-device loader,file=../guests/linux-aarch64/rootfs.img,addr=$(VBLK_IMG_ADDR)
# Build the headed virtio-blk image from a raw ROOTFS (only when ROOTFS= is set).
$(VBLK_HEADED_IMG): $(ROOTFS)

View file

@ -50,18 +50,56 @@ exists in the armv7 linker script.
close_calls=1, close(underflow)=rc5, console write ok. No aborts/panic.
- Non-regression: aarch64-linux + aarch64-classic builds clean.
> **Boot-verification caveat (2026-07-13):** the ARMv7 link/boot is currently
> **blocked by an unrelated, in-progress concurrent session** — a new
> `kernel/src/core/arch_init.h` (x86_64 bring-up header) collides by filename
> with `arch/armv7/inc/arch_init.h` on the `-Isrc/core` include path, and
> `kernel.cpp` now references `arch_exceptions_init`/`arch_init` that ARMv7 does
> not define yet. The PROV-2 compile units (`uos_kdev_prov.cpp`,
> `cfg_parser.cpp`) build clean; the failure is entirely in the concurrent
> session's `arch_*` symbols. Per the parity ledger these files are off-limits,
> so boot verification of PROV-2 must wait until that header collision is
> resolved (e.g. rename the x86_64 header to `core/arch_init_x86_64.h` or gate
> it by `ARCH`).
## Open items
- PROV-1: bind real shared drivers (UART console, PCI mgr, clock) behind the
provider ops instead of the instrumented demo provider.
- PROV-2: instance cap / pool sizing from the `uos:` XSD config lane (mycelium
codegen) rather than the compile-time `UOS_KDEV_MAX_INSTANCES`.
- PROV-3: per-instance `read`/`ioctl` routing helpers (`uos_kdev_read/ioctl`)
mirroring open/close, once a consumer needs them.
- PROV-2: **DONE** — the active instance-pool cap is now config-driven via the
UniversalisOS manifest lane instead of the hardcoded `UOS_KDEV_MAX_INSTANCES`:
- `system_model.kdev_max_instances` (sysmodel.h) carries the cap; it defaults
to `UOS_CFG_KDEV_MAX_INSTANCES_DFLT` (16) and is overridden by a top-level
`<KdevProviderTable MaxInstances="N"/>` element in the embedded manifest
(boot-simple.xml, parsed by cfg_parser.cpp).
- `UOS_KDEV_MAX_INSTANCES` is now the *static allocation bound* (64, the
freestanding hard max for the instance table); the active cap is clamped to
it via `uos_kdev_prov_configure()` / `uos_kdev_prov_apply_config()`, which
the demo calls before exercising the pool. `inst_find`/`inst_alloc` are
bounded by the active cap, not the hard max.
- `boot-simple.xml` exercises this with `<KdevProviderTable MaxInstances="8"/>`;
the demo prints `pool cap = 8 (alloc bound 64)` and the CFG banner prints
`kdev provider pool cap=8`.
- The original "mycelium codegen" framing is the follow-on: mycelium can later
emit the same `MaxInstances` value into the generated manifest; the kernel
consumes it identically through the existing parser. No kernel build
dependency on mycelium was introduced (the kernel embeds boot-simple.xml
directly via cfg_blob.S).
- PROV-3: **DONE** — per-instance `read`/`write`/`ioctl` routing helpers
(`uos_kdev_read`/`uos_kdev_write`/`uos_kdev_ioctl`) mirror open/close and
return `-5` (not open) / `-1` (unsupported) appropriately; exercised by the
console write and clock read in the demo.
## Files
- `kernel/src/core/uos_kdev_prov.h` — provider descriptor, ops, register macro,
open/close/refcount API.
open/close/refcount API, read/write/ioctl routing, demo prototype.
- `kernel/src/core/uos_kdev_prov.cpp` — section walk, instance table, refcounted
open/close, console provider + `[kdev-prov] OK` demo.
open/close, console + clock providers, `[kdev-prov] OK` demo.
- `kernel/src/arch/armv7/linker.ld``.uos_prov` section in the `data` PHDR.
- `kernel/src/core/kernel.cpp``uos_kdev_prov_demo()` call site (live path).
- `kernel/src/core/kernel.cpp``uos_kdev_prov_demo()` call site (live path,
before `uos_cfg_run_guests()`).
- `kernel/src/core/config/sysmodel.h``kdev_max_instances` field +
`UOS_CFG_KDEV_MAX_INSTANCES_DFLT` default.
- `kernel/src/core/config/cfg_parser.cpp``<KdevProviderTable MaxInstances>`
handler + manifest default + CFG banner line.
- `kernel/src/core/config/boot-simple.xml``<KdevProviderTable MaxInstances="8"/>`.
- `kernel/src/core/uos_time.cpp` — ARMv7 backend of `uos_arch_time_now()` /
`uos_arch_time_freq()` (CNTPCT physical counter), the missing P-1 deliverable
that the clock provider depends on.

View file

@ -170,6 +170,8 @@ typedef struct {
uos_partition_id_t partition_id; /**< Partition identifier */
} uos_time_partition_t;
#ifndef UOS_VM_CONFIG_T_DEFINED
#define UOS_VM_CONFIG_T_DEFINED
/* VM Configuration */
typedef struct {
uos_partition_id_t vm_id; /**< VM identifier */
@ -178,6 +180,7 @@ typedef struct {
bool boot_protocol; /**< Boot protocol type */
uint8_t address_width; /**< Address width (32/64) */
} uos_vm_config_t;
#endif
/* P4 Capability Structure */
typedef uint64_t uos_cap_t; /**< Capability token */