Skip to content

Commit 8bd666a

Browse files
glg-rvavpatel
authored andcommitted
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>
1 parent 27c957a commit 8bd666a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/sbi/sbi_ecall_dbcn.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ static int sbi_ecall_dbcn_handler(unsigned long extid, unsigned long funcid,
3434
* Based on above, we simply fail if the upper 32bits of
3535
* the physical address (i.e. a2 register) is non-zero on
3636
* RV32.
37+
*
38+
* Analogously, we fail if the upper 64bit of the
39+
* physical address (i.e. a2 register) is non-zero on
40+
* RV64.
3741
*/
38-
#if __riscv_xlen == 32
3942
if (regs->a2)
4043
return SBI_ERR_FAILED;
41-
#endif
44+
4245
if (!sbi_domain_check_addr_range(sbi_domain_thishart_ptr(),
4346
regs->a1, regs->a0, smode,
4447
SBI_DOMAIN_READ|SBI_DOMAIN_WRITE))

0 commit comments

Comments
 (0)