ZealOS/docs/Kernel/KExcept.ZC.html
2021-12-11 06:10:58 -05:00

190 lines
24 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.07">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF1>asm</span><span class=cF0> {
<a name="l2"></a>#</span><span class=cF1>assert</span><span class=cF0> !(</span><span class=cF7>(</span><span class=cF3>REGG_LOCAL_NON_PTR_VARS</span><span class=cF0> | </span><span class=cF3>REGG_LOCAL_VARS</span><span class=cF7>)</span><span class=cF0> &amp; ~</span><span class=cFE>0xFCC0</span><span class=cF0>)
<a name="l3"></a>
<a name="l4"></a></span><span class=cFD>_TEST_EXCEPT</span><span class=cF0>::
<a name="l5"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</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=cFC>FS</span><span class=cF0>:</span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0>.last_except[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l7"></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=cF9>CExcept</span><span class=cF0>.rbp[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l8"></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=cF9>CExcept</span><span class=cF0>.rsi[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l9"></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=cF9>CExcept</span><span class=cF0>.rdi[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l10"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R10</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r10[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l11"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R11</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r11[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l12"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R12</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r12[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l13"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R13</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r13[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l14"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R14</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r14[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l15"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>R15</span><span class=cF0>, </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r15[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l16"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.rflags[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l17"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l18"></a> </span><span class=cF1>JMP</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.handler_catch[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l19"></a>
<a name="l20"></a></span><span class=cFD>_TAKE_EXCEPT</span><span class=cF0>::
<a name="l21"></a> </span><span class=cF1>XOR</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>RAX</span><span class=cF0>
<a name="l22"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cFC>RAX</span><span class=cF0>, </span><span class=cFC>FS</span><span class=cF0>:</span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CTask</span><span class=cF0>.last_except[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l23"></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> </span><span class=cF9>CExcept</span><span class=cF0>.rsp[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l24"></a> </span><span class=cF1>JMP</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.handler_untry[</span><span class=cFC>RAX</span><span class=cF0>]
<a name="l25"></a>
<a name="l26"></a></span><span class=cFD>_SAVE_EXCEPT_REGS</span><span class=cF0>::
<a name="l27"></a> </span><span class=cF1>PUSH</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l28"></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="l29"></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> </span><span class=cF3>SF_ARG1</span><span class=cF0>[</span><span class=cFC>RBP</span><span class=cF0>]
<a name="l30"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.rsi[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>RSI</span><span class=cF0>
<a name="l31"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.rdi[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>RDI</span><span class=cF0>
<a name="l32"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r10[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R10</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r11[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R11</span><span class=cF0>
<a name="l34"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r12[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R12</span><span class=cF0>
<a name="l35"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r13[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R13</span><span class=cF0>
<a name="l36"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r14[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R14</span><span class=cF0>
<a name="l37"></a> </span><span class=cF1>MOV</span><span class=cF0> </span><span class=cF9>U64</span><span class=cF0> </span><span class=cF9>CExcept</span><span class=cF0>.r15[</span><span class=cFC>RAX</span><span class=cF0>], </span><span class=cFC>R15</span><span class=cF0>
<a name="l38"></a> </span><span class=cF1>POP</span><span class=cF0> </span><span class=cFC>RBP</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>RET1</span><span class=cF0> </span><span class=cFE>8</span><span class=cF0>
<a name="l40"></a>}
<a name="l41"></a>
<a name="l42"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_TEST_EXCEPT</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> TestExcept();
<a name="l43"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_TAKE_EXCEPT</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> TakeExcept();
<a name="l44"></a></span><span class=cF1>_extern</span><span class=cF0> </span><span class=cFD>_SAVE_EXCEPT_REGS</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> SaveExceptRegs(</span><span class=cF9>CExcept</span><span class=cF0> *t);
<a name="l45"></a>
<a name="l46"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>PutExcept</span><span class=cF0>(</span><span class=cF1>Bool</span><span class=cF0> catch_it=</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l47"></a>{</span><span class=cF2>//Print exception message and catch exception.</span><span class=cF0>
<a name="l48"></a> </span><span class=cF6>&quot;Except . %c . &quot;</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_ch;
<a name="l49"></a> </span><span class=cF6>&quot;%P . %P . %P . %P . %P . %P\n&quot;</span><span class=cF0>, </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>1</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>2</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>3</span><span class=cF0>],
<a name="l50"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>4</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>5</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>6</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>7</span><span class=cF0>];
<a name="l51"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = catch_it;
<a name="l52"></a>}
<a name="l53"></a>
<a name="l54"></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="l55"></a>
<a name="l56"></a></span><span class=cF1>class</span><span class=cF0> CTryStack
<a name="l57"></a>{
<a name="l58"></a> </span><span class=cF9>I64</span><span class=cF0> rbp;
<a name="l59"></a> </span><span class=cF9>I64</span><span class=cF0> ret_rip;
<a name="l60"></a> </span><span class=cF9>I64</span><span class=cF0> arg1;
<a name="l61"></a> </span><span class=cF9>I64</span><span class=cF0> arg2;
<a name="l62"></a>};
<a name="l63"></a>
<a name="l64"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SysTry</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *catch_start, </span><span class=cF1>U8</span><span class=cF0> *untry_start)
<a name="l65"></a>{
<a name="l66"></a> </span><span class=cF9>I64</span><span class=cF0> *rbp = </span><span class=cF5>RBPGet</span><span class=cF0>;
<a name="l67"></a> </span><span class=cF9>CExcept</span><span class=cF0> *tmpt = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CExcept</span><span class=cF7>)</span><span class=cF0>);
<a name="l68"></a>
<a name="l69"></a> tmpt-&gt;handler_catch = catch_start;
<a name="l70"></a> tmpt-&gt;handler_untry = untry_start;
<a name="l71"></a> tmpt-&gt;rsp = rbp(</span><span class=cF1>U8</span><span class=cF0> *) + </span><span class=cF1>sizeof</span><span class=cF0>(CTryStack);
<a name="l72"></a> tmpt-&gt;rbp = *rbp;
<a name="l73"></a> tmpt-&gt;rflags = </span><span class=cF5>RFlagsGet</span><span class=cF0>;
<a name="l74"></a>
<a name="l75"></a> SaveExceptRegs(tmpt);
<a name="l76"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpt, </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_except);
<a name="l77"></a>}
<a name="l78"></a>
<a name="l79"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>SysUntry</span><span class=cF0>()
<a name="l80"></a>{
<a name="l81"></a> </span><span class=cF9>CExcept</span><span class=cF0> *tmpt = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_except;
<a name="l82"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpt);
<a name="l83"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l84"></a>}
<a name="l85"></a>
<a name="l86"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> ch=</span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> no_log=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l87"></a>{</span><span class=cF2>//ch can be up to 8 chars like </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KeyDev.ZC.html#l23"><span class=cF4>PutChars</span></a><span class=cF2>().</span><span class=cF0>
<a name="l88"></a></span><span class=cF2>//In the catcher, fetch ch from Fs-&gt;except_ch.</span><span class=cF0>
<a name="l89"></a> </span><span class=cF9>CExcept</span><span class=cF0> *tmpt = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_except;
<a name="l90"></a> </span><span class=cF1>Bool</span><span class=cF0> was_raw;
<a name="l91"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l92"></a>
<a name="l93"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_ch = ch;
<a name="l94"></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=cF3>TASK_EXCEPT_CALLERS</span><span class=cF0>; i++)
<a name="l95"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[i] = </span><span class=cF5>Caller</span><span class=cF0>(i + </span><span class=cFE>1</span><span class=cF0>);
<a name="l96"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_rbp = </span><span class=cF5>RBPGet</span><span class=cF0>;
<a name="l97"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (!no_log)
<a name="l99"></a> </span><span class=cF5>SysLog</span><span class=cF0>(</span><span class=cF6>&quot;Except . %c . %p . %p . %p . %p . %p . %p\n&quot;</span><span class=cF0>, ch,
<a name="l100"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>0</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>1</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>2</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>3</span><span class=cF0>],
<a name="l101"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>4</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>5</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>6</span><span class=cF0>], </span><span class=cF5>Fs</span><span class=cF0>-&gt;except_callers[</span><span class=cFE>7</span><span class=cF0>]);
<a name="l102"></a>
<a name="l103"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_except != &amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;next_except)
<a name="l104"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l105"></a> TestExcept;
<a name="l106"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;catch_except)
<a name="l107"></a> TakeExcept;
<a name="l108"></a> </span><span class=cF5>RBPSet</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;except_rbp);
<a name="l109"></a> tmpt = </span><span class=cF5>Fs</span><span class=cF0>-&gt;last_except;
<a name="l110"></a> </span><span class=cF5>QueueRemove</span><span class=cF0>(tmpt);
<a name="l111"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpt);
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l113"></a> was_raw = </span><span class=cF5>Raw</span><span class=cF0>(</span><span class=cF3>ON</span><span class=cF0>);
<a name="l114"></a> </span><span class=cF5>PutExcept</span><span class=cF0>(</span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l115"></a> </span><span class=cF5>Panic</span><span class=cF0>(</span><span class=cF6>&quot;Unhandled Exception&quot;</span><span class=cF0>);
<a name="l116"></a> </span><span class=cF5>Raw</span><span class=cF0>(was_raw);
<a name="l117"></a>}
<a name="l118"></a>
<a name="l119"></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="l120"></a>
<a name="l121"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>Break</span><span class=cF0>()
<a name="l122"></a>{</span><span class=cF2>//Send &lt;CTRL-ALT-c&gt;.</span><span class=cF0>
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;</span><span class=cF5>Fs</span><span class=cF0>-&gt;task_flags, </span><span class=cF3>TASKf_BREAK_TO_SHIFT_ESC</span><span class=cF7>)</span><span class=cF0>)
<a name="l124"></a> </span><span class=cF5>Message</span><span class=cF0>(</span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>, </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>, </span><span class=cFE>0x20100000201</span><span class=cF0>);
<a name="l125"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l126"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l127"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;wake_jiffy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l128"></a> </span><span class=cF5>TaskResetAwaitingMessage</span><span class=cF0>;
<a name="l129"></a> </span><span class=cF5>DrivesRelease</span><span class=cF0>();
<a name="l130"></a> </span><span class=cF5>BlkDevsRelease</span><span class=cF0>();
<a name="l131"></a> </span><span class=cF5>FlushMessages</span><span class=cF0>;
<a name="l132"></a> </span><span class=cF5>throw</span><span class=cF0>(</span><span class=cF6>'Break'</span><span class=cF0>);
<a name="l133"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l134"></a>}
<a name="l135"></a>
<a name="l136"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>BreakLock</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="l137"></a>{</span><span class=cF2>//Disables &lt;CTRL-ALT-c&gt;.</span><span class=cF0>
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l139"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l140"></a>
<a name="l141"></a> </span><span class=cF1>return</span><span class=cF0> !</span><span class=cF5>LBts</span><span class=cF0>(&amp;task-&gt;task_flags, </span><span class=cF3>TASKf_BREAK_LOCKED</span><span class=cF0>);
<a name="l142"></a>}
<a name="l143"></a>
<a name="l144"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>BreakUnlock</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="l145"></a>{</span><span class=cF2>//Reenables &lt;CTRL-ALT-c&gt; and issues any pending breaks.</span><span class=cF0>
<a name="l146"></a> </span><span class=cF1>Bool</span><span class=cF0> res;
<a name="l147"></a>
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (!task)
<a name="l149"></a> task = </span><span class=cF5>Fs</span><span class=cF0>;
<a name="l150"></a>
<a name="l151"></a> res = </span><span class=cF5>LBtr</span><span class=cF0>(&amp;task-&gt;task_flags, </span><span class=cF3>TASKf_BREAK_LOCKED</span><span class=cF0>);
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>LBtr</span><span class=cF7>(</span><span class=cF0>&amp;task-&gt;task_flags, </span><span class=cF3>TASKf_PENDING_BREAK</span><span class=cF7>)</span><span class=cF0>)
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (task == </span><span class=cF5>Fs</span><span class=cF0>)
<a name="l155"></a> </span><span class=cF5>Break</span><span class=cF0>;
<a name="l156"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l157"></a> task-&gt;rip = &amp;</span><span class=cF5>Break</span><span class=cF0>;
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a>
<a name="l160"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l161"></a>}
</span></pre></body>
</html>