qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sparc64 fix TLB match code
@ 2009-04-27 19:06 Igor Kovalenko
  2009-04-27 19:16 ` Blue Swirl
  0 siblings, 1 reply; 2+ messages in thread
From: Igor Kovalenko @ 2009-04-27 19:06 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 267 bytes --]

TLB match code must respect page size, otherwise 4M page mappings may
be not found.

Also correct a typo in get_physical_address_code which should use IMMU
registers.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

-- 
Kind regards,
Igor V. Kovalenko

[-- Attachment #2: qemu-sparc64-mmu-pagesize.patch --]
[-- Type: application/octet-stream, Size: 2329 bytes --]

Index: qemu-trunk/target-sparc/helper.c
===================================================================
--- qemu-trunk.orig/target-sparc/helper.c
+++ qemu-trunk/target-sparc/helper.c
@@ -404,7 +404,7 @@ static int get_physical_address_data(CPU
         }
         // ctx match, vaddr match, valid?
         if (env->dmmuregs[1] == (env->dtlb_tag[i] & 0x1fff) &&
-            (address & mask) == (env->dtlb_tag[i] & ~0x1fffULL) &&
+            (address & mask) == (env->dtlb_tag[i] & mask) &&
             (env->dtlb_tte[i] & 0x8000000000000000ULL)) {
             // access ok?
             if (((env->dtlb_tte[i] & 0x4) && is_user) ||
@@ -420,8 +420,8 @@ static int get_physical_address_data(CPU
 #endif
                 return 1;
             }
-            *physical = (env->dtlb_tte[i] & mask & 0x1fffffff000ULL) +
-                (address & ~mask & 0x1fffffff000ULL);
+            *physical = ((env->dtlb_tte[i] & mask) | (address & ~mask)) &
+                        0x1ffffffe000ULL;
             *prot = PAGE_READ;
             if (env->dtlb_tte[i] & 0x2)
                 *prot |= PAGE_WRITE;
@@ -467,7 +467,7 @@ static int get_physical_address_code(CPU
         }
         // ctx match, vaddr match, valid?
         if (env->dmmuregs[1] == (env->itlb_tag[i] & 0x1fff) &&
-            (address & mask) == (env->itlb_tag[i] & ~0x1fffULL) &&
+            (address & mask) == (env->itlb_tag[i] & mask) &&
             (env->itlb_tte[i] & 0x8000000000000000ULL)) {
             // access ok?
             if ((env->itlb_tte[i] & 0x4) && is_user) {
@@ -481,8 +481,8 @@ static int get_physical_address_code(CPU
 #endif
                 return 1;
             }
-            *physical = (env->itlb_tte[i] & mask & 0x1fffffff000ULL) +
-                (address & ~mask & 0x1fffffff000ULL);
+            *physical = ((env->itlb_tte[i] & mask) | (address & ~mask)) &
+                        0x1ffffffe000ULL;
             *prot = PAGE_EXEC;
             return 0;
         }
@@ -490,7 +490,7 @@ static int get_physical_address_code(CPU
 #ifdef DEBUG_MMU
     printf("TMISS at 0x%" PRIx64 "\n", address);
 #endif
-    env->immuregs[6] = (address & ~0x1fffULL) | (env->dmmuregs[1] & 0x1fff);
+    env->immuregs[6] = (address & ~0x1fffULL) | (env->immuregs[1] & 0x1fff);
     env->exception_index = TT_TMISS;
     return 1;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] sparc64 fix TLB match code
  2009-04-27 19:06 [Qemu-devel] [PATCH] sparc64 fix TLB match code Igor Kovalenko
@ 2009-04-27 19:16 ` Blue Swirl
  0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2009-04-27 19:16 UTC (permalink / raw)
  To: Igor Kovalenko; +Cc: qemu-devel

On 4/27/09, Igor Kovalenko <igor.v.kovalenko@gmail.com> wrote:
> TLB match code must respect page size, otherwise 4M page mappings may
>  be not found.
>
>  Also correct a typo in get_physical_address_code which should use IMMU
>  registers.
>
>  Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

Thanks, applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-04-27 19:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-27 19:06 [Qemu-devel] [PATCH] sparc64 fix TLB match code Igor Kovalenko
2009-04-27 19:16 ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).