aboutsummaryrefslogtreecommitdiff
path: root/target/loongarch/cpu.h
diff options
context:
space:
mode:
authorJiajie Chen <c@jia.je>2023-08-22 09:13:55 +0200
committerSong Gao <gaosong@loongson.cn>2023-08-24 11:17:57 +0800
commit7033c0e6dd36cd2bfa9a323c3a51ecb0b55903fc (patch)
tree332e0692c8649c7dc091cf187ab12844259be545 /target/loongarch/cpu.h
parent2f6478ffad1770a474460b7692588bae7f031da3 (diff)
target/loongarch: Truncate high 32 bits of address in VA32 mode
When running in VA32 mode(!LA64 or VA32L[1-3] matching PLV), virtual address is truncated to 32 bits before address mapping. Signed-off-by: Jiajie Chen <c@jia.je> Co-authored-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20230822032724.1353391-6-gaosong@loongson.cn> Message-Id: <20230822071405.35386-10-philmd@linaro.org>
Diffstat (limited to 'target/loongarch/cpu.h')
-rw-r--r--target/loongarch/cpu.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index e1562695e8..25a0ef7e41 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -445,7 +445,11 @@ static inline bool is_va32(CPULoongArchState *env)
static inline void set_pc(CPULoongArchState *env, uint64_t value)
{
- env->pc = value;
+ if (is_va32(env)) {
+ env->pc = (uint32_t)value;
+ } else {
+ env->pc = value;
+ }
}
/*