templeos-info/public/Wb/Kernel/KStart32.HC.HTML

149 lines
18 KiB
Plaintext
Raw Normal View History

2024-03-24 21:24:44 +00:00
<!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=cF1>asm</span><span class=cF0> {
<a name="l2"></a></span><span class=cF1>USE32</span><span class=cF0>
<a name="l3"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l4"></a></span><span class=cF2>// ASM Global vars not required for 16-bit start-up</span><span class=cF0>
<a name="l5"></a> </span><span class=cF1>ALIGN</span><span class=cF0> 8,</span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l6"></a></span><span class=cFD>MEM_HEAP_BASE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l7"></a></span><span class=cFD>MEM_HEAP_LIMIT</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l8"></a></span><span class=cFD>MEM_PAGE_SIZE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l9"></a></span><span class=cFD>MEM_MAPPED_SPACE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l10"></a></span><span class=cFD>MEM_2MEG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l11"></a></span><span class=cFD>MEM_1GIG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l12"></a></span><span class=cFD>MEM_512GIG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l13"></a></span><span class=cFD>MEM_PML2</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l14"></a></span><span class=cFD>MEM_PML3</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l15"></a></span><span class=cFD>MEM_PML4</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l16"></a>
<a name="l17"></a>#</span><span class=cF1>exe</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l18"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(
<a name="l19"></a></span><span class=cF6>&quot;SYS_MEM_INIT_FLAG::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l20"></a></span><span class=cF6>&quot;SYS_MEM_INIT_VAL::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l21"></a></span><span class=cF6>&quot;SYS_HEAP_INIT_FLAG::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l22"></a></span><span class=cF6>&quot;SYS_HEAP_INIT_VAL::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l23"></a></span><span class=cF6>&quot;SYS_VAR_INIT_FLAG::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l24"></a></span><span class=cF6>&quot;SYS_VAR_INIT_VAL::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>
<a name="l25"></a></span><span class=cF6>&quot;SYS_STAFF_MODE_FLAG::</span><span class=cF0> </span><span class=cF6>DU8</span><span class=cF0> </span><span class=cF6>%d;&quot;</span><span class=cF0>,
<a name="l26"></a>kernel_cfg-&gt;opts[CFG_MEM_INIT], kernel_cfg-&gt;mem_init_val,
<a name="l27"></a>kernel_cfg-&gt;opts[CFG_HEAP_INIT],kernel_cfg-&gt;heap_init_val,
<a name="l28"></a>kernel_cfg-&gt;opts[CFG_VAR_INIT], kernel_cfg-&gt;var_init_val,
<a name="l29"></a>kernel_cfg-&gt;opts[CFG_STAFF_MODE]);
<a name="l30"></a></span><span class=cF7>}</span><span class=cF0>;
<a name="l31"></a></span><span class=cFD>SYS_HEAP_DBG_FLAG</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>_CFG_HEAP_DBG</span><span class=cF0>;
<a name="l32"></a>
<a name="l33"></a> </span><span class=cF1>ALIGN</span><span class=cF0> 8,0
<a name="l34"></a></span><span class=cFD>SYS_CTRL_ALT_FLAGS</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l35"></a></span><span class=cFD>SYS_EXTERN_TABLE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l36"></a>
<a name="l37"></a></span><span class=cFD>SYS_CODE_BP</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l38"></a></span><span class=cFD>SYS_DATA_BP</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l39"></a>
<a name="l40"></a></span><span class=cFD>SYS_PROGRESSES</span><span class=cF0>::
<a name="l41"></a></span><span class=cFD>SYS_PROGRESS1</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l42"></a></span><span class=cFD>SYS_PROGRESS1_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l43"></a></span><span class=cFD>SYS_PROGRESS1_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l44"></a></span><span class=cFD>SYS_PROGRESS1_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l45"></a></span><span class=cFD>SYS_PROGRESS1_DESC</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>PROGRESS_DESC_LEN</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l46"></a></span><span class=cFD>SYS_PROGRESS2</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l47"></a></span><span class=cFD>SYS_PROGRESS2_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l48"></a></span><span class=cFD>SYS_PROGRESS2_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l49"></a></span><span class=cFD>SYS_PROGRESS2_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l50"></a></span><span class=cFD>SYS_PROGRESS2_DESC</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>PROGRESS_DESC_LEN</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l51"></a></span><span class=cFD>SYS_PROGRESS3</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l52"></a></span><span class=cFD>SYS_PROGRESS3_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l53"></a></span><span class=cFD>SYS_PROGRESS3_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l54"></a></span><span class=cFD>SYS_PROGRESS3_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l55"></a></span><span class=cFD>SYS_PROGRESS3_DESC</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>PROGRESS_DESC_LEN</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l56"></a></span><span class=cFD>SYS_PROGRESS4</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l57"></a></span><span class=cFD>SYS_PROGRESS4_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l58"></a></span><span class=cFD>SYS_PROGRESS4_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l59"></a></span><span class=cFD>SYS_PROGRESS4_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l60"></a></span><span class=cFD>SYS_PROGRESS4_DESC</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>PROGRESS_DESC_LEN</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l61"></a>#</span><span class=cF1>assert</span><span class=cF0> $-</span><span class=cFD>SYS_PROGRESSES</span><span class=cF0>==</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CProgress</span><span class=cF0>)*4
<a name="l62"></a>
<a name="l63"></a></span><span class=cFD>SYS_FOCUS_TASK</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l64"></a></span><span class=cFD>SYS_CPU_STRUCTS</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 0;
<a name="l65"></a></span><span class=cFD>SYS_MP_CNT</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 1;
<a name="l66"></a></span><span class=cFD>SYS_MP_CNT_INITIAL</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 1;
<a name="l67"></a></span><span class=cFD>SYS_MP_CNT_LOCK</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> 1;
<a name="l68"></a>
<a name="l69"></a> </span><span class=cF1>ALIGN</span><span class=cF0> </span><span class=cF3>DFT_CACHE_LINE_WIDTH</span><span class=cF0>,</span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l70"></a></span><span class=cFD>SYS_CACHE_LINE_WIDTH</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cF3>DFT_CACHE_LINE_WIDTH</span><span class=cF0>;
<a name="l71"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>DFT_CACHE_LINE_WIDTH</span><span class=cF0>-</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>)-8 </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l72"></a></span><span class=cFD>SYS_SEMAS</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>SEMA_SEMAS_NUM</span><span class=cF0>*</span><span class=cF3>DFT_CACHE_LINE_WIDTH</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(0);
<a name="l73"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l74"></a> </span><span class=cF1>ALIGN</span><span class=cF0> 16,</span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l75"></a></span><span class=cFD>CORE0_32BIT_INIT</span><span class=cF0>:: </span><span class=cF2>//Entry point for </span><a href="/Wb/Adam/Opt/Boot/BootRAM.HC.HTML#l33"><span class=cF4>BootRAM</span></a><span class=cF2>.</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> </span><span class=cF3>RFLAGG_START</span><span class=cF0>
<a name="l77"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>,</span><span class=cF3>SYS_START_CR0</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>MOV_CR0_EAX</span><span class=cF0>
<a name="l80"></a>
<a name="l81"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>,</span><span class=cF9>CGDT</span><span class=cF0>.boot_ds </span><span class=cF2>//LOAD DS SELECTOR</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l83"></a> </span><span class=cF1>BTS</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>SYS_RUN_LEVEL</span><span class=cF0>],</span><span class=cF3>RLf_32BIT</span><span class=cF0>
<a name="l84"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ESI</span><span class=cF0>,</span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>SYS_BOOT_PATCH_TABLE_BASE</span><span class=cF0>]
<a name="l85"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>EDI</span><span class=cF0>,</span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>MEM_BOOT_BASE</span><span class=cF0>]
<a name="l86"></a>
<a name="l87"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>AX</span><span class=cF0>,</span><span class=cF9>CGDT</span><span class=cF0>.ds
<a name="l88"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>DS</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ES</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>FS</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l91"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>GS</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l92"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>SS</span><span class=cF0>,</span><span class=cFC>AX</span><span class=cF0>
<a name="l93"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ESP</span><span class=cF0>,</span><span class=cF3>BOOT_RAM_LIMIT</span><span class=cF0> </span><span class=cF2>//Tmp Stk</span><span class=cF0>
<a name="l94"></a>
<a name="l95"></a></span><span class=cF2>//Patch abs addresses</span><span class=cF0>
<a name="l96"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>ECX</span><span class=cF0>,</span><span class=cF9>U32</span><span class=cF0> </span><span class=cF9>CPatchTableAbsAddr</span><span class=cF0>.abs_addres_cnt[</span><span class=cFC>ESI</span><span class=cF0>]
<a name="l97"></a> </span><span class=cF1>LEA</span><span class=cF0> </span><span class=cFC>ESI</span><span class=cF0>,</span><span class=cF9>U32</span><span class=cF0> </span><span class=cF9>CPatchTableAbsAddr</span><span class=cF0>.abs_addres[</span><span class=cFC>ESI</span><span class=cF0>]
<a name="l98"></a>@@05: </span><span class=cF1>LODSD</span><span class=cF0>
<a name="l99"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>EAX</span><span class=cF0>,</span><span class=cFC>EDI</span><span class=cF0>
<a name="l100"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFC>EAX</span><span class=cF0>],</span><span class=cFC>EDI</span><span class=cF0>
<a name="l101"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@05
<a name="l102"></a>
<a name="l103"></a> </span><span class=cF1>DU8</span><span class=cF0> 0xEA; </span><span class=cF2>//JMP CGDT.cs32:@@10</span><span class=cF0>
<a name="l104"></a> </span><span class=cF1>DU32</span><span class=cF0> @@10;
<a name="l105"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cF9>CGDT</span><span class=cF0>.cs32;
<a name="l106"></a>
<a name="l107"></a>@@10: </span><span class=cF1>BTS</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> [</span><span class=cFD>SYS_RUN_LEVEL</span><span class=cF0>],</span><span class=cF3>RLf_PATCHED</span><span class=cF0>
<a name="l108"></a>
<a name="l109"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_FIND_PCIBIOS_SERVICE_DIR</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_FIND_PCI_SERVICES</span><span class=cF0>
<a name="l111"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_INIT_PAGE_TABLES</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_INIT_16MEG_SYS_CODE_BP</span><span class=cF0>
<a name="l113"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> 0 </span><span class=cF2>//Return from next call will be 64-bit</span><span class=cF0>
<a name="l114"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_ENTER_LONG_MODE</span><span class=cF0>
<a name="l115"></a>
<a name="l116"></a> </span><span class=cF2>//We fall-thou to </span><a href="/Wb/Kernel/KStart64.HC.HTML#l1"><span class=cF4>KStart64</span></a><span class=cF2>, next.</span><span class=cF0>
<a name="l117"></a>}
</span></pre></body>
</html>