mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 00:06:35 +00:00
93c19f3f1b
Add column headers to Rep functions. Change MEM_EXTRA_HASH2_PAGS to 1. (Revert this later if it causes bugs.)
165 lines
18 KiB
HTML
Executable file
165 lines
18 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.04">
|
|
<style type="text/css">
|
|
body {background-color:#1f1f1f;}
|
|
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
|
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
|
.cF2{color:#73a255;background-color:#1f1f1f;}
|
|
.cF3{color:#297582;background-color:#1f1f1f;}
|
|
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
|
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
|
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
|
.cF7{color:#444444;background-color:#1f1f1f;}
|
|
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
|
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
|
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
|
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
|
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
|
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
|
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
|
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF5> Scoping and Linkage</span><span class=cF0>
|
|
<a name="l2"></a></span><span class=cF4>
|
|
<a name="l3"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l188"><span class=cF4>JIT Compile Mode</span></a><span class=cF0> makes use of the current task's hash symbol table and its parent tasks' tables. It fetches symbols from
|
|
<a name="l4"></a>parent tasks' tables if not found locally in the current task's table and it places new symbols in the current task's table.
|
|
<a name="l5"></a>Conceptually, symbols are at the scope of environment variables in other operating systems.
|
|
<a name="l6"></a>
|
|
<a name="l7"></a>When a symbol is placed into a table, older symbols with ident names will be overshadowed if they exist. Duplicates are not
|
|
<a name="l8"></a>allowed in many cases, especially in asm blocks. Dupicates are allowed, by design in other cases, so that you can repeatedly </span><span class=cF2>
|
|
<a name="l9"></a>#include</span><span class=cF0> the same file from the cmd line while developing it. Or, so you can repeatedly declare a function with a standard
|
|
<a name="l10"></a>name, like </span><span class=cF2>DrawIt()</span><span class=cF0>. This case might occur when the </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l154"><span class=cF4>System Task</span></a><span class=cF0> is starting-up loading-in many little utilities.
|
|
<a name="l11"></a>
|
|
<a name="l12"></a></span><span class=cF2>extern</span><span class=cF0> binds a new </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l828"><span class=cF4>HTT_FUN</span></a><span class=cF0> or </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l825"><span class=cF4>HTT_GLOBAL_VAR</span></a><span class=cF0> symbol to an existing symbol of the same name if it exists in the symbol table
|
|
<a name="l13"></a>(just in just-in-time code). It also can be used to generate a forward reference.
|
|
<a name="l14"></a>
|
|
<a name="l15"></a></span><span class=cF2>import</span><span class=cF0> binds a new </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l828"><span class=cF4>HTT_FUN</span></a><span class=cF0> or </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l825"><span class=cF4>HTT_GLOBAL_VAR</span></a><span class=cF0> symbol to a symbol of the same name imported from the task's symbol table at </span><span class=cF4>
|
|
<a name="l16"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF0>() time. If no symbol exists to bind to at </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF0>() time, the code using this symbol will be left incomplete until the
|
|
<a name="l17"></a>symbol is defined.
|
|
<a name="l18"></a>
|
|
<a name="l19"></a>
|
|
<a name="l20"></a></span><span class=cF2>_extern</span><span class=cF0> binds a new </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l828"><span class=cF4>HTT_FUN</span></a><span class=cF0> or </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l825"><span class=cF4>HTT_GLOBAL_VAR</span></a><span class=cF0> symbol to an existing symbol, of a <blink>different</blink> name. It must exists in the symbol
|
|
<a name="l21"></a>table. Basically, this binds C to asm.
|
|
<a name="l22"></a>
|
|
<a name="l23"></a></span><span class=cF2>_import</span><span class=cF0> binds a new </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l828"><span class=cF4>HTT_FUN</span></a><span class=cF0> or </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l825"><span class=cF4>HTT_GLOBAL_VAR</span></a><span class=cF0> symbol to a symbol, of a <blink>different</blink> name imported from the task's symbol table at </span><span class=cF4>
|
|
<a name="l24"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF0>() time. If no symbol exists to bind to at </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KLoad.CC.html#l208"><span class=cF4>Load</span></a><span class=cF0>() time, the code using this symbol will be left incomplete until the
|
|
<a name="l25"></a>symbol is defined. Basically, this binds C to asm from elsewhere.
|
|
<a name="l26"></a>
|
|
<a name="l27"></a>
|
|
<a name="l28"></a></span><span class=cF5>Ahead of Time Compilation</span><span class=cF0>
|
|
<a name="l29"></a> </span><span class=cF2>G</span><span class=cF0>lobalScope / </span><span class=cF2>F</span><span class=cF0>unctionScope
|
|
<a name="l30"></a> | </span><span class=cF2>C</span><span class=cF0>odeHeap / </span><span class=cF2>D</span><span class=cF0>ataHeap / </span><span class=cF2>S</span><span class=cF0>tack / </span><span class=cF2>R</span><span class=cF0>egister
|
|
<a name="l31"></a> | | TaskHashEntry: Export</span><span class=cF2>S</span><span class=cF0>ysSym / </span><span class=cF2>D</span><span class=cF0>efine / </span><span class=cF2>F</span><span class=cF0>unction / </span><span class=cF2>C</span><span class=cF0>lass
|
|
<a name="l32"></a> | | | UsageScope: </span><span class=cF2>M</span><span class=cF0>odule / </span><span class=cF2>A</span><span class=cF0>smLocal / Asm</span><span class=cF2>B</span><span class=cF0>lk / </span><span class=cF2>T</span><span class=cF0>askAndChildren / </span><span class=cF2>F</span><span class=cF0>unction
|
|
<a name="l33"></a> | | | |UsageScope: </span><span class=cF2>G</span><span class=cF0>lbl / Asm</span><span class=cF2>L</span><span class=cF0>ocal / </span><span class=cF2>R</span><span class=cF0>emainder / </span><span class=cF2>g</span><span class=cF0>lblThisBlkAndRemainder
|
|
<a name="l34"></a> | | | || </span><span class=cF2>S</span><span class=cF0>taticVarInit / </span><span class=cF2>D</span><span class=cF0>ynamicVarInitAllowed / </span><span class=cF2>N</span><span class=cF0>oInitAllowed
|
|
<a name="l35"></a> | | | || | Are dups allowed within the namespace? A dup overshadows the original.
|
|
<a name="l36"></a> | | | || | </span><span class=cF2>D</span><span class=cF0>upsAllowed / </span><span class=cF2>N</span><span class=cF0>oDups / NoDupsBut</span><span class=cF2>P</span><span class=cF0>ad / </span><span class=cF2>W</span><span class=cF0>arningUnlessClosedOut
|
|
<a name="l37"></a>
|
|
<a name="l38"></a>asm export </span><span class=cF2>label::</span><span class=cF0> G C S MG N
|
|
<a name="l39"></a>asm </span><span class=cF2>label:</span><span class=cF0> G C MG N
|
|
<a name="l40"></a>asm local </span><span class=cF2>@@label:</span><span class=cF0> G C AL N
|
|
<a name="l41"></a>asm </span><span class=cF2>IMPORT label;</span><span class=cF0> G C MR N
|
|
<a name="l42"></a>asm export </span><span class=cF2>label::</span><span class=cF0> F C S BG N
|
|
<a name="l43"></a>asm </span><span class=cF2>label:</span><span class=cF0> F C BG N
|
|
<a name="l44"></a>asm local </span><span class=cF2>@@label:</span><span class=cF0> F C AL N
|
|
<a name="l45"></a>asm </span><span class=cF2>IMPORT label;</span><span class=cF0> F C BR N
|
|
<a name="l46"></a>C goto </span><span class=cF2>label:</span><span class=cF0> F C FG N
|
|
<a name="l47"></a>
|
|
<a name="l48"></a> </span><span class=cF2>#define</span><span class=cF0> x MR D
|
|
<a name="l49"></a> function G C S MR D
|
|
<a name="l50"></a> variable F R FR N
|
|
<a name="l51"></a> variable F S FR N
|
|
<a name="l52"></a></span><span class=cF2>static</span><span class=cF0> variable F C FR D N
|
|
<a name="l53"></a> variable G C S MR D D
|
|
<a name="l54"></a> variable G D MR N D
|
|
<a name="l55"></a> </span><span class=cF2>class</span><span class=cF0> G MR D
|
|
<a name="l56"></a>class member G MR P
|
|
<a name="l57"></a></span><span class=cF2>extern class</span><span class=cF0> G MR D
|
|
<a name="l58"></a></span><span class=cF2>extern</span><span class=cF0> function G C MR W
|
|
<a name="l59"></a></span><span class=cF2>import</span><span class=cF0> function G C MR D
|
|
<a name="l60"></a></span><span class=cF2>import</span><span class=cF0> variable G C MR D
|
|
<a name="l61"></a></span><span class=cF2>_extern</span><span class=cF0> function G C MR D
|
|
<a name="l62"></a></span><span class=cF2>_extern</span><span class=cF0> variable G C MR D
|
|
<a name="l63"></a></span><span class=cF2>_import</span><span class=cF0> function G C MR D
|
|
<a name="l64"></a></span><span class=cF2>_import</span><span class=cF0> variable G C MR D
|
|
<a name="l65"></a>
|
|
<a name="l66"></a>
|
|
<a name="l67"></a></span><span class=cF5>Just in Time Compilation</span><span class=cF0>
|
|
<a name="l68"></a> </span><span class=cF2>G</span><span class=cF0>lobalScope / </span><span class=cF2>F</span><span class=cF0>unctionScope
|
|
<a name="l69"></a> | </span><span class=cF2>C</span><span class=cF0>odeHeap / </span><span class=cF2>D</span><span class=cF0>ataHeap / </span><span class=cF2>S</span><span class=cF0>tack / </span><span class=cF2>R</span><span class=cF0>egister
|
|
<a name="l70"></a> | | TaskHashEntry: Export</span><span class=cF2>S</span><span class=cF0>ysSym / </span><span class=cF2>D</span><span class=cF0>efine / </span><span class=cF2>F</span><span class=cF0>unction / </span><span class=cF2>C</span><span class=cF0>lass
|
|
<a name="l71"></a> | | | UsageScope: </span><span class=cF2>M</span><span class=cF0>odule / </span><span class=cF2>A</span><span class=cF0>smLocal / Asm</span><span class=cF2>B</span><span class=cF0>lk / </span><span class=cF2>T</span><span class=cF0>askAndChildren / </span><span class=cF2>F</span><span class=cF0>unction
|
|
<a name="l72"></a> | | | |UsageScope: </span><span class=cF2>G</span><span class=cF0>lbl / Asm</span><span class=cF2>L</span><span class=cF0>ocal / </span><span class=cF2>R</span><span class=cF0>emainder / </span><span class=cF2>g</span><span class=cF0>lblThisBlkAndRemainder
|
|
<a name="l73"></a> | | | || </span><span class=cF2>S</span><span class=cF0>taticVarInit / </span><span class=cF2>D</span><span class=cF0>ynamicVarInitAllowed / </span><span class=cF2>N</span><span class=cF0>oInitAllowed
|
|
<a name="l74"></a> | | | || | Are dups allowed within the namespace? A dup overshadows the original.
|
|
<a name="l75"></a> | | | || | </span><span class=cF2>D</span><span class=cF0>upsAllowed / </span><span class=cF2>N</span><span class=cF0>oDups / NoDupsBut</span><span class=cF2>P</span><span class=cF0>ad / </span><span class=cF2>W</span><span class=cF0>arningUnlessClosedOut
|
|
<a name="l76"></a>
|
|
<a name="l77"></a>asm export </span><span class=cF2>label::</span><span class=cF0> G C S Tg N
|
|
<a name="l78"></a>asm </span><span class=cF2>label:</span><span class=cF0> G C BG N
|
|
<a name="l79"></a>asm local </span><span class=cF2>@@label:</span><span class=cF0> G C AL N
|
|
<a name="l80"></a>asm </span><span class=cF2>IMPORT label;</span><span class=cF0> G C TR N
|
|
<a name="l81"></a>asm export </span><span class=cF2>label::</span><span class=cF0> F C BG N
|
|
<a name="l82"></a>asm </span><span class=cF2>label:</span><span class=cF0> F C BG N
|
|
<a name="l83"></a>asm local </span><span class=cF2>@@label:</span><span class=cF0> F C AL N
|
|
<a name="l84"></a>asm </span><span class=cF2>IMPORT label;</span><span class=cF0> F C BR N
|
|
<a name="l85"></a>C goto </span><span class=cF2>label:</span><span class=cF0> F C FG N
|
|
<a name="l86"></a>
|
|
<a name="l87"></a> </span><span class=cF2>#define</span><span class=cF0> x D TR D
|
|
<a name="l88"></a> function G C F TR D
|
|
<a name="l89"></a> variable F R FR N
|
|
<a name="l90"></a> variable F S FR N
|
|
<a name="l91"></a></span><span class=cF2>static</span><span class=cF0> variable F C FR D N
|
|
<a name="l92"></a> variable G C G TR D D
|
|
<a name="l93"></a> variable G D G TR S D
|
|
<a name="l94"></a> </span><span class=cF2>class</span><span class=cF0> G C TR D
|
|
<a name="l95"></a>class member G TR P
|
|
<a name="l96"></a></span><span class=cF2>extern class</span><span class=cF0> G C TR D
|
|
<a name="l97"></a></span><span class=cF2>extern</span><span class=cF0> function G C F TR W
|
|
<a name="l98"></a></span><span class=cF2>extern</span><span class=cF0> variable G C G TR D
|
|
<a name="l99"></a></span><span class=cF2>extern</span><span class=cF0> variable G D G TR D
|
|
<a name="l100"></a></span><span class=cF2>_extern</span><span class=cF0> function G C F TR D
|
|
<a name="l101"></a></span><span class=cF2>_extern</span><span class=cF0> variable G C G TR D
|
|
<a name="l102"></a>
|
|
<a name="l103"></a>
|
|
<a name="l104"></a>* Goto labels must not have the same name as global scope objects. GoTo's are rare and we don't want to slow the compiler and
|
|
<a name="l105"></a>add code to fix this. You will get errors if a collision happens, so it's not very dangerous, but the error message is
|
|
<a name="l106"></a>baffling.
|
|
<a name="l107"></a>
|
|
<a name="l108"></a>* The member names </span><span class=cF2>pad</span><span class=cF0> and </span><span class=cF2>reserved</span><span class=cF0> are special because multiple instances with the same name are allowed in a class.
|
|
<a name="l109"></a>
|
|
<a name="l110"></a>* Use </span><span class=cF2>reg</span><span class=cF0> or </span><span class=cF2>noreg</span><span class=cF0> in front of local variable names to override automatic register variable allocation. You can, optionally,
|
|
<a name="l111"></a>specify a register after the </span><span class=cF2>reg</span><span class=cF0> keyword.
|
|
<a name="l112"></a>
|
|
<a name="l113"></a>* Local non-reg function variables can be accessed in asm blocks with </span><span class=cF2>&i[RBP]</span><span class=cF0> for example.
|
|
<a name="l114"></a>
|
|
<a name="l115"></a>* Global variables and functions can be accessed in asm with and </span><span class=cF2>&</span><span class=cF0> as in
|
|
<a name="l116"></a> </span><span class=cF2>MOV RAX, I64 [&global_var]
|
|
<a name="l117"></a> CALL I32 &Fun
|
|
<a name="l118"></a> CALL I32 &SYS_SYM</span><span class=cF0>
|
|
<a name="l119"></a>
|
|
<a name="l120"></a>* In </span><span class=cF2>JIT</span><span class=cF0> asm code, &SYS_SYM and &Fun don't need </span><span class=cF2>IMPORT</span><span class=cF0>.
|
|
<a name="l121"></a>
|
|
<a name="l122"></a>* All offspring tasks of a task inherit symbols.
|
|
<a name="l123"></a>
|
|
<a name="l124"></a>* The </span><span class=cF2>sizeof()</span><span class=cF0> and CosmiC structure members can be used in asm blocks.
|
|
<a name="l125"></a>
|
|
<a name="l126"></a>* Using </span><span class=cF2>&i</span><span class=cF0> in </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/CosmiC.DD.html#l1"><span class=cF4>CosmiC</span></a><span class=cF0> or </span><span class=cF2>i.u8[2]</span><span class=cF0> on a local variable, </span><span class=cF2>i</span><span class=cF0>, will force it to </span><span class=cF2>noreg</span><span class=cF0>.
|
|
<a name="l127"></a>
|
|
<a name="l128"></a>* Using </span><span class=cF2>try</span><span class=cF0>/</span><span class=cF2>catch</span><span class=cF0> in a function will force all local variables to </span><span class=cF2>noreg</span><span class=cF0>.
|
|
<a name="l129"></a>
|
|
<a name="l130"></a>* An unused gap on the stack is left for </span><span class=cF2>reg</span><span class=cF0> variables.
|
|
<a name="l131"></a>
|
|
<a name="l132"></a>* Note: </span><span class=cF2>static</span><span class=cF0> function variables do not go on the data heap, no matter the setting of the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1685"><span class=cF4>OPTf_GLOBALS_ON_DATA_HEAP</span></a><span class=cF0>. They
|
|
<a name="l133"></a>may in the future.
|
|
<a name="l134"></a>
|
|
<a name="l135"></a>* </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l1682"><span class=cF4>OPTf_EXTERNS_TO_IMPORTS</span></a><span class=cF0> will treat </span><span class=cF2>_extern</span><span class=cF0> as </span><span class=cF2>_import</span><span class=cF0> and </span><span class=cF2>extern</span><span class=cF0> as </span><span class=cF2>import</span><span class=cF0>. This allows a header to be used either as a </span><span class=cF2>JIT
|
|
<a name="l136"></a>compiled</span><span class=cF0> or </span><span class=cF2>AOT compiled</span><span class=cF0> header.
|
|
</span></pre></body>
|
|
</html>
|