summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianluca Guida <gianluca@rivosinc.com>2023-06-22 18:38:59 +0100
committerAnup Patel <anup@brainfault.org>2023-06-23 08:46:07 +0530
commit8bd666a25b543ba391ae6ee81c1a2469e95c4a05 (patch)
tree7dcaa2b88c62d43f94b9d81d009d6afd862dd361
parent27c957a43b030523baf931a3b8ef002418fb27ad (diff)
downloadopensbi-8bd666a25b543ba391ae6ee81c1a2469e95c4a05.tar.gz
opensbi-8bd666a25b543ba391ae6ee81c1a2469e95c4a05.zip
lib: sbi: check A2 register in ecall_dbcn_handler.
Do not ignore register A2 (high bits of physical address) in the dbcn handler (RV64). Signed-off-by: Gianluca Guida <gianluca@rivosinc.com> Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r--lib/sbi/sbi_ecall_dbcn.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sbi/sbi_ecall_dbcn.c b/lib/sbi/sbi_ecall_dbcn.c
index e0b892c2..ecec027a 100644
--- a/lib/sbi/sbi_ecall_dbcn.c
+++ b/lib/sbi/sbi_ecall_dbcn.c
@@ -34,11 +34,14 @@ static int sbi_ecall_dbcn_handler(unsigned long extid, unsigned long funcid,
* Based on above, we simply fail if the upper 32bits of
* the physical address (i.e. a2 register) is non-zero on
* RV32.
+ *
+ * Analogously, we fail if the upper 64bit of the
+ * physical address (i.e. a2 register) is non-zero on
+ * RV64.
*/
-#if __riscv_xlen == 32
if (regs->a2)
return SBI_ERR_FAILED;
-#endif
+
if (!sbi_domain_check_addr_range(sbi_domain_thishart_ptr(),
regs->a1, regs->a0, smode,
SBI_DOMAIN_READ|SBI_DOMAIN_WRITE))