summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivian Wang <dramforever@live.com>2022-09-02 18:48:35 +0300
committerAnup Patel <anup@brainfault.org>2022-09-13 14:13:07 +0300
commit46e744ab6736c0d14a1a1609d9dda3b802c164fe (patch)
tree1e5a52f34f6a31d9fe7b801abc81f238300581c5
parent37a0d83b6d5a06fd740fcdfb5e4074c33e472a2d (diff)
downloadopensbi-46e744ab6736c0d14a1a1609d9dda3b802c164fe.tar.xz
lib: sbi_misaligned_ldst: Set GVA if not emulating
If a particular misaligned load or store cannot be emulated at all, for the redirected trap, trap.gva is set to 0, but it should be the same as mstatus[h].GVA of the original trap. Fix this so that if the trap is destined for HS-mode, hstatus.GVA is then set correctly. Fixes: 1c4ce74f5128 ("lib: sbi: Set gva when creating sbi_trap_info") Signed-off-by: Vivian Wang <dramforever@live.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
-rw-r--r--lib/sbi/sbi_misaligned_ldst.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sbi/sbi_misaligned_ldst.c b/lib/sbi/sbi_misaligned_ldst.c
index 92a2393..4b91e07 100644
--- a/lib/sbi/sbi_misaligned_ldst.c
+++ b/lib/sbi/sbi_misaligned_ldst.c
@@ -129,7 +129,7 @@ int sbi_misaligned_load_handler(ulong addr, ulong tval2, ulong tinst,
uptrap.tval = addr;
uptrap.tval2 = tval2;
uptrap.tinst = tinst;
- uptrap.gva = 0;
+ uptrap.gva = sbi_regs_gva(regs);
return sbi_trap_redirect(regs, &uptrap);
}
@@ -245,7 +245,7 @@ int sbi_misaligned_store_handler(ulong addr, ulong tval2, ulong tinst,
uptrap.tval = addr;
uptrap.tval2 = tval2;
uptrap.tinst = tinst;
- uptrap.gva = 0;
+ uptrap.gva = sbi_regs_gva(regs);
return sbi_trap_redirect(regs, &uptrap);
}