pr5
This commit is contained in:
-157
@@ -1,160 +1,3 @@
|
||||
# PR-5.1 — Define Canonical Syscall Metadata Table
|
||||
|
||||
### Briefing
|
||||
|
||||
Syscalls must follow a unified, function-like ABI based on slot counts and capabilities. This PR introduces the canonical metadata table describing every syscall.
|
||||
|
||||
### Target
|
||||
|
||||
* Define a single authoritative metadata structure for syscalls.
|
||||
* Ensure all syscalls are described in terms of slot-based ABI.
|
||||
|
||||
### Work items
|
||||
|
||||
* Introduce a `SyscallMeta` struct containing:
|
||||
|
||||
* Syscall identifier.
|
||||
* `arg_slots`.
|
||||
* `ret_slots`.
|
||||
* Capability flags.
|
||||
* Determinism flags (if defined in spec).
|
||||
* Create a canonical syscall table/registry.
|
||||
* Ensure all existing syscalls are registered in this table.
|
||||
* Document the structure in code comments (English).
|
||||
|
||||
### Acceptance checklist
|
||||
|
||||
* [ ] All syscalls have a `SyscallMeta` entry.
|
||||
* [ ] Metadata includes arg and return slot counts.
|
||||
* [ ] No syscall is invoked without metadata.
|
||||
* [ ] `cargo test` passes.
|
||||
|
||||
### Tests
|
||||
|
||||
* Add a test ensuring all registered syscalls have metadata.
|
||||
|
||||
### Junie instructions
|
||||
|
||||
**You MAY:**
|
||||
|
||||
* Introduce a syscall metadata struct.
|
||||
* Add a central registry for syscalls.
|
||||
|
||||
**You MUST NOT:**
|
||||
|
||||
* Change existing syscall semantics.
|
||||
* Add new syscalls.
|
||||
|
||||
**If unclear:**
|
||||
|
||||
* Ask before defining metadata fields.
|
||||
|
||||
---
|
||||
|
||||
# PR-5.2 — Implement Slot-Based Syscall Calling Convention
|
||||
|
||||
### Briefing
|
||||
|
||||
Syscalls must behave like functions using the stack-based slot ABI. This PR implements the unified calling convention.
|
||||
|
||||
### Target
|
||||
|
||||
* Ensure syscalls read arguments from the stack.
|
||||
* Ensure syscalls push return values based on `ret_slots`.
|
||||
|
||||
### Work items
|
||||
|
||||
* Modify the VM syscall dispatch logic to:
|
||||
|
||||
* Look up `SyscallMeta`.
|
||||
* Pop `arg_slots` from the stack.
|
||||
* Invoke the syscall.
|
||||
* Push `ret_slots` results.
|
||||
* Remove any legacy argument handling paths.
|
||||
|
||||
### Acceptance checklist
|
||||
|
||||
* [ ] All syscalls use slot-based calling convention.
|
||||
* [ ] Argument and return slot counts are enforced.
|
||||
* [ ] No legacy calling paths remain.
|
||||
* [ ] `cargo test` passes.
|
||||
|
||||
### Tests
|
||||
|
||||
* Add tests:
|
||||
|
||||
* Syscall with correct arg/ret slots → passes.
|
||||
* Syscall with insufficient args → trap or verifier failure.
|
||||
|
||||
### Junie instructions
|
||||
|
||||
**You MAY:**
|
||||
|
||||
* Refactor syscall dispatch code.
|
||||
* Use metadata to enforce slot counts.
|
||||
|
||||
**You MUST NOT:**
|
||||
|
||||
* Change the stack model.
|
||||
* Add compatibility layers.
|
||||
|
||||
**If unclear:**
|
||||
|
||||
* Ask before modifying dispatch semantics.
|
||||
|
||||
---
|
||||
|
||||
# PR-5.3 — Enforce Capability Checks in Syscall Dispatch
|
||||
|
||||
### Briefing
|
||||
|
||||
Syscalls must be capability-gated. The runtime must verify that the current program has permission to invoke each syscall.
|
||||
|
||||
### Target
|
||||
|
||||
* Enforce capability checks before syscall execution.
|
||||
|
||||
### Work items
|
||||
|
||||
* Extend `SyscallMeta` with capability requirements.
|
||||
* Add capability data to the VM or execution context.
|
||||
* In syscall dispatch:
|
||||
|
||||
* Check capabilities.
|
||||
* If missing, trigger `TRAP_INVALID_SYSCALL` or equivalent.
|
||||
|
||||
### Acceptance checklist
|
||||
|
||||
* [ ] Capability checks occur before syscall execution.
|
||||
* [ ] Missing capability leads to deterministic trap.
|
||||
* [ ] Valid capabilities allow execution.
|
||||
* [ ] `cargo test` passes.
|
||||
|
||||
### Tests
|
||||
|
||||
* Add tests:
|
||||
|
||||
* Syscall without capability → trap.
|
||||
* Syscall with capability → success.
|
||||
|
||||
### Junie instructions
|
||||
|
||||
**You MAY:**
|
||||
|
||||
* Add capability checks in dispatch.
|
||||
* Extend metadata with capability fields.
|
||||
|
||||
**You MUST NOT:**
|
||||
|
||||
* Change trap semantics.
|
||||
* Introduce dynamic or nondeterministic permission systems.
|
||||
|
||||
**If unclear:**
|
||||
|
||||
* Ask before defining capability behavior.
|
||||
|
||||
---
|
||||
|
||||
# PR-5.4 — Verifier Integration for Syscall Slot Rules
|
||||
|
||||
### Briefing
|
||||
|
||||
Reference in New Issue
Block a user