2021-07-03 05:07:57 +01:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
|
|
<meta name="generator" content="ZealOS V0.05">
|
|
|
|
<style type="text/css">
|
|
|
|
body {background-color:#000000;}
|
|
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2021-07-05 01:12:38 +01:00
|
|
|
<pre style="font-family:monospace;font-size:12pt">
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Memory/Task"</span><span class=cF0>
|
|
|
|
<a name="l2"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>TaskMemAlloced</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> override_validate=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
|
|
<a name="l3"></a>{</span><span class=cF2>//Count of bytes alloced to a task, used+unused.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l4"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l5"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l6"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
|
|
<a name="l7"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
|
|
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (override_validate || </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l9"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l10"></a> res = task->code_heap->alloced_u8s;
|
|
|
|
<a name="l11"></a> </span><span class=cF1>if</span><span class=cF0> (task->code_heap != task->data_heap)
|
|
|
|
<a name="l12"></a> res += task->data_heap->alloced_u8s;
|
|
|
|
<a name="l13"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
|
|
<a name="l14"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l15"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
|
|
<a name="l16"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l17"></a>}
|
|
|
|
<a name="l18"></a>
|
|
|
|
<a name="l19"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>TaskMemUsed</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> override_validate=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
|
|
<a name="l20"></a>{</span><span class=cF2>//Count of bytes alloced to a task and in use.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> res;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l22"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
|
|
<a name="l24"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
|
|
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (override_validate || </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l26"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l27"></a> res = task->code_heap->used_u8s;
|
|
|
|
<a name="l28"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap != task->code_heap)
|
|
|
|
<a name="l29"></a> res += task->data_heap->used_u8s;
|
|
|
|
<a name="l30"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
|
|
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l32"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
|
|
<a name="l33"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l34"></a>}
|
|
|
|
<a name="l35"></a>
|
|
|
|
<a name="l36"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Memory/Task;Debugging/Heap;Memory/Debugging"</span><span class=cF0>
|
|
|
|
<a name="l37"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>HeapRep</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
|
|
|
<a name="l38"></a>{</span><span class=cF2>//Report status of task's heap.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l39"></a> </span><span class=cF9>I64</span><span class=cF0> i, count;
|
|
|
|
<a name="l40"></a> </span><span class=cF9>CMemUnused</span><span class=cF0> *uum;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l41"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l42"></a> </span><span class=cF1>if</span><span class=cF0> (!task || task == </span><span class=cF5>Fs</span><span class=cF0>)
|
|
|
|
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l44"></a> </span><span class=cF6>"Task can't HeapRep on self.\n"</span><span class=cF0>;
|
|
|
|
<a name="l45"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
|
|
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l48"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l49"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l50"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
|
|
<a name="l51"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
|
|
<a name="l52"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->code_heap->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l53"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap != task->code_heap)
|
|
|
|
<a name="l55"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->data_heap->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l56"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l57"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l58"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>MEM_HEAP_HASH_SIZE</span><span class=cF0> >> </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
|
|
<a name="l59"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l60"></a> count = </span><span class=cFE>0</span><span class=cF0>;
|
|
|
|
<a name="l61"></a> uum = task->code_heap->heap_hash[i];
|
|
|
|
<a name="l62"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l63"></a> {
|
|
|
|
<a name="l64"></a> count += uum->size;
|
|
|
|
<a name="l65"></a> uum = uum->next;
|
|
|
|
<a name="l66"></a> }
|
|
|
|
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap != task->code_heap)
|
|
|
|
<a name="l68"></a> {
|
|
|
|
<a name="l69"></a> uum = task->data_heap->heap_hash[i];
|
|
|
|
<a name="l70"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l71"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l72"></a> count += uum->size;
|
|
|
|
<a name="l73"></a> uum = uum->next;
|
|
|
|
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l75"></a> }
|
|
|
|
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (count)
|
|
|
|
<a name="l77"></a> </span><span class=cF6>"%03X:%08X\n"</span><span class=cF0>, i << </span><span class=cFE>3</span><span class=cF0>, count;
|
|
|
|
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l79"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l80"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l81"></a> uum = task->code_heap->malloc_free_list;
|
|
|
|
<a name="l82"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l83"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l84"></a> </span><span class=cF6>"%X, "</span><span class=cF0>, uum->size;
|
|
|
|
<a name="l85"></a> uum = uum->next;
|
|
|
|
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap != task->code_heap)
|
|
|
|
<a name="l88"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l89"></a> uum = task->data_heap->malloc_free_list;
|
|
|
|
<a name="l90"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l91"></a> {
|
|
|
|
<a name="l92"></a> </span><span class=cF6>"%X, "</span><span class=cF0>, uum->size;
|
|
|
|
<a name="l93"></a> uum = uum->next;
|
|
|
|
<a name="l94"></a> }
|
|
|
|
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l96"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap != task->code_heap)
|
|
|
|
<a name="l98"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->data_heap->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l99"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->code_heap->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l100"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l101"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l102"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l103"></a>}
|
|
|
|
<a name="l104"></a>
|
|
|
|
<a name="l105"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Memory/HeapCtrl;Debugging/Heap;Memory/Debugging"</span><span class=cF0>
|
|
|
|
<a name="l106"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsInHeapCtrl</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *a, </span><span class=cF9>CHeapCtrl</span><span class=cF0> *hc, </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF1>lock</span><span class=cF0>=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
|
|
<a name="l107"></a>{</span><span class=cF2>//Check addr if in HeapCtrl.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l108"></a> </span><span class=cF9>CMemBlk</span><span class=cF0> *m;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l109"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l110"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
|
|
<a name="l111"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
|
|
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>lock</span><span class=cF0>)
|
|
|
|
<a name="l113"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l114"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
|
|
|
<a name="l115"></a> m = hc->next_mem_blk;
|
|
|
|
<a name="l116"></a> </span><span class=cF1>while</span><span class=cF0> (m != &hc->next_mem_blk)
|
|
|
|
<a name="l117"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l118"></a> </span><span class=cF1>if</span><span class=cF0> (a >= m && a < m</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0> + m->pags << </span><span class=cF3>MEM_PAG_BITS</span><span class=cF0>)
|
|
|
|
<a name="l119"></a> {
|
|
|
|
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>lock</span><span class=cF0>)
|
|
|
|
<a name="l121"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l122"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
|
|
<a name="l123"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
|
|
<a name="l124"></a> }
|
|
|
|
<a name="l125"></a> m = m->next;
|
|
|
|
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF1>lock</span><span class=cF0>)
|
|
|
|
<a name="l128"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l129"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l130"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l131"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l132"></a>}
|
|
|
|
<a name="l133"></a>
|
|
|
|
<a name="l134"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>HeapCtrlWalk</span><span class=cF0>(</span><span class=cF9>CHeapCtrl</span><span class=cF0> *hc)
|
|
|
|
<a name="l135"></a>{</span><span class=cF2>//Check integrity of HeapCtrl.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l136"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
|
|
<a name="l137"></a> </span><span class=cF9>CMemUnused</span><span class=cF0> *uum;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l138"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l139"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
|
|
|
<a name="l140"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
|
|
|
<a name="l141"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l142"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l143"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l144"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cF3>MEM_HEAP_HASH_SIZE</span><span class=cF0> >> </span><span class=cFE>3</span><span class=cF0>; i++)
|
|
|
|
<a name="l145"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l146"></a> uum = hc->heap_hash[i];
|
|
|
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l148"></a> {
|
|
|
|
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsInHeapCtrl</span><span class=cF7>(</span><span class=cF0>uum, hc, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l150"></a> </span><span class=cF1>goto</span><span class=cF0> hc_false;
|
|
|
|
<a name="l151"></a> uum = uum->next;
|
|
|
|
<a name="l152"></a> }
|
|
|
|
<a name="l153"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
|
|
<a name="l154"></a> uum = hc->malloc_free_list;
|
|
|
|
<a name="l155"></a> </span><span class=cF1>while</span><span class=cF0> (uum)
|
|
|
|
<a name="l156"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsInHeapCtrl</span><span class=cF7>(</span><span class=cF0>uum, hc, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l158"></a> </span><span class=cF1>goto</span><span class=cF0> hc_false;
|
|
|
|
<a name="l159"></a> uum = uum->next;
|
|
|
|
<a name="l160"></a> </span><span class=cF7>}</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l161"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l162"></a> #</span><span class=cF1>if</span><span class=cF0> </span><span class=cF3>_CONFIG_HEAP_DEBUG</span><span class=cF0>
|
|
|
|
<a name="l163"></a> </span><span class=cF9>CMemUsed</span><span class=cF0> *um, *um1;
|
|
|
|
<a name="l164"></a> um1 = (&hc->next_um)(</span><span class=cF1>U8</span><span class=cF0> *) - </span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CMemUsed</span><span class=cF0>.next);
|
|
|
|
<a name="l165"></a> um = um1->next;
|
|
|
|
<a name="l166"></a> </span><span class=cF1>while</span><span class=cF0> (um != um1)
|
|
|
|
<a name="l167"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsInHeapCtrl</span><span class=cF7>(</span><span class=cF0>um, hc, </span><span class=cF3>FALSE</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l169"></a> </span><span class=cF1>goto</span><span class=cF0> hc_false;
|
|
|
|
<a name="l170"></a> um = um->next;
|
|
|
|
<a name="l171"></a> </span><span class=cF7>}</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l172"></a>#</span><span class=cF1>endif</span><span class=cF0>
|
|
|
|
<a name="l173"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l174"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l175"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
|
|
|
<a name="l176"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l177"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l178"></a> hc_false:
|
|
|
|
<a name="l179"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&hc->locked_flags, </span><span class=cF3>HClf_LOCKED</span><span class=cF0>);
|
|
|
|
<a name="l180"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l181"></a>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l183"></a>}
|
|
|
|
<a name="l184"></a>
|
|
|
|
<a name="l185"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Memory/Task;Debugging/Heap;Memory/Debugging"</span><span class=cF0>
|
|
|
|
<a name="l186"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsInHeap</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *a, </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF1>lock</span><span class=cF0>=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
|
|
<a name="l187"></a>{</span><span class=cF2>//Check addr if in task's heaps.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l188"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
|
|
<a name="l189"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
|
|
<a name="l190"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF7>(</span><span class=cF5>IsInHeapCtrl</span><span class=cF0>(a, task->code_heap, </span><span class=cF1>lock</span><span class=cF0>) ||
|
|
|
|
<a name="l191"></a> task->data_heap != task->code_heap &&
|
|
|
|
<a name="l192"></a> </span><span class=cF5>IsInHeapCtrl</span><span class=cF0>(a, task->data_heap, </span><span class=cF1>lock</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
|
|
<a name="l194"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
|
|
<a name="l195"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l196"></a>}
|
|
|
|
<a name="l197"></a>
|
|
|
|
<a name="l198"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>HeapWalk</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
|
|
|
<a name="l199"></a>{</span><span class=cF2>//Check integrity of task's heaps.</span><span class=cF0>
|
2021-07-04 23:11:34 +01:00
|
|
|
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
|
|
|
|
<a name="l201"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
|
|
|
|
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF5>HeapCtrlWalk</span><span class=cF7>(</span><span class=cF0>task->code_heap</span><span class=cF7>)</span><span class=cF0> || task->data_heap != task->code_heap && !</span><span class=cF5>HeapCtrlWalk</span><span class=cF7>(</span><span class=cF0>task->data_heap</span><span class=cF7>)</span><span class=cF0>)
|
|
|
|
<a name="l203"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
|
|
<a name="l204"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
|
|
<a name="l205"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
2021-07-03 05:07:57 +01:00
|
|
|
<a name="l206"></a>}
|
|
|
|
</span></pre></body>
|
|
|
|
</html>
|