From 333525360b22f3d3ea31db46a4d2f1b4edbfebdb Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 26 Aug 2019 11:55:26 -0700 Subject: 5592 - switch register names to lowercase --- html/052kernel-string-equal.subx.html | 164 +++++++++++++++++----------------- 1 file changed, 82 insertions(+), 82 deletions(-) (limited to 'html/052kernel-string-equal.subx.html') diff --git a/html/052kernel-string-equal.subx.html b/html/052kernel-string-equal.subx.html index d1257e5e..cb0414e2 100644 --- a/html/052kernel-string-equal.subx.html +++ b/html/052kernel-string-equal.subx.html @@ -84,13 +84,13 @@ if ('onhashchange' in window) { 22 Entry: # run all tests 23 e8/call run-tests/disp32 # 'run-tests' is a function created automatically by SubX. It calls all functions that start with 'test-'. 24 # syscall(exit, Num-test-failures) - 25 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32 # copy *Num-test-failures to EBX - 26 b8/copy-to-EAX 1/imm32/exit + 25 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32 # copy *Num-test-failures to ebx + 26 b8/copy-to-eax 1/imm32/exit 27 cd/syscall 0x80/imm8 28 29 # compare a null-terminated ascii string with a more idiomatic length-prefixed byte array 30 # reason for the name: the only place we should have null-terminated ascii strings is from commandline args - 31 kernel-string-equal?: # s : null-terminated ascii string, benchmark : length-prefixed ascii string -> EAX : boolean + 31 kernel-string-equal?: # s : null-terminated ascii string, benchmark : length-prefixed ascii string -> eax : boolean 32 # pseudocode: 33 # n = benchmark->length 34 # s1 = s @@ -105,217 +105,217 @@ if ('onhashchange' in window) { 43 # return *s1 == 0 44 # 45 # registers: - 46 # i: ECX - 47 # n: EDX - 48 # s1: EDI - 49 # s2: ESI - 50 # c1: EAX - 51 # c2: EBX + 46 # i: ecx + 47 # n: edx + 48 # s1: edi + 49 # s2: esi + 50 # c1: eax + 51 # c2: ebx 52 # 53 # . prolog - 54 55/push-EBP - 55 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + 54 55/push-ebp + 55 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp 56 # . save registers - 57 51/push-ECX - 58 52/push-EDX - 59 53/push-EBX - 60 56/push-ESI - 61 57/push-EDI - 62 # s1/EDI = s - 63 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 . # copy *(EBP+8) to EDI - 64 # n/EDX = benchmark->length - 65 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0xc/disp8 . # copy *(EBP+12) to EDX - 66 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . . # copy *EDX to EDX - 67 # s2/ESI = benchmark->data - 68 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 . # copy *(EBP+12) to ESI - 69 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32 # add to ESI - 70 # i/ECX = c1/EAX = c2/EBX = 0 - 71 b9/copy-to-ECX 0/imm32/exit - 72 b8/copy-to-EAX 0/imm32 - 73 bb/copy-to-EBX 0/imm32 + 57 51/push-ecx + 58 52/push-edx + 59 53/push-ebx + 60 56/push-esi + 61 57/push-edi + 62 # s1/edi = s + 63 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi + 64 # n/edx = benchmark->length + 65 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx + 66 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx + 67 # s2/esi = benchmark->data + 68 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi + 69 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 4/imm32 # add to esi + 70 # i/ecx = c1/eax = c2/ebx = 0 + 71 b9/copy-to-ecx 0/imm32/exit + 72 b8/copy-to-eax 0/imm32 + 73 bb/copy-to-ebx 0/imm32 74 $kernel-string-equal?:loop: 75 # if (i >= n) break - 76 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . . # compare ECX with EDX + 76 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . . # compare ecx with edx 77 7d/jump-if-greater-or-equal $kernel-string-equal?:break/disp8 78 # c1 = *s1 - 79 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 0/r32/AL . . # copy byte at *EDI to AL + 79 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 0/r32/AL . . # copy byte at *edi to AL 80 # c2 = *s2 - 81 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 3/r32/BL . . # copy byte at *ESI to BL + 81 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 3/r32/BL . . # copy byte at *esi to BL 82 # if (c1 == 0) return false - 83 3d/compare-EAX-and 0/imm32 + 83 3d/compare-eax-and 0/imm32 84 74/jump-if-equal $kernel-string-equal?:false/disp8 85 # if (c1 != c2) return false - 86 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX + 86 39/compare 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . . # compare eax and ebx 87 75/jump-if-not-equal $kernel-string-equal?:false/disp8 88 # ++i - 89 41/increment-ECX + 89 41/increment-ecx 90 # ++s1 - 91 47/increment-EDI + 91 47/increment-edi 92 # ++s2 - 93 46/increment-ESI + 93 46/increment-esi 94 eb/jump $kernel-string-equal?:loop/disp8 95 $kernel-string-equal?:break: 96 # return *s1 == 0 - 97 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 0/r32/AL . . # copy byte at *EDI to AL - 98 3d/compare-EAX-and 0/imm32 + 97 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 0/r32/AL . . # copy byte at *edi to AL + 98 3d/compare-eax-and 0/imm32 99 75/jump-if-not-equal $kernel-string-equal?:false/disp8 100 $kernel-string-equal?:true: -101 b8/copy-to-EAX 1/imm32 +101 b8/copy-to-eax 1/imm32 102 eb/jump $kernel-string-equal?:end/disp8 103 $kernel-string-equal?:false: -104 b8/copy-to-EAX 0/imm32 +104 b8/copy-to-eax 0/imm32 105 $kernel-string-equal?:end: 106 # . restore registers -107 5f/pop-to-EDI -108 5e/pop-to-ESI -109 5b/pop-to-EBX -110 5a/pop-to-EDX -111 59/pop-to-ECX +107 5f/pop-to-edi +108 5e/pop-to-esi +109 5b/pop-to-ebx +110 5a/pop-to-edx +111 59/pop-to-ecx 112 # . epilog -113 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -114 5d/pop-to-EBP +113 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp +114 5d/pop-to-ebp 115 c3/return 116 117 # - tests 118 119 test-compare-null-kernel-string-with-empty-array: -120 # EAX = kernel-string-equal?(Null-kernel-string, "") +120 # eax = kernel-string-equal?(Null-kernel-string, "") 121 # . . push args 122 68/push ""/imm32 123 68/push Null-kernel-string/imm32 124 # . . call 125 e8/call kernel-string-equal?/disp32 126 # . . discard args -127 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -128 # check-ints-equal(EAX, 1, msg) +127 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +128 # check-ints-equal(eax, 1, msg) 129 # . . push args 130 68/push "F - test-compare-null-kernel-string-with-empty-array"/imm32 131 68/push 1/imm32/true -132 50/push-EAX +132 50/push-eax 133 # . . call 134 e8/call check-ints-equal/disp32 135 # . . discard args -136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +136 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 137 c3/return 138 139 test-compare-null-kernel-string-with-non-empty-array: -140 # EAX = kernel-string-equal?(Null-kernel-string, "Abc") +140 # eax = kernel-string-equal?(Null-kernel-string, "Abc") 141 # . . push args 142 68/push "Abc"/imm32 143 68/push Null-kernel-string/imm32 144 # . . call 145 e8/call kernel-string-equal?/disp32 146 # . . discard args -147 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -148 # check-ints-equal(EAX, 0, msg) +147 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +148 # check-ints-equal(eax, 0, msg) 149 # . . push args 150 68/push "F - test-compare-null-kernel-string-with-non-empty-array"/imm32 151 68/push 0/imm32/false -152 50/push-EAX +152 50/push-eax 153 # . . call 154 e8/call check-ints-equal/disp32 155 # . . discard args -156 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +156 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 157 c3/return 158 159 test-compare-kernel-string-with-equal-array: -160 # EAX = kernel-string-equal?(_test-Abc-kernel-string, "Abc") +160 # eax = kernel-string-equal?(_test-Abc-kernel-string, "Abc") 161 # . . push args 162 68/push "Abc"/imm32 163 68/push _test-Abc-kernel-string/imm32 164 # . . call 165 e8/call kernel-string-equal?/disp32 166 # . . discard args -167 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -168 # check-ints-equal(EAX, 1, msg) +167 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +168 # check-ints-equal(eax, 1, msg) 169 # . . push args 170 68/push "F - test-compare-kernel-string-with-equal-array"/imm32 171 68/push 1/imm32/true -172 50/push-EAX +172 50/push-eax 173 # . . call 174 e8/call check-ints-equal/disp32 175 # . . discard args -176 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +176 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 177 c3/return 178 179 test-compare-kernel-string-with-inequal-array: -180 # EAX = kernel-string-equal?(_test-Abc-kernel-string, "Adc") +180 # eax = kernel-string-equal?(_test-Abc-kernel-string, "Adc") 181 # . . push args 182 68/push "Adc"/imm32 183 68/push _test-Abc-kernel-string/imm32 184 # . . call 185 e8/call kernel-string-equal?/disp32 186 # . . discard args -187 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -188 # check-ints-equal(EAX, 0, msg) +187 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +188 # check-ints-equal(eax, 0, msg) 189 # . . push args 190 68/push "F - test-compare-kernel-string-with-equal-array"/imm32 191 68/push 0/imm32/false -192 50/push-EAX +192 50/push-eax 193 # . . call 194 e8/call check-ints-equal/disp32 195 # . . discard args -196 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +196 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 197 c3/return 198 199 test-compare-kernel-string-with-empty-array: -200 # EAX = kernel-string-equal?(_test-Abc-kernel-string, "") +200 # eax = kernel-string-equal?(_test-Abc-kernel-string, "") 201 # . . push args 202 68/push ""/imm32 203 68/push _test-Abc-kernel-string/imm32 204 # . . call 205 e8/call kernel-string-equal?/disp32 206 # . . discard args -207 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -208 # check-ints-equal(EAX, 0, msg) +207 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +208 # check-ints-equal(eax, 0, msg) 209 # . . push args 210 68/push "F - test-compare-kernel-string-with-equal-array"/imm32 211 68/push 0/imm32/false -212 50/push-EAX +212 50/push-eax 213 # . . call 214 e8/call check-ints-equal/disp32 215 # . . discard args -216 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +216 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 217 c3/return 218 219 test-compare-kernel-string-with-shorter-array: -220 # EAX = kernel-string-equal?(_test-Abc-kernel-string, "Ab") +220 # eax = kernel-string-equal?(_test-Abc-kernel-string, "Ab") 221 # . . push args 222 68/push "Ab"/imm32 223 68/push _test-Abc-kernel-string/imm32 224 # . . call 225 e8/call kernel-string-equal?/disp32 226 # . . discard args -227 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -228 # check-ints-equal(EAX, 0, msg) +227 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +228 # check-ints-equal(eax, 0, msg) 229 # . . push args 230 68/push "F - test-compare-kernel-string-with-shorter-array"/imm32 231 68/push 0/imm32/false -232 50/push-EAX +232 50/push-eax 233 # . . call 234 e8/call check-ints-equal/disp32 235 # . . discard args -236 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +236 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 237 c3/return 238 239 test-compare-kernel-string-with-longer-array: -240 # EAX = kernel-string-equal?(_test-Abc-kernel-string, "Abcd") +240 # eax = kernel-string-equal?(_test-Abc-kernel-string, "Abcd") 241 # . . push args 242 68/push "Abcd"/imm32 243 68/push _test-Abc-kernel-string/imm32 244 # . . call 245 e8/call kernel-string-equal?/disp32 246 # . . discard args -247 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -248 # check-ints-equal(EAX, 0, msg) +247 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp +248 # check-ints-equal(eax, 0, msg) 249 # . . push args 250 68/push "F - test-compare-kernel-string-with-longer-array"/imm32 251 68/push 0/imm32/false -252 50/push-EAX +252 50/push-eax 253 # . . call 254 e8/call check-ints-equal/disp32 255 # . . discard args -256 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +256 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 257 c3/return 258 259 == data -- cgit 1.4.1-2-gfad0