Skip to content

Commit 9bfb820

Browse files
josecmdanielRep
authored andcommitted
fix(riscv): add low order bits to faulting address
Signed-off-by: Jose Martins <[email protected]>
1 parent 6df80f4 commit 9bfb820

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/arch/riscv/sync_exceptions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static inline bool is_pseudo_ins(uint32_t ins)
8080

8181
static size_t guest_page_fault_handler(void)
8282
{
83-
vaddr_t addr = csrs_htval_read() << 2;
83+
vaddr_t addr = (csrs_htval_read() << 2) | (csrs_stval_read() & 0x3);
8484

8585
emul_handler_t handler = vm_emul_get_mem(cpu()->vcpu->vm, addr);
8686
if (handler != NULL) {

0 commit comments

Comments
 (0)