Skip to content

fix(riscv): decode segment fault-only-first loads (vlseg*nf*e*ff) - #293

Closed
carlosqwqqwq wants to merge 1 commit into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-vlsegff-decode
Closed

fix(riscv): decode segment fault-only-first loads (vlseg*nf*e*ff)#293
carlosqwqqwq wants to merge 1 commit into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-vlsegff-decode

Conversation

@carlosqwqqwq

Copy link
Copy Markdown
Contributor

Allow segment fault-only-first loads vlseg<nf>e<eew>ff to decode.
decode_load_fp currently accepts lumop 0b10000 only when nf == 0
(single-register vle<eew>ff) and rejects every nf != 0 segment form as
illegal, although the V extension defines them as legal instructions
(riscv-v-spec vector-common.adoc norm:vector_ls__seg_ff_unit-stride_op).
QEMU executes the canonical encoding (vlseg2e8ff.v v0, (a0) = 0x23050007)
normally; RAX reports Op::Illegal in both the unit decoder and the
rax-isa-oracle CLI.

Validation

  • Assembler check: riscv64-linux-gnu-as -march=rv64gcv emits 0x23050007
    for vlseg2e8ff.v v0, (a0), confirming the encoding is legal.
  • QEMU -cpu max runs the witness ELF to completion (exit 0); a control ELF
    with 0xffffffff dies with SIGILL (132).
  • RAX probe: decode(0x23050007, Xlen::Rv64, &Isa::rv64gc()) returns
    Op::Illegal before the fix, and the decode arm is reachable after the
    fix with the same Op used by the non-fault-only-first segment loads.
  • Regression test added covering nf=1..3 with e8/e16/e32/e64 and both
    unit-stride and strided forms.

Closes #288

@carlosqwqqwq carlosqwqqwq changed the title ## Summary fix(riscv): decode segment fault-only-first loads (vlseg*nf*e*ff) Aug 13, 2026

19h commented Aug 13, 2026

Copy link
Copy Markdown
Member

Thanks for the report and patch. I independently validated the segment fault-only-first encodings and implemented the complete behavior in #296: first-element faults remain precise, later faults trim vl, partial segments are preserved, and direct/SMIR/QEMU paths are covered. The rollup includes your co-author credit and asks for your review. I’m closing this PR as superseded by #296.

@19h 19h closed this Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Segment fault-only-first loads vlseg<nf>e<eew>ff are rejected as illegal

2 participants