| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> |
| <title>oscl_mem_audit_internals.h Source File</title> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"> |
| </head><body> |
| <!-- Generated by Doxygen 1.2.18 --> |
| <center> |
| <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> |
| <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> |
| 00002 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> |
| 00003 |
| 00004 <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> |
| 00005 |
| 00006 <span class="comment">// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =</span> |
| 00007 |
| 00019 <span class="preprocessor">#ifndef OSCL_MEM_AUDIT_INTERNALS_H</span> |
| 00020 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_MEM_AUDIT_INTERNALS_H</span> |
| 00021 <span class="preprocessor"></span> |
| 00022 |
| 00023 <span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span> |
| 00024 <span class="preprocessor">#include "<a class="code" href="oscl__mem__audit_8h.html">oscl_mem_audit.h</a>"</span> |
| 00025 <span class="preprocessor">#include "<a class="code" href="oscl__mem__inst_8h.html">oscl_mem_inst.h</a>"</span> |
| 00026 |
| <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> |
| 00028 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__compiler__warnings_8h.html">osclconfig_compiler_warnings.h</a>"</span> |
| 00029 |
| 00030 <span class="preprocessor">#if(PVMEM_INST_LEVEL>0)</span> |
| 00031 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_ALLOC_NODE_SUPPORT 1</span> |
| 00032 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FENCE_SUPPORT 1</span> |
| 00033 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_INCLUDE_ALL_HEAP_VALIDATION 1</span> |
| 00034 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FILL_SUPPORT 1</span> |
| 00035 <span class="preprocessor"></span><span class="preprocessor">#define MM_AUDIT_FAILURE_SIMULATION_SUPPORT 1</span> |
| 00036 <span class="preprocessor"></span><span class="preprocessor">#else</span> |
| <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> |
| <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> |
| <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> |
| <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> |
| <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> |
| 00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
| 00043 <span class="preprocessor"></span> |
| <a name="l00044"></a><a class="code" href="group__osclmemory.html#a78">00044</a> <span class="preprocessor">#define FENCE_PATTERN 0xAA</span> |
| <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> |
| 00046 <span class="preprocessor"></span> |
| 00047 <span class="preprocessor">#ifdef MEM_ALIGN_4</span> |
| 00048 <span class="preprocessor"></span><span class="preprocessor">#define MEM_ALIGN_SIZE 4</span> |
| 00049 <span class="preprocessor"></span><span class="preprocessor">#else</span> |
| <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> |
| 00051 <span class="preprocessor"></span><span class="preprocessor">#endif</span> |
| 00052 <span class="preprocessor"></span> |
| 00053 |
| 00054 |
| 00055 <span class="comment">/* CURRENTLY THIS STRUCTURE IS A MULTIPLE OF 8 BYTES. MAKE SURE IT</span> |
| 00056 <span class="comment"> * MAINTAINS A SIZE THAT IS AN INTEGER MULTIPLE OF THE ALIGNMENT SIZE</span> |
| 00057 <span class="comment"> * FOR THE PLATFORM IN QUESTION. ADD PAD BYTES TO THE STRUCTURE</span> |
| 00058 <span class="comment"> * IF NECESSARY</span> |
| 00059 <span class="comment"> */</span> |
| <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> |
| 00061 { |
| <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> |
| <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>; |
| 00064 |
| <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> |
| <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> |
| 00067 |
| 00068 <span class="comment">/* windows compiler assumes the the assignment</span> |
| 00069 <span class="comment"> * is a pure-virtual declaration and does not allow</span> |
| 00070 <span class="comment"> * it to be non-zero. We actually set the value below.</span> |
| 00071 <span class="comment"> */</span> |
| 00072 <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> |
| 00073 |
| <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>() |
| 00075 { |
| 00076 <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); |
| 00077 }; |
| <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>() |
| 00079 { |
| 00080 <a class="code" href="structMM__AllocBlockHdr.html#m1">size</a> |= <a class="code" href="group__osclmemory.html#a85">ALLOC_NODE_FLAG</a>; |
| 00081 }; |
| 00082 |
| <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) {}; |
| <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) {}; |
| 00085 }; |
| 00086 |
| 00087 <span class="comment">// actually set the value here.</span> |
| <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; |
| 00089 |
| <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> |
| 00091 <span class="preprocessor"></span> |
| <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> |
| 00093 { |
| 00094 |
| <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>)]; |
| <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>() |
| 00097 { |
| 00098 <a class="code" href="structMM__AllocBlockFence.html#a1">fill_fence</a>(); |
| 00099 }; |
| 00100 |
| <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>() |
| 00102 { |
| 00103 <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>)); |
| 00104 }; |
| 00105 |
| <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>() |
| 00107 { |
| 00108 <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) |
| 00109 { |
| 00110 <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>; |
| 00111 } |
| 00112 <span class="keywordflow">return</span> <span class="keyword">true</span>; |
| 00113 }; |
| 00114 }; |
| 00115 |
| 00116 |
| 00117 |
| 00118 |
| <a name="l00119"></a><a class="code" href="group__osclmemory.html#a82">00119</a> <span class="preprocessor">#define DEFAULT_PREFILL_PATTERN 0x96</span> |
| <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> |
| 00121 <span class="preprocessor"></span> |
| 00122 |
| 00123 |
| 00124 |
| 00125 |
| 00126 <span class="preprocessor">#endif</span> |
| 00127 <span class="preprocessor"></span> |
| </pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> |
| <address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> |
| </small></address> |
| </body> |
| </html> |