From: Julian Seward Date: Tue, 20 Feb 2007 19:23:19 +0000 (+0000) Subject: Make ppc32/64-aix5 work again following recent VG_(tt_fast) rearrangement. X-Git-Tag: svn/VALGRIND_3_3_0~359 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06d8004b23af0026c4871990556964dcdb0d2465;p=thirdparty%2Fvalgrind.git Make ppc32/64-aix5 work again following recent VG_(tt_fast) rearrangement. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6606 --- diff --git a/coregrind/m_dispatch/dispatch-ppc32-aix5.S b/coregrind/m_dispatch/dispatch-ppc32-aix5.S index cfa2c968b8..41e366badd 100644 --- a/coregrind/m_dispatch/dispatch-ppc32-aix5.S +++ b/coregrind/m_dispatch/dispatch-ppc32-aix5.S @@ -267,9 +267,12 @@ VG_(run_innerloop__dispatch_unprofiled): 128(r1) (=orig guest_state) */ - /* Has the guest state pointer been messed with? If yes, exit. */ + /* Has the guest state pointer been messed with? If yes, exit. + Also set up & VG_(tt_fast) early in an attempt at better + scheduling. */ lwz 5,128(1) /* original guest_state ptr */ cmpw 5,31 + lwz 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ bne gsp_changed /* save the jump address in the guest state */ @@ -281,24 +284,17 @@ VG_(run_innerloop__dispatch_unprofiled): beq counter_is_zero /* try a fast lookup in the translation cache */ - /* r4 = VG_TT_FAST_HASH(addr) * sizeof(ULong*) - = ((r3 >>u 2) & VG_TT_FAST_MASK) << 2 */ - rlwinm 4,3, 0, 32-2-VG_TT_FAST_BITS, 31-2 - - lwz 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ - - lwzx 5,5,4 /* r5 = tt_fast[r5] */ - - lwz 6,4(5) /* big-endian, so comparing 2nd 32bit word */ + /* r4 = VG_TT_FAST_HASH(addr) * sizeof(FastCacheEntry) + = ((r3 >>u 2) & VG_TT_FAST_MASK) << 3 */ + rlwinm 4,3,1, 29-VG_TT_FAST_BITS, 28 /* entry# * 8 */ + add 5,5,4 /* & VG_(tt_fast)[entry#] */ + lwz 6,0(5) /* .guest */ + lwz 7,4(5) /* .host */ cmpw 3,6 bne fast_lookup_failed - /* Found a match. Call tce[1], which is 8 bytes along, since - each tce element is a 64-bit int. */ - addi 8,5,8 - mtctr 8 - - /* run the translation */ + /* Found a match. Call .host. */ + mtctr 7 bctrl /* On return from guest code: @@ -306,7 +302,6 @@ VG_(run_innerloop__dispatch_unprofiled): r31 may be unchanged (guest_state), or may indicate further details of the control transfer requested to *r3. */ - /* start over */ b VG_(run_innerloop__dispatch_unprofiled) /*NOTREACHED*/ @@ -325,10 +320,12 @@ VG_(run_innerloop__dispatch_profiled): Stack state: 128(r1) (=orig guest_state) */ - - /* Has the guest state pointer been messed with? If yes, exit. */ + /* Has the guest state pointer been messed with? If yes, exit. + Also set up & VG_(tt_fast) early in an attempt at better + scheduling. */ lwz 5,128(1) /* original guest_state ptr */ cmpw 5,31 + lwz 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ bne gsp_changed /* save the jump address in the guest state */ @@ -340,31 +337,25 @@ VG_(run_innerloop__dispatch_profiled): beq counter_is_zero /* try a fast lookup in the translation cache */ - /* r4 = VG_TT_FAST_HASH(addr) * sizeof(ULong*) - = ((r3 >>u 2) & VG_TT_FAST_MASK) << 2 */ - rlwinm 4,3, 0, 32-2-VG_TT_FAST_BITS, 31-2 - - lwz 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ - - lwzx 5,5,4 /* r5 = tt_fast[r4] */ - - lwz 6,4(5) /* big-endian, so comparing 2nd 32bit word */ + /* r4 = VG_TT_FAST_HASH(addr) * sizeof(FastCacheEntry) + = ((r3 >>u 2) & VG_TT_FAST_MASK) << 3 */ + rlwinm 4,3,1, 29-VG_TT_FAST_BITS, 28 /* entry# * 8 */ + add 5,5,4 /* & VG_(tt_fast)[entry#] */ + lwz 6,0(5) /* .guest */ + lwz 7,4(5) /* .host */ cmpw 3,6 bne fast_lookup_failed /* increment bb profile counter */ + srwi 4,4,1 /* entry# * sizeof(UInt*) */ lwz 9,tocent__vgPlain_tt_fastN(2) /* r9 = &tt_fastN */ - lwzx 7,9,4 /* r7 = tt_fastN[r4] */ - lwz 10,0(7) + lwzx 8,9,4 /* r7 = tt_fastN[r4] */ + lwz 10,0(8) addi 10,10,1 - stw 10,0(7) + stw 10,0(8) - /* Found a match. Call tce[1], which is 8 bytes along, since - each tce element is a 64-bit int. */ - addi 8,5,8 - mtctr 8 - - /* run the translation */ + /* Found a match. Call .host. */ + mtctr 7 bctrl /* On return from guest code: @@ -372,11 +363,11 @@ VG_(run_innerloop__dispatch_profiled): r31 may be unchanged (guest_state), or may indicate further details of the control transfer requested to *r3. */ - /* start over */ - b VG_(run_innerloop__dispatch_profiled) + b VG_(run_innerloop__dispatch_unprofiled) /*NOTREACHED*/ + /*----------------------------------------------------*/ /*--- exit points ---*/ /*----------------------------------------------------*/ diff --git a/coregrind/m_dispatch/dispatch-ppc64-aix5.S b/coregrind/m_dispatch/dispatch-ppc64-aix5.S index 8a39a75d33..6e2a6bf85a 100644 --- a/coregrind/m_dispatch/dispatch-ppc64-aix5.S +++ b/coregrind/m_dispatch/dispatch-ppc64-aix5.S @@ -203,7 +203,7 @@ LafterVMX1: /* hold dispatch_ctr (NOTE: 32-bit value) in r29 */ ld 5,tocent__vgPlain_dispatch_ctr(2) - lwz 29,0(5) + lwz 29,0(5) /* 32-bit zero-extending load */ /* set host FPU control word to the default mode expected by VEX-generated code. See comments in libvex.h for @@ -258,6 +258,7 @@ VG_(run_innerloop__dispatch_unprofiled): /* Has the guest state pointer been messed with? If yes, exit. */ ld 5,256(1) /* original guest_state ptr */ cmpd 5,31 + ld 5,tocent__vgPlain_tt_fast(2) /* &VG_(tt_fast) */ bne gsp_changed /* save the jump address in the guest state */ @@ -269,24 +270,18 @@ VG_(run_innerloop__dispatch_unprofiled): beq counter_is_zero /* try a fast lookup in the translation cache */ - /* r4 = VG_TT_FAST_HASH(addr) * sizeof(ULong*) - = ((r3 >>u 2) & VG_TT_FAST_MASK) << 3 */ - rldicl 4,3, 62, 64-VG_TT_FAST_BITS - sldi 4,4,3 - - ld 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ - - ldx 5,5,4 /* r5 = VG_(tt_fast)[VG_TT_FAST_HASH(addr)] */ - ld 6,0(5) /* r6 = (r5)->orig_addr */ + /* r4 = VG_TT_FAST_HASH(addr) * sizeof(FastCacheEntry) + = ((r3 >>u 2) & VG_TT_FAST_MASK) << 4 */ + rldicl 4,3, 62, 64-VG_TT_FAST_BITS /* entry# */ + sldi 4,4,4 /* entry# * sizeof(FastCacheEntry) */ + add 5,5,4 /* &VG_(tt_fast)[entry#] */ + ld 6,0(5) /* .guest */ + ld 7,8(5) /* .host */ cmpd 3,6 bne fast_lookup_failed - /* Found a match. Call tce[1], which is 8 bytes along, since - each tce element is a 64-bit int. */ - addi 8,5,8 - mtctr 8 - - /* run the translation */ + /* Found a match. Call .host. */ + mtctr 7 bctrl /* On return from guest code: @@ -294,7 +289,6 @@ VG_(run_innerloop__dispatch_unprofiled): r31 may be unchanged (guest_state), or may indicate further details of the control transfer requested to *r3. */ - /* start over */ b VG_(run_innerloop__dispatch_unprofiled) /*NOTREACHED*/ @@ -317,6 +311,7 @@ VG_(run_innerloop__dispatch_profiled): /* Has the guest state pointer been messed with? If yes, exit. */ ld 5,256(1) /* original guest_state ptr */ cmpd 5,31 + ld 5,tocent__vgPlain_tt_fast(2) /* &VG_(tt_fast) */ bne gsp_changed /* save the jump address in the guest state */ @@ -328,31 +323,26 @@ VG_(run_innerloop__dispatch_profiled): beq counter_is_zero /* try a fast lookup in the translation cache */ - /* r4 = VG_TT_FAST_HASH(addr) * sizeof(ULong*) - = ((r3 >>u 2) & VG_TT_FAST_MASK) << 3 */ - rldicl 4,3, 62, 64-VG_TT_FAST_BITS - sldi 4,4,3 - - ld 5,tocent__vgPlain_tt_fast(2) /* r5 = &tt_fast */ - - ldx 5,5,4 /* r5 = VG_(tt_fast)[VG_TT_FAST_HASH(addr)] */ - ld 6,0(5) /* r6 = (r5)->orig_addr */ + /* r4 = VG_TT_FAST_HASH(addr) * sizeof(FastCacheEntry) + = ((r3 >>u 2) & VG_TT_FAST_MASK) << 4 */ + rldicl 4,3, 62, 64-VG_TT_FAST_BITS /* entry# */ + sldi 4,4,4 /* entry# * sizeof(FastCacheEntry) */ + add 5,5,4 /* &VG_(tt_fast)[entry#] */ + ld 6,0(5) /* .guest */ + ld 7,8(5) /* .host */ cmpd 3,6 bne fast_lookup_failed /* increment bb profile counter */ ld 9,tocent__vgPlain_tt_fastN(2) /* r9 = &tt_fastN */ - ldx 7,9,4 /* r7 = tt_fastN[r4] */ - lwz 10,0(7) + srdi 4,4,1 /* entry# * sizeof(UInt*) */ + ldx 8,9,4 /* r7 = tt_fastN[r4] */ + lwz 10,0(8) addi 10,10,1 - stw 10,0(7) + stw 10,0(8) - /* Found a match. Call tce[1], which is 8 bytes along, since - each tce element is a 64-bit int. */ - addi 8,5,8 - mtctr 8 - - /* run the translation */ + /* Found a match. Call .host. */ + mtctr 7 bctrl /* On return from guest code: @@ -360,7 +350,6 @@ VG_(run_innerloop__dispatch_profiled): r31 may be unchanged (guest_state), or may indicate further details of the control transfer requested to *r3. */ - /* start over */ b VG_(run_innerloop__dispatch_profiled) /*NOTREACHED*/ diff --git a/coregrind/m_dispatch/dispatch-ppc64-linux.S b/coregrind/m_dispatch/dispatch-ppc64-linux.S index e4c328a575..04775681d6 100644 --- a/coregrind/m_dispatch/dispatch-ppc64-linux.S +++ b/coregrind/m_dispatch/dispatch-ppc64-linux.S @@ -204,7 +204,7 @@ VG_(run_innerloop): /* hold dispatch_ctr (=32bit value) in r29 */ ld 29,.tocent__vgPlain_dispatch_ctr@toc(2) - lwz 29,0(29) + lwz 29,0(29) /* 32-bit zero-extending load */ /* set host FPU control word to the default mode expected by VEX-generated code. See comments in libvex.h for