From 63da307b469c7f7a5a69787e7cf48a6e64161ff1 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 13 Jan 2006 09:57:01 +0000 Subject: [PATCH] Use VG_(am_mmap_anon_float_valgrind) to allocate the unredirected translation cache. This ensures that the cache space is executable which it isn't when it is allocated as a static variable in the data segment, at least on my amd64 box. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5525 --- coregrind/m_transtab.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index 87417d00b0..36c4abb4f0 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -1241,8 +1241,8 @@ typedef UTCEntry; /* We just allocate forwards in _tc, never deleting. */ -static ULong unredir_tc[N_UNREDIR_TCQ] __attribute__((aligned(8))); -static Int unredir_tc_used; +static ULong *unredir_tc; +static Int unredir_tc_used = N_UNREDIR_TCQ; /* Slots in _tt can come into use and out again (.inUse). Nevertheless _tt_highwater is maintained so that invalidations @@ -1256,6 +1256,14 @@ static Int unredir_tt_highwater; static void init_unredir_tt_tc ( void ) { Int i; + if (unredir_tc == NULL) { + SysRes sres = VG_(am_mmap_anon_float_valgrind)( N_UNREDIR_TT * UNREDIR_SZB ); + if (sres.isError) { + VG_(out_of_memory_NORETURN)("init_unredir_tt_tc", N_UNREDIR_TT * UNREDIR_SZB); + /*NOTREACHED*/ + } + unredir_tc = (ULong *)sres.val; + } unredir_tc_used = 0; for (i = 0; i < N_UNREDIR_TT; i++) unredir_tt[i].inUse = False; -- 2.47.2