diff mbox

[14/29] target-sparc: use direct address translation in hyperprivileged mode

Message ID 1475316333-9776-15-git-send-email-atar4qemu@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Artyom Tarasenko Oct. 1, 2016, 10:05 a.m. UTC
Implement translation behavior described in the chapter 13.7 of
"UltraSPARC T1™ Supplement to the UltraSPARC Architecture 2005".

Please note that QEMU doesn't impelement Real->Physical address
translation. The "Real Address" is always the "Physical Address".

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 target-sparc/mmu_helper.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c
index 32b629f..bef63f8 100644
--- a/target-sparc/mmu_helper.c
+++ b/target-sparc/mmu_helper.c
@@ -498,7 +498,8 @@  static int get_physical_address_data(CPUSPARCState *env,
     int is_user = (mmu_idx == MMU_USER_IDX ||
                    mmu_idx == MMU_USER_SECONDARY_IDX);
 
-    if ((env->lsu & DMMU_E) == 0) { /* DMMU disabled */
+    if ((env->lsu & DMMU_E) == 0 || cpu_hypervisor_mode(env)) {
+        /* direct translation VA -> PA */
         *physical = ultrasparc_truncate_physical(address);
         *prot = PAGE_READ | PAGE_WRITE;
         return 0;
@@ -617,8 +618,9 @@  static int get_physical_address_code(CPUSPARCState *env,
     int is_user = (mmu_idx == MMU_USER_IDX ||
                    mmu_idx == MMU_USER_SECONDARY_IDX);
 
-    if ((env->lsu & IMMU_E) == 0 || (env->pstate & PS_RED) != 0) {
-        /* IMMU disabled */
+    if (((env->lsu & IMMU_E) == 0) || (env->pstate & PS_RED) != 0
+        || cpu_hypervisor_mode(env)) {
+        /* direct translation VA -> PA */
         *physical = ultrasparc_truncate_physical(address);
         *prot = PAGE_EXEC;
         return 0;