]> Git Repo - qemu.git/commitdiff
target-ppc: Don't share get_pteg_offset() between 32 and 64-bit
authorDavid Gibson <[email protected]>
Tue, 12 Mar 2013 00:31:15 +0000 (00:31 +0000)
committerAlexander Graf <[email protected]>
Fri, 22 Mar 2013 14:28:48 +0000 (15:28 +0100)
The get_pteg_offset() helper function is currently shared between 32-bit
and 64-bit hash mmus, taking a parameter for the hash pte size.  In the
64-bit paths, it's only called in one place, and it's a trivial
calculation.  This patch, therefore, open codes it for 64-bit.  The
remaining version, which is used in two places is made 32-bit only and
moved to mmu-hash32.c.

Signed-off-by: David Gibson <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
target-ppc/cpu.h
target-ppc/mmu-hash32.c
target-ppc/mmu-hash32.h
target-ppc/mmu-hash64.c
target-ppc/mmu_helper.c

index 41cd5d6aba6f3dc765ecbe9afd3b840ad3dbdf75..86e8978ff8f2fce97d832497b8f4c43133ddce84 100644 (file)
@@ -1133,7 +1133,6 @@ void ppc_hw_interrupt (CPUPPCState *env);
 
 #if !defined(CONFIG_USER_ONLY)
 void ppc_store_sdr1 (CPUPPCState *env, target_ulong value);
-hwaddr get_pteg_offset(CPUPPCState *env, hwaddr hash, int pte_size);
 int get_bat(CPUPPCState *env, mmu_ctx_t *ctx,
             target_ulong virtual, int rw, int type);
 #endif /* !defined(CONFIG_USER_ONLY) */
index 4b7598bdfc315167131636b8d44f9352112a27f2..0ccaf7cf0698dab11e80691dc29abd7dcc501162 100644 (file)
@@ -174,6 +174,11 @@ static int ppc_hash32_pte_update_flags(mmu_ctx_t *ctx, target_ulong *pte1p,
     return store;
 }
 
+hwaddr get_pteg_offset32(CPUPPCState *env, hwaddr hash)
+{
+    return (hash * HASH_PTE_SIZE_32 * 8) & env->htab_mask;
+}
+
 /* PTE table lookup */
 static int find_pte32(CPUPPCState *env, mmu_ctx_t *ctx, int h,
                       int rw, int type, int target_page_bits)
@@ -184,7 +189,7 @@ static int find_pte32(CPUPPCState *env, mmu_ctx_t *ctx, int h,
     int ret, r;
 
     ret = -1; /* No entry found */
-    pteg_off = get_pteg_offset(env, ctx->hash[h], HASH_PTE_SIZE_32);
+    pteg_off = get_pteg_offset32(env, ctx->hash[h]);
     for (i = 0; i < 8; i++) {
         if (env->external_htab) {
             pte0 = ldl_p(env->external_htab + pteg_off + (i * 8));
index 8f10e0d15cdfda2043dc88122379407b13a2837e..3435aa5513353f9a93677b5f153e70ba28d33a7b 100644 (file)
@@ -3,7 +3,7 @@
 
 #ifndef CONFIG_USER_ONLY
 
-int pte32_is_valid(target_ulong pte0);
+hwaddr get_pteg_offset32(CPUPPCState *env, hwaddr hash);
 hwaddr ppc_hash32_get_phys_page_debug(CPUPPCState *env, target_ulong addr);
 int ppc_hash32_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw,
                                 int mmu_idx);
index f9c5b099b44c297df37e908a203e1f616890e434..7134616f2c9ab3be015fbf4b4630a8bda64e61a8 100644 (file)
@@ -378,7 +378,7 @@ static int find_pte64(CPUPPCState *env, mmu_ctx_t *ctx, int h,
     int ret, r;
 
     ret = -1; /* No entry found */
-    pteg_off = get_pteg_offset(env, ctx->hash[h], HASH_PTE_SIZE_64);
+    pteg_off = (ctx->hash[h] * HASH_PTE_SIZE_64 * 8) & env->htab_mask;
     for (i = 0; i < 8; i++) {
         if (env->external_htab) {
             pte0 = ldq_p(env->external_htab + pteg_off + (i * 16));
index 2deb635d75d024c7e22bfb52dbace250819bb8c1..50ec0ace7d9374359af0b638ea560977faa0430c 100644 (file)
@@ -499,11 +499,6 @@ int get_bat(CPUPPCState *env, mmu_ctx_t *ctx,
     return ret;
 }
 
-hwaddr get_pteg_offset(CPUPPCState *env, hwaddr hash, int pte_size)
-{
-    return (hash * pte_size * 8) & env->htab_mask;
-}
-
 /* Perform segment based translation */
 static inline int get_segment_6xx_tlb(CPUPPCState *env, mmu_ctx_t *ctx,
                                       target_ulong eaddr, int rw, int type)
@@ -1551,9 +1546,9 @@ int cpu_ppc_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw,
                 tlb_miss:
                     env->error_code |= ctx.key << 19;
                     env->spr[SPR_HASH1] = env->htab_base +
-                        get_pteg_offset(env, ctx.hash[0], HASH_PTE_SIZE_32);
+                        get_pteg_offset32(env, ctx.hash[0]);
                     env->spr[SPR_HASH2] = env->htab_base +
-                        get_pteg_offset(env, ctx.hash[1], HASH_PTE_SIZE_32);
+                        get_pteg_offset32(env, ctx.hash[1]);
                     break;
                 case POWERPC_MMU_SOFT_74xx:
                     if (rw == 1) {
This page took 0.039848 seconds and 4 git commands to generate.