Skip to content

Implement VECTOR/CUBE first-use task context after EXTCTX ABI is fixed #32

Description

@zhoubot

Scope

Implement the Linux side of the unreleased LinxISA v0.58 VECTOR/CUBE first-use contract once the architectural cross-ACR context ABI is complete.

Evidence

Audited against:

  • root superproject PR #181 head 3c2ca6ef
  • Linux 1055a743f16eaebfc371e0aabec8c861ab44858f / tree e6f3593f698db1de6bff8f9a43dc9007c237f21b
  • LLVM b7c83f68bf84125e696a70bec4b665c70a3b584d
  • QEMU PR #74 evidence head bbe090a8956bf2dce443c907e5118212d7c8768d
  • r7 evidence /private/tmp/linx-pto-cube-system-181-r7/evidence

The r7 CUBE failure is not a first-use exception. QEMU observed ACR2 ECONFIG=0x7, CUBE kind 1, prepared=0, then delivered an ordinary illegal-instruction trap (trapno=0x8000000000000000, no ARGV/cause 4).

Current Linux gap

Linux 1055 defines the V/C bit constants but does not implement the contract:

  • arch/linx/kernel/head.S writes zero to SSR_ECONFIG during boot.
  • There are no TIF_VECTOR / TIF_CUBE used flags.
  • There is no independent LIVE/resident state for NEVER_USED, SAVED_NOT_RESTORED, and LIVE.
  • do_trap_insn_exception() treats E_INST/EC_PERM(4) as a page-fault-style permission exception; it does not recognize the full E=1,ARGV=1,TRAPNUM=0,CAUSE=4,TRAPARG0={0,1},BI=0 signature.
  • switch_to() has no extension save/restore or per-task ECONFIG rewrite.
  • fork, exec, exit, migration, and allocation-failure behavior are undefined.

V/C must remain disabled until a real handler and context ABI exist; merely enabling them would convert legal user VECTOR/CUBE headers into unserviceable traps.

Architectural prerequisites

Blocked on LinxISA issue (cross-link after creation) defining:

  1. exact VECTOR and CUBE context blob size, alignment, version, reset image, and field coverage;
  2. an ACR1 operation that saves/restores the managed ACR2 task context, not the currently executing ACR1 context;
  3. inclusion of all task-owned state, including queues/block progress and any CUBE accumulator or extension-owned state;
  4. save/restore failure, restart, migration, and forward-progress rules.

The current QEMU bring-up ESAVE/ERCOV implementation transfers a 64-byte LB/LC blob for the currently executing ACR. That is insufficient for an architecture-correct ACR1 Linux scheduler implementation.

Linux acceptance criteria

  • Allocate each context only on first use.
  • Track used and resident/loaded state independently for VECTOR and CUBE.
  • Recognize only the complete first-use trap signature.
  • Initialize or restore the selected context, clear only its V/C bit, and retry the original block header.
  • On switch-out, save only used+LIVE contexts; use a defined immediate or lazy restore policy on switch-in.
  • Rewrite V/C for the next task before every ACR2 return.
  • Correct fork/clone, exec, exit, CPU migration, and allocation failure semantics.
  • Add focused trap-envelope/state-machine tests plus a two-task QEMU runtime test proving isolation and retry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions