diff options
| author | Anup Patel <[email protected]> | 2018-12-24 16:49:01 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2018-12-26 11:14:22 +0530 |
| commit | b5ae8e8a650d8cb0134f03f53472fb026d2ee6e6 (patch) | |
| tree | 807e81429152b2375cd4169ca8d8f95e625273d3 /lib/sbi_trap.c | |
| parent | 96f66f79ca022eb4b591d319675b5ee0854ca45f (diff) | |
lib: Add misaligned load/store trap handling
We generally don't get misaligned load/store traps from Linux/U-Boot
compiled using GCC 8.2 or higher but this is not true with older
GCC toolchains. To tackle this we add misaligned load/store trap
handling adopted from BBL sources but much more simpler.
(Note: BBL sources can be found at https://github.com/riscv/riscv-pk.git)
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/sbi_trap.c')
| -rw-r--r-- | lib/sbi_trap.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/sbi_trap.c b/lib/sbi_trap.c index 284bb74f..012a9a00 100644 --- a/lib/sbi_trap.c +++ b/lib/sbi_trap.c @@ -12,9 +12,10 @@ #include <sbi/sbi_console.h> #include <sbi/sbi_ecall.h> #include <sbi/sbi_error.h> -#include <sbi/sbi_illegal_insn.h> #include <sbi/sbi_hart.h> +#include <sbi/sbi_illegal_insn.h> #include <sbi/sbi_ipi.h> +#include <sbi/sbi_misaligned_ldst.h> #include <sbi/sbi_timer.h> #include <sbi/sbi_trap.h> @@ -95,6 +96,14 @@ void sbi_trap_handler(struct sbi_trap_regs *regs, rc = sbi_illegal_insn_handler(hartid, mcause, regs, scratch); msg = "illegal instruction handler failed"; break; + case CAUSE_MISALIGNED_LOAD: + rc = sbi_misaligned_load_handler(hartid, mcause, regs, scratch); + msg = "misaligned load handler failed"; + break; + case CAUSE_MISALIGNED_STORE: + rc = sbi_misaligned_store_handler(hartid, mcause, regs, scratch); + msg = "misaligned store handler failed"; + break; case CAUSE_SUPERVISOR_ECALL: case CAUSE_HYPERVISOR_ECALL: rc = sbi_ecall_handler(hartid, mcause, regs, scratch); |
