lib: Handle page/access fault caused by unpriv load/store
authorAnup Patel <anup.patel@wdc.com>
Thu, 23 May 2019 08:00:58 +0000 (13:30 +0530)
committerAnup Patel <anup@brainfault.org>
Fri, 24 May 2019 02:52:47 +0000 (08:22 +0530)
commita6395acd6cb2c35871481d3e4f0beaf449f8c0fd
tree4361c3454a814e49cea8f53d0a6cf3885e7f280b
parentbb915780ac76b146f3de47f105a95359e02f158c
lib: Handle page/access fault caused by unpriv load/store

The unpriv load/store instruction from M-mode can cause page/access
fault to M-mode if S-mode page table did not have mappings OR it did
not have PMP access permission.

To tackle this, we redirect trap back to S-mode if unpriv load/store
instruction traps in M-mode.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
include/sbi/riscv_unpriv.h
include/sbi/sbi_error.h
include/sbi/sbi_ipi.h
lib/riscv_unpriv.c
lib/sbi_ecall.c
lib/sbi_ipi.c
lib/sbi_misaligned_ldst.c
lib/sbi_system.c
lib/sbi_trap.c