Skip to contentSkip to conversation

[4351] Make the paged properties of the tb-jmp-cache hash function work for TARGET_PAGE_BITS ! = 12.

Qemu-devel Edgar E. Iglesias 3 participants 4 messages May 6, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4351

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4351
Author:   edgar_igl
Date:     2008-05-06 08:38:22 +0000 (Tue, 06 May 2008)

Log Message:
-----------
Make the paged properties of the tb-jmp-cache hash function work for TARGET_PAGE_BITS != 12.

Modified Paths:
--------------
trunk/exec-all.h

Modified: trunk/exec-all.h
===================================================================

exec-all.h +3 -3
@@ -191,15 +191,15 @@
 {
     target_ulong tmp;
     tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
-    return (tmp >> TB_JMP_PAGE_BITS) & TB_JMP_PAGE_MASK;
+    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK;
 }
 
 static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc)
 {
     target_ulong tmp;
     tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
-    return (((tmp >> TB_JMP_PAGE_BITS) & TB_JMP_PAGE_MASK) |
-	    (tmp & TB_JMP_ADDR_MASK));
+    return (((tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) & TB_JMP_PAGE_MASK)
+	    | (tmp & TB_JMP_ADDR_MASK));
 }
 
 static inline unsigned int tb_phys_hash_func(unsigned long pc)
#1 lore raw
Quoted 6 lines
 {
     target_ulong tmp;
     tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
(quoted diff) +1 -1
-    return (tmp >> TB_JMP_PAGE_BITS) & TB_JMP_PAGE_MASK;
+    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) &

TB_JMP_PAGE_MASK; }

I'm not sure what you're trying to achieve here, but this is definitely wrong. TARGET_PAGE_BITS may be less than TB_JMP_PAGE_BITS.

Paul

#2 lore raw
Quoted 10 lines · Paul Brook
Quoted 6 lines
 {
     target_ulong tmp;
     tmp = pc ^ (pc >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS));
(quoted diff) +1 -1
-    return (tmp >> TB_JMP_PAGE_BITS) & TB_JMP_PAGE_MASK;
+    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) &

TB_JMP_PAGE_MASK; }

I'm not sure what you're trying to achieve here, but this is definitely wrong. TARGET_PAGE_BITS may be less than TB_JMP_PAGE_BITS.

Hi Paul,

Thanks for the comment.

I didn't find any page bits under 10 in the tree. Please note that the constant beeing used is not TB_JMP_CACHE_BITS but TB_JMP_PAGE_BITS. Also that same right shift constant was already used in the initial shift of pc in that same routine.

Before committing I ran tests with target page bits 10, 11, 12, and 13 and the modified hash function behaved ok here. Are there more setups I should test ?

Best regards

Signature · 2 lines
Edgar E. Iglesias
Axis Communications AB
#3 lore raw
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
(quoted diff) +1 -1
-    return (tmp >> TB_JMP_PAGE_BITS) & TB_JMP_PAGE_MASK;
+    return (tmp >> (TARGET_PAGE_BITS - TB_JMP_PAGE_BITS)) &

TB_JMP_PAGE_MASK; }

I'm not sure what you're trying to achieve here, but this is definitely wrong. TARGET_PAGE_BITS may be less than TB_JMP_PAGE_BITS.

I didn't find any page bits under 10 in the tree.

Oops, sorry, my bad. I read TB_JMP_PAGE_BITS as TB_JMP_CACHE_BITS-1, not /2.

Paul