templeos-info/public/Wb/Adam/Opt/Boot/BootRAM.HC.HTML

92 lines
9.6 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=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Call&quot;</span><span class=cF0>
<a name="l2"></a></span><span class=cF1>asm</span><span class=cF0> {
<a name="l3"></a></span><span class=cFD>_HI_CALL</span><span class=cF0>::
<a name="l4"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l5"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>,</span><span class=cFC>RSP</span><span class=cF0>
<a name="l6"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> 16[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l7"></a> </span><span class=cF1>TEST</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,</span><span class=cFC>RAX</span><span class=cF0>
<a name="l8"></a> </span><span class=cF1>JZ</span><span class=cF0> @@05
<a name="l9"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
<a name="l10"></a>@@05: </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l11"></a> </span><span class=cF1>RET1</span><span class=cF0> 8
<a name="l12"></a></span><span class=cF2>//************************************</span><span class=cF0>
<a name="l13"></a></span><span class=cFD>_HI_MEMCPY</span><span class=cF0>::
<a name="l14"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>,</span><span class=cFC>RSP</span><span class=cF0>
<a name="l16"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l17"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>CLD</span><span class=cF0>
<a name="l19"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l20"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG2</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l21"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RCX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> </span><span class=cF3>SF_ARG3</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l22"></a> </span><span class=cF1>REP_MOVSB</span><span class=cF0>
<a name="l23"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,</span><span class=cFC>RDI</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDI</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RSI</span><span class=cF0>
<a name="l26"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>RET1</span><span class=cF0> 24
<a name="l28"></a>}
<a name="l29"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_HI_CALL</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>HiCall</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *machine_code);
<a name="l30"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_HI_MEMCPY</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>HiMemCpy</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dst,</span><span class=cF1>U8</span><span class=cF0> *src,</span><span class=cF9>I64</span><span class=cF0> cnt);
<a name="l31"></a>
<a name="l32"></a>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;Boot&quot;</span><span class=cF0>
<a name="l33"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>BootRAM</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>)
<a name="l34"></a>{</span><span class=cF2>//Softboot Kernel.BIN file. No hardware reset.</span><span class=cF0>
<a name="l35"></a> </span><span class=cF9>I64</span><span class=cF0> size;
<a name="l36"></a> </span><span class=cF9>CKernel</span><span class=cF0> *hi_image,*lo_image=</span><span class=cFB>mem_boot_base</span><span class=cF0>-</span><span class=cF1>sizeof</span><span class=cF0>(</span><span class=cF9>CBinFile</span><span class=cF0>),
<a name="l37"></a> </span><span class=cF1>reg</span><span class=cF0> *sys_ram_reboot;
<a name="l38"></a> </span><span class=cF1>if</span><span class=cF0> (!filename)
<a name="l39"></a> filename=</span><span class=cF6>&quot;::/&quot;</span><span class=cF0> </span><span class=cF3>KERNEL_BIN_C</span><span class=cF0>;
<a name="l40"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>hi_image=</span><span class=cF5>FileRead</span><span class=cF0>(filename,&amp;size)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF1>return</span><span class=cF0>;
<a name="l41"></a> </span><span class=cF1>while</span><span class=cF0> (hi_image&lt;0x100000); </span><span class=cF2>//If alloc from low 640K, just get another copy.</span><span class=cF0>
<a name="l42"></a>
<a name="l43"></a> </span><span class=cF1>do</span><span class=cF0> sys_ram_reboot=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFD>SYS_RAM_REBOOT_END</span><span class=cF0>-</span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>,</span><span class=cF5>Fs</span><span class=cF0>-&gt;code_heap);
<a name="l44"></a> </span><span class=cF1>while</span><span class=cF0> (sys_ram_reboot&lt;0x100000);
<a name="l45"></a>
<a name="l46"></a> hi_image-&gt;boot_src=</span><span class=cF3>BOOT_SRC_RAM</span><span class=cF0>;
<a name="l47"></a> hi_image-&gt;boot_blk=0;
<a name="l48"></a> hi_image-&gt;boot_patch_table_base=lo_image(</span><span class=cF1>U8</span><span class=cF0> *)+hi_image-&gt;h.patch_table_offset;
<a name="l49"></a> hi_image-&gt;</span><span class=cFB>sys_run_level</span><span class=cF0> =lo_image-&gt;</span><span class=cFB>sys_run_level</span><span class=cF0>&amp;(</span><span class=cF3>RLF_VGA</span><span class=cF0>|</span><span class=cF3>RLF_16BIT</span><span class=cF0>);
<a name="l50"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(&amp;hi_image-&gt;</span><span class=cF1>start</span><span class=cF0>,&amp;lo_image-&gt;</span><span class=cF1>start</span><span class=cF0>,
<a name="l51"></a> </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CKernel</span><span class=cF7>)</span><span class=cF0>-</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CKernel</span><span class=cF0>.</span><span class=cF1>start</span><span class=cF7>)</span><span class=cF0>);
<a name="l52"></a>
<a name="l53"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mp_cnt</span><span class=cF0>&gt;1)
<a name="l55"></a> </span><span class=cF5>MPHalt</span><span class=cF0>;
<a name="l56"></a>
<a name="l57"></a> </span><span class=cF5>HiMemCpy</span><span class=cF0>(sys_ram_reboot,</span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>,</span><span class=cFD>SYS_RAM_REBOOT_END</span><span class=cF0>-</span><span class=cFD>SYS_RAM_REBOOT</span><span class=cF0>);
<a name="l58"></a> </span><span class=cF5>HiMemCpy</span><span class=cF0>(lo_image,hi_image,size);
<a name="l59"></a> </span><span class=cF5>HiCall</span><span class=cF0>(sys_ram_reboot);
<a name="l60"></a>}
</span></pre></body>
</html>