diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-02 12:49:15 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-02 13:09:23 -0800 |
commit | 39d718afcff131abf9c12f89357e7e387d7892d5 (patch) | |
tree | d7179a92c27871ec646661517e348957b9805a5f /html/subx/056write.subx.html | |
parent | f44c595267ba1dc6b076340e300961c304904408 (diff) | |
download | mu-39d718afcff131abf9c12f89357e7e387d7892d5.tar.gz |
4816
Diffstat (limited to 'html/subx/056write.subx.html')
-rw-r--r-- | html/subx/056write.subx.html | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/html/subx/056write.subx.html b/html/subx/056write.subx.html index d21a4bfb..7d08441f 100644 --- a/html/subx/056write.subx.html +++ b/html/subx/056write.subx.html @@ -23,6 +23,9 @@ body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: .LineNr { color:#444444; } .subxS1Comment { color:#2d8cff; } .CommentedCode { color: #6c6c6c; } +.subxFunction { color: #ff8700; } +.subxTest { color: #00af00; } +.subxMinorFunction { color: #875f5f; } .Constant { color:#00a0a0; } .SpecialChar { color: #ff0000; } --> @@ -89,7 +92,7 @@ if ('onhashchange' in window) { <span id="L27" class="LineNr"> 27 </span> b8/copy-to-EAX 1/imm32 <span id="L28" class="LineNr"> 28 </span> cd/syscall 0x80/imm8 <span id="L29" class="LineNr"> 29 </span> -<span id="L30" class="LineNr"> 30 </span>write: <span class="subxComment"># f : fd or (address stream), s : (address array byte) -> bytes_written/EAX</span> +<span id="L30" class="LineNr"> 30 </span><span class="subxFunction">write</span>: <span class="subxComment"># f : fd or (address stream), s : (address array byte) -> bytes_written/EAX</span> <span id="L31" class="LineNr"> 31 </span> <span class="subxComment"># (If we ever leave the Linux kernel behind, it may be better to return</span> <span id="L32" class="LineNr"> 32 </span> <span class="subxComment"># the number of bytes *not* written. Success would then be signaled by</span> <span id="L33" class="LineNr"> 33 </span> <span class="subxComment"># returning 0.)</span> @@ -107,7 +110,7 @@ if ('onhashchange' in window) { <span id="L45" class="LineNr"> 45 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L46" class="LineNr"> 46 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> <span id="L47" class="LineNr"> 47 </span> eb/jump $write:end/disp8 -<span id="L48" class="LineNr"> 48 </span>$write:fake: +<span id="L48" class="LineNr"> 48 </span><span class="Constant">$write:fake</span>: <span id="L49" class="LineNr"> 49 </span> <span class="subxComment"># otherwise, treat 'f' as a stream to append to</span> <span id="L50" class="LineNr"> 50 </span> <span class="subxS1Comment"># . save registers</span> <span id="L51" class="LineNr"> 51 </span> 51/push-ECX @@ -138,13 +141,13 @@ if ('onhashchange' in window) { <span id="L76" class="LineNr"> 76 </span> 5b/pop-to-EBX <span id="L77" class="LineNr"> 77 </span> 5a/pop-to-EDX <span id="L78" class="LineNr"> 78 </span> 59/pop-to-ECX -<span id="L79" class="LineNr"> 79 </span>$write:end: +<span id="L79" class="LineNr"> 79 </span><span class="Constant">$write:end</span>: <span id="L80" class="LineNr"> 80 </span> <span class="subxS1Comment"># . epilog</span> <span id="L81" class="LineNr"> 81 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> <span id="L82" class="LineNr"> 82 </span> 5d/pop-to-EBP <span id="L83" class="LineNr"> 83 </span> c3/return <span id="L84" class="LineNr"> 84 </span> -<span id="L85" class="LineNr"> 85 </span>clear-stream: <span class="subxComment"># f : (address stream) -> <void></span> +<span id="L85" class="LineNr"> 85 </span><span class="subxFunction">clear-stream</span>: <span class="subxComment"># f : (address stream) -> <void></span> <span id="L86" class="LineNr"> 86 </span> <span class="subxS1Comment"># . prolog</span> <span id="L87" class="LineNr"> 87 </span> 55/push-EBP <span id="L88" class="LineNr"> 88 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> @@ -164,7 +167,7 @@ if ('onhashchange' in window) { <span id="L102" class="LineNr">102 </span> <span class="subxComment"># EAX = f->data</span> <span id="L103" class="LineNr">103 </span> 81 0/subop/add 3/mod/direct 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/imm32 <span class="subxComment"># add to EAX</span> <span id="L104" class="LineNr">104 </span> <span class="subxComment"># while (true)</span> -<span id="L105" class="LineNr">105 </span>$clear-stream:loop: +<span id="L105" class="LineNr">105 </span><span class="Constant">$clear-stream:loop</span>: <span id="L106" class="LineNr">106 </span> <span class="subxComment"># if EAX >= ECX break</span> <span id="L107" class="LineNr">107 </span> 39/compare 3/mod/direct 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 1/r32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># compare EAX with ECX</span> <span id="L108" class="LineNr">108 </span> 7d/jump-if-greater-or-equal $clear-stream:end/disp8 @@ -173,7 +176,7 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span> <span class="subxComment"># EAX += 4</span> <span id="L112" class="LineNr">112 </span> 81 0/subop/add 3/mod/direct 0/rm32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to EAX</span> <span id="L113" class="LineNr">113 </span> eb/jump $clear-stream:loop/disp8 -<span id="L114" class="LineNr">114 </span>$clear-stream:end: +<span id="L114" class="LineNr">114 </span><span class="Constant">$clear-stream:end</span>: <span id="L115" class="LineNr">115 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L116" class="LineNr">116 </span> 59/pop-to-ECX <span id="L117" class="LineNr">117 </span> 58/pop-to-EAX @@ -182,7 +185,7 @@ if ('onhashchange' in window) { <span id="L120" class="LineNr">120 </span> 5d/pop-to-EBP <span id="L121" class="LineNr">121 </span> c3/return <span id="L122" class="LineNr">122 </span> -<span id="L123" class="LineNr">123 </span>test-write-single: +<span id="L123" class="LineNr">123 </span><span class="subxTest">test-write-single</span>: <span id="L124" class="LineNr">124 </span> <span class="subxComment"># clear-stream(_test-stream)</span> <span id="L125" class="LineNr">125 </span> <span class="subxS2Comment"># . . push args</span> <span id="L126" class="LineNr">126 </span> 68/push _test-stream/imm32 @@ -221,7 +224,7 @@ if ('onhashchange' in window) { <span id="L159" class="LineNr">159 </span> <span class="subxComment"># end</span> <span id="L160" class="LineNr">160 </span> c3/return <span id="L161" class="LineNr">161 </span> -<span id="L162" class="LineNr">162 </span>test-write-appends: +<span id="L162" class="LineNr">162 </span><span class="subxTest">test-write-appends</span>: <span id="L163" class="LineNr">163 </span> <span class="subxComment"># clear-stream(_test-stream)</span> <span id="L164" class="LineNr">164 </span> <span class="subxS2Comment"># . . push args</span> <span id="L165" class="LineNr">165 </span> 68/push _test-stream/imm32 @@ -261,7 +264,7 @@ if ('onhashchange' in window) { <span id="L199" class="LineNr">199 </span> <span id="L200" class="LineNr">200 </span>== data <span id="L201" class="LineNr">201 </span> -<span id="L202" class="LineNr">202 </span>_test-stream: +<span id="L202" class="LineNr">202 </span><span class="subxMinorFunction">_test-stream</span>: <span id="L203" class="LineNr">203 </span> <span class="subxComment"># current write index</span> <span id="L204" class="LineNr">204 </span> 00 00 00 00 <span id="L205" class="LineNr">205 </span> <span class="subxComment"># current read index</span> |