Skip to content

Commit 0eb5127

Browse files
charlie-rivospalmer-dabbelt
authored andcommitted
riscv: Fix default misaligned access trap
Commit d1703dc ("RISC-V: Detect unaligned vector accesses supported") removed the default handlers for handle_misaligned_load() and handle_misaligned_store(). When the kernel is compiled without RISCV_SCALAR_MISALIGNED, these handlers are never defined, causing compilation errors. Signed-off-by: Charlie Jenkins <charlie@rivosinc.com> Fixes: d1703dc ("RISC-V: Detect unaligned vector accesses supported") Reviewed-by: Jesse Taube <mr.bossman075@gmail.com> Link: https://lore.kernel.org/r/20241108-fix_handle_misaligned_load-v2-1-91d547ce64db@rivosinc.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 64f7b77 commit 0eb5127

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/riscv/include/asm/entry-common.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
2525
void handle_page_fault(struct pt_regs *regs);
2626
void handle_break(struct pt_regs *regs);
2727

28+
#ifdef CONFIG_RISCV_MISALIGNED
2829
int handle_misaligned_load(struct pt_regs *regs);
2930
int handle_misaligned_store(struct pt_regs *regs);
31+
#else
32+
static inline int handle_misaligned_load(struct pt_regs *regs)
33+
{
34+
return -1;
35+
}
36+
37+
static inline int handle_misaligned_store(struct pt_regs *regs)
38+
{
39+
return -1;
40+
}
41+
#endif
3042

3143
#endif /* _ASM_RISCV_ENTRY_COMMON_H */

0 commit comments

Comments
 (0)