ZealOS/docs/Kernel/KStart32.CC.html
TomAwezome 1b75d91002 Fix Mount AHCI Port selection.
Add arg to SATARep to specify drive types to show.
Add checks in AHCIPortInit to verify port signatures, add helper method to get signatures from port.
2021-08-02 16:40:05 -04:00

151 lines
20 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.13">
<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=cF1>asm</span><span class=cF0> {
<a name="l2"></a></span><span class=cF1>USE32</span><span class=cF0>
<a name="l3"></a>
<a name="l4"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l5"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>ASM Global vars not required for 16-bit start-up</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>ALIGN</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>, </span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a></span><span class=cFD>MEM_HEAP_BASE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l9"></a></span><span class=cFD>MEM_HEAP_LIMIT</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l10"></a></span><span class=cFD>MEM_PAGE_SIZE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l11"></a></span><span class=cFD>MEM_MAPPED_SPACE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l12"></a></span><span class=cFD>MEM_2MEG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l13"></a></span><span class=cFD>MEM_1GIG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l14"></a></span><span class=cFD>MEM_512GIG_NUM</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l15"></a></span><span class=cFD>MEM_PML2</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l16"></a></span><span class=cFD>MEM_PML3</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l17"></a></span><span class=cFD>MEM_PML4</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l18"></a>
<a name="l19"></a>#</span><span class=cF1>exe</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l20"></a>
<a name="l21"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</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="l22"></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="l23"></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="l24"></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="l25"></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="l26"></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="l27"></a>
<a name="l28"></a> kernel_config-&gt;opts[CONFIG_MEM_INIT],
<a name="l29"></a> kernel_config-&gt;mem_init_val,
<a name="l30"></a> kernel_config-&gt;opts[CONFIG_HEAP_INIT],
<a name="l31"></a> kernel_config-&gt;heap_init_val,
<a name="l32"></a> kernel_config-&gt;opts[CONFIG_VAR_INIT],
<a name="l33"></a> kernel_config-&gt;var_init_val);
<a name="l34"></a></span><span class=cF7>}</span><span class=cF0>;
<a name="l35"></a></span><span class=cFD>SYS_HEAP_DEBUG_FLAG</span><span class=cF0>:: </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>_CONFIG_HEAP_DEBUG</span><span class=cF0>;
<a name="l36"></a>
<a name="l37"></a> </span><span class=cF1>ALIGN</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>
<a name="l38"></a></span><span class=cFD>SYS_CTRL_ALT_FLAGS</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l39"></a></span><span class=cFD>SYS_EXTERN_TABLE</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l40"></a>
<a name="l41"></a></span><span class=cFD>SYS_CODE_BP</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l42"></a></span><span class=cFD>SYS_DATA_BP</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l43"></a>
<a name="l44"></a></span><span class=cFD>SYS_PROGRESSES</span><span class=cF0>::
<a name="l45"></a></span><span class=cFD>SYS_PROGRESS1</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l46"></a></span><span class=cFD>SYS_PROGRESS1_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l47"></a></span><span class=cFD>SYS_PROGRESS1_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l48"></a></span><span class=cFD>SYS_PROGRESS1_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l49"></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>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l50"></a></span><span class=cFD>SYS_PROGRESS2</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l51"></a></span><span class=cFD>SYS_PROGRESS2_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l52"></a></span><span class=cFD>SYS_PROGRESS2_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l53"></a></span><span class=cFD>SYS_PROGRESS2_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l54"></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>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l55"></a></span><span class=cFD>SYS_PROGRESS3</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l56"></a></span><span class=cFD>SYS_PROGRESS3_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l57"></a></span><span class=cFD>SYS_PROGRESS3_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l58"></a></span><span class=cFD>SYS_PROGRESS3_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l59"></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>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l60"></a></span><span class=cFD>SYS_PROGRESS4</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l61"></a></span><span class=cFD>SYS_PROGRESS4_MAX</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l62"></a></span><span class=cFD>SYS_PROGRESS4_T0</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l63"></a></span><span class=cFD>SYS_PROGRESS4_TF</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l64"></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>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l65"></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>) * </span><span class=cFE>4</span><span class=cF0>
<a name="l66"></a>
<a name="l67"></a></span><span class=cFD>SYS_FOCUS_TASK</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l68"></a></span><span class=cFD>SYS_CPU_STRUCTS</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
<a name="l69"></a></span><span class=cFD>SYS_MP_COUNT</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>;
<a name="l70"></a></span><span class=cFD>SYS_MP_COUNT_INITIAL</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>;
<a name="l71"></a></span><span class=cFD>SYS_MP_COUNT_LOCK</span><span class=cF0>:: </span><span class=cF1>DU64</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>;
<a name="l72"></a>
<a name="l73"></a> </span><span class=cF1>ALIGN</span><span class=cF0> </span><span class=cF3>DEFAULT_CACHE_LINE_WIDTH</span><span class=cF0>, </span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l74"></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>DEFAULT_CACHE_LINE_WIDTH</span><span class=cF0>;
<a name="l75"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>DEFAULT_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>) - </span><span class=cFE>8</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l76"></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>DEFAULT_CACHE_LINE_WIDTH</span><span class=cF0> </span><span class=cF1>DUP</span><span class=cF0>(</span><span class=cFE>0</span><span class=cF0>);
<a name="l77"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>ALIGN</span><span class=cF0> </span><span class=cFE>16</span><span class=cF0>, </span><span class=cF3>OC_NOP</span><span class=cF0>
<a name="l79"></a>
<a name="l80"></a></span><span class=cFD>CORE0_32BIT_INIT</span><span class=cF0>:: </span><span class=cF2>//Entry point for </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootRAM.CC.html#l33"><span class=cF4>BootRAM</span></a><span class=cF2>.</span><span class=cF0>
<a name="l81"></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="l82"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l83"></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="l84"></a> </span><span class=cF1>MOV_CR0_EAX</span><span class=cF0>
<a name="l85"></a>
<a name="l86"></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="l87"></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="l88"></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="l89"></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="l90"></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="l91"></a>
<a name="l92"></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="l93"></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="l94"></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="l95"></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="l96"></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="l97"></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="l98"></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 Stack</span><span class=cF0>
<a name="l99"></a>
<a name="l100"></a></span><span class=cF2>//Patch abs addresses</span><span class=cF0>
<a name="l101"></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_count[</span><span class=cFC>ESI</span><span class=cF0>]
<a name="l102"></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="l103"></a>@@05: </span><span class=cF1>LODSD</span><span class=cF0>
<a name="l104"></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="l105"></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="l106"></a> </span><span class=cF1>LOOP</span><span class=cF0> @@05
<a name="l107"></a>
<a name="l108"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0xEA</span><span class=cF0>; </span><span class=cF2>//JMP CGDT.cs32:@@10</span><span class=cF0>
<a name="l109"></a> </span><span class=cF1>DU32</span><span class=cF0> @@10;
<a name="l110"></a> </span><span class=cF1>DU16</span><span class=cF0> </span><span class=cF9>CGDT</span><span class=cF0>.cs32;
<a name="l111"></a>
<a name="l112"></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="l113"></a>
<a name="l114"></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="l115"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_FIND_PCI_SERVICES</span><span class=cF0>
<a name="l116"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_INIT_PAGE_TABLES</span><span class=cF0>
<a name="l117"></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="l118"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cF9>U32</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0> </span><span class=cF2>//Return from next call will be 64-bit</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>SYS_ENTER_LONG_MODE</span><span class=cF0>
<a name="l120"></a>
<a name="l121"></a> </span><span class=cF2>//We fall-through to </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KStart64.CC.html#l1"><span class=cF4>KStart64</span></a><span class=cF2>, next.</span><span class=cF0>
<a name="l122"></a>}
</span></pre></body>
</html>