173 lines
18 KiB
HTML
Executable File
173 lines
18 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashEntrySize</span><span class=cF0>(</span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph)
|
|
<a name="l2"></a>{</span><span class=cF2>//Logical size of a std system hash entry.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF9>CDbgInfo</span><span class=cF0> *dbg_info;
|
|
<a name="l4"></a> </span><span class=cF9>CBinFile</span><span class=cF0> *bfh;
|
|
<a name="l5"></a> </span><span class=cF1>switch</span><span class=cF0> (</span><span class=cF5>HashTypeNum</span><span class=cF7>(</span><span class=cF0>tmph</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_DEFINE_STR</span><span class=cF0>:
|
|
<a name="l7"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>MSize</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->data);
|
|
<a name="l8"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_GLBL_VAR</span><span class=cF0>:
|
|
<a name="l9"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_CLASS</span><span class=cF0>:
|
|
<a name="l10"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_INTERNAL_TYPE</span><span class=cF0>:
|
|
<a name="l11"></a> </span><span class=cF1>return</span><span class=cF0> tmph(</span><span class=cF9>CHashClass</span><span class=cF0> *)->size;
|
|
<a name="l12"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FUN</span><span class=cF0>:
|
|
<a name="l13"></a> </span><span class=cF1>if</span><span class=cF0> (dbg_info=tmph->dbg_info)
|
|
<a name="l14"></a> </span><span class=cF1>return</span><span class=cF0> dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
|
|
<a name="l15"></a> -dbg_info->body[0];
|
|
<a name="l16"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF1>return</span><span class=cF0> -1;
|
|
<a name="l18"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_FILE</span><span class=cF0>:
|
|
<a name="l19"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>MSize</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->user_data0);
|
|
<a name="l20"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_MODULE</span><span class=cF0>:
|
|
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>tmph->str,</span><span class=cF3>KERNEL_MODULE_NAME</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l22"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>MSize</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->user_data0);
|
|
<a name="l23"></a> </span><span class=cF1>else</span><span class=cF0> {
|
|
<a name="l24"></a> bfh=</span><span class=cFB>mem_boot_base</span><span class=cF0>-</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>);
|
|
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0> bfh->file_size;
|
|
<a name="l26"></a> }
|
|
<a name="l27"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>HTt_WORD</span><span class=cF0>:
|
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrLen</span><span class=cF0>(tmph->str);
|
|
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l30"></a> </span><span class=cF1>return</span><span class=cF0> -1;
|
|
<a name="l31"></a>}
|
|
<a name="l32"></a>
|
|
<a name="l33"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashEntrySize2</span><span class=cF0>(</span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph)
|
|
<a name="l34"></a>{</span><span class=cF2>//Memory size of a std system hash entry.</span><span class=cF0>
|
|
<a name="l35"></a> </span><span class=cF9>CDbgInfo</span><span class=cF0> *dbg_info;
|
|
<a name="l36"></a> </span><span class=cF9>I64</span><span class=cF0> res=</span><span class=cF5>MSize2</span><span class=cF0>(tmph);
|
|
<a name="l37"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmph->type&</span><span class=cF3>HTT_DICT_WORD</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l38"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph->str);
|
|
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTG_SRC_SYM</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l40"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph->src_link);
|
|
<a name="l41"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph->idx);
|
|
<a name="l42"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph->import_name);
|
|
<a name="l43"></a> res+=</span><span class=cF5>LinkedLstSize</span><span class=cF0>(tmph->ie_lst);
|
|
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF7>(</span><span class=cF3>HTT_FUN</span><span class=cF0> | </span><span class=cF3>HTT_EXPORT_SYS_SYM</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l45"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph->dbg_info);
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTT_CLASS</span><span class=cF0>)
|
|
<a name="l47"></a> res+=</span><span class=cFD>MemberLstSize</span><span class=cF0>(tmph);
|
|
<a name="l48"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTT_FUN</span><span class=cF0>) {
|
|
<a name="l49"></a> res+=</span><span class=cFD>MemberLstSize</span><span class=cF0>(tmph);
|
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (dbg_info=tmph->dbg_info)
|
|
<a name="l51"></a></span><span class=cF2>//This should be </span><a href="/Wb/Kernel/Mem/MAllocFree.HC.HTML#l384"><span class=cF4>MSize</span></a><span class=cF2>() but it would crash on AOT .BIN.Z file funs.</span><span class=cF0>
|
|
<a name="l52"></a> res+=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]
|
|
<a name="l53"></a> -dbg_info->body[0];
|
|
<a name="l54"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph->type&</span><span class=cF3>HTT_DEFINE_STR</span><span class=cF0>)
|
|
<a name="l55"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashDefineStr</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->data);
|
|
<a name="l56"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTT_GLBL_VAR</span><span class=cF0>) {
|
|
<a name="l57"></a> res+=</span><span class=cF5>LinkedLstSize</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->dim.next);
|
|
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>tmph(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *)->flags&</span><span class=cF3>GVF_ALIAS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l59"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->data_addr);
|
|
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->fun_ptr)
|
|
<a name="l61"></a> res+=</span><span class=cF5>HashEntrySize2</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->fun_ptr
|
|
<a name="l62"></a> -tmph</span><span class=cF7>(</span><span class=cF9>CHashGlblVar</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->fun_ptr->ptr_stars_cnt);
|
|
<a name="l63"></a> }
|
|
<a name="l64"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTT_FILE</span><span class=cF0>)
|
|
<a name="l65"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->user_data0);
|
|
<a name="l66"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmph->type & </span><span class=cF3>HTT_MODULE</span><span class=cF0> &&
|
|
<a name="l67"></a> </span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>tmph->str,</span><span class=cF3>KERNEL_MODULE_NAME</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l68"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(tmph</span><span class=cF7>(</span><span class=cF9>CHashGeneric</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>->user_data0);
|
|
<a name="l69"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l70"></a>}
|
|
<a name="l71"></a>
|
|
<a name="l72"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HashTableSize2</span><span class=cF0>(</span><span class=cF9>CHashTable</span><span class=cF0> *table)
|
|
<a name="l73"></a>{</span><span class=cF2>//Memory size of std system hash table and all entries.</span><span class=cF0>
|
|
<a name="l74"></a> </span><span class=cF9>I64</span><span class=cF0> i,res=0;
|
|
<a name="l75"></a> </span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph;
|
|
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (!table)
|
|
<a name="l77"></a> </span><span class=cF1>return</span><span class=cF0> 0;
|
|
<a name="l78"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<=table->mask;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> tmph=table->body[i];
|
|
<a name="l80"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
|
|
<a name="l81"></a> res+=</span><span class=cF5>HashEntrySize2</span><span class=cF0>(tmph);
|
|
<a name="l82"></a> tmph=tmph->next;
|
|
<a name="l83"></a> }
|
|
<a name="l84"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l85"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(table->body);
|
|
<a name="l86"></a> res+=</span><span class=cF5>MSize2</span><span class=cF0>(table);
|
|
<a name="l87"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l88"></a>}
|
|
<a name="l89"></a>
|
|
<a name="l90"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>MapFileWrite</span><span class=cF0>(</span><span class=cF9>CHashTable</span><span class=cF0> *h,</span><span class=cF1>U8</span><span class=cF0> *map_name,</span><span class=cF1>U8</span><span class=cF0> drv_let)
|
|
<a name="l91"></a>{
|
|
<a name="l92"></a> </span><span class=cF9>CHashSrcSym</span><span class=cF0> *tmph;
|
|
<a name="l93"></a> </span><span class=cF9>I64</span><span class=cF0> i,size;
|
|
<a name="l94"></a> </span><span class=cF1>U8</span><span class=cF0> *src_link;
|
|
<a name="l95"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
|
<a name="l96"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
|
|
<a name="l97"></a> </span><span class=cF9>CDbgInfo</span><span class=cF0> *dbg_info;
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> doc=</span><span class=cF5>DocNew</span><span class=cF0>(map_name);
|
|
<a name="l100"></a> doc->flags|=</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>;
|
|
<a name="l101"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<=h->mask;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l102"></a> tmph=h->body[i];
|
|
<a name="l103"></a> </span><span class=cF1>while</span><span class=cF0> (tmph) {
|
|
<a name="l104"></a> </span><span class=cF1>if</span><span class=cF0> (tmph->src_link && !</span><span class=cF7>(</span><span class=cF0>tmph->type & (</span><span class=cF3>HTF_IMPORT</span><span class=cF0> | </span><span class=cF3>HTF_PRIVATE</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l105"></a> src_link=</span><span class=cF5>StrNew</span><span class=cF0>(tmph->src_link);
|
|
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (drv_let && </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>src_link</span><span class=cF7>)</span><span class=cF0>>=4)
|
|
<a name="l107"></a> src_link[3]=drv_let;
|
|
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (dbg_info=tmph->dbg_info) {
|
|
<a name="l109"></a> size=</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CDbgInfo</span><span class=cF0>.body)+
|
|
<a name="l110"></a> </span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>U32</span><span class=cF0>)*(dbg_info->max_line+2-dbg_info->min_line);
|
|
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (size></span><span class=cF5>MSize</span><span class=cF7>(</span><span class=cF0>dbg_info</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF6>"Corrupt Map Entry\n"</span><span class=cF0>;
|
|
<a name="l113"></a> dbg_info=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l114"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (dbg_info->min_line<=dbg_info->max_line) {
|
|
<a name="l116"></a> tmpb=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocBin</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l117"></a> tmpb->size=size;
|
|
<a name="l118"></a> tmpb->data=</span><span class=cF5>MAlloc</span><span class=cF0>(size);
|
|
<a name="l119"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(tmpb->data,dbg_info,size);
|
|
<a name="l120"></a> tmpb->num=doc->cur_bin_num++;
|
|
<a name="l121"></a> tmpb->use_cnt=1;
|
|
<a name="l122"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpb,doc->bin_head.last);
|
|
<a name="l123"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l124"></a> dbg_info=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l125"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l126"></a> }
|
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (dbg_info)
|
|
<a name="l128"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"$LK,\"%s\",A=\"%s\",BI=%d$\n"</span><span class=cF0>,
|
|
<a name="l129"></a> tmph->str,src_link,tmpb->num);
|
|
<a name="l130"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc,</span><span class=cF6>"$LK,\"%s\",A=\"%s\"$\n"</span><span class=cF0>,tmph->str,src_link);
|
|
<a name="l132"></a>
|
|
<a name="l133"></a> </span><span class=cF5>Free</span><span class=cF0>(src_link);
|
|
<a name="l134"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l135"></a> tmph=tmph->next;
|
|
<a name="l136"></a> }
|
|
<a name="l137"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l138"></a> </span><span class=cF5>DocBinsValidate</span><span class=cF0>(doc);
|
|
<a name="l139"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(doc);
|
|
<a name="l140"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l141"></a>}
|
|
</span></pre></body>
|
|
</html>
|