1 == code 2 # instruction effective address register displacement immediate 3 # . op subop mod rm32 base index scale r32 4 # . 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 5 6 # print 'arr' in hex with a space after every byte 7 emit-hex-array: # out: (addr buffered-file), arr: (addr array byte) 8 # . prologue 9 55/push-ebp 10 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp 11 # . save registers 12 50/push-eax 13 51/push-ecx 14 52/push-edx 15 57/push-edi 16 # edi = out 17 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi 18 # edx = arr 19 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx 20 # var curr/ecx: (addr byte) = arr->data 21 8d/copy-address 1/mod/*+disp8 2/rm32/edx . . . 1/r32/ecx 4/disp8 . # copy edx+4 to ecx 22 # var max/edx: (addr byte) = &arr->data[arr->size] 23 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx 24 01/add 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # add ecx to edx 25 # var c/eax: byte = 0 26 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 27 $emit-hex-array:loop: 28 # if (curr >= width) break 29 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . . # compare ecx with edx 30 73/jump-if-addr>= $emit-hex-array:end/disp8 31 # emit-hex(out, c = *curr, width=1) 32 # . . push args 33 68/push 1/imm32/width 34 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . . # copy byte at *ecx to AL 35 50/push-eax 36 57/push-edi 37 # . . call 38 e8/call emit-hex/disp32 39 # . . discard args 40 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp 41 # ++curr 42 <// Common functionality for PLT documentation pages // Page Parameters ------------------------------------------------------------ var page_query_string = (location.href.search(/\?([^#]+)(?:#|$)/) >= 0) && RegExp.$1; var page_args = ((function(){ if (!page_query_string) return []; var args = page_query_string.split(/[&;]/); for (var i=0; i<args.length; i++) { var a = args[i]; var p = a.indexOf('='); if (p >= 0) args[i] = [a.substring(0,p), a