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/052kernel_string_equal.subx.html | |
parent | f44c595267ba1dc6b076340e300961c304904408 (diff) | |
download | mu-39d718afcff131abf9c12f89357e7e387d7892d5.tar.gz |
4816
Diffstat (limited to 'html/subx/052kernel_string_equal.subx.html')
-rw-r--r-- | html/subx/052kernel_string_equal.subx.html | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/html/subx/052kernel_string_equal.subx.html b/html/subx/052kernel_string_equal.subx.html index e35b1aa3..5c6911ff 100644 --- a/html/subx/052kernel_string_equal.subx.html +++ b/html/subx/052kernel_string_equal.subx.html @@ -23,6 +23,8 @@ 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; } .Constant { color:#00a0a0; } .SpecialChar { color: #ff0000; } .subxH1Comment { color:#00ffff; } @@ -91,7 +93,7 @@ if ('onhashchange' in window) { <span id="L28" class="LineNr"> 28 </span> <span id="L29" class="LineNr"> 29 </span><span class="subxComment"># compare a null-terminated ascii string with a more idiomatic length-prefixed byte array</span> <span id="L30" class="LineNr"> 30 </span><span class="subxComment"># reason for the name: the only place we should have null-terminated ascii strings is from commandline args</span> -<span id="L31" class="LineNr"> 31 </span>kernel-string-equal: <span class="subxComment"># s : null-terminated ascii string, benchmark : length-prefixed ascii string -> EAX : boolean</span> +<span id="L31" class="LineNr"> 31 </span><span class="subxFunction">kernel-string-equal</span>: <span class="subxComment"># s : null-terminated ascii string, benchmark : length-prefixed ascii string -> EAX : boolean</span> <span id="L32" class="LineNr"> 32 </span> <span class="subxS1Comment"># . prolog</span> <span id="L33" class="LineNr"> 33 </span> 55/push-EBP <span id="L34" class="LineNr"> 34 </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> @@ -127,7 +129,7 @@ if ('onhashchange' in window) { <span id="L64" class="LineNr"> 64 </span> <span class="subxComment"># initialize loop counter i into ECX</span> <span id="L65" class="LineNr"> 65 </span> b9/copy-to-ECX 0/imm32/exit <span id="L66" class="LineNr"> 66 </span> <span class="subxComment"># while (i/ECX < n/EDX)</span> -<span id="L67" class="LineNr"> 67 </span>$kernel-string-equal:loop: +<span id="L67" class="LineNr"> 67 </span><span class="Constant">$kernel-string-equal:loop</span>: <span id="L68" class="LineNr"> 68 </span> 39/compare 3/mod/direct 1/rm32/ECX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 2/r32/EDX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># compare ECX with EDX</span> <span id="L69" class="LineNr"> 69 </span> 74/jump-if-equal $kernel-string-equal:break/disp8 <span id="L70" class="LineNr"> 70 </span> <span class="subxComment"># c1/EAX, c2/EBX = *s, *benchmark</span> @@ -147,20 +149,20 @@ if ('onhashchange' in window) { <span id="L84" class="LineNr"> 84 </span> 47/inc-EDI <span id="L85" class="LineNr"> 85 </span> <span class="subxComment"># end while</span> <span id="L86" class="LineNr"> 86 </span> eb/jump $kernel-string-equal:loop/disp8 -<span id="L87" class="LineNr"> 87 </span>$kernel-string-equal:break: +<span id="L87" class="LineNr"> 87 </span><span class="Constant">$kernel-string-equal:break</span>: <span id="L88" class="LineNr"> 88 </span> <span class="subxComment"># if (*s/EDI == 0) return true</span> <span id="L89" class="LineNr"> 89 </span> b8/copy-to-EAX 0/imm32 <span id="L90" class="LineNr"> 90 </span> 8a/copy 0/mod/indirect 7/rm32/EDI <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy byte at *EDI to lower byte of EAX</span> <span id="L91" class="LineNr"> 91 </span> 3d/compare-EAX 0/imm32 <span id="L92" class="LineNr"> 92 </span> 75/jump-if-not-equal $kernel-string-equal:false/disp8 -<span id="L93" class="LineNr"> 93 </span>$kernel-string-equal:true: +<span id="L93" class="LineNr"> 93 </span><span class="Constant">$kernel-string-equal:true</span>: <span id="L94" class="LineNr"> 94 </span> b8/copy-to-EAX 1/imm32 <span id="L95" class="LineNr"> 95 </span> eb/jump $kernel-string-equal:end/disp8 <span id="L96" class="LineNr"> 96 </span> <span class="subxComment"># return false</span> -<span id="L97" class="LineNr"> 97 </span>$kernel-string-equal:false: +<span id="L97" class="LineNr"> 97 </span><span class="Constant">$kernel-string-equal:false</span>: <span id="L98" class="LineNr"> 98 </span> b8/copy-to-EAX 0/imm32 <span id="L99" class="LineNr"> 99 </span> -<span id="L100" class="LineNr">100 </span>$kernel-string-equal:end: +<span id="L100" class="LineNr">100 </span><span class="Constant">$kernel-string-equal:end</span>: <span id="L101" class="LineNr">101 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L102" class="LineNr">102 </span> 5f/pop-to-EDI <span id="L103" class="LineNr">103 </span> 5e/pop-to-ESI @@ -174,7 +176,7 @@ if ('onhashchange' in window) { <span id="L111" class="LineNr">111 </span> <span id="L112" class="LineNr">112 </span><span class="subxH1Comment"># - tests</span> <span id="L113" class="LineNr">113 </span> -<span id="L114" class="LineNr">114 </span>test-compare-null-kernel-string-with-empty-array: +<span id="L114" class="LineNr">114 </span><span class="subxTest">test-compare-null-kernel-string-with-empty-array</span>: <span id="L115" class="LineNr">115 </span> <span class="subxComment"># EAX = kernel-string-equal(Null-kernel-string, "")</span> <span id="L116" class="LineNr">116 </span> <span class="subxS2Comment"># . . push args</span> <span id="L117" class="LineNr">117 </span> 68/push <span class="Constant">""</span>/imm32 @@ -194,7 +196,7 @@ if ('onhashchange' in window) { <span id="L131" class="LineNr">131 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L132" class="LineNr">132 </span> c3/return <span id="L133" class="LineNr">133 </span> -<span id="L134" class="LineNr">134 </span>test-compare-null-kernel-string-with-non-empty-array: +<span id="L134" class="LineNr">134 </span><span class="subxTest">test-compare-null-kernel-string-with-non-empty-array</span>: <span id="L135" class="LineNr">135 </span> <span class="subxComment"># EAX = kernel-string-equal(Null-kernel-string, "Abc")</span> <span id="L136" class="LineNr">136 </span> <span class="subxS2Comment"># . . push args</span> <span id="L137" class="LineNr">137 </span> 68/push <span class="Constant">"Abc"</span>/imm32 @@ -214,7 +216,7 @@ if ('onhashchange' in window) { <span id="L151" class="LineNr">151 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L152" class="LineNr">152 </span> c3/return <span id="L153" class="LineNr">153 </span> -<span id="L154" class="LineNr">154 </span>test-compare-kernel-string-with-equal-array: +<span id="L154" class="LineNr">154 </span><span class="subxTest">test-compare-kernel-string-with-equal-array</span>: <span id="L155" class="LineNr">155 </span> <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, "Abc")</span> <span id="L156" class="LineNr">156 </span> <span class="subxS2Comment"># . . push args</span> <span id="L157" class="LineNr">157 </span> 68/push <span class="Constant">"Abc"</span>/imm32 @@ -234,7 +236,7 @@ if ('onhashchange' in window) { <span id="L171" class="LineNr">171 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L172" class="LineNr">172 </span> c3/return <span id="L173" class="LineNr">173 </span> -<span id="L174" class="LineNr">174 </span>test-compare-kernel-string-with-inequal-array: +<span id="L174" class="LineNr">174 </span><span class="subxTest">test-compare-kernel-string-with-inequal-array</span>: <span id="L175" class="LineNr">175 </span> <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, "Adc")</span> <span id="L176" class="LineNr">176 </span> <span class="subxS2Comment"># . . push args</span> <span id="L177" class="LineNr">177 </span> 68/push <span class="Constant">"Adc"</span>/imm32 @@ -254,7 +256,7 @@ if ('onhashchange' in window) { <span id="L191" class="LineNr">191 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L192" class="LineNr">192 </span> c3/return <span id="L193" class="LineNr">193 </span> -<span id="L194" class="LineNr">194 </span>test-compare-kernel-string-with-empty-array: +<span id="L194" class="LineNr">194 </span><span class="subxTest">test-compare-kernel-string-with-empty-array</span>: <span id="L195" class="LineNr">195 </span> <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, "")</span> <span id="L196" class="LineNr">196 </span> <span class="subxS2Comment"># . . push args</span> <span id="L197" class="LineNr">197 </span> 68/push <span class="Constant">""</span>/imm32 @@ -274,7 +276,7 @@ if ('onhashchange' in window) { <span id="L211" class="LineNr">211 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L212" class="LineNr">212 </span> c3/return <span id="L213" class="LineNr">213 </span> -<span id="L214" class="LineNr">214 </span>test-compare-kernel-string-with-shorter-array: +<span id="L214" class="LineNr">214 </span><span class="subxTest">test-compare-kernel-string-with-shorter-array</span>: <span id="L215" class="LineNr">215 </span> <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, "Ab")</span> <span id="L216" class="LineNr">216 </span> <span class="subxS2Comment"># . . push args</span> <span id="L217" class="LineNr">217 </span> 68/push <span class="Constant">"Ab"</span>/imm32 @@ -294,7 +296,7 @@ if ('onhashchange' in window) { <span id="L231" class="LineNr">231 </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> 0xc/imm32 <span class="subxComment"># add to ESP</span> <span id="L232" class="LineNr">232 </span> c3/return <span id="L233" class="LineNr">233 </span> -<span id="L234" class="LineNr">234 </span>test-compare-kernel-string-with-longer-array: +<span id="L234" class="LineNr">234 </span><span class="subxTest">test-compare-kernel-string-with-longer-array</span>: <span id="L235" class="LineNr">235 </span> <span class="subxComment"># EAX = kernel-string-equal(Abc-kernel-string, "Abcd")</span> <span id="L236" class="LineNr">236 </span> <span class="subxS2Comment"># . . push args</span> <span id="L237" class="LineNr">237 </span> 68/push <span class="Constant">"Abcd"</span>/imm32 |