diff options
author | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2006-01-18 04:16:27 +0000 |
---|---|---|
committer | sewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2006-01-18 04:16:27 +0000 |
commit | 2e1a6778c8e0442229cc68006e4353d1937bcea7 (patch) | |
tree | 4f6d0a4a2e497185dc1cbe6643483c40ce2b1599 /memcheck/mc_main.c | |
parent | 93baf94b3fbea6cd1633dd9dd2ddccd0cdf13e3e (diff) |
Valgrind-side handling (fast case) for the ppc64 ELF stack redzone.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5545 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'memcheck/mc_main.c')
-rw-r--r-- | memcheck/mc_main.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index a8972220..c6df65ce 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -1006,6 +1006,7 @@ void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len ) any attempt to access it will elicit an addressing error, and that's good enough. */ + /* 128 bytes (16 ULongs) is the magic value for ELF amd64. */ if (EXPECTED_TAKEN( len == 128 && VG_IS_8_ALIGNED(base) )) { @@ -1050,7 +1051,74 @@ void MC_(helperc_MAKE_STACK_UNINIT) ( Addr base, UWord len ) } } + /* 288 bytes (36 ULongs) is the magic value for ELF ppc64. */ + if (EXPECTED_TAKEN( len == 288 + && VG_IS_8_ALIGNED(base) + )) { + /* Now we know the address range is suitably sized and + aligned. */ + UWord a_lo = (UWord)base; + UWord a_hi = (UWord)(base + 287); + UWord sec_lo = a_lo >> 16; + UWord sec_hi = a_hi >> 16; + + if (EXPECTED_TAKEN( sec_lo == sec_hi + && sec_lo <= N_PRIMARY_MAP + )) { + /* Now we know that the entire address range falls within a + single secondary map, and that that secondary 'lives' in + the main primary map. */ + SecMap* sm = primary_map[sec_lo]; + + if (EXPECTED_TAKEN( !is_distinguished_sm(sm) )) { + /* And finally, now we know that the secondary in question + is modifiable. */ + UWord v_off = a_lo & 0xFFFF; + ULong* p = (ULong*)(&sm->vbyte[v_off]); + p[ 0] = VGM_WORD64_INVALID; + p[ 1] = VGM_WORD64_INVALID; + p[ 2] = VGM_WORD64_INVALID; + p[ 3] = VGM_WORD64_INVALID; + p[ 4] = VGM_WORD64_INVALID; + p[ 5] = VGM_WORD64_INVALID; + p[ 6] = VGM_WORD64_INVALID; + p[ 7] = VGM_WORD64_INVALID; + p[ 8] = VGM_WORD64_INVALID; + p[ 9] = VGM_WORD64_INVALID; + p[10] = VGM_WORD64_INVALID; + p[11] = VGM_WORD64_INVALID; + p[12] = VGM_WORD64_INVALID; + p[13] = VGM_WORD64_INVALID; + p[14] = VGM_WORD64_INVALID; + p[15] = VGM_WORD64_INVALID; + p[16] = VGM_WORD64_INVALID; + p[17] = VGM_WORD64_INVALID; + p[18] = VGM_WORD64_INVALID; + p[19] = VGM_WORD64_INVALID; + p[20] = VGM_WORD64_INVALID; + p[21] = VGM_WORD64_INVALID; + p[22] = VGM_WORD64_INVALID; + p[23] = VGM_WORD64_INVALID; + p[24] = VGM_WORD64_INVALID; + p[25] = VGM_WORD64_INVALID; + p[26] = VGM_WORD64_INVALID; + p[27] = VGM_WORD64_INVALID; + p[28] = VGM_WORD64_INVALID; + p[29] = VGM_WORD64_INVALID; + p[30] = VGM_WORD64_INVALID; + p[31] = VGM_WORD64_INVALID; + p[32] = VGM_WORD64_INVALID; + p[33] = VGM_WORD64_INVALID; + p[34] = VGM_WORD64_INVALID; + p[35] = VGM_WORD64_INVALID; + return; + } + } + } + /* else fall into slow case */ + if (0) VG_(printf)("MC_(helperc_MAKE_STACK_UNINIT): " + "slow case, %d\n", len); mc_make_writable(base, len); } |