riscv: add support for PR_SET_UNALIGN and PR_GET_UNALIGN
authorClément Léger <cleger@rivosinc.com>
Wed, 4 Oct 2023 15:14:05 +0000 (17:14 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 1 Nov 2023 15:34:59 +0000 (08:34 -0700)
commit9f23a5d2f6b01c2ab91d791109731a0d87ec2239
tree17fd1a240636a03de468a1f01b0ca407f099de28
parent71c54b3d169db5569655cbd2a3616bc701fd5eec
riscv: add support for PR_SET_UNALIGN and PR_GET_UNALIGN

Now that trap support is ready to handle misalignment errors in S-mode,
allow the user to control the behavior of misaligned accesses using
prctl(PR_SET_UNALIGN). Add an align_ctl flag in thread_struct which
will be used to determine if we should SIGBUS the process or not on
such fault.

Signed-off-by: Clément Léger <cleger@rivosinc.com>
Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
Link: https://lore.kernel.org/r/20231004151405.521596-9-cleger@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/processor.h
arch/riscv/kernel/process.c
arch/riscv/kernel/traps_misaligned.c