ZealOS/docs/Kernel/KMain.CC.html
TomAwezome 67479705de Add SATA port number reporting to DriveRep.
Improve Lex assert failure warning to give exact line number.
Remove some deprecated IDE functions.
Add default arg to Drive.
Fix raw-mode printing in StackRep, DriveRep, SATARep, Mount2, and CharGet.
Change LongLines cols default arg from 80 to 128.
2021-08-04 15:25:55 -04:00

288 lines
33 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>U0</span><span class=cF0> </span><span class=cFD>SysGlobalsInit</span><span class=cF0>()
<a name="l2"></a>{
<a name="l3"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
<a name="l4"></a> </span><span class=cF9>CRAXRBXRCXRDX</span><span class=cF0> regs;
<a name="l5"></a>
<a name="l6"></a> </span><span class=cF5>CPUId</span><span class=cF0>(</span><span class=cFE>0x1</span><span class=cF0>, &amp;regs);
<a name="l7"></a> </span><span class=cFB>sys_cache_line_width</span><span class=cF0> = regs.rbx.u8[</span><span class=cFE>1</span><span class=cF0>] * </span><span class=cFE>8</span><span class=cF0>;
<a name="l8"></a>
<a name="l9"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0> = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l10"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>sys_macro_head</span><span class=cF0>);
<a name="l11"></a>
<a name="l12"></a> </span><span class=cFB>blkdev</span><span class=cF0>.default_iso_filename = </span><span class=cF5>SysStrNew</span><span class=cF0>(</span><span class=cF3>DEFAULT_ISO_FILENAME</span><span class=cF0>);
<a name="l13"></a> </span><span class=cFB>blkdev</span><span class=cF0>.default_iso_c_filename = </span><span class=cF5>SysStrNew</span><span class=cF0>(</span><span class=cF3>DEFAULT_ISO_C_FILENAME</span><span class=cF0>);
<a name="l14"></a> </span><span class=cFB>blkdev</span><span class=cF0>.tmp_filename = </span><span class=cF5>SysStrNew</span><span class=cF0>(</span><span class=cF6>&quot;~/Tmp.DD&quot;</span><span class=cF0>);
<a name="l15"></a> </span><span class=cFB>blkdev</span><span class=cF0>.dvd_boot_is_good = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l16"></a>
<a name="l17"></a> #</span><span class=cF1>exe</span><span class=cF0>
<a name="l18"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (!kernel_config-&gt;mount_ide_auto_hd_let)
<a name="l20"></a> kernel_config-&gt;mount_ide_auto_hd_let = </span><span class=cF6>'C'</span><span class=cF0>;
<a name="l21"></a>
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (!kernel_config-&gt;mount_ide_auto_cd_let)
<a name="l23"></a> kernel_config-&gt;mount_ide_auto_cd_let = </span><span class=cF6>'T'</span><span class=cF0>;
<a name="l24"></a>
<a name="l25"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;blkdev.first_hd_drive_let = %d;&quot;</span><span class=cF0>, kernel_config-&gt;mount_ide_auto_hd_let);
<a name="l26"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;blkdev.first_dvd_drive_let = %d;&quot;</span><span class=cF0>, kernel_config-&gt;mount_ide_auto_cd_let);
<a name="l27"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l28"></a>
<a name="l29"></a> </span><span class=cF5>DebugMode</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
<a name="l30"></a>
<a name="l31"></a> </span><span class=cFB>rev_bits_table</span><span class=cF0> = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFE>256</span><span class=cF0>);
<a name="l32"></a>
<a name="l33"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>256</span><span class=cF0>; i++)
<a name="l34"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; </span><span class=cFE>8</span><span class=cF0>; j++)
<a name="l35"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;i, </span><span class=cFE>7</span><span class=cF0> - j</span><span class=cF7>)</span><span class=cF0>)
<a name="l36"></a> </span><span class=cF5>Bts</span><span class=cF0>(</span><span class=cFB>rev_bits_table</span><span class=cF0> + i, j);
<a name="l37"></a>
<a name="l38"></a> </span><span class=cFB>ext</span><span class=cF0> = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>EXT_EXTS_NUM</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF7>)</span><span class=cF0>);
<a name="l39"></a> </span><span class=cFB>fp_getstr2</span><span class=cF0> = &amp;</span><span class=cFD>SysGetStr2</span><span class=cF0>;
<a name="l40"></a> </span><span class=cFD>KeyDevInit</span><span class=cF0>;
<a name="l41"></a>
<a name="l42"></a> #</span><span class=cF1>exe</span><span class=cF0>
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l44"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;blkdev.boot_drive_let = '%C';&quot;</span><span class=cF0>, kernel_config-&gt;boot_drive_let);
<a name="l45"></a>
<a name="l46"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;#exe{ Option(OPTf_WARN_PAREN, OFF); }&quot;</span><span class=cF0>);
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;DiskCacheInit(%s);&quot;</span><span class=cF0>, kernel_config-&gt;disk_cache_size_exp);
<a name="l49"></a>
<a name="l50"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;#exe{ Option(OPTf_WARN_PAREN, ON); }&quot;</span><span class=cF0>);
<a name="l51"></a> </span><span class=cF7>}</span><span class=cF0>;
<a name="l52"></a>
<a name="l53"></a> </span><span class=cFD>pow10_I64</span><span class=cF0> = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF1>F64</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF7>(</span><span class=cFE>308</span><span class=cF0> + </span><span class=cFE>308</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>);
<a name="l54"></a> </span><span class=cF1>for</span><span class=cF0> (i = -</span><span class=cFE>308</span><span class=cF0>; i &lt; </span><span class=cFE>309</span><span class=cF0>; i++)
<a name="l55"></a> </span><span class=cFD>pow10_I64</span><span class=cF0>[i + </span><span class=cFE>309</span><span class=cF0>] = </span><span class=cF5>Pow10</span><span class=cF0>(i);
<a name="l56"></a>
<a name="l57"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>screencast</span><span class=cF0>.sound_head);
<a name="l58"></a> </span><span class=cFB>screencast</span><span class=cF0>.t0_now = </span><span class=cF5>Now</span><span class=cF0>;
<a name="l59"></a> </span><span class=cFB>screencast</span><span class=cF0>.t0_tS = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l60"></a> </span><span class=cFB>screencast</span><span class=cF0>.ona = </span><span class=cFB>screencast</span><span class=cF0>.sound_head.ona = </span><span class=cFE>0</span><span class=cF0>;
<a name="l61"></a>
<a name="l62"></a> </span><span class=cF5>ProgressBarsReset</span><span class=cF0>;
<a name="l63"></a>
<a name="l64"></a> </span><span class=cF5>QueueInit</span><span class=cF0>(&amp;</span><span class=cFB>dev</span><span class=cF0>.pci_head);
<a name="l65"></a> </span><span class=cFB>dev</span><span class=cF0>.mem64_ptr = </span><span class=cFB>mem_mapped_space</span><span class=cF0>;
<a name="l66"></a>
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_boot_src</span><span class=cF0>.u8[</span><span class=cFE>0</span><span class=cF0>] != </span><span class=cF3>BOOT_SRC_RAM</span><span class=cF0>)
<a name="l68"></a> </span><span class=cF7>{</span><span class=cF2>//framebuffer pointer is already linear</span><span class=cF0>
<a name="l69"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(&amp;</span><span class=cFB>sys_vbe_info</span><span class=cF0>.video_modes);
<a name="l70"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(&amp;</span><span class=cFB>sys_vbe_info</span><span class=cF0>.oem);
<a name="l71"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(&amp;</span><span class=cFB>sys_vbe_info</span><span class=cF0>.vendor);
<a name="l72"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(&amp;</span><span class=cFB>sys_vbe_info</span><span class=cF0>.product_name);
<a name="l73"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(&amp;</span><span class=cFB>sys_vbe_info</span><span class=cF0>.product_revision);
<a name="l74"></a> </span><span class=cF5>Seg2Linear</span><span class=cF0>(</span><span class=cFD>SYS_FONT_PTR</span><span class=cF0>);
<a name="l75"></a> </span><span class=cFB>sys_vbe_info</span><span class=cF0>.software_revision = </span><span class=cFD>Bcd2Binary</span><span class=cF0>(</span><span class=cFB>sys_vbe_info</span><span class=cF0>.software_revision);
<a name="l76"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l77"></a>
<a name="l78"></a> </span><span class=cFB>debug</span><span class=cF0>.fun_seg_cache = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF3>FUN_SEG_CACHE_SIZE</span><span class=cF0> * </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFunSegCache</span><span class=cF7>)</span><span class=cF0>);
<a name="l79"></a> </span><span class=cFB>debug</span><span class=cF0>.int_fault_code = </span><span class=cFD>IntFaultHandlersNew</span><span class=cF0>;
<a name="l80"></a>}
<a name="l81"></a>
<a name="l82"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>SysGrInit</span><span class=cF0>()
<a name="l83"></a>{
<a name="l84"></a> </span><span class=cF9>I64</span><span class=cF0> i, j;
<a name="l85"></a> </span><span class=cFB>text</span><span class=cF0>.aux_font = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>256</span><span class=cF0> * </span><span class=cFE>8</span><span class=cF0>); </span><span class=cF2>//256 U64s</span><span class=cF0>
<a name="l86"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.aux_font, *</span><span class=cFD>SYS_FONT_PTR</span><span class=cF7>(</span><span class=cF9>U32</span><span class=cF7>)</span><span class=cF0>, </span><span class=cFE>256</span><span class=cF0> * </span><span class=cFE>8</span><span class=cF0>);
<a name="l87"></a>
<a name="l88"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>256</span><span class=cF0>; i++)
<a name="l89"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; </span><span class=cFE>8</span><span class=cF0>; j++)
<a name="l90"></a> </span><span class=cFB>text</span><span class=cF0>.aux_font[i].u8[j] = </span><span class=cFB>rev_bits_table</span><span class=cF0>[</span><span class=cFB>text</span><span class=cF0>.aux_font[i].u8[j]];
<a name="l91"></a>
<a name="l92"></a> </span><span class=cFB>text</span><span class=cF0>.font = </span><span class=cFD>sys_font_std</span><span class=cF0>;
<a name="l93"></a>
<a name="l94"></a> </span><span class=cF2>//patch some chars</span><span class=cF0>
<a name="l95"></a> </span><span class=cFB>text</span><span class=cF0>.aux_font[</span><span class=cFE>10</span><span class=cF0>] = </span><span class=cFB>text</span><span class=cF0>.font[</span><span class=cFE>10</span><span class=cF0>]; </span><span class=cF2>//&quot;Return&quot; symbol </span><span class=cF0>
<a name="l96"></a> </span><span class=cFB>text</span><span class=cF0>.aux_font[</span><span class=cFE>255</span><span class=cF0>] = </span><span class=cFB>text</span><span class=cF0>.font[</span><span class=cFE>255</span><span class=cF0>]; </span><span class=cF2>//Block symbol .</span><span class=cF0>
<a name="l97"></a>
<a name="l98"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cF6>'.'</span><span class=cF0>; i &lt; </span><span class=cF6>'.'</span><span class=cF0>; i++)
<a name="l99"></a> </span><span class=cFB>text</span><span class=cF0>.aux_font[i] = </span><span class=cFB>text</span><span class=cF0>.font[i];
<a name="l100"></a>
<a name="l101"></a> </span><span class=cFB>text</span><span class=cF0>.border_chars[</span><span class=cFE>2</span><span class=cF0>] (</span><span class=cF9>I64</span><span class=cF0>) = </span><span class=cF6>'........'</span><span class=cF0>;
<a name="l102"></a> </span><span class=cFB>text</span><span class=cF0>.border_chars[</span><span class=cFE>10</span><span class=cF0>](</span><span class=cF9>U32</span><span class=cF0>) = </span><span class=cF6>'....'</span><span class=cF0>;
<a name="l103"></a>
<a name="l104"></a> </span><span class=cFB>text</span><span class=cF0>.cols = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width / </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l105"></a> </span><span class=cFB>text</span><span class=cF0>.rows = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.height / </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l106"></a>
<a name="l107"></a> </span><span class=cFB>text</span><span class=cF0>.screen_size = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.width * </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.height;
<a name="l108"></a> </span><span class=cFB>text</span><span class=cF0>.buffer_size = </span><span class=cFB>text</span><span class=cF0>.screen_size * </span><span class=cFE>4</span><span class=cF0>; </span><span class=cF2>//buffer for 32-bit, but only 16 colors now.</span><span class=cF0>
<a name="l109"></a> </span><span class=cFB>text</span><span class=cF0>.raw_screen = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.buffer_size);
<a name="l110"></a> </span><span class=cFB>text</span><span class=cF0>.fb_alias = </span><span class=cFB>sys_vbe_mode</span><span class=cF0>.framebuffer;
<a name="l111"></a>
<a name="l112"></a> </span><span class=cF5>MemSetU32</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.fb_alias, </span><span class=cF3>BLACK32</span><span class=cF0>, </span><span class=cFB>text</span><span class=cF0>.screen_size);
<a name="l113"></a> </span><span class=cFB>text</span><span class=cF0>.vga_alias = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFB>text</span><span class=cF0>.rows * </span><span class=cFB>text</span><span class=cF0>.cols * </span><span class=cFE>8</span><span class=cF0>);
<a name="l114"></a>}
<a name="l115"></a>
<a name="l116"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>TimerInit</span><span class=cF0>()
<a name="l117"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/PIT.DD.html#l1"><span class=cF4>::/Doc/PIT.DD</span></a><span class=cF2>.</span><span class=cF0>
<a name="l118"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PIT_CMD</span><span class=cF0>, </span><span class=cF3>PIT_CMDF_CHANNEL0</span><span class=cF0> | </span><span class=cF3>PIT_CMDF_OPMODE_RATE_GEN</span><span class=cF0> | </span><span class=cF3>PIT_CMDF_ACCESS_WORD</span><span class=cF0>);
<a name="l119"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PIT_0</span><span class=cF0>, </span><span class=cF3>SYS_TIMER0_PERIOD</span><span class=cF0>);
<a name="l120"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PIT_0</span><span class=cF0>, </span><span class=cF3>SYS_TIMER0_PERIOD</span><span class=cF0> &gt;&gt; </span><span class=cFE>8</span><span class=cF0>);
<a name="l121"></a>}
<a name="l122"></a>
<a name="l123"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Reboot</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> format_ramdisks=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l124"></a>{</span><span class=cF2>//Hardware reset.</span><span class=cF0>
<a name="l125"></a> </span><span class=cF1>if</span><span class=cF0> (format_ramdisks)
<a name="l126"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DriveIsWritable</span><span class=cF7>(</span><span class=cF6>'A'</span><span class=cF7>)</span><span class=cF0>)
<a name="l128"></a> </span><span class=cF5>Format</span><span class=cF0>(</span><span class=cF6>'A'</span><span class=cF0>,, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FSt_REDSEA</span><span class=cF0>);
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>DriveIsWritable</span><span class=cF7>(</span><span class=cF6>'B'</span><span class=cF7>)</span><span class=cF0>)
<a name="l130"></a> </span><span class=cF5>Format</span><span class=cF0>(</span><span class=cF6>'B'</span><span class=cF0>,, </span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF3>FSt_REDSEA</span><span class=cF0>);
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l132"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mp_count</span><span class=cF0> &gt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l134"></a> </span><span class=cF5>MPHalt</span><span class=cF0>;
<a name="l135"></a> *</span><span class=cFE>0x472</span><span class=cF0>(</span><span class=cF9>U16</span><span class=cF0> *) = </span><span class=cFE>0</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cFE>0x70</span><span class=cF0>, </span><span class=cFE>0x8F</span><span class=cF0>);
<a name="l137"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cFE>0x71</span><span class=cF0>, </span><span class=cFE>0x00</span><span class=cF0>);
<a name="l138"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cFE>0x70</span><span class=cF0>, </span><span class=cFE>0x00</span><span class=cF0>);
<a name="l139"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cFE>0x92</span><span class=cF0>, </span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cFE>0x92</span><span class=cF7>)</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0>);
<a name="l140"></a> </span><span class=cF5>SysHlt</span><span class=cF0>;
<a name="l141"></a>}
<a name="l142"></a>
<a name="l143"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KMain</span><span class=cF0>()
<a name="l144"></a>{</span><span class=cF2>//Continued from </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KStart64.CC.html#l50"><span class=cF4>KStart64.CC</span></a><span class=cF0>
<a name="l145"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
<a name="l146"></a>
<a name="l147"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PCSPKR</span><span class=cF0>, </span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF3>PCSPKR</span><span class=cF7>)</span><span class=cF0> &amp; ~</span><span class=cFE>3</span><span class=cF0>); </span><span class=cF2>//Sound;</span><span class=cF0>
<a name="l148"></a> </span><span class=cFB>sys_task</span><span class=cF0> = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l149"></a> </span><span class=cFD>BlkPoolsInit</span><span class=cF0>;
<a name="l150"></a> </span><span class=cFD>SysGlobalsInit</span><span class=cF0>;
<a name="l151"></a> </span><span class=cFD>Mem32DevInit</span><span class=cF0>;
<a name="l152"></a> </span><span class=cFD>UncachedAliasAlloc</span><span class=cF0>;
<a name="l153"></a> </span><span class=cFD>LoadKernel</span><span class=cF0>;
<a name="l154"></a> </span><span class=cFD>SysGrInit</span><span class=cF0>;
<a name="l155"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_name, </span><span class=cF6>&quot;System Task CPU00&quot;</span><span class=cF0>);
<a name="l156"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_title, </span><span class=cF5>Fs</span><span class=cF0>-&gt;task_name);
<a name="l157"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;title_src = </span><span class=cF3>TTS_TASK_NAME</span><span class=cF0>;
<a name="l158"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_right = </span><span class=cFB>text</span><span class=cF0>.cols - </span><span class=cFE>2</span><span class=cF0>;
<a name="l159"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;win_top++;
<a name="l160"></a> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>;
<a name="l161"></a>
<a name="l162"></a> </span><span class=cFD>SysDefinesLoad</span><span class=cF0>;
<a name="l163"></a> </span><span class=cFD>Core0Init</span><span class=cF0>;
<a name="l164"></a> </span><span class=cFD>IntInit1</span><span class=cF0>;
<a name="l165"></a>
<a name="l166"></a> </span><span class=cF2>//Before this point use </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l129"><span class=cF4>Sound</span></a><span class=cF2>() and </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KMisc.CC.html#l88"><span class=cF4>Busy</span></a><span class=cF2>()</span><span class=cF0>
<a name="l167"></a> </span><span class=cF2>//to debug. After this point, use </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KDebug.CC.html#l235"><span class=cF4>RawPrint</span></a><span class=cF2>()</span><span class=cF0>
<a name="l168"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_RAW</span><span class=cF0>);
<a name="l169"></a> </span><span class=cF6>&quot;ZealOS V%0.2f\t%D %T\n\n&quot;</span><span class=cF0>, </span><span class=cFB>sys_os_version</span><span class=cF0>, </span><span class=cFB>sys_compile_time</span><span class=cF0>, </span><span class=cFB>sys_compile_time</span><span class=cF0>;
<a name="l170"></a>
<a name="l171"></a> </span><span class=cFD>TimerInit</span><span class=cF0>;
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>MemBIOSTotal</span><span class=cF0> &lt; </span><span class=cF5>ToI64</span><span class=cF0> </span><span class=cF7>(</span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>95</span><span class=cF0> * </span><span class=cF3>MEM_MIN_MEG</span><span class=cF0> * </span><span class=cFE>0x100000</span><span class=cF7>)</span><span class=cF0> )
<a name="l173"></a> </span><span class=cF5>RawPrint</span><span class=cF0>(</span><span class=cFE>4000</span><span class=cF0>, </span><span class=cF6>&quot;!!! Requires 256Meg of RAM Memory !!!&quot;</span><span class=cF0>);
<a name="l174"></a>
<a name="l175"></a> </span><span class=cFD>IntPICInit</span><span class=cF0>;
<a name="l176"></a> </span><span class=cF6>&quot;Enable IRQs\n&quot;</span><span class=cF0>;
<a name="l177"></a> </span><span class=cF5>RFlagsSet</span><span class=cF0>(</span><span class=cF3>RFLAGG_NORMAL</span><span class=cF0>);
<a name="l178"></a> </span><span class=cF5>Busy</span><span class=cF0>(</span><span class=cFE>2000</span><span class=cF0>);
<a name="l179"></a> </span><span class=cFD>IntInit2</span><span class=cF0>;
<a name="l180"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_INTERRUPTS</span><span class=cF0>);
<a name="l181"></a>
<a name="l182"></a> </span><span class=cF5>TimeCal</span><span class=cF0>;
<a name="l183"></a> </span><span class=cF6>&quot;BlkDevsInitAll;\n&quot;</span><span class=cF0>;
<a name="l184"></a> </span><span class=cFD>BlkDevsInitAll</span><span class=cF0>;
<a name="l185"></a> </span><span class=cF6>&quot;DiskChange(':');\n&quot;</span><span class=cF0>;
<a name="l186"></a> </span><span class=cF5>DiskChange</span><span class=cF0>(</span><span class=cF6>':'</span><span class=cF0>);
<a name="l187"></a>
<a name="l188"></a> #</span><span class=cF1>exe</span><span class=cF0>
<a name="l189"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l190"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;HomeSet(\&quot;%s\&quot;);\n&quot;</span><span class=cF0>
<a name="l191"></a> </span><span class=cF6>&quot;blkdev.ins_base0 = %d;&quot;</span><span class=cF0>
<a name="l192"></a> </span><span class=cF6>&quot;blkdev.ins_base1 = %d;&quot;</span><span class=cF0>
<a name="l193"></a> </span><span class=cF6>&quot;blkdev.ins_unit = %d;\n&quot;</span><span class=cF0>,
<a name="l194"></a> kernel_config-&gt;home_dir,
<a name="l195"></a> </span><span class=cFB>blkdev</span><span class=cF0>.ins_base0, </span><span class=cFB>blkdev</span><span class=cF0>.ins_base1, </span><span class=cFB>blkdev</span><span class=cF0>.ins_unit);
<a name="l196"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l197"></a>
<a name="l198"></a> </span><span class=cF5>Gs</span><span class=cF0>-&gt;idle_task-&gt;cur_dv = </span><span class=cFB>blkdev</span><span class=cF0>.let_to_drive[*</span><span class=cFB>blkdev</span><span class=cF0>.home_dir - </span><span class=cF6>'A'</span><span class=cF0>];
<a name="l199"></a> </span><span class=cF5>DriveRep</span><span class=cF0>;
<a name="l200"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>blkdev</span><span class=cF0>.dvd_boot_is_good)
<a name="l201"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l202"></a> bd = </span><span class=cF5>Letter2BlkDev</span><span class=cF0>(</span><span class=cF6>':'</span><span class=cF0>);
<a name="l203"></a> </span><span class=cF1>if</span><span class=cF0> (bd-&gt;type == </span><span class=cF3>BDT_ATAPI</span><span class=cF0>) {
<a name="l204"></a> </span><span class=cFB>blkdev</span><span class=cF0>.ins_base0 = bd-&gt;base0;
<a name="l205"></a> </span><span class=cFB>blkdev</span><span class=cF0>.ins_base1 = bd-&gt;base1;
<a name="l206"></a> </span><span class=cFB>blkdev</span><span class=cF0>.ins_unit = bd-&gt;unit;
<a name="l207"></a> }
<a name="l208"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l209"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_BLKDEV</span><span class=cF0>);
<a name="l210"></a>
<a name="l211"></a> #</span><span class=cF1>exe</span><span class=cF0>
<a name="l212"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (!kernel_config-&gt;opts[CONFIG_NO_MP])
<a name="l214"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;\&quot;MultiCore Start\\n\\n\&quot;;&quot;</span><span class=cF0>
<a name="l215"></a> </span><span class=cF6>&quot;Core0StartMP;&quot;</span><span class=cF0>
<a name="l216"></a> </span><span class=cF6>&quot;LBts(&amp;sys_run_level, RLf_MP);&quot;</span><span class=cF0>);
<a name="l217"></a> </span><span class=cF7>}</span><span class=cF0>;
<a name="l218"></a>
<a name="l219"></a> </span><span class=cF5>KbdMouseInit</span><span class=cF0>;
<a name="l220"></a> </span><span class=cF5>MouseInit</span><span class=cF0>;
<a name="l221"></a> </span><span class=cF5>KbdInit</span><span class=cF0>;
<a name="l222"></a> </span><span class=cF5>Spawn</span><span class=cF0>(&amp;</span><span class=cF5>MouseHardDriverInstall</span><span class=cF0>);
<a name="l223"></a>
<a name="l224"></a> </span><span class=cF6>&quot;Loading Compiler\n&quot;</span><span class=cF0>;
<a name="l225"></a> </span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF6>&quot;/Compiler&quot;</span><span class=cF0>);
<a name="l226"></a> </span><span class=cF5>Load</span><span class=cF0>(</span><span class=cF6>&quot;Compiler&quot;</span><span class=cF0>, </span><span class=cF3>LDF_SILENT</span><span class=cF0>);
<a name="l227"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_COMPILER</span><span class=cF0>);
<a name="l228"></a>
<a name="l229"></a> </span><span class=cF5>DebugMode</span><span class=cF0>(</span><span class=cF3>OFF</span><span class=cF0>);
<a name="l230"></a> </span><span class=cFB>counts</span><span class=cF0>.time_stamp_freq_initial = </span><span class=cF5>TimeCal</span><span class=cF0>;
<a name="l231"></a> </span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l232"></a> </span><span class=cF1>try</span><span class=cF0>
<a name="l233"></a> </span><span class=cF5>ExeFile</span><span class=cF0>(</span><span class=cF6>&quot;StartOS&quot;</span><span class=cF0>); </span><span class=cF2>//Continues </span><a href="https://zeal-operating-system.github.io/ZealOS/StartOS.CC.html#l1"><span class=cF4>/StartOS.CC</span></a><span class=cF0>
<a name="l234"></a> </span><span class=cF1>catch</span><span class=cF0>
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l236"></a> </span><span class=cF5>Raw</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
<a name="l237"></a> </span><span class=cF5>Silent</span><span class=cF0>(</span><span class=cF3>OFF</span><span class=cF0>);
<a name="l238"></a> </span><span class=cF5>GetOutOfDollar</span><span class=cF0>;
<a name="l239"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
<a name="l240"></a> </span><span class=cF5>Debug</span><span class=cF0>;
<a name="l241"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l242"></a>
<a name="l243"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;</span><span class=cFB>sys_run_level</span><span class=cF0>, </span><span class=cF3>RLf_SYSTEM_SERVER</span><span class=cF0>);
<a name="l244"></a> </span><span class=cF5>ServerTaskCont</span><span class=cF0>; </span><span class=cF2>//Never to return</span><span class=cF0>
<a name="l245"></a>}
<a name="l246"></a>
<a name="l247"></a></span><span class=cF1>asm</span><span class=cF0>
<a name="l248"></a>{
<a name="l249"></a>
<a name="l250"></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="l251"></a></span><span class=cFD>SYS_KERNEL_END</span><span class=cF0>::
<a name="l252"></a>#</span><span class=cF1>exe</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l253"></a> </span><span class=cF1>if</span><span class=cF0> (kernel_config-&gt;opts[CONFIG_DEBUG_DISTRO])
<a name="l254"></a> </span><span class=cF5>StreamPrint</span><span class=cF0>(</span><span class=cF6>&quot;DU8 0x%X - (SYS_KERNEL_END-SYS_KERNEL + BOOT_RAM_BASE + sizeof(CBinFile)) DUP (0);&quot;</span><span class=cF0>
<a name="l255"></a> </span><span class=cF6>&quot;BINFILE \&quot;%s\&quot;;&quot;</span><span class=cF0>,
<a name="l256"></a> kernel_config-&gt;debug_distro_start, kernel_config-&gt;debug_distro_file);
<a name="l257"></a></span><span class=cF7>}</span><span class=cF0>;
<a name="l258"></a>
<a name="l259"></a>}
</span></pre></body>
</html>