Skip to content

Commit c35f3aa

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
RISC-V: vector: export VLENB csr in __sc_riscv_v_state
VLENB is critical for callers of ptrace to reconstruct Vector register files from the register dump of NT_RISCV_VECTOR. Also, future systems may will have a writable VLENB, so add it now to potentially save future compatibility issue. Fixes: 0c59922 ("riscv: Add ptrace vector support") Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Link: https://lore.kernel.org/r/20230816155450.26200-3-andy.chiu@sifive.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent e3f9324 commit c35f3aa

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

arch/riscv/include/asm/vector.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ static __always_inline void __vstate_csr_save(struct __riscv_v_ext_state *dest)
7070
"csrr %1, " __stringify(CSR_VTYPE) "\n\t"
7171
"csrr %2, " __stringify(CSR_VL) "\n\t"
7272
"csrr %3, " __stringify(CSR_VCSR) "\n\t"
73+
"csrr %4, " __stringify(CSR_VLENB) "\n\t"
7374
: "=r" (dest->vstart), "=r" (dest->vtype), "=r" (dest->vl),
74-
"=r" (dest->vcsr) : :);
75+
"=r" (dest->vcsr), "=r" (dest->vlenb) : :);
7576
}
7677

7778
static __always_inline void __vstate_csr_restore(struct __riscv_v_ext_state *src)

arch/riscv/include/uapi/asm/ptrace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct __riscv_v_ext_state {
9797
unsigned long vl;
9898
unsigned long vtype;
9999
unsigned long vcsr;
100+
unsigned long vlenb;
100101
void *datap;
101102
/*
102103
* In signal handler, datap will be set a correct user stack offset

0 commit comments

Comments
 (0)