Reorganize source tree: kernel/, v3/, v4/ split and board infrastructure
Source tree reorganization: - Move StarForth v3 engine to v3/ (src/, include/, Makefile) - Move kernel to kernel/ (src/, include/, linker/, Makefile) - Create v4/ skeleton for F18-ISA golden model (DECOMPOSITION.md, JUSTIFICATION.md) - Move FABRIC-0..4.md to docs/fabric/ - Move ONTOLOGY.md and ROADMAP.md to docs/ Board infrastructure: - Add boards/ser5/, boards/raspi/, boards/milkv/, boards/zynq7020/ - Each board has board.mk (ISA, CPU flags, boot recipe) and README.md - Root Makefile becomes thin dispatcher: boot_image, all, clean, docs take TARGET - make boot_image TARGET=SER5|RASPI|MILKV builds one GPT/MBR image per board - ZYNQ7020 target exists but stops with clear error (ARMv7 port not built yet) - scripts/mkdiskimage.sh builds disk images for all boards Docs pipeline: - docs/book/ with LaTeX master (main.tex) and Makefile - pandoc converts Markdown to LaTeX at build time - Two Lua filters: table-widths.lua (wide tables wrap), code-breaks.lua (inline code breaks) - make docs builds single PDF (754 pages, 0 missing characters) - make docs TARGET=<board> adds board appendix - build/docs/<book|board>/meta.tex stamps git commit into PDF Bug fixes: - 42 include paths that only worked by accident now use correct relative paths - clang-18 hardcode replaced with configurable CC variable (fixed aarch64 build) - Pi 5: kernel_2712.img linked at 0x80000, .bss zeroed, memory reserved - Doxyfile, .clang-tidy, README.md, Kconfig paths updated Verified: - Hosted v3 build passes 1012 tests, 0 failures - SER5 image boots in QEMU (OVMF), POST passes, K exact (65536 = Q48_ONE) - Milk-V image boots in QEMU (OpenSBI + U-Boot + bootefi), POST passes - make clean TARGET=<board> removes only that board and its ISA objects - make all builds all boards, hosted v3, and docs in one run Co-authored-by: Junie <junie@jetbrains.com>
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
StarForth — Steady-State Virtual Machine Runtime
|
||||
|
||||
Copyright (c) 2023–2025 Robert A. James
|
||||
All rights reserved.
|
||||
|
||||
Licensed under the StarForth License, Version 1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* lifecycle_words_hosted.c - BIRTH KILL PAUSE RESUME USE for hosted Linux build
|
||||
*
|
||||
* Hosted-build counterpart to src/starkernel/capsule/lifecycle_words.c.
|
||||
* All five words are ( c-addr u -- ), stack-clean, errors logged not pushed.
|
||||
*
|
||||
* In the hosted build there is no capsule blob or kernel VM registry, so
|
||||
* these implementations consume their arguments and log intent. The kernel
|
||||
* build (compiled with -D__STARKERNEL__) skips this file entirely because
|
||||
* the Makefile glob does not include src/word_source/ for that target.
|
||||
*/
|
||||
|
||||
#ifndef __STARKERNEL__
|
||||
|
||||
#include "../../include/vm.h"
|
||||
#include "../../include/word_registry.h"
|
||||
#include "../../include/log.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define NAME_MAX_LEN 64
|
||||
|
||||
static void extract_name(VM *vm, cell_t caddr, cell_t u, char *out, int max) {
|
||||
int len = (int)u;
|
||||
if (len >= max) len = max - 1;
|
||||
if (len < 0) len = 0;
|
||||
if (len > 0 && caddr < (cell_t)VM_MEMORY_SIZE)
|
||||
memcpy(out, (const char *)vm->memory + caddr, (size_t)len);
|
||||
out[len] = '\0';
|
||||
}
|
||||
|
||||
static void hosted_lifecycle_birth(VM *vm) {
|
||||
cell_t u = vm_pop(vm);
|
||||
cell_t caddr = vm_pop(vm);
|
||||
char name[NAME_MAX_LEN];
|
||||
extract_name(vm, caddr, u, name, NAME_MAX_LEN);
|
||||
log_message(LOG_INFO, "BIRTH %s (hosted)", name);
|
||||
}
|
||||
|
||||
static void hosted_lifecycle_kill(VM *vm) {
|
||||
cell_t u = vm_pop(vm);
|
||||
cell_t caddr = vm_pop(vm);
|
||||
char name[NAME_MAX_LEN];
|
||||
extract_name(vm, caddr, u, name, NAME_MAX_LEN);
|
||||
log_message(LOG_INFO, "KILL %s (hosted)", name);
|
||||
}
|
||||
|
||||
static void hosted_lifecycle_pause(VM *vm) {
|
||||
cell_t u = vm_pop(vm);
|
||||
cell_t caddr = vm_pop(vm);
|
||||
char name[NAME_MAX_LEN];
|
||||
extract_name(vm, caddr, u, name, NAME_MAX_LEN);
|
||||
log_message(LOG_INFO, "PAUSE %s (hosted)", name);
|
||||
}
|
||||
|
||||
static void hosted_lifecycle_resume(VM *vm) {
|
||||
cell_t u = vm_pop(vm);
|
||||
cell_t caddr = vm_pop(vm);
|
||||
char name[NAME_MAX_LEN];
|
||||
extract_name(vm, caddr, u, name, NAME_MAX_LEN);
|
||||
log_message(LOG_INFO, "RESUME %s (hosted)", name);
|
||||
}
|
||||
|
||||
static void hosted_lifecycle_use(VM *vm) {
|
||||
cell_t u = vm_pop(vm);
|
||||
cell_t caddr = vm_pop(vm);
|
||||
char name[NAME_MAX_LEN];
|
||||
extract_name(vm, caddr, u, name, NAME_MAX_LEN);
|
||||
log_message(LOG_INFO, "USE %s (hosted)", name);
|
||||
}
|
||||
|
||||
void register_lifecycle_words(VM *vm) {
|
||||
register_word(vm, "BIRTH", hosted_lifecycle_birth);
|
||||
register_word(vm, "KILL", hosted_lifecycle_kill);
|
||||
register_word(vm, "PAUSE", hosted_lifecycle_pause);
|
||||
register_word(vm, "RESUME", hosted_lifecycle_resume);
|
||||
register_word(vm, "USE", hosted_lifecycle_use);
|
||||
}
|
||||
|
||||
#endif /* !__STARKERNEL__ */
|
||||
Reference in New Issue
Block a user