577 lines
65 KiB
Plaintext
577 lines
65 KiB
Plaintext
|
<!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>U0</span><span class=cF0> </span><span class=cF5>Exit</span><span class=cF0>()
|
||
|
<a name="l2"></a>{</span><span class=cF2>//Terminate own task.</span><span class=cF0>
|
||
|
<a name="l3"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>==</span><span class=cFB>sys_focus_task</span><span class=cF0> && </span><span class=cF5>IsDbgMode</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l4"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_KILL_AFTER_DBG</span><span class=cF0>);
|
||
|
<a name="l5"></a> </span><span class=cF5>G</span><span class=cF0>;
|
||
|
<a name="l6"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_staff_mode_flag</span><span class=cF0>)
|
||
|
<a name="l8"></a> </span><span class=cF5>AdamLog</span><span class=cF0>(</span><span class=cF6>"%p:%p:%p:%p:%p:%p\n"</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>0</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>1</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>2</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>3</span><span class=cF7>)</span><span class=cF0>,
|
||
|
<a name="l9"></a> </span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>4</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>5</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>6</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF5>Caller</span><span class=cF7>(</span><span class=cF0>7</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Gs</span><span class=cF0>->num && !</span><span class=cF5>IsDbgMode</span><span class=cF0>)
|
||
|
<a name="l11"></a> </span><span class=cF5>SingleUser</span><span class=cF0>(</span><span class=cF3>OFF</span><span class=cF0>);
|
||
|
<a name="l12"></a> </span><span class=cF5>Fs</span><span class=cF0>->rflags=</span><span class=cF5>GetRFlags</span><span class=cF0>;
|
||
|
<a name="l13"></a> </span><span class=cF5>Fs</span><span class=cF0>->rsp=</span><span class=cF5>GetRSP</span><span class=cF0>;
|
||
|
<a name="l14"></a> </span><span class=cF5>Fs</span><span class=cF0>->rbp=</span><span class=cF5>GetRBP</span><span class=cF0>;
|
||
|
<a name="l15"></a> </span><span class=cF5>Fs</span><span class=cF0>->rip=$;
|
||
|
<a name="l16"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l17"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF0>);
|
||
|
<a name="l18"></a> </span><span class=cF5>TaskEndNow</span><span class=cF0>;
|
||
|
<a name="l19"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l20"></a>}
|
||
|
<a name="l21"></a>
|
||
|
<a name="l22"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>TaskValidate</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
||
|
<a name="l23"></a>{</span><span class=cF2>//return TRUE if task looks valid.</span><span class=cF0>
|
||
|
<a name="l24"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>0<task<=</span><span class=cF3>I32_MAX</span><span class=cF7>)</span><span class=cF0> || task->addr!=task ||
|
||
|
<a name="l25"></a> task->task_signature!=</span><span class=cF3>TASK_SIGNATURE_VAL</span><span class=cF0>)
|
||
|
<a name="l26"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l27"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l29"></a>}
|
||
|
<a name="l30"></a>
|
||
|
<a name="l31"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>BirthWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> **_task,</span><span class=cF9>I64</span><span class=cF0> task_num=-1)
|
||
|
<a name="l32"></a>{</span><span class=cF2>//Wait for task valid and not task_num.</span><span class=cF0>
|
||
|
<a name="l33"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>*_task</span><span class=cF7>)</span><span class=cF0>||</span><span class=cF7>(</span><span class=cF0>*_task</span><span class=cF7>)</span><span class=cF0>->task_num==task_num)
|
||
|
<a name="l34"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0> (*_task)->task_num;
|
||
|
<a name="l36"></a>}
|
||
|
<a name="l37"></a>
|
||
|
<a name="l38"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DeathWait</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> **_task,</span><span class=cF1>Bool</span><span class=cF0> send_exit=</span><span class=cF3>FALSE</span><span class=cF0>)
|
||
|
<a name="l39"></a>{</span><span class=cF2>//Wait for task death.</span><span class=cF0>
|
||
|
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (send_exit && </span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>*_task</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l41"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(*_task,</span><span class=cF3>TRUE</span><span class=cF0>);
|
||
|
<a name="l42"></a> </span><span class=cF5>XTalk</span><span class=cF0>(*_task,</span><span class=cF6>"Exit;\n"</span><span class=cF0>);
|
||
|
<a name="l43"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l44"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>*_task</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l45"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l46"></a>}
|
||
|
<a name="l47"></a>
|
||
|
<a name="l48"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Kill</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF1>Bool</span><span class=cF0> wait=</span><span class=cF3>TRUE</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> just_break=</span><span class=cF3>FALSE</span><span class=cF0>)
|
||
|
<a name="l49"></a>{</span><span class=cF2>//Terminate other task.</span><span class=cF0>
|
||
|
<a name="l50"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||
|
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (just_break) {
|
||
|
<a name="l53"></a> </span><span class=cF1>if</span><span class=cF0> (task!=</span><span class=cF5>Fs</span><span class=cF0>)
|
||
|
<a name="l54"></a> </span><span class=cF5>Break</span><span class=cF0>;
|
||
|
<a name="l55"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF2>//TODO wait</span><span class=cF0>
|
||
|
<a name="l56"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0>=task;
|
||
|
<a name="l57"></a> </span><span class=cF5>LBts</span><span class=cF0>(</span><span class=cFB>sys_ctrl_alt_flags</span><span class=cF0>,</span><span class=cF3>CTRL_ALT_C</span><span class=cF0>);
|
||
|
<a name="l58"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l59"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l60"></a> } </span><span class=cF1>else</span><span class=cF0> {
|
||
|
<a name="l61"></a> </span><span class=cF1>if</span><span class=cF0> (task!=</span><span class=cFB>sys_winmgr_task</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l62"></a> </span><span class=cF1>for</span><span class=cF0> (i=0;i<</span><span class=cFB>mp_cnt</span><span class=cF0>;i++)
|
||
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (task==</span><span class=cFB>cpu_structs</span><span class=cF0>[i].seth_task)
|
||
|
<a name="l64"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l65"></a> </span><span class=cF5>LBts</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF0>);
|
||
|
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (wait) {
|
||
|
<a name="l67"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l68"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&task->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l69"></a> }
|
||
|
<a name="l70"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l71"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l72"></a> }
|
||
|
<a name="l73"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l74"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l75"></a>}
|
||
|
<a name="l76"></a>
|
||
|
<a name="l77"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Suspend</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> state=</span><span class=cF3>TRUE</span><span class=cF0>)
|
||
|
<a name="l78"></a>{</span><span class=cF2>//Tell scheduler to skip task.</span><span class=cF0>
|
||
|
<a name="l79"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
|
||
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l81"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l82"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l84"></a> res=</span><span class=cF5>LBEqu</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_SUSPENDED</span><span class=cF0>,state);
|
||
|
<a name="l85"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l86"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l87"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l88"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l89"></a>}
|
||
|
<a name="l90"></a>
|
||
|
<a name="l91"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsSuspended</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>)
|
||
|
<a name="l92"></a>{</span><span class=cF2>//You might use this in a DrawIt() or Animatetask().</span><span class=cF0>
|
||
|
<a name="l93"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TaskValidate</span><span class=cF7>(</span><span class=cF0>task</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l95"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>Bt</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_SUSPENDED</span><span class=cF0>);
|
||
|
<a name="l96"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l97"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l98"></a>}
|
||
|
<a name="l99"></a>
|
||
|
<a name="l100"></a></span><span class=cF9>CTaskStk</span><span class=cF0> *</span><span class=cFD>TaskStkNew</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> stk_size,</span><span class=cF9>CTask</span><span class=cF0> *task)
|
||
|
<a name="l101"></a>{
|
||
|
<a name="l102"></a> </span><span class=cF9>CTaskStk</span><span class=cF0> *tmps=</span><span class=cF5>MAlloc</span><span class=cF0>(stk_size+</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CTaskStk</span><span class=cF0>.stk_base</span><span class=cF7>)</span><span class=cF0>,task);
|
||
|
<a name="l103"></a> tmps->next_stk=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l104"></a> tmps->stk_ptr=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l105"></a> tmps->stk_size=</span><span class=cF5>MSize</span><span class=cF0>(tmps)-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CTaskStk</span><span class=cF0>.stk_base);
|
||
|
<a name="l106"></a> </span><span class=cF1>return</span><span class=cF0> tmps;
|
||
|
<a name="l107"></a>}
|
||
|
<a name="l108"></a>
|
||
|
<a name="l109"></a>#</span><span class=cF1>exe</span><span class=cF0> {</span><span class=cF5>Option</span><span class=cF0>(</span><span class=cF3>OPTf_NO_REG_VAR</span><span class=cF0>,</span><span class=cF3>ON</span><span class=cF0>);};
|
||
|
<a name="l110"></a></span><span class=cF1>argpop</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>CallStkGrow</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> stk_size_threshold,</span><span class=cF9>I64</span><span class=cF0> stk_size,
|
||
|
<a name="l111"></a> </span><span class=cF2>/*argpop*/</span><span class=cF9>I64</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*fp_addr</span><span class=cF7>)(</span><span class=cF0>...</span><span class=cF7>)</span><span class=cF0>,...)
|
||
|
<a name="l112"></a>{</span><span class=cF2>//Grow stk in call with any fixed num of args.</span><span class=cF0>
|
||
|
<a name="l113"></a></span><span class=cF2>//See </span><a href="/Wb/Demo/StkGrow.HC.HTML#l1"><span class=cF4>::/Demo/StkGrow.HC</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l114"></a> </span><span class=cF9>CTaskStk</span><span class=cF0> *tmps,*tmps2,**_stk;
|
||
|
<a name="l115"></a> </span><span class=cF9>I64</span><span class=cF0> res,*rsp,*rsp2,*old_stk;
|
||
|
<a name="l116"></a>
|
||
|
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>UnusedStk</span><span class=cF0>>=stk_size_threshold) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l118"></a>
|
||
|
<a name="l119"></a> </span><span class=cF1>asm</span><span class=cF0> {
|
||
|
<a name="l120"></a> </span><span class=cF1>LEAVE</span><span class=cF0>
|
||
|
<a name="l121"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0> </span><span class=cF2>//return addr</span><span class=cF0>
|
||
|
<a name="l122"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>RSP</span><span class=cF0>,16 </span><span class=cF2>//pop threshold,stk_size</span><span class=cF0>
|
||
|
<a name="l123"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0> </span><span class=cF2>// *f</span><span class=cF0>
|
||
|
<a name="l124"></a> </span><span class=cF1>ADD</span><span class=cF0> </span><span class=cFC>RSP</span><span class=cF0>,8 </span><span class=cF2>//pop ARGC</span><span class=cF0>
|
||
|
<a name="l125"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>
|
||
|
<a name="l126"></a> </span><span class=cF1>JMP</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0> </span><span class=cF2>//CALL fp_addr()</span><span class=cF0>
|
||
|
<a name="l127"></a> };
|
||
|
<a name="l128"></a>
|
||
|
<a name="l129"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l130"></a>
|
||
|
<a name="l131"></a> tmps2=</span><span class=cFD>TaskStkNew</span><span class=cF0>(stk_size,</span><span class=cF5>Fs</span><span class=cF0>);
|
||
|
<a name="l132"></a> tmps2->next_stk=tmps=</span><span class=cF5>Fs</span><span class=cF0>->stk;
|
||
|
<a name="l133"></a> rsp2=(&tmps2->stk_base)(</span><span class=cF1>U8</span><span class=cF0> *)+tmps2->stk_size;
|
||
|
<a name="l134"></a> old_stk=rsp=&argv[argc];
|
||
|
<a name="l135"></a> </span><span class=cF1>while</span><span class=cF0> (argc-->0)
|
||
|
<a name="l136"></a> *--rsp2=*--rsp;
|
||
|
<a name="l137"></a> _stk=&</span><span class=cF5>Fs</span><span class=cF0>->stk;
|
||
|
<a name="l138"></a> tmps->stk_ptr=rsp=</span><span class=cF5>GetRSP</span><span class=cF0>;
|
||
|
<a name="l139"></a> </span><span class=cF1>asm</span><span class=cF0> {
|
||
|
<a name="l140"></a> </span><span class=cF1>IMPORT</span><span class=cF0> </span><span class=cFD>_FREE</span><span class=cF0>; </span><span class=cF2>//We are in a function, not at glbl scope.</span><span class=cF0>
|
||
|
<a name="l141"></a></span><span class=cF2>//The compiler treats these in isolation.</span><span class=cF0>
|
||
|
<a name="l142"></a>
|
||
|
<a name="l143"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l144"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDX</span><span class=cF0> </span><span class=cF2>//flags</span><span class=cF0>
|
||
|
<a name="l145"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l146"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> &tmps2[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l147"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,&_stk[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l148"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> [</span><span class=cFC>RAX</span><span class=cF0>],</span><span class=cFC>RBX</span><span class=cF0> </span><span class=cF2>//Fs->stk=tmps2</span><span class=cF0>
|
||
|
<a name="l149"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSP</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> &rsp2[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l150"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDX</span><span class=cF0>
|
||
|
<a name="l151"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l152"></a>
|
||
|
<a name="l153"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> &fp_addr[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l154"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> &res[</span><span class=cFC>RBP</span><span class=cF0>],</span><span class=cFC>RAX</span><span class=cF0>
|
||
|
<a name="l155"></a>
|
||
|
<a name="l156"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l157"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RDX</span><span class=cF0> </span><span class=cF2>//flags</span><span class=cF0>
|
||
|
<a name="l158"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l159"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> &tmps[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l160"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>,&_stk[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l161"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> [</span><span class=cFC>RAX</span><span class=cF0>],</span><span class=cFC>RBX</span><span class=cF0> </span><span class=cF2>//Fs->stk=tmps</span><span class=cF0>
|
||
|
<a name="l162"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSP</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> &rsp[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l163"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RDX</span><span class=cF0>
|
||
|
<a name="l164"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l165"></a>
|
||
|
<a name="l166"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> &tmps2[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l167"></a> </span><span class=cF1>CALL</span><span class=cF0> </span><span class=cFD>_FREE</span><span class=cF0>
|
||
|
<a name="l168"></a>
|
||
|
<a name="l169"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RDX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> &old_stk[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l170"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> 8[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l171"></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> &res[</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l172"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>,</span><span class=cF9>U64</span><span class=cF0> [</span><span class=cFC>RBP</span><span class=cF0>]
|
||
|
<a name="l173"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RSP</span><span class=cF0>,</span><span class=cFC>RDX</span><span class=cF0>
|
||
|
<a name="l174"></a> </span><span class=cF1>JMP</span><span class=cF0> </span><span class=cFC>RBX</span><span class=cF0> </span><span class=cF2>//return</span><span class=cF0>
|
||
|
<a name="l175"></a> };
|
||
|
<a name="l176"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l177"></a> </span><span class=cF1>return</span><span class=cF0> 0; </span><span class=cF2>//dummy to get rid of warning</span><span class=cF0>
|
||
|
<a name="l178"></a>}
|
||
|
<a name="l179"></a>;
|
||
|
<a name="l180"></a>#</span><span class=cF1>exe</span><span class=cF0> {</span><span class=cF5>Option</span><span class=cF0>(</span><span class=cF3>OPTf_NO_REG_VAR</span><span class=cF0>,</span><span class=cF3>OFF</span><span class=cF0>);};
|
||
|
<a name="l181"></a>
|
||
|
<a name="l182"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>TaskInit</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task,</span><span class=cF9>I64</span><span class=cF0> stk_size)
|
||
|
<a name="l183"></a>{</span><span class=cF2>//Returns Fs of task</span><span class=cF0>
|
||
|
<a name="l184"></a> </span><span class=cF9>CTaskStk</span><span class=cF0> *tmps;
|
||
|
<a name="l185"></a>
|
||
|
<a name="l186"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->code_heap->next_mem_blk);
|
||
|
<a name="l187"></a> task->code_heap->last_mergable=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l188"></a> </span><span class=cF1>if</span><span class=cF0> (task->code_heap!=task->data_heap) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l189"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->data_heap->next_mem_blk);
|
||
|
<a name="l190"></a> task->data_heap->last_mergable=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l191"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l192"></a>
|
||
|
<a name="l193"></a> task->addr=task->next_task=task->last_task=
|
||
|
<a name="l194"></a> task->next_input_filter_task=task->last_input_filter_task=
|
||
|
<a name="l195"></a> task;
|
||
|
<a name="l196"></a>
|
||
|
<a name="l197"></a> task->task_num=</span><span class=cFB>sys_num_spawned_tasks</span><span class=cF0>++;
|
||
|
<a name="l198"></a>
|
||
|
<a name="l199"></a> task->rflags=</span><span class=cF3>RFLAGG_NORMAL</span><span class=cF0>;
|
||
|
<a name="l200"></a> task->win_inhibit=</span><span class=cF3>WIG_TASK_DFT</span><span class=cF0>;
|
||
|
<a name="l201"></a>
|
||
|
<a name="l202"></a> task->next_child_task=task->last_child_task=
|
||
|
<a name="l203"></a> (&task->next_child_task)(</span><span class=cF1>U8</span><span class=cF0> *)-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0>.next_sibling_task);
|
||
|
<a name="l204"></a>
|
||
|
<a name="l205"></a> </span><span class=cFD>JobCtrlInit</span><span class=cF0>(&task->srv_ctrl);
|
||
|
<a name="l206"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->next_cc);
|
||
|
<a name="l207"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->next_except);
|
||
|
<a name="l208"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->next_ctrl);
|
||
|
<a name="l209"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&task->next_ode);
|
||
|
<a name="l210"></a>
|
||
|
<a name="l211"></a> task->fpu_mmx=</span><span class=cF5>MAllocAligned</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFPU</span><span class=cF7>)</span><span class=cF0>,0x10,task);
|
||
|
<a name="l212"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(task->fpu_mmx,
|
||
|
<a name="l213"></a> </span><span class=cF3>SYS_FIXED_AREA</span><span class=cF0>+</span><span class=cF1>offset</span><span class=cF7>(</span><span class=cF9>CSysFixedArea</span><span class=cF0>.init_fpu_mmx</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CFPU</span><span class=cF7>)</span><span class=cF0>);
|
||
|
<a name="l214"></a>
|
||
|
<a name="l215"></a> task->hash_table=</span><span class=cF5>HashTableNew</span><span class=cF0>(</span><span class=cF3>TASK_HASH_TABLE_SIZE</span><span class=cF0>,task);
|
||
|
<a name="l216"></a>
|
||
|
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (!stk_size)
|
||
|
<a name="l218"></a> stk_size=</span><span class=cF3>MEM_DFT_STK</span><span class=cF0>;
|
||
|
<a name="l219"></a> task->stk=tmps=</span><span class=cFD>TaskStkNew</span><span class=cF0>(stk_size,task);
|
||
|
<a name="l220"></a> task->rsp=(&tmps->stk_base)(</span><span class=cF1>U8</span><span class=cF0> *)+tmps->stk_size;
|
||
|
<a name="l221"></a>
|
||
|
<a name="l222"></a> task->text_attr =</span><span class=cF3>WHITE</span><span class=cF0><<4+</span><span class=cF3>BLUE</span><span class=cF0>;
|
||
|
<a name="l223"></a> task->border_src =</span><span class=cF3>BDS_CONST</span><span class=cF0>;
|
||
|
<a name="l224"></a> task->border_attr =</span><span class=cF5>DrvTextAttrGet</span><span class=cF0>(</span><span class=cF6>':'</span><span class=cF0>);
|
||
|
<a name="l225"></a> task->title_src =</span><span class=cF3>TTS_CONST</span><span class=cF0>;
|
||
|
<a name="l226"></a> task->win_left =1;
|
||
|
<a name="l227"></a> task->win_right =</span><span class=cFB>text</span><span class=cF0>.cols-2;
|
||
|
<a name="l228"></a> task->win_top =13;
|
||
|
<a name="l229"></a> task->win_bottom =</span><span class=cFB>text</span><span class=cF0>.rows-2;
|
||
|
<a name="l230"></a>
|
||
|
<a name="l231"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>blkdev</span><span class=cF0>.home_dir) </span><span class=cF7>{</span><span class=cF2>//Beware Adam </span><a href="/Wb/Kernel/KStart64.HC.HTML#l36"><span class=cF4>TaskInit</span></a><span class=cF2>. I guess ok until </span><a href="/Wb/Kernel/KMain.HC.HTML#l176"><span class=cF4>DskChg</span></a><span class=cF2>().</span><span class=cF0>
|
||
|
<a name="l232"></a> task->cur_dv=</span><span class=cFB>blkdev</span><span class=cF0>.let_to_drv[*</span><span class=cFB>blkdev</span><span class=cF0>.home_dir-</span><span class=cF6>'A'</span><span class=cF0>];
|
||
|
<a name="l233"></a> task->cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cFB>blkdev</span><span class=cF0>.home_dir+2,task);
|
||
|
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l235"></a> task->cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"/Home"</span><span class=cF0>,task);
|
||
|
<a name="l236"></a>
|
||
|
<a name="l237"></a> </span><span class=cF5>Seed</span><span class=cF0>(,task);
|
||
|
<a name="l238"></a>
|
||
|
<a name="l239"></a> </span><span class=cF1>return</span><span class=cF0> task;
|
||
|
<a name="l240"></a>}
|
||
|
<a name="l241"></a>
|
||
|
<a name="l242"></a></span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>Spawn</span><span class=cF0>(</span><span class=cF1>U0</span><span class=cF0> </span><span class=cF7>(</span><span class=cF0>*fp_start_addr</span><span class=cF7>)(</span><span class=cF1>U8</span><span class=cF0> *data</span><span class=cF7>)</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *data=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>U8</span><span class=cF0> *task_name=</span><span class=cF3>NULL</span><span class=cF0>,
|
||
|
<a name="l243"></a> </span><span class=cF9>I64</span><span class=cF0> target_cpu=-1, </span><span class=cF2>//-1 for current CPU. See </span><a href="/Wb/Demo/MultiCore/LoadTest.HC.HTML#l1"><span class=cF4>multi-core</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l244"></a> </span><span class=cF9>CTask</span><span class=cF0> *parent=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF2>//NULL means adam</span><span class=cF0>
|
||
|
<a name="l245"></a> </span><span class=cF9>I64</span><span class=cF0> stk_size=0, </span><span class=cF2>//0=default</span><span class=cF0>
|
||
|
<a name="l246"></a> </span><span class=cF9>I64</span><span class=cF0> flags=1<<</span><span class=cF3>JOBf_ADD_TO_QUE</span><span class=cF0>)
|
||
|
<a name="l247"></a>{</span><span class=cF2>//Create task on core running at address.</span><span class=cF0>
|
||
|
<a name="l248"></a></span><span class=cF2>//Alloc </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3271"><span class=cF4>CTask</span></a><span class=cF2> structure from code heap so addr will be short.</span><span class=cF0>
|
||
|
<a name="l249"></a> </span><span class=cF2>//Could be alloced off of data heap.</span><span class=cF0>
|
||
|
<a name="l250"></a> </span><span class=cF9>CTask</span><span class=cF0> *task;
|
||
|
<a name="l251"></a> </span><span class=cF1>if</span><span class=cF0> (target_cpu>=0)
|
||
|
<a name="l252"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>SpawnQue</span><span class=cF0>(fp_start_addr,data,task_name,target_cpu,
|
||
|
<a name="l253"></a> parent,stk_size,flags);
|
||
|
<a name="l254"></a> task=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CTask</span><span class=cF7>)</span><span class=cF0>,</span><span class=cFB>adam_task</span><span class=cF0>->code_heap);
|
||
|
<a name="l255"></a> task->task_signature=</span><span class=cF3>TASK_SIGNATURE_VAL</span><span class=cF0>;
|
||
|
<a name="l256"></a> </span><span class=cF1>if</span><span class=cF0> (!task_name) task_name=</span><span class=cF6>"Unnamed Task"</span><span class=cF0>;
|
||
|
<a name="l257"></a> </span><span class=cF1>if</span><span class=cF0> (!parent) parent=</span><span class=cF5>Gs</span><span class=cF0>->seth_task;
|
||
|
<a name="l258"></a> task->parent_task=parent;
|
||
|
<a name="l259"></a> task->gs=parent->gs;
|
||
|
<a name="l260"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_code_bp</span><span class=cF0>)
|
||
|
<a name="l261"></a> task->code_heap=</span><span class=cF5>HeapCtrlInit</span><span class=cF0>(,task,</span><span class=cFB>sys_code_bp</span><span class=cF0>);
|
||
|
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_data_bp</span><span class=cF0>)
|
||
|
<a name="l263"></a> task->data_heap=</span><span class=cF5>HeapCtrlInit</span><span class=cF0>(,task,</span><span class=cFB>sys_data_bp</span><span class=cF0>);
|
||
|
<a name="l264"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l265"></a> task->data_heap=task->code_heap;
|
||
|
<a name="l266"></a> </span><span class=cFD>TaskInit</span><span class=cF0>(task,stk_size);
|
||
|
<a name="l267"></a> task->rip=fp_start_addr;
|
||
|
<a name="l268"></a> task->rsp(</span><span class=cF1>U8</span><span class=cF0> *)-=8;
|
||
|
<a name="l269"></a> *task->rsp=data;
|
||
|
<a name="l270"></a> task->rsp(</span><span class=cF1>U8</span><span class=cF0> *)-=8;
|
||
|
<a name="l271"></a> *task->rsp=&</span><span class=cF5>Exit</span><span class=cF0>;
|
||
|
<a name="l272"></a> task->hash_table->next=parent->hash_table;
|
||
|
<a name="l273"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(task->task_name,task_name,</span><span class=cF3>TASK_NAME_LEN</span><span class=cF0>);
|
||
|
<a name="l274"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(task->task_title,task->task_name);
|
||
|
<a name="l275"></a> task->title_src=</span><span class=cF3>TTS_TASK_NAME</span><span class=cF0>;
|
||
|
<a name="l276"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l277"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l278"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&flags,</span><span class=cF3>JOBf_ADD_TO_QUE</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l279"></a> </span><span class=cFD>TaskQueInsChild</span><span class=cF0>(task);
|
||
|
<a name="l280"></a> </span><span class=cF5>TaskQueIns</span><span class=cF0>(task);
|
||
|
<a name="l281"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l282"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l283"></a> </span><span class=cF1>return</span><span class=cF0> task;
|
||
|
<a name="l284"></a>}
|
||
|
<a name="l285"></a>
|
||
|
<a name="l286"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>TaskDerivedValsUpdate</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> update_z_buf=</span><span class=cF3>TRUE</span><span class=cF0>)
|
||
|
<a name="l287"></a>{</span><span class=cF2>//Those things calculated from other variables.</span><span class=cF0>
|
||
|
<a name="l288"></a> </span><span class=cF1>if</span><span class=cF0> (!task) task=</span><span class=cF5>Fs</span><span class=cF0>;
|
||
|
<a name="l289"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
|
||
|
<a name="l290"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l291"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->task_flags,</span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l292"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l293"></a> </span><span class=cF5>WinDerivedValsUpdate</span><span class=cF0>(task);
|
||
|
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>fp_update_ctrls</span><span class=cF0>)
|
||
|
<a name="l295"></a> (*</span><span class=cFB>fp_update_ctrls</span><span class=cF0>)(task);
|
||
|
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (update_z_buf && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&task->display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l297"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_UPDATE_WIN_Z_BUF</span><span class=cF0>],0);
|
||
|
<a name="l298"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF0>);
|
||
|
<a name="l299"></a> </span><span class=cF1>POPFD</span><span class=cF0>
|
||
|
<a name="l300"></a>}
|
||
|
<a name="l301"></a>
|
||
|
<a name="l302"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>ExeCmdLine</span><span class=cF0>(</span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc)
|
||
|
<a name="l303"></a>{</span><span class=cF2>//Terminal JIT-compile-and-execute loop for CCmpCtrl.</span><span class=cF0>
|
||
|
<a name="l304"></a> </span><span class=cF9>I64</span><span class=cF0> res=0,type,old_title_src=</span><span class=cF5>Fs</span><span class=cF0>->title_src;
|
||
|
<a name="l305"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr,*ptr2,*ptr3,*machine_code,*old_task_title=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->task_title);
|
||
|
<a name="l306"></a> </span><span class=cF1>F64</span><span class=cF0> t0;
|
||
|
<a name="l307"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
||
|
<a name="l308"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
||
|
<a name="l309"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->title_src!=</span><span class=cF3>TTS_LOCKED_CONST</span><span class=cF0>)
|
||
|
<a name="l310"></a> </span><span class=cF5>Fs</span><span class=cF0>->title_src=</span><span class=cF3>TTS_CUR_LEX</span><span class=cF0>;
|
||
|
<a name="l311"></a> </span><span class=cF1>while</span><span class=cF0> (cc->token &&
|
||
|
<a name="l312"></a> </span><span class=cF7>(</span><span class=cF0>cc->token!=</span><span class=cF6>'}'</span><span class=cF0> || !(cc->flags & </span><span class=cF3>CCF_EXE_BLK</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> ) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l313"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->title_src==</span><span class=cF3>TTS_CUR_LEX</span><span class=cF0>) {
|
||
|
<a name="l314"></a> ptr2=&</span><span class=cF5>Fs</span><span class=cF0>->task_title;
|
||
|
<a name="l315"></a> ptr3=ptr2+</span><span class=cF3>STR_LEN</span><span class=cF0>-1;
|
||
|
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (cc->lex_include_stk->flags & </span><span class=cF3>LFSF_DOC</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l317"></a> doc_e=cc->lex_include_stk->cur_entry;
|
||
|
<a name="l318"></a> doc=cc->lex_include_stk->doc;
|
||
|
<a name="l319"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc && ptr2<ptr3) {
|
||
|
<a name="l320"></a> </span><span class=cF1>switch</span><span class=cF0> (doc_e->type_u8) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TEXT</span><span class=cF0>:
|
||
|
<a name="l322"></a> ptr=doc_e->tag;
|
||
|
<a name="l323"></a> </span><span class=cF1>while</span><span class=cF0> (*ptr && ptr2<ptr3)
|
||
|
<a name="l324"></a> *ptr2++=*ptr++;
|
||
|
<a name="l325"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l326"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TAB</span><span class=cF0>:
|
||
|
<a name="l327"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>:
|
||
|
<a name="l328"></a> *ptr2++=</span><span class=cF6>'.'</span><span class=cF0>;
|
||
|
<a name="l329"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||
|
<a name="l330"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l331"></a> doc_e=doc_e->next;
|
||
|
<a name="l332"></a> }
|
||
|
<a name="l333"></a> </span><span class=cF1>if</span><span class=cF0> (ptr2<ptr3) *ptr2=0;
|
||
|
<a name="l334"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l335"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ptr=cc->lex_include_stk->line_start</span><span class=cF7>)</span><span class=cF0> && *ptr)
|
||
|
<a name="l336"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(ptr2,ptr,</span><span class=cF3>STR_LEN</span><span class=cF0>-1);
|
||
|
<a name="l337"></a> }
|
||
|
<a name="l338"></a> cc->flags&=~</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF0>;
|
||
|
<a name="l339"></a> machine_code=</span><span class=cF5>LexStmt2Bin</span><span class=cF0>(cc,&type);
|
||
|
<a name="l340"></a> </span><span class=cF1>if</span><span class=cF0> (machine_code!=</span><span class=cF3>INVALID_PTR</span><span class=cF0>) {
|
||
|
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags&</span><span class=cF3>CCF_JUST_LOAD</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l342"></a> t0=</span><span class=cF5>tS</span><span class=cF0>;
|
||
|
<a name="l343"></a> res=</span><span class=cF5>Call</span><span class=cF0>(machine_code);
|
||
|
<a name="l344"></a> </span><span class=cF5>Fs</span><span class=cF0>->answer=res;
|
||
|
<a name="l345"></a> </span><span class=cF5>Fs</span><span class=cF0>->answer_type=type;
|
||
|
<a name="l346"></a> </span><span class=cF5>Fs</span><span class=cF0>->answer_time=</span><span class=cF5>tS</span><span class=cF0>-t0;
|
||
|
<a name="l347"></a> </span><span class=cF5>Fs</span><span class=cF0>->new_answer=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l348"></a> cc->pmt_line=0;
|
||
|
<a name="l349"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l350"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>cc->flags&</span><span class=cF3>CCF_HAS_MISC_DATA</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l351"></a> </span><span class=cF5>Free</span><span class=cF0>(machine_code);
|
||
|
<a name="l352"></a> }
|
||
|
<a name="l353"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l354"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->title_src!=</span><span class=cF3>TTS_LOCKED_CONST</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l355"></a> </span><span class=cF5>Fs</span><span class=cF0>->title_src=old_title_src;
|
||
|
<a name="l356"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->task_title,old_task_title);
|
||
|
<a name="l357"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l358"></a> </span><span class=cF5>Free</span><span class=cF0>(old_task_title);
|
||
|
<a name="l359"></a> </span><span class=cF1>if</span><span class=cF0> (cc->flags&</span><span class=cF3>CCF_JUST_LOAD</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (cc->error_cnt)
|
||
|
<a name="l361"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
||
|
<a name="l362"></a> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l363"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l364"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
||
|
<a name="l365"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||
|
<a name="l366"></a>}
|
||
|
<a name="l367"></a>
|
||
|
<a name="l368"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SrvTaskCont</span><span class=cF0>()
|
||
|
<a name="l369"></a>{</span><span class=cF2>//Act as server task in a loop handling commands.</span><span class=cF0>
|
||
|
<a name="l370"></a> </span><span class=cF9>I64</span><span class=cF0> old_flags=</span><span class=cF5>GetRFlags</span><span class=cF0>;
|
||
|
<a name="l371"></a> </span><span class=cF5>FlushMsgs</span><span class=cF0>;
|
||
|
<a name="l372"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l373"></a> </span><span class=cF1>CLI</span><span class=cF0>
|
||
|
<a name="l374"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>JobsHndlr</span><span class=cF7>(</span><span class=cF0>old_flags</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>Fs</span><span class=cF0>->title_src==</span><span class=cF3>TTS_TASK_NAME</span><span class=cF0>)
|
||
|
<a name="l375"></a> </span><span class=cF5>MemCpy</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->task_title,</span><span class=cF5>Fs</span><span class=cF0>->task_name,</span><span class=cF3>TASK_NAME_LEN</span><span class=cF0>);
|
||
|
<a name="l376"></a> </span><span class=cF5>FlushMsgs</span><span class=cF0>;
|
||
|
<a name="l377"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_IDLE</span><span class=cF0>);
|
||
|
<a name="l378"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cF5>Fs</span><span class=cF0>->task_flags,</span><span class=cF3>TASKf_AWAITING_MSG</span><span class=cF0>);
|
||
|
<a name="l379"></a> </span><span class=cF5>Yield</span><span class=cF0>;
|
||
|
<a name="l380"></a> </span><span class=cF5>SetRFlags</span><span class=cF0>(old_flags);
|
||
|
<a name="l381"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l382"></a>}
|
||
|
<a name="l383"></a>
|
||
|
<a name="l384"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>UserTaskCont</span><span class=cF0>()
|
||
|
<a name="l385"></a>{</span><span class=cF2>//Terminal key-input-execute loop.</span><span class=cF0>
|
||
|
<a name="l386"></a> </span><span class=cF9>CCmpCtrl</span><span class=cF0> *cc;
|
||
|
<a name="l387"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc;
|
||
|
<a name="l388"></a> </span><span class=cF1>Bool</span><span class=cF0> cont=</span><span class=cF3>TRUE</span><span class=cF0>;
|
||
|
<a name="l389"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l390"></a> cc=</span><span class=cF5>CmpCtrlNew</span><span class=cF0>(,</span><span class=cF3>CCF_CMD_LINE</span><span class=cF0>|</span><span class=cF3>CCF_PMT</span><span class=cF0>|</span><span class=cF3>CCF_QUESTION_HELP</span><span class=cF0>);
|
||
|
<a name="l391"></a> </span><span class=cF5>QueIns</span><span class=cF0>(cc,</span><span class=cF5>Fs</span><span class=cF0>->last_cc);
|
||
|
<a name="l392"></a> </span><span class=cF1>try</span><span class=cF0> {
|
||
|
<a name="l393"></a> </span><span class=cF5>Lex</span><span class=cF0>(cc);
|
||
|
<a name="l394"></a> </span><span class=cF5>ExeCmdLine</span><span class=cF0>(cc);
|
||
|
<a name="l395"></a> cont=</span><span class=cF5>Bt</span><span class=cF0>(&cc->flags,</span><span class=cF3>CCf_PMT</span><span class=cF0>);
|
||
|
<a name="l396"></a> </span><span class=cF5>QueRem</span><span class=cF0>(cc);
|
||
|
<a name="l397"></a> </span><span class=cF5>CmpCtrlDel</span><span class=cF0>(cc);
|
||
|
<a name="l398"></a> } </span><span class=cF1>catch</span><span class=cF0> {
|
||
|
<a name="l399"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>doc=</span><span class=cF5>Fs</span><span class=cF0>->put_doc</span><span class=cF7>)</span><span class=cF0> && doc->doc_signature==</span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
|
||
|
<a name="l400"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||
|
<a name="l401"></a> </span><span class=cF5>PutExcept</span><span class=cF0>;
|
||
|
<a name="l402"></a> }
|
||
|
<a name="l403"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (cont);
|
||
|
<a name="l404"></a>}
|
||
|
<a name="l405"></a>
|
||
|
<a name="l406"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SrvCmdLine</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> dummy=0)
|
||
|
<a name="l407"></a>{
|
||
|
<a name="l408"></a> </span><span class=cF1>no_warn</span><span class=cF0> dummy;
|
||
|
<a name="l409"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit=</span><span class=cF3>WIG_USER_TASK_DFT</span><span class=cF0>;
|
||
|
<a name="l410"></a> </span><span class=cF5>CallExtStr</span><span class=cF0>(</span><span class=cF6>"SrvStartUp"</span><span class=cF0>);
|
||
|
<a name="l411"></a> </span><span class=cF5>SrvTaskCont</span><span class=cF0>;
|
||
|
<a name="l412"></a>}
|
||
|
<a name="l413"></a>
|
||
|
<a name="l414"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>UserCmdLine</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> dummy=0)
|
||
|
<a name="l415"></a>{</span><span class=cF2>//A user task ends-up calling this.</span><span class=cF0>
|
||
|
<a name="l416"></a> </span><span class=cF1>no_warn</span><span class=cF0> dummy;
|
||
|
<a name="l417"></a> </span><span class=cF5>Fs</span><span class=cF0>->win_inhibit=</span><span class=cF3>WIG_USER_TASK_DFT</span><span class=cF0>;
|
||
|
<a name="l418"></a> </span><span class=cF5>CallExtStr</span><span class=cF0>(</span><span class=cF6>"UserStartUp"</span><span class=cF0>);
|
||
|
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cF5>Fs</span><span class=cF0>->display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l420"></a> </span><span class=cF5>Dbg</span><span class=cF0>;
|
||
|
<a name="l421"></a> </span><span class=cF5>UserTaskCont</span><span class=cF0>;
|
||
|
<a name="l422"></a>}
|
||
|
<a name="l423"></a>
|
||
|
<a name="l424"></a></span><span class=cF9>CTask</span><span class=cF0> *</span><span class=cF5>User</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *fmt=</span><span class=cF3>NULL</span><span class=cF0>,...)
|
||
|
<a name="l425"></a>{</span><span class=cF2>//Create user term task.</span><span class=cF0>
|
||
|
<a name="l426"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
||
|
<a name="l427"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF5>Spawn</span><span class=cF0>(&</span><span class=cF5>UserCmdLine</span><span class=cF0>);
|
||
|
<a name="l428"></a> </span><span class=cF5>TaskWait</span><span class=cF0>(task);
|
||
|
<a name="l429"></a> </span><span class=cF1>if</span><span class=cF0> (fmt) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l430"></a> st=</span><span class=cF5>StrPrintJoin</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>,fmt,argc,argv);
|
||
|
<a name="l431"></a> </span><span class=cF5>XTalk</span><span class=cF0>(task,st);
|
||
|
<a name="l432"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||
|
<a name="l433"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l434"></a> </span><span class=cF1>return</span><span class=cF0> task;
|
||
|
<a name="l435"></a>}
|
||
|
<a name="l436"></a>
|
||
|
<a name="l437"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>TaskDel</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0> *task)
|
||
|
<a name="l438"></a>{</span><span class=cF2>//We delay freeing in case lingering ptr to reincarnated.</span><span class=cF0>
|
||
|
<a name="l439"></a> </span><span class=cF5>HeapCtrlDel</span><span class=cF0>(task->code_heap);
|
||
|
<a name="l440"></a> </span><span class=cF1>if</span><span class=cF0> (task->data_heap!=task->code_heap)
|
||
|
<a name="l441"></a> </span><span class=cF5>HeapCtrlDel</span><span class=cF0>(task->data_heap);
|
||
|
<a name="l442"></a> </span><span class=cF5>Free</span><span class=cF0>(task);
|
||
|
<a name="l443"></a>}
|
||
|
<a name="l444"></a>
|
||
|
<a name="l445"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>TaskEnd</span><span class=cF0>()
|
||
|
<a name="l446"></a>{</span><span class=cF2>//Called with irq's off.</span><span class=cF0>
|
||
|
<a name="l447"></a> </span><span class=cF9>CTask</span><span class=cF0> *task=</span><span class=cF5>Fs</span><span class=cF0>,*tmpt,*tmpt1;
|
||
|
<a name="l448"></a> </span><span class=cF1>if</span><span class=cF0> (task==</span><span class=cFB>sys_task_being_scrn_updated</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l449"></a> </span><span class=cF5>LBts</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF0>);
|
||
|
<a name="l450"></a> </span><span class=cF1>return</span><span class=cF0> task->next_task;
|
||
|
<a name="l451"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l452"></a> </span><span class=cF1>if</span><span class=cF0> (task->task_end_cb) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l453"></a> task->wake_jiffy=0;
|
||
|
<a name="l454"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF0>);
|
||
|
<a name="l455"></a> </span><span class=cF5>TaskRstAwaitingMsg</span><span class=cF0>(task);
|
||
|
<a name="l456"></a> </span><span class=cF5>Suspend</span><span class=cF0>(task,</span><span class=cF3>FALSE</span><span class=cF0>);
|
||
|
<a name="l457"></a> task->rip=task->task_end_cb;
|
||
|
<a name="l458"></a> task->task_end_cb=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l459"></a> </span><span class=cF1>return</span><span class=cF0> task;
|
||
|
<a name="l460"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l461"></a> </span><span class=cF1>if</span><span class=cF0> (task->parent_task && task->parent_task->popup_task==task) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l462"></a> task->parent_task->popup_task=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l463"></a> </span><span class=cF5>Kill</span><span class=cF0>(task->parent_task,</span><span class=cF3>FALSE</span><span class=cF0>);
|
||
|
<a name="l464"></a> </span><span class=cF1>return</span><span class=cF0> task->parent_task;
|
||
|
<a name="l465"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l466"></a>
|
||
|
<a name="l467"></a> </span><span class=cF5>DrvsRelease</span><span class=cF0>;
|
||
|
<a name="l468"></a> </span><span class=cF5>BlkDevsRelease</span><span class=cF0>;
|
||
|
<a name="l469"></a> tmpt1=(&task->next_child_task)(</span><span class=cF1>U8</span><span class=cF0> *)-</span><span class=cF1>offset</span><span class=cF0>(</span><span class=cF9>CTask</span><span class=cF0>.next_sibling_task);
|
||
|
<a name="l470"></a> tmpt=tmpt1->next_sibling_task;
|
||
|
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (tmpt!=tmpt1) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l472"></a> </span><span class=cF1>do</span><span class=cF0> {
|
||
|
<a name="l473"></a> </span><span class=cF5>LBts</span><span class=cF0>(&tmpt->task_flags,</span><span class=cF3>TASKf_KILL_TASK</span><span class=cF0>);
|
||
|
<a name="l474"></a> tmpt=tmpt->next_sibling_task;
|
||
|
<a name="l475"></a> } </span><span class=cF1>while</span><span class=cF0> (tmpt!=tmpt1);
|
||
|
<a name="l476"></a> </span><span class=cF1>return</span><span class=cF0> task->next_task;
|
||
|
<a name="l477"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l478"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>&task->display_flags,</span><span class=cF3>DISPLAYf_SHOW</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l479"></a> </span><span class=cF5>LBts</span><span class=cF0>(&</span><span class=cFB>sys_semas</span><span class=cF0>[</span><span class=cF3>SEMA_UPDATE_WIN_Z_BUF</span><span class=cF0>],0);
|
||
|
<a name="l480"></a>
|
||
|
<a name="l481"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->task_flags,</span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l482"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l483"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l484"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l485"></a>
|
||
|
<a name="l486"></a> </span><span class=cFD>JobQueDel</span><span class=cF0>(&task->srv_ctrl.next_waiting);
|
||
|
<a name="l487"></a> </span><span class=cFD>JobQueDel</span><span class=cF0>(&task->srv_ctrl.next_done);
|
||
|
<a name="l488"></a>
|
||
|
<a name="l489"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsRaw</span><span class=cF0>)
|
||
|
<a name="l490"></a> </span><span class=cF5>VGAFlush</span><span class=cF0>;
|
||
|
<a name="l491"></a>
|
||
|
<a name="l492"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_focus_task</span><span class=cF0>==task) </span><span class=cF7>{</span><span class=cF0>
|
||
|
<a name="l493"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Gs</span><span class=cF0>->num)
|
||
|
<a name="l494"></a> </span><span class=cF5>SingleUser</span><span class=cF0>(</span><span class=cF3>OFF</span><span class=cF0>);
|
||
|
<a name="l495"></a> </span><span class=cFB>sys_focus_task</span><span class=cF0>=</span><span class=cF3>NULL</span><span class=cF0>;
|
||
|
<a name="l496"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>fp_set_std_palette</span><span class=cF0>)
|
||
|
<a name="l497"></a> (*</span><span class=cFB>fp_set_std_palette</span><span class=cF0>)();
|
||
|
<a name="l498"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l499"></a>
|
||
|
<a name="l500"></a> </span><span class=cF2>//QueRem</span><span class=cF0>
|
||
|
<a name="l501"></a> task->task_signature(</span><span class=cF9>I64</span><span class=cF0>)=0;
|
||
|
<a name="l502"></a>
|
||
|
<a name="l503"></a> tmpt =task->next_input_filter_task;
|
||
|
<a name="l504"></a> tmpt1=task->last_input_filter_task;
|
||
|
<a name="l505"></a> tmpt1->next_input_filter_task=tmpt;
|
||
|
<a name="l506"></a> tmpt ->last_input_filter_task=tmpt1;
|
||
|
<a name="l507"></a>
|
||
|
<a name="l508"></a> tmpt =task->next_sibling_task;
|
||
|
<a name="l509"></a> tmpt1=task->last_sibling_task;
|
||
|
<a name="l510"></a> tmpt1->next_sibling_task=tmpt;
|
||
|
<a name="l511"></a> tmpt ->last_sibling_task=tmpt1;
|
||
|
<a name="l512"></a>
|
||
|
<a name="l513"></a> tmpt =task->next_task; </span><span class=cF2>//save to return</span><span class=cF0>
|
||
|
<a name="l514"></a> </span><span class=cF5>TaskQueRem</span><span class=cF0>(task);
|
||
|
<a name="l515"></a>
|
||
|
<a name="l516"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->srv_ctrl.flags,</span><span class=cF3>JOBCf_LOCKED</span><span class=cF0>);
|
||
|
<a name="l517"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&task->task_flags,</span><span class=cF3>TASKf_TASK_LOCK</span><span class=cF0>);
|
||
|
<a name="l518"></a>
|
||
|
<a name="l519"></a> task->wake_jiffy=</span><span class=cFB>cnts</span><span class=cF0>.jiffies+</span><span class=cF3>DYING_JIFFIES</span><span class=cF0>;
|
||
|
<a name="l520"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cF5>Gs</span><span class=cF0>->cpu_flags,</span><span class=cF3>CPUf_DYING_TASK_QUE</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l521"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l522"></a> </span><span class=cF5>QueIns</span><span class=cF0>(task,</span><span class=cF5>Gs</span><span class=cF0>->last_dying);
|
||
|
<a name="l523"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cF5>Gs</span><span class=cF0>->cpu_flags,</span><span class=cF3>CPUf_DYING_TASK_QUE</span><span class=cF0>);
|
||
|
<a name="l524"></a>
|
||
|
<a name="l525"></a> </span><span class=cF1>return</span><span class=cF0> tmpt;
|
||
|
<a name="l526"></a>}
|
||
|
<a name="l527"></a>
|
||
|
<a name="l528"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>TaskKillDying</span><span class=cF0>()
|
||
|
<a name="l529"></a>{</span><span class=cF2>//Delay freeing to prevent asking for trouble with quick reincarnations.</span><span class=cF0>
|
||
|
<a name="l530"></a></span><span class=cF2>//What if the user is doing this: </span><a href="/Wb/Misc/OSTestSuite.HC.HTML#l449"><span class=cF4>DoTreeCheckers</span></a><span class=cF2>.</span><span class=cF0>
|
||
|
<a name="l531"></a> </span><span class=cF9>CTaskDying</span><span class=cF0> *task,*task1;
|
||
|
<a name="l532"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Gs</span><span class=cF0>->kill_jiffy<</span><span class=cFB>cnts</span><span class=cF0>.jiffies) </span><span class=cF7>{</span><span class=cF2>//Avoid doing as many lock operations.</span><span class=cF0>
|
||
|
<a name="l533"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>LBts</span><span class=cF7>(</span><span class=cF0>&</span><span class=cF5>Gs</span><span class=cF0>->cpu_flags,</span><span class=cF3>CPUf_DYING_TASK_QUE</span><span class=cF7>)</span><span class=cF0>)
|
||
|
<a name="l534"></a> </span><span class=cF1>PAUSE</span><span class=cF0>
|
||
|
<a name="l535"></a> task=</span><span class=cF5>Gs</span><span class=cF0>->next_dying;
|
||
|
<a name="l536"></a> </span><span class=cF1>while</span><span class=cF0> (task!=&</span><span class=cF5>Gs</span><span class=cF0>->next_dying && task->wake_jiffy<</span><span class=cFB>cnts</span><span class=cF0>.jiffies) {
|
||
|
<a name="l537"></a> task1=task->next;
|
||
|
<a name="l538"></a> </span><span class=cF5>QueRem</span><span class=cF0>(task);
|
||
|
<a name="l539"></a> </span><span class=cFD>TaskDel</span><span class=cF0>(task);
|
||
|
<a name="l540"></a> task=task1;
|
||
|
<a name="l541"></a> }
|
||
|
<a name="l542"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&</span><span class=cF5>Gs</span><span class=cF0>->cpu_flags,</span><span class=cF3>CPUf_DYING_TASK_QUE</span><span class=cF0>);
|
||
|
<a name="l543"></a> </span><span class=cF5>Gs</span><span class=cF0>->kill_jiffy=</span><span class=cFB>cnts</span><span class=cF0>.jiffies+</span><span class=cF3>DYING_JIFFIES</span><span class=cF0>;
|
||
|
<a name="l544"></a> </span><span class=cF7>}</span><span class=cF0>
|
||
|
<a name="l545"></a>}
|
||
|
</span></pre></body>
|
||
|
</html>
|