Skip to content

Commit

Permalink
lib: sbi: check A2 register in ecall_dbcn_handler.
Browse files Browse the repository at this point in the history
Do not ignore register A2 (high bits of physical address) in the dbcn
handler (RV64).

Signed-off-by: Gianluca Guida <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
  • Loading branch information
glg-rv authored and avpatel committed Jun 23, 2023
1 parent 27c957a commit 8bd666a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sbi/sbi_ecall_dbcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 8bd666a

Please sign in to comment.