Summary
The runtime still relies on hardcoded .equ offsets in runtime/runtime_sh4_minimal.S, but the current gen-offsets.c / asm-offsets.h pipeline is incomplete and make check-offsets does not validate the assembly constants actually in use.
Why
- Assembly context-switch code depends on struct field offsets matching C layouts exactly.
- The current generated
runtime/asm-offsets.h is only a placeholder with include guards and no offset definitions.
make check-offsets validates that placeholder output, not the hardcoded .equ constants consumed by the assembly.
- This creates silent-corruption risk: a C struct layout change can make the assembly read or write the wrong fields.
Evidence
runtime/runtime_sh4_minimal.S still defines local .equ constants such as G_CONTEXT.
runtime/asm-offsets.h currently contains only include guards and no offset values.
Makefile explicitly notes that check-offsets does not validate the hardcoded .equ values.
runtime/gen-offsets.c still exists and is intended to describe the C-side layout being checked.
Direction
- Make one source of truth for assembly-visible offsets.
- Either generate a real include file consumed by assembly, or add a direct build-time/runtime verification step against the
.equ constants actually used.
- Ensure
make check-offsets fails when assembly constants drift from the C layout.
- Document the supported workflow for changing
G / context-related structs once the synchronization path is real.
Summary
The runtime still relies on hardcoded
.equoffsets inruntime/runtime_sh4_minimal.S, but the currentgen-offsets.c/asm-offsets.hpipeline is incomplete andmake check-offsetsdoes not validate the assembly constants actually in use.Why
runtime/asm-offsets.his only a placeholder with include guards and no offset definitions.make check-offsetsvalidates that placeholder output, not the hardcoded.equconstants consumed by the assembly.Evidence
runtime/runtime_sh4_minimal.Sstill defines local.equconstants such asG_CONTEXT.runtime/asm-offsets.hcurrently contains only include guards and no offset values.Makefileexplicitly notes thatcheck-offsetsdoes not validate the hardcoded.equvalues.runtime/gen-offsets.cstill exists and is intended to describe the C-side layout being checked.Direction
.equconstants actually used.make check-offsetsfails when assembly constants drift from the C layout.G/ context-related structs once the synchronization path is real.