FABRIC.md -> FABRIC-0.md FABRIC-2.md -> FABRIC-1.md FABRIC-3.md -> FABRIC-2.md (the current/living document) FABRIC-4.md unchanged (new #3 to follow separately) Every cross-reference repo-wide updated to match, including doc-comment citations inside kernel source (.c/.h) files -- done via an ordered placeholder substitution (FABRIC-3.md->placeholder2, FABRIC-2.md-> placeholder1, FABRIC.md->placeholder0, then placeholders resolved to final names) in a single pass per file to avoid double-shifting already-renamed references. One line in capsules/font.4th grew past the 64-char block-format limit as a side effect of the longer filename; shortened it and reverified with mkcapsule --lint (34/34 pass) before rebuilding. Verified 3-arch boot to ok> (amd64/aarch64/riscv64, each in the foreground) after the fix; logs and DoE CSVs from this session's verification runs included per this repo's own audit-artifact convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YcT3H2PQeyujrzjqS3Var
54 lines
1.8 KiB
C
54 lines
1.8 KiB
C
/*
|
||
StarForth — Steady-State Virtual Machine Runtime
|
||
Copyright (c) 2023–2025 Robert A. James. All rights reserved.
|
||
Licensed under the StarForth License, Version 1.0.
|
||
*/
|
||
|
||
/**
|
||
* plic.h - Platform-Level Interrupt Controller interface (riscv64 only)
|
||
*
|
||
* Item 4.3.5a (FABRIC-0.md §27.5): Phase 0 (0.2/0.3) only ever enabled the
|
||
* S-mode *timer* interrupt (sie.STIE). External interrupts (sie.SEIE) were
|
||
* never touched, and the PLIC -- the only external-interrupt path on
|
||
* RISC-V, there is no legacy PIC or I/O APIC equivalent -- had no driver
|
||
* at all before this item. Pure substrate: this item wires the mechanism
|
||
* (claim/dispatch/complete) with no permanent source enabled by default;
|
||
* a real consumer (4.3.5b, virtio-keyboard) enables its own source later.
|
||
*/
|
||
|
||
#ifndef STARKERNEL_PLIC_H
|
||
#define STARKERNEL_PLIC_H
|
||
|
||
#include <stdint.h>
|
||
|
||
/**
|
||
* Map the PLIC and set the S-mode hart-0 context's priority threshold to 0
|
||
* (maximally permissive -- safe because nothing is enabled at any source
|
||
* by default; enabling a source is what actually lets it reach claim()).
|
||
* Also sets sie.SEIE. Does not touch sstatus.SIE -- arch_enable_interrupts()
|
||
* still owns that, same as the timer.
|
||
*
|
||
* @return 0 on success.
|
||
*/
|
||
int plic_init(void);
|
||
|
||
/** Set a source's interrupt priority (1-7; 0 means "never interrupt"). */
|
||
void plic_set_priority(uint32_t irq, uint32_t priority);
|
||
|
||
/** Enable a source for the S-mode hart-0 context. */
|
||
void plic_enable(uint32_t irq);
|
||
|
||
/** Disable a source for the S-mode hart-0 context. */
|
||
void plic_disable(uint32_t irq);
|
||
|
||
/**
|
||
* Claim the highest-priority pending interrupt for the S-mode hart-0
|
||
* context. Returns the source ID, or 0 if none is pending.
|
||
*/
|
||
uint32_t plic_claim(void);
|
||
|
||
/** Signal completion of the source previously returned by plic_claim(). */
|
||
void plic_complete(uint32_t irq);
|
||
|
||
#endif /* STARKERNEL_PLIC_H */
|