From cf02c20bb02f5d2fbfee5557baf68c0e2ca5a042 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 4 Dec 2018 00:29:06 -0800 Subject: 4832 Let's start adding ':end' labels in all functions, just because it helps us visualize where function calls end in traces, thanks to the '--map' commandline argument. --- html/subx/062write-byte.subx.html | 170 +++++++++++++++++++------------------- 1 file changed, 86 insertions(+), 84 deletions(-) (limited to 'html/subx/062write-byte.subx.html') diff --git a/html/subx/062write-byte.subx.html b/html/subx/062write-byte.subx.html index d6a65565..c3d9ca0d 100644 --- a/html/subx/062write-byte.subx.html +++ b/html/subx/062write-byte.subx.html @@ -138,91 +138,93 @@ if ('onhashchange' in window) { 73 88/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0x10/disp8 . # copy AL to *(ESI+ECX+16) 74 # ++f->read 75 ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 . # increment *(ESI+4) - 76 # . restore registers - 77 5e/pop-to-ESI - 78 59/pop-to-ECX - 79 # . epilog - 80 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 81 5d/pop-to-EBP - 82 c3/return - 83 - 84 flush: # f : (address buffered-file) -> <void> - 85 # . prolog - 86 55/push-EBP - 87 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - 88 # . save registers - 89 50/push-EAX - 90 51/push-ECX - 91 # EAX = f - 92 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX - 93 # write-stream(f->fd, data = f+4) - 94 # . . push args - 95 8d/copy-address 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 . # copy EAX+4 to ECX - 96 51/push-ECX - 97 ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . . # push *EAX - 98 # . . call - 99 e8/call write-stream/disp32 -100 # . . discard args -101 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -102 # . restore registers -103 59/pop-to-ECX -104 58/pop-to-EAX -105 # . epilog -106 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -107 5d/pop-to-EBP -108 c3/return -109 -110 # - tests + 76 $write-byte:end: + 77 # . restore registers + 78 5e/pop-to-ESI + 79 59/pop-to-ECX + 80 # . epilog + 81 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 82 5d/pop-to-EBP + 83 c3/return + 84 + 85 flush: # f : (address buffered-file) -> <void> + 86 # . prolog + 87 55/push-EBP + 88 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + 89 # . save registers + 90 50/push-EAX + 91 51/push-ECX + 92 # EAX = f + 93 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/EAX 8/disp8 . # copy *(EBP+8) to EAX + 94 # write-stream(f->fd, data = f+4) + 95 # . . push args + 96 8d/copy-address 1/mod/*+disp8 0/rm32/EAX . . . 1/r32/ECX 4/disp8 . # copy EAX+4 to ECX + 97 51/push-ECX + 98 ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . . # push *EAX + 99 # . . call +100 e8/call write-stream/disp32 +101 # . . discard args +102 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP +103 $flush:end: +104 # . restore registers +105 59/pop-to-ECX +106 58/pop-to-EAX +107 # . epilog +108 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +109 5d/pop-to-EBP +110 c3/return 111 -112 test-write-byte-single: -113 # - check that read-byte returns first byte of 'file' -114 # setup -115 # . clear-stream(_test-stream) -116 # . . push args -117 68/push _test-stream/imm32 -118 # . . call -119 e8/call clear-stream/disp32 -120 # . . discard args -121 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -122 # . clear-stream(_test-buffered-file+4) -123 # . . push args -124 b8/copy-to-EAX _test-buffered-file/imm32 -125 05/add-to-EAX 4/imm32 -126 50/push-EAX -127 # . . call -128 e8/call clear-stream/disp32 -129 # . . discard args -130 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -131 # write-byte(_test-buffered-file, 'A') -132 # . . push args -133 68/push 0x41/imm32 -134 68/push _test-buffered-file/imm32 -135 # . . call -136 e8/call write-byte/disp32 -137 # . . discard args -138 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -139 # flush(_test-buffered-file) -140 # . . push args -141 68/push _test-buffered-file/imm32 -142 # . . call -143 e8/call flush/disp32 -144 # . . discard args -145 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -146 # check-ints-equal(*_test-stream->data, 'A', msg) -147 # . . push args -148 68/push "F - test-write-byte-single"/imm32 -149 68/push 0x41/imm32 -150 # . . push *_test-stream->data -151 b8/copy-to-EAX _test-stream/imm32 -152 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12) -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 -157 # . end -158 c3/return -159 -160 # . . vim:nowrap:textwidth=0 +112 # - tests +113 +114 test-write-byte-single: +115 # - check that read-byte returns first byte of 'file' +116 # setup +117 # . clear-stream(_test-stream) +118 # . . push args +119 68/push _test-stream/imm32 +120 # . . call +121 e8/call clear-stream/disp32 +122 # . . discard args +123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +124 # . clear-stream(_test-buffered-file+4) +125 # . . push args +126 b8/copy-to-EAX _test-buffered-file/imm32 +127 05/add-to-EAX 4/imm32 +128 50/push-EAX +129 # . . call +130 e8/call clear-stream/disp32 +131 # . . discard args +132 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +133 # write-byte(_test-buffered-file, 'A') +134 # . . push args +135 68/push 0x41/imm32 +136 68/push _test-buffered-file/imm32 +137 # . . call +138 e8/call write-byte/disp32 +139 # . . discard args +140 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP +141 # flush(_test-buffered-file) +142 # . . push args +143 68/push _test-buffered-file/imm32 +144 # . . call +145 e8/call flush/disp32 +146 # . . discard args +147 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +148 # check-ints-equal(*_test-stream->data, 'A', msg) +149 # . . push args +150 68/push "F - test-write-byte-single"/imm32 +151 68/push 0x41/imm32 +152 # . . push *_test-stream->data +153 b8/copy-to-EAX _test-stream/imm32 +154 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12) +155 # . . call +156 e8/call check-ints-equal/disp32 +157 # . . discard args +158 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +159 # . end +160 c3/return +161 +162 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0