diff mbox

[21/29] target-sparc: allow 256M sized pages

Message ID 1475316333-9776-22-git-send-email-atar4qemu@gmail.com
State New
Headers show

Commit Message

Artyom Tarasenko Oct. 1, 2016, 10:05 a.m. UTC
Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
---
 target-sparc/mmu_helper.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

Comments

Richard Henderson Oct. 11, 2016, 2:07 p.m. UTC | #1
On 10/01/2016 05:05 AM, Artyom Tarasenko wrote:
> +    uint64_t mask = 1ULL + ~(8192ULL << 3 * TTE_PGSIZE(tlb->tte));

Not the first time it has appeared in this patch series, but I find the "1 + ~" 
idiom to be strange.  Surely plain old "-" is clearer.


r~
diff mbox

Patch

diff --git a/target-sparc/mmu_helper.c b/target-sparc/mmu_helper.c
index bef63f8..33b48eb 100644
--- a/target-sparc/mmu_helper.c
+++ b/target-sparc/mmu_helper.c
@@ -456,23 +456,7 @@  static inline int ultrasparc_tag_match(SparcTLBEntry *tlb,
                                        uint64_t address, uint64_t context,
                                        hwaddr *physical)
 {
-    uint64_t mask;
-
-    switch (TTE_PGSIZE(tlb->tte)) {
-    default:
-    case 0x0: /* 8k */
-        mask = 0xffffffffffffe000ULL;
-        break;
-    case 0x1: /* 64k */
-        mask = 0xffffffffffff0000ULL;
-        break;
-    case 0x2: /* 512k */
-        mask = 0xfffffffffff80000ULL;
-        break;
-    case 0x3: /* 4M */
-        mask = 0xffffffffffc00000ULL;
-        break;
-    }
+    uint64_t mask = 1ULL + ~(8192ULL << 3 * TTE_PGSIZE(tlb->tte));
 
     /* valid, context match, virtual address match? */
     if (TTE_IS_VALID(tlb->tte) &&