ofs | hex dump | ascii |
---|
0000 | 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 08 f1 00 00 05 c1 08 06 00 00 00 f6 4a 98 | .PNG........IHDR..............J. |
0020 | 46 00 00 0c 2b 69 43 43 50 49 43 43 20 50 72 6f 66 69 6c 65 00 00 48 89 95 97 07 54 93 c9 16 80 | F...+iCCPICC.Profile..H....T.... |
0040 | e7 2f 49 48 48 68 81 08 48 09 bd 89 d2 09 20 35 b4 00 02 52 05 1b 21 09 24 94 18 13 82 88 1d 5d | ./IHHh..H......5...R..!.$......] |
0060 | 54 70 2d a8 88 60 45 57 45 14 5d 0b 20 a2 22 f6 b2 28 f6 fe b0 a0 a2 ac 8b ba d8 50 79 93 04 d0 | Tp-..`EWE.]..."..(.........Py... |
0080 | d5 f3 de 3b ef 9e 33 ff ff e5 ce 9d 3b f7 de cc 3f 67 06 00 cd 58 ae 44 92 83 6a 01 90 2b ce 93 | ...;..3.....;...?g...X.D..j..+.. |
00a0 | c6 85 05 31 c7 a5 a4 32 49 8f 00 15 90 00 0d b0 80 2d 97 27 93 04 c6 c6 46 01 28 83 ef 7f ca bb | ...1...2I........-.'....F.(..... |
00c0 | 1b 00 51 bc af 3a 2a 7c fd dc ff 5f 45 9b 2f 90 f1 00 40 62 21 a7 f3 65 bc 5c c8 07 00 c0 3d 78 | ..Q..:*|..._E./...@b!..e.\....=x |
00e0 | 12 69 1e 00 84 6e a8 b7 98 96 27 81 4c 84 51 02 5d 29 0c 10 b2 a5 82 33 55 cc 52 70 ba 8a a3 94 | .i...n....'.L.Q.]).....3U.Rp.... |
0100 | 36 09 71 6c c8 69 00 a8 51 b9 5c 69 26 00 1a 8a b8 98 f9 bc 4c e8 47 63 09 64 27 31 5f 24 86 dc | 6.ql.i..Q.\i&.......L.Gc.d'1_$.. |
0120 | 0c d9 8f 27 e4 f2 21 7f 86 3c 22 37 77 0a 64 4d 5b c8 b6 e9 df f9 c9 fc 87 cf f4 21 9f 5c 6e e6 | ...'..!..<"7w.dM[..........!.\n. |
0140 | 10 ab 72 51 8a 5a b0 48 26 c9 e1 4e ff 3f cb f1 bf 25 37 47 3e 38 87 05 6c 54 a1 34 3c 4e 91 b3 | ..rQ.Z.H&..N.?...%7G>8..lT.4<N.. |
0160 | a2 6e d9 53 22 15 4c 85 7c 56 9c 1e 1d 03 59 07 f2 35 11 5f 69 af e0 a7 42 79 78 e2 80 fd 07 9e | .n.S".L.|V....Y..5._i...Byx..... |
0180 | 8c 0d 6b 06 18 00 a0 54 3e 37 38 12 b2 11 64 73 71 4e 74 d4 80 de 2f 43 14 ca 81 0c 6b 8f 26 88 | ..k....T>78...dsqNt.../C....k.&. |
01a0 | f2 38 09 aa b1 28 5f 3a 25 6e c0 3f 5a 20 90 85 c4 0f 32 57 aa 9c 4b 61 53 22 cf 4e 0c 1c f0 b9 | .8...(_:%n.?Z.....2W..KaS".N.... |
01c0 | 41 28 e0 0c fa 6c 2a 14 26 24 ab e2 44 2f e7 8b 92 a2 21 6b 40 be 27 cb 8e 8f 1c b0 79 51 28 64 | A(...l*.&$..D/....!k@.'.....yQ(d |
01e0 | 47 0f da 48 e5 71 8a 98 e1 7f 8e 81 0c 69 68 9c ca 06 b3 cc 95 0d e6 85 79 0b 45 9c e8 01 8e ca | G..H.q.......ih.........y.E..... |
0200 | 13 26 84 ab c6 62 93 78 5c 65 6c fa 90 b3 04 b2 71 51 83 71 f2 05 c1 21 aa bc b0 22 81 38 71 20 | .&...b.x\el.....qQ.q...!...".8q. |
0220 | 7e ac 4c 92 17 14 37 60 bf 55 92 13 3b 60 8f 35 0b 72 c2 14 7a 73 c8 6d b2 fc f8 c1 b1 3d 79 70 | ~.L...7`.U..;`.5.r..zs.m.....=yp |
0240 | b1 a9 f2 c5 81 24 2f 36 41 15 1b ae 9b c5 8d 88 55 c5 80 db 83 28 c0 06 c1 80 09 e4 b0 a5 83 29 | .....$/6A.......U....(.........) |
0260 | 20 0b 88 da ba 1b ba e1 2f 55 4f 28 e0 02 29 c8 04 02 e0 38 a0 19 1c 91 ac ec 11 c3 67 3c 28 04 | ......../UO(..)....8........g<(. |
0280 | 7f 42 12 00 d9 d0 b8 20 65 af 00 e4 43 fd 97 21 ad ea e9 08 32 94 bd f9 ca 11 d9 e0 29 e4 5c 10 | .B......e...C..!....2.......).\. |
02a0 | 09 72 e0 6f b9 72 94 78 68 b6 24 f0 04 6a 44 3f cd ce 83 b1 e6 c0 a6 e8 fb 49 c7 d4 1c d4 11 43 | .r.o.r.xh.$..jD?.........I.....C |
02c0 | 88 c1 c4 70 62 28 d1 0e 37 c4 fd 70 1f 3c 0a 3e 03 60 73 c1 59 b8 d7 60 5c df ec 09 4f 09 ed 84 | ...pb(..7..p.<.>.`s.Y..`\...O... |
02e0 | 47 84 eb 84 0e c2 ed c9 a2 22 e9<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 080zero-out.subx</title>
<meta name="Generator" content="Vim/8.1">
<meta name="plugin-version" content="vim8.1_v1">
<meta name="syntax" content="none">
<meta name="settings" content="number_lines,use_css,no_foldcolumn,expand_tabs,line_ids,prevent_copy=">
<meta name="colorscheme" content="minimal-light">
<style type="text/css">
<!--
pre { font-family: monospace; color: #000000; background-color: #c6c6c6; }
body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
a { color:inherit; }
* { font-size:12pt; font-size: 1em; }
.subxComment { color: #005faf; }
.subxS2Comment { color: #8a8a8a; }
.LineNr { }
.subxS1Comment { color: #0000af; }
.subxFunction { color: #af5f00; text-decoration: underline; }
.Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; }
.Constant { color: #008787; }
.subxTest { color: #5f8700; }
-->
</style>
<script type='text/javascript'>
<!--
/* function to open any folds containing a jumped-to line before jumping to it */
function JumpToLine()
{
var lineNum;
lineNum = window.location.hash;
lineNum = lineNum.substr(1); /* strip off '#' */
if (lineNum.indexOf('L') == -1) {
lineNum = 'L'+lineNum;
}
var lineElem = document.getElementById(lineNum);
/* Always jump to new location even if the line was hidden inside a fold, or
* we corrected the raw number to a line ID.
*/
if (lineElem) {
lineElem.scrollIntoView(true);
}
return true;
}
if ('onhashchange' in window) {
window.onhashchange = JumpToLine;
}
-->
</script>
</head>
<body onload='JumpToLine();'>
<a href='https://github.com/akkartik/mu/blob/master/080zero-out.subx'>https://github.com/akkartik/mu/blob/master/080zero-out.subx</a>
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Fill a region of memory with zeroes.</span>
<span id="L2" class="LineNr"> 2 </span>
<span id="L3" class="LineNr"> 3 </span>== code
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># instruction effective address register displacement immediate</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes</span>
<span id="L7" class="LineNr"> 7 </span>
<span id="L8" class="LineNr"> 8 </span><span class="subxFunction">zero-out</span>: <span class="subxComment"># start: (addr byte), len: int</span>
<span id="L9" class="LineNr"> 9 </span> <span class="subxComment"># pseudocode:</span>
<span id="L10" class="LineNr">10 </span> <span class="subxComment"># curr/esi = start</span>
<span id="L11" class="LineNr">11 </span> <span class="subxComment"># i/ecx = 0</span>
<span id="L12" class="LineNr">12 </span> <span class="subxComment"># while true</span>
<span id="L13" class="LineNr">13 </span> <span class="subxComment"># if (i >= len) break</span>
<span id="L14" class="LineNr">14 </span> <span class="subxComment"># *curr = 0</span>
<span id="L15" class="LineNr">15 </span> <span class="subxComment"># ++curr</span>
<span id="L16" class="LineNr">16 </span> <span class="subxComment"># ++i</span>
<span id="L17" class="LineNr">17 </span> <span class="subxComment">#</span>
<span id="L18" class="LineNr">18 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L19" class="LineNr">19 </span> 55/push-ebp
<span id="L20" class="LineNr">20 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
<span id="L21" class="LineNr">21 </span> <span class="subxS1Comment"># . save registers</span>
<span id="L22" class="LineNr">22 </span> 50/push-eax
<span id="L23" class="LineNr">23 </span> 51/push-ecx
<span id="L24" class="LineNr">24 </span> 52/push-edx
<span id="L25" class="LineNr">25 </span> 56/push-esi
<span id="L26" class="LineNr">26 </span> <span class="subxComment"># curr/esi = start</span>
<span id="L27" class="LineNr">27 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L28" class="LineNr">28 </span> <span class="subxComment"># var i/ecx: int = 0</span>
<span id="L29" class="LineNr">29 </span> 31/xor 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear ecx</span>
<span id="L30" class="LineNr">30 </span> <span class="subxComment"># edx = len</span>
<span id="L31" class="LineNr">31 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+12) to edx</span>
<span id="L32" class="LineNr">32 </span><span class="Constant">$zero-out:loop</span>:
<span id="L33" class="LineNr">33 </span> <span class="subxComment"># if (i >= len) break</span>
<span id="L34" class="LineNr">34 </span> 39/compare 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/edx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare ecx with edx</span>
<span id="L35" class="LineNr">35 </span> 7d/jump-if->= $zero-out:end/disp8
<span id="L36" class="LineNr">36 </span> <span class="subxComment"># *curr = 0</span>
<span id="L37" class="LineNr">37 </span> c6 0/subop/copy 0/mod/direct 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/imm8 <span class="subxComment"># copy byte to *esi</span>
<span id="L38" class="LineNr">38 </span> <span class="subxComment"># ++curr</span>
<span id="L39" class="LineNr">39 </span> 46/increment-esi
<span id="L40" class="LineNr">40 </span> <span class="subxComment"># ++i</span>
<span id="L41" class="LineNr">41 </span> 41/increment-ecx
<span id="L42" class="LineNr">42 </span> eb/jump $zero-out:<span class="Constant">loop</span>/disp8
<span id="L43" class="LineNr">43 </span><span class="Constant">$zero-out:end</span>:
<span id="L44" class="LineNr">44 </span> <span class="subxS1Comment"># . restore registers</span>
<span id="L45" class="LineNr">45 </span> 5e/pop-to-esi
<span id="L46" class="LineNr">46 </span> 5a/pop-to-edx
<span id="L47" class="LineNr">47 </span> 59/pop-to-ecx
<span id="L48" class="LineNr">48 </span> 58/pop-to-eax
<span id="L49" class="LineNr">49 </span> <span class="subxS1Comment"># . epilogue</span>
<span id="L50" class="LineNr">50 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span>
<span id="L51" class="LineNr">51 </span> 5d/pop-to-ebp
<span id="L52" class="LineNr">52 </span> c3/return
<span id="L53" class="LineNr">53 </span>
<span id="L54" class="LineNr">54 </span><span class="subxTest">test-zero-out</span>:
<span id="L55" class="LineNr">55 </span> <span class="subxS1Comment"># . prologue</span>
<span id="L56" class="LineNr">56 </span> 55/push-ebp
<span id="L57" class="LineNr">57 </span> 89/copy 3/mod/direct 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
<span id="L58" class="LineNr">58 </span> <span class="subxComment"># region/ecx = 34, 35, 36, 37</span>
<span id="L59" class="LineNr">59 </span> 68/push 0x37363534/imm32
<span id="L60" class="LineNr">60 </span> 89/copy 3/mod/direct 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ecx</span>
<span id="L61" class="LineNr">61 </span> <span class="subxComment"># zero-out(ecx, 3)</span>
<span id="L62" class="LineNr">62 </span> <span class="subxS2Comment"># . . push args</span>
<span id="L63" class="LineNr">63 </span> 68/push 3/imm32/len
<span id="L64" class="LineNr">64 </span> 51/push-ecx
<span id="L65" class="LineNr">65 </span> <span class="subxS2Comment"># . . call</span>
<span id="L66" class="LineNr">66 </span> e8/call <a href='080zero-out.subx.html#L8'>zero-out</a>/disp32
<span id="L67" class="LineNr">67 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L68" class="LineNr">68 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to esp</span>
<span id="L69" class="LineNr">69 </span> <span class="subxComment"># first 3 bytes cleared, fourth left alone</span>
<span id="L70" class="LineNr">70 </span> <span class="subxS1Comment"># . check-ints-equal(*ecx, 0x37000000, msg)</span>
<span id="L71" class="LineNr">71 </span> <span class="subxS2Comment"># . . push args</span>
<span id="L72" class="LineNr">72 </span> 68/push <span class="Constant">"F - test-zero-out"</span>/imm32
<span id="L73" class="LineNr">73 </span> 68/push 0x37000000/imm32
<span id="L74" class="LineNr">74 </span> ff 6/subop/push 0/mod/indirect 1/rm32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># push *ecx</span>
<span id="L75" class="LineNr">75 </span> <span class="subxS2Comment"># . . call</span>
<span id="L76" class="LineNr">76 </span> e8/call <a href='051test.subx.html#L24'>check-ints-equal</a>/disp32
<span id="L77" class="LineNr">77 </span> <span class="subxS2Comment"># . . discard args</span>
<span id="L78" class="LineNr">78 </span> 81 0/subop/add 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0xc/imm32 <span class="subxComment"># add to esp</span>
<span id="L79" class="LineNr">79 </span> <span class="subxS1Comment"># . epilogue</span>
<span id="L80" class="LineNr">80 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span>
<span id="L81" class="LineNr">81 </span> 5d/pop-to-ebp
<span id="L82" class="LineNr">82 </span> c3/return
<span id="L83" class="LineNr">83 </span>
<span id="L84" class="LineNr">84 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
|