lib: sbi_trap: Allow M-mode to M-mode ECALLs
authorAnup Patel <anup.patel@wdc.com>
Fri, 4 Sep 2020 11:09:49 +0000 (16:39 +0530)
committerAnup Patel <anup@brainfault.org>
Wed, 9 Sep 2020 04:02:04 +0000 (09:32 +0530)
We should allow M-mode to M-mode ECALLs because:
1. No other mode can handle M-mode ECALLs
2. In future, we can allow M-mode baremetal application (not
   linked to OpenSBI) running independently and cooperatively
   without corrupting OpenSBI M-mode state (CSRs and memory).

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
lib/sbi/sbi_trap.c

index b8bb20c..db5aa2f 100644 (file)
@@ -252,6 +252,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs)
                msg = "misaligned store handler failed";
                break;
        case CAUSE_SUPERVISOR_ECALL:
+       case CAUSE_MACHINE_ECALL:
                rc  = sbi_ecall_handler(regs);
                msg = "ecall handler failed";
                break;