mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 16:26:35 +00:00
135 lines
13 KiB
HTML
Executable file
135 lines
13 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V1.00">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>"Compiler"</span><span class=cF0>
|
|
<a name="l2"></a>
|
|
<a name="l3"></a></span><span class=cF5>DefineListLoad</span><span class=cF0>(</span><span class=cF6>"ST_BIN_FILE_TYPES"</span><span class=cF0>, </span><span class=cF6>"END\0"</span><span class=cF0>
|
|
<a name="l4"></a> </span><span class=cF6>" \0"</span><span class=cF0>
|
|
<a name="l5"></a> </span><span class=cF6>"REL_I0\0"</span><span class=cF0>
|
|
<a name="l6"></a> </span><span class=cF6>"IMM_U0\0"</span><span class=cF0>
|
|
<a name="l7"></a> </span><span class=cF6>"REL_I8\0"</span><span class=cF0>
|
|
<a name="l8"></a> </span><span class=cF6>"IMM_U8\0"</span><span class=cF0>
|
|
<a name="l9"></a> </span><span class=cF6>"REL_I16\0"</span><span class=cF0>
|
|
<a name="l10"></a> </span><span class=cF6>"IMM_U16\0"</span><span class=cF0>
|
|
<a name="l11"></a> </span><span class=cF6>"REL_I32\0"</span><span class=cF0>
|
|
<a name="l12"></a> </span><span class=cF6>"IMM_U32\0"</span><span class=cF0>
|
|
<a name="l13"></a> </span><span class=cF6>"REL_I64\0"</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF6>"IMM_U64\0"</span><span class=cF0>
|
|
<a name="l15"></a> </span><span class=cF6>" \0 \0 \0 \0"</span><span class=cF0>
|
|
<a name="l16"></a> </span><span class=cF6>"REL32_EXPORT\0"</span><span class=cF0>
|
|
<a name="l17"></a> </span><span class=cF6>"IMM32_EXPORT\0"</span><span class=cF0>
|
|
<a name="l18"></a> </span><span class=cF6>"REL64_EXPORT\0"</span><span class=cF0>
|
|
<a name="l19"></a> </span><span class=cF6>"IMM64_EXPORT\0"</span><span class=cF0>
|
|
<a name="l20"></a> </span><span class=cF6>"ABS_ADDR\0"</span><span class=cF0>
|
|
<a name="l21"></a> </span><span class=cF6>"CODE_HEAP\0"</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF6>"ZEROED_CODE_HEAP\0"</span><span class=cF0>
|
|
<a name="l23"></a> </span><span class=cF6>"DATA_HEAP\0"</span><span class=cF0>
|
|
<a name="l24"></a> </span><span class=cF6>"ZEROED_DATA_HEAP\0"</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF6>"MAIN"</span><span class=cF0>);
|
|
<a name="l26"></a>
|
|
<a name="l27"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>BinRep</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename)
|
|
<a name="l28"></a>{</span><span class=cF2>//Reports imports, exports, etc for a .BIN file</span><span class=cF0>
|
|
<a name="l29"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/CMain.CC.html#l525"><span class=cF4>Patch Table Generation</span></a><span class=cF2> and </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF2>().</span><span class=cF0>
|
|
<a name="l30"></a> </span><span class=cF1>U8</span><span class=cF0> *fbuf, *ptr, *sptr, *absname;
|
|
<a name="l31"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, size, etype;
|
|
<a name="l32"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l33"></a> </span><span class=cF9>CBinFile</span><span class=cF0> *bf;
|
|
<a name="l34"></a> </span><span class=cF9>CHashExport</span><span class=cF0> *saved_hash_ptr = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l35"></a>
|
|
<a name="l36"></a> fbuf = </span><span class=cF5>ExtDefault</span><span class=cF0>(filename, </span><span class=cF6>"BIN"</span><span class=cF0>);
|
|
<a name="l37"></a>
|
|
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>bf = </span><span class=cF5>FileRead</span><span class=cF0>(fbuf, &size)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l39"></a> </span><span class=cF1>goto</span><span class=cF0> br_done1;
|
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (bf->bin_signature != </span><span class=cF3>BIN_SIGNATURE_VAL</span><span class=cF0>)
|
|
<a name="l41"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l42"></a> </span><span class=cF6>"Not a CosmiC Binary File.\n"</span><span class=cF0>;
|
|
<a name="l43"></a> </span><span class=cF1>goto</span><span class=cF0> br_done2;
|
|
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l45"></a>
|
|
<a name="l46"></a> absname = </span><span class=cF5>FileNameAbs</span><span class=cF0>(fbuf);
|
|
<a name="l47"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf);
|
|
<a name="l48"></a> fbuf = </span><span class=cF5>StrNew</span><span class=cF0>(absname);
|
|
<a name="l49"></a> </span><span class=cF5>FileExtRemove</span><span class=cF0>(fbuf);
|
|
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (fbuf[</span><span class=cFE>1</span><span class=cF0>] == </span><span class=cF6>':'</span><span class=cF0> && </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>fbuf</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>2</span><span class=cF0>)
|
|
<a name="l51"></a> </span><span class=cF6>" MODULE_NAME:%s\n"</span><span class=cF0>, fbuf + </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l52"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l53"></a> </span><span class=cF6>"NO MODULE NAME\n"</span><span class=cF0>;
|
|
<a name="l54"></a>
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (bf->org != </span><span class=cF3>INVALID_PTR</span><span class=cF0>)
|
|
<a name="l56"></a> </span><span class=cF6>" ORG:%X\n"</span><span class=cF0>, bf->org;
|
|
<a name="l57"></a>
|
|
<a name="l58"></a> </span><span class=cF6>" MODULE_ALIGN:%X\n"</span><span class=cF0>, </span><span class=cFE>1</span><span class=cF0> << bf->module_align_bits;
|
|
<a name="l59"></a>
|
|
<a name="l60"></a> ptr = bf(</span><span class=cF1>U8</span><span class=cF0> *) + bf->patch_table_offset;
|
|
<a name="l61"></a> </span><span class=cF1>while</span><span class=cF0> (etype = *ptr++)
|
|
<a name="l62"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l63"></a> i = *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l64"></a> sptr = ptr;
|
|
<a name="l65"></a> ptr += </span><span class=cF5>StrLen</span><span class=cF0>(sptr) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l66"></a> </span><span class=cF6>"$LTCYAN$%16Z:$GREEN$%s$FG$:%X "</span><span class=cF0>, etype, </span><span class=cF6>"ST_BIN_FILE_TYPES"</span><span class=cF0>, sptr, i;
|
|
<a name="l67"></a> </span><span class=cF1>switch</span><span class=cF0> (etype)
|
|
<a name="l68"></a> {
|
|
<a name="l69"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_REL_I0</span><span class=cF0> ... </span><span class=cF3>IET_IMM_I64</span><span class=cF0>:
|
|
<a name="l70"></a> </span><span class=cF1>if</span><span class=cF0> (*sptr)
|
|
<a name="l71"></a> saved_hash_ptr = </span><span class=cF5>HashFind</span><span class=cF0>(sptr, </span><span class=cF5>Fs</span><span class=cF0>->hash_table, </span><span class=cF3>HTG_ALL</span><span class=cF0>);
|
|
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (!saved_hash_ptr)
|
|
<a name="l73"></a> </span><span class=cF6>"Unresolved Reference:%s\n"</span><span class=cF0>, sptr;
|
|
<a name="l74"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_ABS_ADDR</span><span class=cF0>:
|
|
<a name="l77"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l78"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < i; j++)
|
|
<a name="l79"></a> </span><span class=cF6>"%X "</span><span class=cF0>, *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l80"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l81"></a>
|
|
<a name="l82"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_CODE_HEAP</span><span class=cF0>:
|
|
<a name="l83"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_ZEROED_CODE_HEAP</span><span class=cF0>:
|
|
<a name="l84"></a> </span><span class=cF6>"Size:%X\n"</span><span class=cF0>, *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l85"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < i; j++)
|
|
<a name="l86"></a> </span><span class=cF6>"%X "</span><span class=cF0>, *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l87"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l88"></a>
|
|
<a name="l89"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_DATA_HEAP</span><span class=cF0>:
|
|
<a name="l90"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>IET_ZEROED_DATA_HEAP</span><span class=cF0>:
|
|
<a name="l91"></a> </span><span class=cF6>"Size:%X\n"</span><span class=cF0>, *ptr(</span><span class=cF9>I64</span><span class=cF0> *)++;
|
|
<a name="l92"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j < i; j++)
|
|
<a name="l93"></a> </span><span class=cF6>"%X "</span><span class=cF0>, *ptr(</span><span class=cF9>U32</span><span class=cF0> *)++;
|
|
<a name="l94"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l95"></a> }
|
|
<a name="l96"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l98"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l99"></a> </span><span class=cF5>Free</span><span class=cF0>(absname);
|
|
<a name="l100"></a>br_done2:
|
|
<a name="l101"></a> </span><span class=cF5>Free</span><span class=cF0>(bf);
|
|
<a name="l102"></a>br_done1:
|
|
<a name="l103"></a> </span><span class=cF5>Free</span><span class=cF0>(fbuf);
|
|
<a name="l104"></a>
|
|
<a name="l105"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l106"></a>}
|
|
</span></pre></body>
|
|
</html>
|