njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 3 | /*--- Declarations shared between MemCheck and AddrCheck. ---*/ |
| 4 | /*--- mac_shared.h ---*/ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 5 | /*--------------------------------------------------------------------*/ |
| 6 | |
| 7 | /* |
nethercote | 137bc55 | 2003-11-14 17:47:54 +0000 | [diff] [blame] | 8 | This file is part of MemCheck, a heavyweight Valgrind tool for |
| 9 | detecting memory errors, and AddrCheck, a lightweight Valgrind tool |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 10 | for detecting memory errors. |
| 11 | |
njn | 5361242 | 2005-03-12 16:22:54 +0000 | [diff] [blame] | 12 | Copyright (C) 2000-2005 Julian Seward |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 13 | jseward@acm.org |
| 14 | |
| 15 | This program is free software; you can redistribute it and/or |
| 16 | modify it under the terms of the GNU General Public License as |
| 17 | published by the Free Software Foundation; either version 2 of the |
| 18 | License, or (at your option) any later version. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, but |
| 21 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | General Public License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with this program; if not, write to the Free Software |
| 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 28 | 02111-1307, USA. |
| 29 | |
| 30 | The GNU General Public License is contained in the file COPYING. |
| 31 | */ |
| 32 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 33 | /* Note: This header contains the declarations shared between |
| 34 | Addrcheck and Memcheck, and is #included by both. */ |
| 35 | |
| 36 | #ifndef __MAC_SHARED_H |
| 37 | #define __MAC_SHARED_H |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 38 | |
nethercote | 4606320 | 2004-09-02 08:51:43 +0000 | [diff] [blame] | 39 | #include "tool.h" |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 40 | |
| 41 | #define MAC_(str) VGAPPEND(vgMAC_,str) |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 42 | |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 43 | /*------------------------------------------------------------*/ |
| 44 | /*--- Errors and suppressions ---*/ |
| 45 | /*------------------------------------------------------------*/ |
| 46 | |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 47 | /* The classification of a faulting address. */ |
| 48 | typedef |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 49 | enum { |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 50 | Undescribed, // as-yet unclassified |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 51 | Stack, |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 52 | Unknown, // classification yielded nothing useful |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 53 | Freed, Mallocd, |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 54 | UserG, // in a user-defined block |
| 55 | Mempool, // in a mempool |
| 56 | Register, // in a register; for Param errors only |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 57 | } |
| 58 | AddrKind; |
| 59 | |
| 60 | /* Records info about a faulting address. */ |
| 61 | typedef |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 62 | struct { // Used by: |
| 63 | AddrKind akind; // ALL |
nethercote | 928a5f7 | 2004-11-03 18:10:37 +0000 | [diff] [blame] | 64 | SizeT blksize; // Freed, Mallocd |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 65 | OffT rwoffset; // Freed, Mallocd |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 66 | ExeContext* lastchange; // Freed, Mallocd |
| 67 | ThreadId stack_tid; // Stack |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 68 | const Char *desc; // UserG |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 69 | Bool maybe_gcc; // True if just below %esp -- could be a gcc bug. |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 70 | } |
| 71 | AddrInfo; |
| 72 | |
| 73 | typedef |
| 74 | enum { |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 75 | ParamSupp, // Bad syscall params |
| 76 | CoreMemSupp, // Memory errors in core (pthread ops, signal handling) |
| 77 | |
| 78 | // Use of invalid values of given size (MemCheck only) |
njn | c061666 | 2003-06-12 09:58:41 +0000 | [diff] [blame] | 79 | Value0Supp, Value1Supp, Value2Supp, Value4Supp, Value8Supp, Value16Supp, |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 80 | |
| 81 | // Invalid read/write attempt at given size |
njn | c061666 | 2003-06-12 09:58:41 +0000 | [diff] [blame] | 82 | Addr1Supp, Addr2Supp, Addr4Supp, Addr8Supp, Addr16Supp, |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 83 | |
| 84 | FreeSupp, // Invalid or mismatching free |
| 85 | OverlapSupp, // Overlapping blocks in memcpy(), strcpy(), etc |
| 86 | LeakSupp, // Something to be suppressed in a leak check. |
| 87 | MempoolSupp, // Memory pool suppression. |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 88 | } |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 89 | MAC_SuppKind; |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 90 | |
| 91 | /* What kind of error it is. */ |
| 92 | typedef |
| 93 | enum { ValueErr, /* Memcheck only */ |
| 94 | CoreMemErr, |
| 95 | AddrErr, |
| 96 | ParamErr, UserErr, /* behaves like an anonymous ParamErr */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 97 | FreeErr, FreeMismatchErr, |
njn | 7201b2a | 2003-08-19 12:16:05 +0000 | [diff] [blame] | 98 | OverlapErr, |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 99 | LeakErr, |
| 100 | IllegalMempoolErr, |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 101 | } |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 102 | MAC_ErrorKind; |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 103 | |
| 104 | /* What kind of memory access is involved in the error? */ |
| 105 | typedef |
| 106 | enum { ReadAxs, WriteAxs, ExecAxs } |
| 107 | AxsKind; |
| 108 | |
| 109 | /* Extra context for memory errors */ |
| 110 | typedef |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 111 | struct { // Used by: |
| 112 | AxsKind axskind; // AddrErr |
| 113 | Int size; // AddrErr, ValueErr |
| 114 | AddrInfo addrinfo; // {Addr,Free,FreeMismatch,Param,User}Err |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 115 | Bool isUnaddr; // {CoreMem,Param,User}Err |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 116 | } |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 117 | MAC_Error; |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 118 | |
njn | b6cae9f | 2003-09-04 20:50:47 +0000 | [diff] [blame] | 119 | /* Extra info for overlap errors */ |
| 120 | typedef |
| 121 | struct { |
| 122 | Addr src; |
| 123 | Addr dst; |
| 124 | Int len; // -1 if unused |
| 125 | } |
| 126 | OverlapExtra; |
| 127 | |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 128 | /* For malloc()/new/new[] vs. free()/delete/delete[] mismatch checking. */ |
| 129 | typedef |
| 130 | enum { |
| 131 | MAC_AllocMalloc = 0, |
| 132 | MAC_AllocNew = 1, |
njn | 1078545 | 2003-05-20 16:38:24 +0000 | [diff] [blame] | 133 | MAC_AllocNewVec = 2, |
| 134 | MAC_AllocCustom = 3 |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 135 | } |
| 136 | MAC_AllocKind; |
| 137 | |
| 138 | /* Nb: first two fields must match core's VgHashNode. */ |
| 139 | typedef |
| 140 | struct _MAC_Chunk { |
| 141 | struct _MAC_Chunk* next; |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 142 | Addr data; // ptr to actual block |
njn | b729e0d | 2004-12-01 00:19:38 +0000 | [diff] [blame] | 143 | SizeT size : (sizeof(UWord)*8)-2; // size requested; 30 or 62 bits |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 144 | MAC_AllocKind allockind : 2; // which wrapper did the allocation |
| 145 | ExeContext* where; // where it was allocated |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 146 | } |
| 147 | MAC_Chunk; |
| 148 | |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 149 | /* Memory pool. Nb: first two fields must match core's VgHashNode. */ |
| 150 | typedef |
| 151 | struct _MAC_Mempool { |
| 152 | struct _MAC_Mempool* next; |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 153 | Addr pool; // pool identifier |
njn | b729e0d | 2004-12-01 00:19:38 +0000 | [diff] [blame] | 154 | SizeT rzB; // pool red-zone size |
nethercote | 05675c8 | 2004-08-04 10:37:49 +0000 | [diff] [blame] | 155 | Bool is_zeroed; // allocations from this pool are zeroed |
| 156 | VgHashTable chunks; // chunks associated with this pool |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 157 | } |
| 158 | MAC_Mempool; |
| 159 | |
| 160 | |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 161 | /*------------------------------------------------------------*/ |
nethercote | 7cc9c23 | 2004-01-21 15:08:04 +0000 | [diff] [blame] | 162 | /*--- Profiling of tools and memory events ---*/ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 163 | /*------------------------------------------------------------*/ |
| 164 | |
| 165 | typedef |
| 166 | enum { |
| 167 | VgpCheckMem = VgpFini+1, |
| 168 | VgpSetMem, |
| 169 | VgpESPAdj |
| 170 | } |
nethercote | 7cc9c23 | 2004-01-21 15:08:04 +0000 | [diff] [blame] | 171 | VgpToolCC; |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 172 | |
| 173 | /* Define to collect detailed performance info. */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 174 | /* #define MAC_PROFILE_MEMORY */ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 175 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 176 | #ifdef MAC_PROFILE_MEMORY |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 177 | # define N_PROF_EVENTS 150 |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 178 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 179 | extern UInt MAC_(event_ctr)[N_PROF_EVENTS]; |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 180 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 181 | # define PROF_EVENT(ev) \ |
njn | ca82cc0 | 2004-11-22 17:18:48 +0000 | [diff] [blame] | 182 | do { tl_assert((ev) >= 0 && (ev) < N_PROF_EVENTS); \ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 183 | MAC_(event_ctr)[ev]++; \ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 184 | } while (False); |
| 185 | |
| 186 | #else |
| 187 | |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 188 | # define PROF_EVENT(ev) /* */ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 189 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 190 | #endif /* MAC_PROFILE_MEMORY */ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 191 | |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 192 | /*------------------------------------------------------------*/ |
| 193 | /*--- V and A bits ---*/ |
| 194 | /*------------------------------------------------------------*/ |
| 195 | |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 196 | /* expand 1 bit -> 8 */ |
| 197 | #define BIT_EXPAND(b) ((~(((UChar)(b) & 1) - 1)) & 0xFF) |
| 198 | |
| 199 | #define SECONDARY_SHIFT 16 |
| 200 | #define SECONDARY_SIZE (1 << SECONDARY_SHIFT) |
| 201 | #define SECONDARY_MASK (SECONDARY_SIZE - 1) |
| 202 | |
| 203 | #define PRIMARY_SIZE (1 << (32 - SECONDARY_SHIFT)) |
| 204 | |
| 205 | #define SM_OFF(addr) ((addr) & SECONDARY_MASK) |
| 206 | #define PM_IDX(addr) ((addr) >> SECONDARY_SHIFT) |
| 207 | |
| 208 | #define IS_DISTINGUISHED_SM(smap) \ |
| 209 | ((smap) >= &distinguished_secondary_maps[0] && \ |
| 210 | (smap) < &distinguished_secondary_maps[N_SECONDARY_MAPS]) |
| 211 | |
| 212 | #define IS_DISTINGUISHED(addr) (IS_DISTINGUISHED_SM(primary_map[PM_IDX(addr)])) |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 213 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 214 | #define ENSURE_MAPPABLE(addr,caller) \ |
| 215 | do { \ |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 216 | if (IS_DISTINGUISHED(addr)) { \ |
| 217 | primary_map[PM_IDX(addr)] = alloc_secondary_map(caller, primary_map[PM_IDX(addr)]); \ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 218 | /* VG_(printf)("new 2map because of %p\n", addr); */ \ |
| 219 | } \ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 220 | } while(0) |
| 221 | |
| 222 | #define BITARR_SET(aaa_p,iii_p) \ |
| 223 | do { \ |
| 224 | UInt iii = (UInt)iii_p; \ |
| 225 | UChar* aaa = (UChar*)aaa_p; \ |
| 226 | aaa[iii >> 3] |= (1 << (iii & 7)); \ |
| 227 | } while (0) |
| 228 | |
| 229 | #define BITARR_CLEAR(aaa_p,iii_p) \ |
| 230 | do { \ |
| 231 | UInt iii = (UInt)iii_p; \ |
| 232 | UChar* aaa = (UChar*)aaa_p; \ |
| 233 | aaa[iii >> 3] &= ~(1 << (iii & 7)); \ |
| 234 | } while (0) |
| 235 | |
| 236 | #define BITARR_TEST(aaa_p,iii_p) \ |
| 237 | (0 != (((UChar*)aaa_p)[ ((UInt)iii_p) >> 3 ] \ |
| 238 | & (1 << (((UInt)iii_p) & 7)))) \ |
| 239 | |
| 240 | |
| 241 | #define VGM_BIT_VALID 0 |
| 242 | #define VGM_BIT_INVALID 1 |
| 243 | |
| 244 | #define VGM_NIBBLE_VALID 0 |
| 245 | #define VGM_NIBBLE_INVALID 0xF |
| 246 | |
| 247 | #define VGM_BYTE_VALID 0 |
| 248 | #define VGM_BYTE_INVALID 0xFF |
| 249 | |
| 250 | #define VGM_WORD_VALID 0 |
| 251 | #define VGM_WORD_INVALID 0xFFFFFFFF |
| 252 | |
sewardj | 9544807 | 2004-11-22 20:19:51 +0000 | [diff] [blame] | 253 | #define VGM_WORD64_VALID 0x0ULL |
| 254 | #define VGM_WORD64_INVALID 0xFFFFFFFFFFFFFFFFULL |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 255 | |
| 256 | /*------------------------------------------------------------*/ |
| 257 | /*--- Command line options + defaults ---*/ |
| 258 | /*------------------------------------------------------------*/ |
| 259 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 260 | /* Memcheck defines a couple more. */ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 261 | |
| 262 | /* Allow loads from partially-valid addresses? default: YES */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 263 | extern Bool MAC_(clo_partial_loads_ok); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 264 | |
| 265 | /* Max volume of the freed blocks queue. */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 266 | extern Int MAC_(clo_freelist_vol); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 267 | |
| 268 | /* Do leak check at exit? default: NO */ |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 269 | typedef |
| 270 | enum { |
| 271 | LC_Off, |
| 272 | LC_Summary, |
| 273 | LC_Full, |
| 274 | } |
| 275 | LeakCheckMode; |
| 276 | |
| 277 | extern LeakCheckMode MAC_(clo_leak_check); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 278 | |
| 279 | /* How closely should we compare ExeContexts in leak records? default: 2 */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 280 | extern VgRes MAC_(clo_leak_resolution); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 281 | |
| 282 | /* In leak check, show reachable-but-not-freed blocks? default: NO */ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 283 | extern Bool MAC_(clo_show_reachable); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 284 | |
| 285 | /* Assume accesses immediately below %esp are due to gcc-2.96 bugs. |
| 286 | * default: NO*/ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 287 | extern Bool MAC_(clo_workaround_gcc296_bugs); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 288 | |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 289 | extern Bool MAC_(process_common_cmd_line_option) ( Char* arg ); |
| 290 | extern void MAC_(print_common_usage) ( void ); |
| 291 | extern void MAC_(print_common_debug_usage) ( void ); |
| 292 | |
| 293 | |
| 294 | /*------------------------------------------------------------*/ |
| 295 | /*--- Variables ---*/ |
| 296 | /*------------------------------------------------------------*/ |
| 297 | |
| 298 | /* For tracking malloc'd blocks */ |
| 299 | extern VgHashTable MAC_(malloc_list); |
| 300 | |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 301 | /* For tracking memory pools. */ |
| 302 | extern VgHashTable MAC_(mempool_list); |
| 303 | |
nethercote | 7cc9c23 | 2004-01-21 15:08:04 +0000 | [diff] [blame] | 304 | /* Function pointers for the two tools to track interesting events. */ |
nethercote | 451eae9 | 2004-11-02 13:06:32 +0000 | [diff] [blame] | 305 | extern void (*MAC_(new_mem_heap)) ( Addr a, SizeT len, Bool is_inited ); |
| 306 | extern void (*MAC_(ban_mem_heap)) ( Addr a, SizeT len ); |
| 307 | extern void (*MAC_(die_mem_heap)) ( Addr a, SizeT len ); |
| 308 | extern void (*MAC_(copy_mem_heap))( Addr from, Addr to, SizeT len ); |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 309 | |
sewardj | ecf8e10 | 2003-07-12 12:11:39 +0000 | [diff] [blame] | 310 | /* Function pointers for internal sanity checking. */ |
nethercote | 451eae9 | 2004-11-02 13:06:32 +0000 | [diff] [blame] | 311 | extern Bool (*MAC_(check_noaccess))( Addr a, SizeT len, Addr* bad_addr ); |
sewardj | ecf8e10 | 2003-07-12 12:11:39 +0000 | [diff] [blame] | 312 | |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 313 | /* Used in describe_addr() */ |
| 314 | extern Bool (*MAC_(describe_addr_supp)) ( Addr a, AddrInfo* ai ); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 315 | |
njn | 47363ab | 2003-04-21 13:24:40 +0000 | [diff] [blame] | 316 | /* For VALGRIND_COUNT_LEAKS client request */ |
njn | e8b5c05 | 2003-07-22 22:03:58 +0000 | [diff] [blame] | 317 | extern Int MAC_(bytes_leaked); |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 318 | extern Int MAC_(bytes_indirect); |
njn | e8b5c05 | 2003-07-22 22:03:58 +0000 | [diff] [blame] | 319 | extern Int MAC_(bytes_dubious); |
| 320 | extern Int MAC_(bytes_reachable); |
| 321 | extern Int MAC_(bytes_suppressed); |
sewardj | 99aac97 | 2002-12-26 01:53:45 +0000 | [diff] [blame] | 322 | |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 323 | /*------------------------------------------------------------*/ |
| 324 | /*--- Functions ---*/ |
| 325 | /*------------------------------------------------------------*/ |
| 326 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 327 | extern void MAC_(pp_AddrInfo) ( Addr a, AddrInfo* ai ); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 328 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 329 | extern void MAC_(clear_MAC_Error) ( MAC_Error* err_extra ); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 330 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 331 | extern Bool MAC_(shared_recognised_suppression) ( Char* name, Supp* su ); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 332 | |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 333 | extern void* MAC_(new_block) ( ThreadId tid, |
| 334 | Addr p, SizeT size, SizeT align, UInt rzB, |
nethercote | 57e36b3 | 2004-07-10 14:56:28 +0000 | [diff] [blame] | 335 | Bool is_zeroed, MAC_AllocKind kind, |
| 336 | VgHashTable table); |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 337 | |
| 338 | extern void MAC_(handle_free) ( ThreadId tid, |
| 339 | Addr p, UInt rzB, MAC_AllocKind kind ); |
njn | 1078545 | 2003-05-20 16:38:24 +0000 | [diff] [blame] | 340 | |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 341 | extern void MAC_(create_mempool)(Addr pool, UInt rzB, Bool is_zeroed); |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 342 | |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 343 | extern void MAC_(destroy_mempool)(Addr pool); |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 344 | |
| 345 | extern void MAC_(mempool_alloc)(ThreadId tid, |
| 346 | Addr pool, Addr addr, SizeT size); |
| 347 | |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 348 | extern void MAC_(mempool_free)(Addr pool, Addr addr); |
| 349 | |
njn | 7271864 | 2003-07-24 08:45:32 +0000 | [diff] [blame] | 350 | extern void MAC_(record_address_error) ( ThreadId tid, Addr a, |
sewardj | af48a60 | 2003-07-06 00:54:47 +0000 | [diff] [blame] | 351 | Int size, Bool isWrite ); |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 352 | extern void MAC_(record_core_mem_error) ( ThreadId tid, Bool isUnaddr, |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 353 | Char* s ); |
nethercote | 8b76fe5 | 2004-11-08 19:20:09 +0000 | [diff] [blame] | 354 | extern void MAC_(record_param_error) ( ThreadId tid, Addr a, Bool isReg, |
| 355 | Bool isUnaddr, Char* msg ); |
njn | 7271864 | 2003-07-24 08:45:32 +0000 | [diff] [blame] | 356 | extern void MAC_(record_jump_error) ( ThreadId tid, Addr a ); |
| 357 | extern void MAC_(record_free_error) ( ThreadId tid, Addr a ); |
| 358 | extern void MAC_(record_freemismatch_error)( ThreadId tid, Addr a ); |
sewardj | 2a99cf6 | 2004-11-24 10:44:19 +0000 | [diff] [blame] | 359 | extern void MAC_(record_overlap_error) ( ThreadId tid, |
| 360 | Char* function, OverlapExtra* oe ); |
rjwalsh | bc0bb83 | 2004-06-19 18:12:36 +0000 | [diff] [blame] | 361 | extern void MAC_(record_illegal_mempool_error) ( ThreadId tid, Addr pool ); |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 362 | |
njn | b126f73 | 2004-11-22 17:57:07 +0000 | [diff] [blame] | 363 | extern void MAC_(pp_shared_Error) ( Error* err); |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 364 | |
thughes | 4ad52d0 | 2004-06-27 17:37:21 +0000 | [diff] [blame] | 365 | extern MAC_Chunk* MAC_(first_matching_freed_MAC_Chunk)( Bool (*p)(MAC_Chunk*, void*), void* d ); |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 366 | |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 367 | extern void MAC_(common_pre_clo_init) ( void ); |
njn | b8dca86 | 2005-03-14 02:42:44 +0000 | [diff] [blame^] | 368 | extern void MAC_(common_fini) ( void (*leak_check)(ThreadId tid, |
| 369 | LeakCheckMode mode) ); |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 370 | |
njn | 7271864 | 2003-07-24 08:45:32 +0000 | [diff] [blame] | 371 | extern Bool MAC_(handle_common_client_requests) ( ThreadId tid, |
nethercote | d1b64b2 | 2004-11-04 18:22:28 +0000 | [diff] [blame] | 372 | UWord* arg_block, UWord* ret ); |
njn | 47363ab | 2003-04-21 13:24:40 +0000 | [diff] [blame] | 373 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 374 | /* For leak checking */ |
| 375 | extern void MAC_(pp_LeakError)(void* vl, UInt n_this_record, |
| 376 | UInt n_total_records); |
| 377 | |
njn | 86f12dc | 2005-03-14 01:16:05 +0000 | [diff] [blame] | 378 | extern void MAC_(print_malloc_stats) ( void ); |
| 379 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 380 | extern void MAC_(do_detect_memory_leaks) ( |
njn | b8dca86 | 2005-03-14 02:42:44 +0000 | [diff] [blame^] | 381 | ThreadId tid, LeakCheckMode mode, |
sewardj | b5f6f51 | 2005-03-10 23:59:00 +0000 | [diff] [blame] | 382 | Bool (*is_valid_64k_chunk) ( UInt ), |
| 383 | Bool (*is_valid_address) ( Addr ) |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 384 | ); |
| 385 | |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 386 | extern REGPARM(1) void MAC_(new_mem_stack_4) ( Addr old_ESP ); |
| 387 | extern REGPARM(1) void MAC_(die_mem_stack_4) ( Addr old_ESP ); |
| 388 | extern REGPARM(1) void MAC_(new_mem_stack_8) ( Addr old_ESP ); |
| 389 | extern REGPARM(1) void MAC_(die_mem_stack_8) ( Addr old_ESP ); |
| 390 | extern REGPARM(1) void MAC_(new_mem_stack_12) ( Addr old_ESP ); |
| 391 | extern REGPARM(1) void MAC_(die_mem_stack_12) ( Addr old_ESP ); |
| 392 | extern REGPARM(1) void MAC_(new_mem_stack_16) ( Addr old_ESP ); |
| 393 | extern REGPARM(1) void MAC_(die_mem_stack_16) ( Addr old_ESP ); |
| 394 | extern REGPARM(1) void MAC_(new_mem_stack_32) ( Addr old_ESP ); |
| 395 | extern REGPARM(1) void MAC_(die_mem_stack_32) ( Addr old_ESP ); |
nethercote | 451eae9 | 2004-11-02 13:06:32 +0000 | [diff] [blame] | 396 | extern void MAC_(die_mem_stack) ( Addr a, SizeT len); |
| 397 | extern void MAC_(new_mem_stack) ( Addr a, SizeT len); |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 398 | |
| 399 | |
| 400 | /*------------------------------------------------------------*/ |
| 401 | /*--- Stack pointer adjustment ---*/ |
| 402 | /*------------------------------------------------------------*/ |
| 403 | |
| 404 | /* Some noble preprocessor abuse, to enable Memcheck and Addrcheck to |
njn | 3e88418 | 2003-04-15 13:03:23 +0000 | [diff] [blame] | 405 | share this code, but call different functions. |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 406 | |
| 407 | Note that this code is executed very frequently and must be highly |
| 408 | optimised, which is why I resort to the preprocessor to achieve the |
| 409 | factoring, rather than eg. using function pointers. |
| 410 | */ |
| 411 | |
| 412 | #define ESP_UPDATE_HANDLERS(ALIGNED4_NEW, ALIGNED4_DIE, \ |
| 413 | ALIGNED8_NEW, ALIGNED8_DIE, \ |
| 414 | UNALIGNED_NEW, UNALIGNED_DIE) \ |
| 415 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 416 | void REGPARM(1) MAC_(new_mem_stack_4)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 417 | { \ |
| 418 | PROF_EVENT(110); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 419 | if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 420 | ALIGNED4_NEW ( new_ESP ); \ |
| 421 | } else { \ |
| 422 | UNALIGNED_NEW ( new_ESP, 4 ); \ |
| 423 | } \ |
| 424 | } \ |
| 425 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 426 | void REGPARM(1) MAC_(die_mem_stack_4)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 427 | { \ |
| 428 | PROF_EVENT(120); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 429 | if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 430 | ALIGNED4_DIE ( new_ESP-4 ); \ |
| 431 | } else { \ |
| 432 | UNALIGNED_DIE ( new_ESP-4, 4 ); \ |
| 433 | } \ |
| 434 | } \ |
| 435 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 436 | void REGPARM(1) MAC_(new_mem_stack_8)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 437 | { \ |
| 438 | PROF_EVENT(111); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 439 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 440 | ALIGNED8_NEW ( new_ESP ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 441 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 442 | ALIGNED4_NEW ( new_ESP ); \ |
| 443 | ALIGNED4_NEW ( new_ESP+4 ); \ |
| 444 | } else { \ |
| 445 | UNALIGNED_NEW ( new_ESP, 8 ); \ |
| 446 | } \ |
| 447 | } \ |
| 448 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 449 | void REGPARM(1) MAC_(die_mem_stack_8)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 450 | { \ |
| 451 | PROF_EVENT(121); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 452 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 453 | ALIGNED8_DIE ( new_ESP-8 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 454 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 455 | ALIGNED4_DIE ( new_ESP-8 ); \ |
| 456 | ALIGNED4_DIE ( new_ESP-4 ); \ |
| 457 | } else { \ |
| 458 | UNALIGNED_DIE ( new_ESP-8, 8 ); \ |
| 459 | } \ |
| 460 | } \ |
| 461 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 462 | void REGPARM(1) MAC_(new_mem_stack_12)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 463 | { \ |
| 464 | PROF_EVENT(112); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 465 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 466 | ALIGNED8_NEW ( new_ESP ); \ |
| 467 | ALIGNED4_NEW ( new_ESP+8 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 468 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 469 | ALIGNED4_NEW ( new_ESP ); \ |
| 470 | ALIGNED8_NEW ( new_ESP+4 ); \ |
| 471 | } else { \ |
| 472 | UNALIGNED_NEW ( new_ESP, 12 ); \ |
| 473 | } \ |
| 474 | } \ |
| 475 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 476 | void REGPARM(1) MAC_(die_mem_stack_12)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 477 | { \ |
| 478 | PROF_EVENT(122); \ |
| 479 | /* Note the -12 in the test */ \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 480 | if (IS_8_ALIGNED(new_ESP-12)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 481 | ALIGNED8_DIE ( new_ESP-12 ); \ |
| 482 | ALIGNED4_DIE ( new_ESP-4 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 483 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 484 | ALIGNED4_DIE ( new_ESP-12 ); \ |
| 485 | ALIGNED8_DIE ( new_ESP-8 ); \ |
| 486 | } else { \ |
| 487 | UNALIGNED_DIE ( new_ESP-12, 12 ); \ |
| 488 | } \ |
| 489 | } \ |
| 490 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 491 | void REGPARM(1) MAC_(new_mem_stack_16)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 492 | { \ |
| 493 | PROF_EVENT(113); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 494 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 495 | ALIGNED8_NEW ( new_ESP ); \ |
| 496 | ALIGNED8_NEW ( new_ESP+8 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 497 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 498 | ALIGNED4_NEW ( new_ESP ); \ |
| 499 | ALIGNED8_NEW ( new_ESP+4 ); \ |
| 500 | ALIGNED4_NEW ( new_ESP+12 ); \ |
| 501 | } else { \ |
| 502 | UNALIGNED_NEW ( new_ESP, 16 ); \ |
| 503 | } \ |
| 504 | } \ |
| 505 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 506 | void REGPARM(1) MAC_(die_mem_stack_16)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 507 | { \ |
| 508 | PROF_EVENT(123); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 509 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 510 | ALIGNED8_DIE ( new_ESP-16 ); \ |
| 511 | ALIGNED8_DIE ( new_ESP-8 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 512 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 513 | ALIGNED4_DIE ( new_ESP-16 ); \ |
| 514 | ALIGNED8_DIE ( new_ESP-12 ); \ |
| 515 | ALIGNED4_DIE ( new_ESP-4 ); \ |
| 516 | } else { \ |
| 517 | UNALIGNED_DIE ( new_ESP-16, 16 ); \ |
| 518 | } \ |
| 519 | } \ |
| 520 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 521 | void REGPARM(1) MAC_(new_mem_stack_32)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 522 | { \ |
| 523 | PROF_EVENT(114); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 524 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 525 | ALIGNED8_NEW ( new_ESP ); \ |
| 526 | ALIGNED8_NEW ( new_ESP+8 ); \ |
| 527 | ALIGNED8_NEW ( new_ESP+16 ); \ |
| 528 | ALIGNED8_NEW ( new_ESP+24 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 529 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 530 | ALIGNED4_NEW ( new_ESP ); \ |
| 531 | ALIGNED8_NEW ( new_ESP+4 ); \ |
| 532 | ALIGNED8_NEW ( new_ESP+12 ); \ |
| 533 | ALIGNED8_NEW ( new_ESP+20 ); \ |
| 534 | ALIGNED4_NEW ( new_ESP+28 ); \ |
| 535 | } else { \ |
| 536 | UNALIGNED_NEW ( new_ESP, 32 ); \ |
| 537 | } \ |
| 538 | } \ |
| 539 | \ |
nethercote | eec4630 | 2004-08-23 15:06:23 +0000 | [diff] [blame] | 540 | void REGPARM(1) MAC_(die_mem_stack_32)(Addr new_ESP) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 541 | { \ |
| 542 | PROF_EVENT(124); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 543 | if (IS_8_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 544 | ALIGNED8_DIE ( new_ESP-32 ); \ |
| 545 | ALIGNED8_DIE ( new_ESP-24 ); \ |
| 546 | ALIGNED8_DIE ( new_ESP-16 ); \ |
| 547 | ALIGNED8_DIE ( new_ESP- 8 ); \ |
njn | edfa0f6 | 2004-11-30 18:08:05 +0000 | [diff] [blame] | 548 | } else if (IS_4_ALIGNED(new_ESP)) { \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 549 | ALIGNED4_DIE ( new_ESP-32 ); \ |
| 550 | ALIGNED8_DIE ( new_ESP-28 ); \ |
| 551 | ALIGNED8_DIE ( new_ESP-20 ); \ |
| 552 | ALIGNED8_DIE ( new_ESP-12 ); \ |
| 553 | ALIGNED4_DIE ( new_ESP-4 ); \ |
| 554 | } else { \ |
| 555 | UNALIGNED_DIE ( new_ESP-32, 32 ); \ |
| 556 | } \ |
| 557 | } \ |
| 558 | \ |
nethercote | 451eae9 | 2004-11-02 13:06:32 +0000 | [diff] [blame] | 559 | void MAC_(new_mem_stack) ( Addr a, SizeT len ) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 560 | { \ |
| 561 | PROF_EVENT(115); \ |
| 562 | UNALIGNED_NEW ( a, len ); \ |
| 563 | } \ |
| 564 | \ |
nethercote | 451eae9 | 2004-11-02 13:06:32 +0000 | [diff] [blame] | 565 | void MAC_(die_mem_stack) ( Addr a, SizeT len ) \ |
njn | 9b007f6 | 2003-04-07 14:40:25 +0000 | [diff] [blame] | 566 | { \ |
| 567 | PROF_EVENT(125); \ |
| 568 | UNALIGNED_DIE ( a, len ); \ |
| 569 | } |
| 570 | |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 571 | #endif /* __MAC_SHARED_H */ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 572 | |
| 573 | /*--------------------------------------------------------------------*/ |
njn | 43c799e | 2003-04-08 00:08:52 +0000 | [diff] [blame] | 574 | /*--- end mac_shared.h ---*/ |
njn | 5c004e4 | 2002-11-18 11:04:50 +0000 | [diff] [blame] | 575 | /*--------------------------------------------------------------------*/ |