1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3<title>oscl_mem_audit_internals.h Source File</title> 4<link href="doxygen.css" rel="stylesheet" type="text/css"> 5</head><body> 6<!-- Generated by Doxygen 1.2.18 --> 7<center> 8<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9<hr><h1>oscl_mem_audit_internals.h</h1><a href="oscl__mem__audit__internals_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/* -*- c++ -*- */</span> 1000002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1100003 1200004 <span class="comment">// O S C L _ M E M _ A U D I T _ I N T E R N A L S</span> 1300005 1400006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> 1500007 1600019 <span class="preprocessor">#ifndef OSCL_MEM_AUDIT_INTERNALS_H</span> 1700020 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_MEM_AUDIT_INTERNALS_H</span> 1800021 <span class="preprocessor"></span> 1900022 2000023 <span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> 2100024 <span class="preprocessor">#include "<a class="code" href="oscl__mem__audit_8h.html">oscl_mem_audit.h</a>"</span> 2200025 <span class="preprocessor">#include "<a class="code" href="oscl__mem__inst_8h.html">oscl_mem_inst.h</a>"</span> 2300026 24<a name="l00027"></a><a class="code" href="oscl__mem__audit__internals_8h.html#a0">00027</a> <span class="preprocessor">#define OSCL_DISABLE_WARNING_TRUNCATE_DEBUG_MESSAGE</span> 2500028 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__compiler__warnings_8h.html">osclconfig_compiler_warnings.h</a>"</span> 2600029 2700030 <span class="preprocessor">#if(PVMEM_INST_LEVEL>0)</span> 2800031 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_ALLOC_NODE_SUPPORT 1</span> 2900032 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FENCE_SUPPORT 1</span> 3000033 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_INCLUDE_ALL_HEAP_VALIDATION 1</span> 3100034 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FILL_SUPPORT 1</span> 3200035 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FAILURE_SIMULATION_SUPPORT 1</span> 3300036 <span class="preprocessor"></span><span class="preprocessor">#else</span> 34<a name="l00037"></a><a class="code" href="group__osclmemory.html#a73">00037</a> <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_ALLOC_NODE_SUPPORT 1</span> 35<a name="l00038"></a><a class="code" href="group__osclmemory.html#a74">00038</a> <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FENCE_SUPPORT 0</span> 36<a name="l00039"></a><a class="code" href="group__osclmemory.html#a75">00039</a> <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_INCLUDE_ALL_HEAP_VALIDATION 1</span> 37<a name="l00040"></a><a class="code" href="group__osclmemory.html#a76">00040</a> <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FILL_SUPPORT 0</span> 38<a name="l00041"></a><a class="code" href="group__osclmemory.html#a77">00041</a> <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FAILURE_SIMULATION_SUPPORT 1</span> 3900042 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 4000043 <span class="preprocessor"></span> 41<a name="l00044"></a><a class="code" href="group__osclmemory.html#a78">00044</a> <span class="preprocessor">#define FENCE_PATTERN 0xAA</span> 42<a name="l00045"></a><a class="code" href="group__osclmemory.html#a79">00045</a> <span class="preprocessor"></span><span class="preprocessor">#define MIN_FENCE_SIZE 4</span> 4300046 <span class="preprocessor"></span> 4400047 <span class="preprocessor">#ifdef MEM_ALIGN_4</span> 4500048 <span class="preprocessor"></span><span class="preprocessor">#define MEM_ALIGN_SIZE 4</span> 4600049 <span class="preprocessor"></span><span class="preprocessor">#else</span> 47<a name="l00050"></a><a class="code" href="group__osclmemory.html#a80">00050</a> <span class="preprocessor"></span><span class="preprocessor">#define MEM_ALIGN_SIZE 8</span> 4800051 <span class="preprocessor"></span><span class="preprocessor">#endif</span> 4900052 <span class="preprocessor"></span> 5000053 5100054 5200055 <span class="comment">/* CURRENTLY THIS STRUCTURE IS A MULTIPLE OF 8 BYTES. MAKE SURE IT</span> 5300056 <span class="comment"> * MAINTAINS A SIZE THAT IS AN INTEGER MULTIPLE OF THE ALIGNMENT SIZE</span> 5400057 <span class="comment"> * FOR THE PLATFORM IN QUESTION. ADD PAD BYTES TO THE STRUCTURE</span> 5500058 <span class="comment"> * IF NECESSARY</span> 5600059 <span class="comment"> */</span> 57<a name="l00060"></a><a class="code" href="structMM__AllocBlockHdr.html">00060</a> <span class="keyword">struct </span><a class="code" href="structMM__AllocBlockHdr.html">MM_AllocBlockHdr</a> 5800061 { 59<a name="l00062"></a><a class="code" href="structMM__AllocBlockHdr.html#m0">00062</a> <span class="keywordtype">void</span> *<a class="code" href="structMM__AllocBlockHdr.html#m0">pNode</a>; <span class="comment">//pointer to either a stats node or an alloc node.</span> 60<a name="l00063"></a><a class="code" href="structMM__AllocBlockHdr.html#m1">00063</a> uint32 <a class="code" href="structMM__AllocBlockHdr.html#m1">size</a>; 6100064 62<a name="l00065"></a><a class="code" href="structMM__AllocBlockHdr.html#m2">00065</a> <span class="keywordtype">void</span> *<a class="code" href="structMM__AllocBlockHdr.html#m2">pRootNode</a>; <span class="comment">//pointer to root node, to use when de-allocating.</span> 63<a name="l00066"></a><a class="code" href="structMM__AllocBlockHdr.html#m3">00066</a> uint32 <a class="code" href="structMM__AllocBlockHdr.html#m3">pad</a>;<span class="comment">//to maintain 8-byte alignment</span> 6400067 6500068 <span class="comment">/* windows compiler assumes the the assignment</span> 6600069 <span class="comment"> * is a pure-virtual declaration and does not allow</span> 6700070 <span class="comment"> * it to be non-zero. We actually set the value below.</span> 6800071 <span class="comment"> */</span> 6900072 <span class="keyword">static</span> <span class="keyword">const</span> uint32 <a class="code" href="group__osclmemory.html#a85">ALLOC_NODE_FLAG</a>; <span class="comment">// = 0x80000000;</span> 7000073 71<a name="l00074"></a><a class="code" href="structMM__AllocBlockHdr.html#a0">00074</a> <span class="keywordtype">bool</span> <a class="code" href="structMM__AllocBlockHdr.html#a0">isAllocNodePtr</a>() 7200075 { 7300076 <span class="keywordflow">return</span> ((<a class="code" href="structMM__AllocBlockHdr.html#m1">size</a> & <a class="code" href="group__osclmemory.html#a85">ALLOC_NODE_FLAG</a>) != 0); 7400077 }; 75<a name="l00078"></a><a class="code" href="structMM__AllocBlockHdr.html#a1">00078</a> <span class="keywordtype">void</span> <a class="code" href="structMM__AllocBlockHdr.html#a1">setAllocNodeFlag</a>() 7600079 { 7700080 <a class="code" href="structMM__AllocBlockHdr.html#m1">size</a> |= <a class="code" href="group__osclmemory.html#a85">ALLOC_NODE_FLAG</a>; 7800081 }; 7900082 80<a name="l00083"></a><a class="code" href="structMM__AllocBlockHdr.html#a2">00083</a> <a class="code" href="structMM__AllocBlockHdr.html#a2">MM_AllocBlockHdr</a>(): <a class="code" href="structMM__AllocBlockHdr.html#m0">pNode</a>(0), <a class="code" href="structMM__AllocBlockHdr.html#m1">size</a>(0), <a class="code" href="structMM__AllocBlockHdr.html#m2">pRootNode</a>(0) {}; 81<a name="l00084"></a><a class="code" href="structMM__AllocBlockHdr.html#a3">00084</a> <a class="code" href="structMM__AllocBlockHdr.html#a2">MM_AllocBlockHdr</a>(<span class="keywordtype">void</span>* ptr, uint32 inSize): <a class="code" href="structMM__AllocBlockHdr.html#m0">pNode</a>(ptr), <a class="code" href="structMM__AllocBlockHdr.html#m1">size</a>(inSize) {}; 8200085 }; 8300086 8400087 <span class="comment">// actually set the value here.</span> 85<a name="l00088"></a><a class="code" href="structMM__AllocBlockHdr.html#a85">00088</a> <span class="keyword">const</span> uint32 <a class="code" href="group__osclmemory.html#a85">MM_AllocBlockHdr::ALLOC_NODE_FLAG</a> = 0x80000000; 8600089 87<a name="l00090"></a><a class="code" href="group__osclmemory.html#a81">00090</a> <span class="preprocessor">#define COMPUTE_MEM_ALIGN_SIZE(x,y,z) (y+(((x+y)%z) ? (z - (x+y)%z) : 0))</span> 8800091 <span class="preprocessor"></span> 89<a name="l00092"></a><a class="code" href="structMM__AllocBlockFence.html">00092</a> <span class="keyword">struct </span><a class="code" href="structMM__AllocBlockFence.html">MM_AllocBlockFence</a> 9000093 { 9100094 92<a name="l00095"></a><a class="code" href="structMM__AllocBlockFence.html#m0">00095</a> uint8 <a class="code" href="structMM__AllocBlockFence.html#m0">pad</a>[<a class="code" href="group__osclmemory.html#a81">COMPUTE_MEM_ALIGN_SIZE</a>(<span class="keyword">sizeof</span>(<a class="code" href="structMM__AllocBlockHdr.html">MM_AllocBlockHdr</a>), <a class="code" href="group__osclmemory.html#a79">MIN_FENCE_SIZE</a>, <a class="code" href="group__osclmemory.html#a80">MEM_ALIGN_SIZE</a>)]; 93<a name="l00096"></a><a class="code" href="structMM__AllocBlockFence.html#a0">00096</a> <a class="code" href="structMM__AllocBlockFence.html#a0">MM_AllocBlockFence</a>() 9400097 { 9500098 <a class="code" href="structMM__AllocBlockFence.html#a1">fill_fence</a>(); 9600099 }; 9700100 98<a name="l00101"></a><a class="code" href="structMM__AllocBlockFence.html#a1">00101</a> <span class="keywordtype">void</span> <a class="code" href="structMM__AllocBlockFence.html#a1">fill_fence</a>() 9900102 { 10000103 <a class="code" href="group__osclmemory.html#a14">oscl_memset</a>(<a class="code" href="structMM__AllocBlockFence.html#m0">pad</a>, <a class="code" href="group__osclmemory.html#a78">FENCE_PATTERN</a>, <span class="keyword">sizeof</span>(<a class="code" href="structMM__AllocBlockFence.html#m0">pad</a>)); 10100104 }; 10200105 103<a name="l00106"></a><a class="code" href="structMM__AllocBlockFence.html#a2">00106</a> <span class="keywordtype">bool</span> <a class="code" href="structMM__AllocBlockFence.html#a2">check_fence</a>() 10400107 { 10500108 <span class="keywordflow">for</span> (<a class="code" href="group__osclbase.html#a27">uint</a> ii = 0; ii < <span class="keyword">sizeof</span>(pad); ++ii) 10600109 { 10700110 <span class="keywordflow">if</span> (<a class="code" href="structMM__AllocBlockFence.html#m0">pad</a>[ii] != <a class="code" href="group__osclmemory.html#a78">FENCE_PATTERN</a>) <span class="keywordflow">return</span> <span class="keyword">false</span>; 10800111 } 10900112 <span class="keywordflow">return</span> <span class="keyword">true</span>; 11000113 }; 11100114 }; 11200115 11300116 11400117 11500118 116<a name="l00119"></a><a class="code" href="group__osclmemory.html#a82">00119</a> <span class="preprocessor">#define DEFAULT_PREFILL_PATTERN 0x96</span> 117<a name="l00120"></a><a class="code" href="group__osclmemory.html#a83">00120</a> <span class="preprocessor"></span><span class="preprocessor">#define DEFAULT_POSTFILL_PATTERN 0x5A</span> 11800121 <span class="preprocessor"></span> 11900122 12000123 12100124 12200125 12300126 <span class="preprocessor">#endif</span> 12400127 <span class="preprocessor"></span> 125</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 126<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 127</small></address> 128</body> 129</html> 130