]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Change the return value of LibVEX_{Chain,UnChain,PatchProfInc}.
authorFlorian Krohm <florian@eich-krohm.de>
Sat, 29 Sep 2012 17:05:46 +0000 (17:05 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Sat, 29 Sep 2012 17:05:46 +0000 (17:05 +0000)
These functions now always return the address range that was
patched. Therefore, these functions no longer need knowledge
about I-cache coherency of the host system.

git-svn-id: svn://svn.valgrind.org/vex/trunk@2545

VEX/priv/host_amd64_defs.c
VEX/priv/host_s390_defs.c
VEX/priv/host_x86_defs.c
VEX/pub/libvex.h

index cdb8ab61cba194bf18f3f43c05296c397669601e..44029ea5f2d78d991d5fb526652262c5efb7b403 100644 (file)
@@ -3595,7 +3595,7 @@ VexInvalRange chainXDirect_AMD64 ( void* place_to_chain,
       *(ULong*)(&p[2]) = Ptr_to_ULong(place_to_jump_to);
       p[12] = 0xE3;
    }
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_chain, 13 };
    return vir;
 }
 
@@ -3659,7 +3659,7 @@ VexInvalRange unchainXDirect_AMD64 ( void* place_to_unchain,
    p[10] = 0x41;
    p[11] = 0xFF;
    p[12] = 0xD3;
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_unchain, 13 };
    return vir;
 }
 
@@ -3693,7 +3693,7 @@ VexInvalRange patchProfInc_AMD64 ( void*  place_to_patch,
    p[7] = imm64 & 0xFF; imm64 >>= 8;
    p[8] = imm64 & 0xFF; imm64 >>= 8;
    p[9] = imm64 & 0xFF; imm64 >>= 8;
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_patch, 13 };
    return vir;
 }
 
index 8a99ad0e77905d998be6f3c4fff58ec32570afb8..01056ef0c8cc75608f3df87d284c01797c1d3050 100644 (file)
@@ -7643,7 +7643,7 @@ s390_tchain_verify_load64(const UChar *code, UChar regno, ULong value)
 }
 
 /* CODE points to the code sequence as generated by s390_tchain_load64.
-   Change the loaded value to VALUE. Return pointer to the byte following
+   Change the loaded value to IMM64. Return pointer to the byte following
    the patched code sequence. */
 static UChar *
 s390_tchain_patch_load64(UChar *code, ULong imm64)
@@ -8130,9 +8130,11 @@ patchProfInc_S390(void *code_to_patch, ULong *location_of_counter)
 
    s390_tchain_verify_load64(code_to_patch, S390_REGNO_TCHAIN_SCRATCH, 0);
 
-   s390_tchain_patch_load64(code_to_patch, Ptr_to_ULong(location_of_counter));
+   UChar *p = s390_tchain_patch_load64(code_to_patch,
+                                       Ptr_to_ULong(location_of_counter));
 
-   VexInvalRange vir = {0, 0};
+   UInt len = p - (UChar *)code_to_patch;
+   VexInvalRange vir = { (HWord)code_to_patch, len };
    return vir;
 }
 
@@ -8216,7 +8218,8 @@ chainXDirect_S390(void *place_to_chain,
       /* There is not need to emit a BCR here, as it is already there. */
    }
 
-   VexInvalRange vir = {0, 0};
+   UInt len = p - (UChar *)place_to_chain;
+   VexInvalRange vir = { (HWord)place_to_chain, len };
    return vir;
 }
 
@@ -8286,7 +8289,8 @@ unchainXDirect_S390(void *place_to_unchain,
    if (uses_short_form)
       s390_emit_BCR(p, S390_CC_ALWAYS, S390_REGNO_TCHAIN_SCRATCH);
 
-   VexInvalRange vir = {0, 0};
+   UInt len = p - (UChar *)place_to_unchain;
+   VexInvalRange vir = { (HWord)place_to_unchain, len };
    return vir;
 }
 
index efd511ec821d28fd26a5b4cbe966b18a3e51d22c..2d6106053d78faf9af0601c3b86de23af4e89b91 100644 (file)
@@ -3349,7 +3349,7 @@ VexInvalRange chainXDirect_X86 ( void* place_to_chain,
    /* sanity check on the delta -- top 32 are all 0 or all 1 */
    delta >>= 32;
    vassert(delta == 0LL || delta == -1LL);
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_chain, 7 };
    return vir;
 }
 
@@ -3392,7 +3392,7 @@ VexInvalRange unchainXDirect_X86 ( void* place_to_unchain,
    *(UInt*)(&p[1]) = (UInt)Ptr_to_ULong(disp_cp_chain_me);
    p[5] = 0xFF;
    p[6] = 0xD2;
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_unchain, 7 };
    return vir;
 }
 
@@ -3428,7 +3428,7 @@ VexInvalRange patchProfInc_X86 ( void*  place_to_patch,
    p[10] = imm32 & 0xFF; imm32 >>= 8;
    p[11] = imm32 & 0xFF; imm32 >>= 8;
    p[12] = imm32 & 0xFF; imm32 >>= 8;
-   VexInvalRange vir = {0, 0};
+   VexInvalRange vir = { (HWord)place_to_patch, 14 };
    return vir;
 }
 
index 3692770e29dc0fb5b06119ebd165d0622f5f6868..9d7f8bd7dd10ec8cc4b1e110545ac6848c88f60b 100644 (file)
@@ -699,14 +699,12 @@ VexTranslateResult LibVEX_Translate ( VexTranslateArgs* );
 /*--- Patch existing translations                     ---*/
 /*-------------------------------------------------------*/
 
-/* Indicates a host address range for which callers to the functions
-   below must request I-D cache syncing after the call.  ::len == 0 is
-   ambiguous -- it could mean either zero bytes or the entire address
-   space, so we mean the former. */
+/* A host address range that was modified by the functions below. 
+   Callers must request I-cache syncing after the call as appropriate. */
 typedef
    struct {
       HWord start;
-      HWord len;
+      HWord len;     /* always > 0 */
    }
    VexInvalRange;