From 104e521c04d1a0cad9c68fb11e250e12ad8917ef Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 17 Oct 2018 07:08:47 -0700 Subject: 4709 --- html/subx/examples/ex7.subx.html | 92 ++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'html/subx/examples/ex7.subx.html') diff --git a/html/subx/examples/ex7.subx.html b/html/subx/examples/ex7.subx.html index d5ef4a99..3ffc6a49 100644 --- a/html/subx/examples/ex7.subx.html +++ b/html/subx/examples/ex7.subx.html @@ -71,79 +71,79 @@ if ('onhashchange' in window) { 15 # op subop mod rm32 base index scale r32 16 # 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 17 - 18 # creat(filename) - 19 bb/copy . . . . . . . filename/imm32 # copy to EBX - 20 b9/copy . . . . . . . 0x180/imm32/fixed-perms # copy to ECX - 21 b8/copy . . . . . . . 8/imm32/creat # copy to EAX + 18 # syscall(creat, filename) + 19 bb/copy-to-EBX filename/imm32 + 20 b9/copy-to-ECX 0x180/imm32/fixed-perms + 21 b8/copy-to-EAX 8/imm32/creat 22 cd/syscall 0x80/imm8 23 - 24 # stream = open(filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte - 25 bb/copy . . . . . . . filename/imm32 # copy to EBX - 26 b9/copy . . . . . . . 1/imm32/wronly # copy to ECX - 27 ba/copy . . . . . . . 0x180/imm32/fixed-perms # copy to EDX - 28 b8/copy . . . . . . . 5/imm32/open # copy to EAX + 24 # stream = syscall(open, filename, O_WRONLY, 0) # we can't use 'fd' because it looks like a hex byte + 25 bb/copy-to-EBX filename/imm32 + 26 b9/copy-to-ECX 1/imm32/wronly + 27 ba/copy-to-EDX 0x180/imm32/fixed-perms + 28 b8/copy-to-EAX 5/imm32/open 29 cd/syscall 0x80/imm8 30 # save stream - 31 bb/copy . . . . . . . stream/imm32 # copy to EBX - 32 89/copy 0/mod/indirect 3/rm32/EBX 0/r32/EAX # copy EAX to *EBX + 31 bb/copy-to-EBX stream/imm32 + 32 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX 33 - 34 # write(stream, "a", 1) + 34 # syscall(write, stream, "a", 1) 35 # load stream - 36 bb/copy . . . . . . . stream/imm32 # copy to EBX - 37 8b/copy 0/mod/indirect 3/rm32/EBX 3/r32/EBX # copy *EBX to EBX + 36 bb/copy-to-EBX stream/imm32 + 37 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX 38 # - 39 b9/copy . . . . . . . a/imm32 # copy to ECX - 40 ba/copy . . . . . . . 1/imm32/size # copy to EDX - 41 b8/copy . . . . . . . 4/imm32/write # copy to EAX + 39 b9/copy-to-ECX a/imm32 + 40 ba/copy-to-EDX 1/imm32/size + 41 b8/copy-to-EAX 4/imm32/write 42 cd/syscall 0x80/imm8 43 - 44 # close(stream) + 44 # syscall(close, stream) 45 # load stream - 46 bb/copy . . . . . . . stream/imm32 # copy to EBX - 47 8b/copy 0/mod/indirect 3/rm32/EBX 3/r32/EBX # copy *EBX to EBX + 46 bb/copy-to-EBX stream/imm32 + 47 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX 48 # - 49 b8/copy . . . . . . . 6/imm32/close # copy to EAX + 49 b8/copy-to-EAX 6/imm32/close 50 cd/syscall 0x80/imm8 51 - 52 # stream = open(filename, O_RDONLY, 0) - 53 bb/copy . . . . . . . filename/imm32 # copy to EBX - 54 b9/copy . . . . . . . 0/imm32/rdonly # copy to ECX - 55 ba/copy . . . . . . . 0x180/imm32/fixed-perms # copy to EDX - 56 b8/copy . . . . . . . 5/imm32/open # copy to EAX + 52 # stream = syscall(open, filename, O_RDONLY, 0) + 53 bb/copy-to-EBX filename/imm32 + 54 b9/copy-to-ECX 0/imm32/rdonly + 55 ba/copy-to-EDX 0x180/imm32/fixed-perms + 56 b8/copy-to-EAX 5/imm32/open 57 cd/syscall 0x80/imm8 58 # save stream - 59 bb/copy . . . . . . . stream/imm32 # copy to EBX - 60 89/copy 0/mod/indirect 3/rm32/EBX 0/r32/EAX # copy EAX to *EBX + 59 bb/copy-to-EBX stream/imm32 + 60 89/copy 0/mod/indirect 3/rm32/EBX . . . 0/r32/EAX . . # copy EAX to *EBX 61 - 62 # read(stream, b, 1) + 62 # syscall(read, stream, b, 1) 63 # load stream - 64 bb/copy . . . . . . . stream/imm32 # copy to EBX - 65 8b/copy 0/mod/indirect 3/rm32/EBX 3/r32/EBX # copy *EBX to EBX + 64 bb/copy-to-EBX stream/imm32 + 65 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX 66 # - 67 b9/copy . . . . . . . b/imm32 # copy to ECX - 68 ba/copy . . . . . . . 1/imm32/size # copy to EDX - 69 b8/copy . . . . . . . 3/imm32/read # copy to EAX + 67 b9/copy-to-ECX b/imm32 + 68 ba/copy-to-EDX 1/imm32/size + 69 b8/copy-to-EAX 3/imm32/read 70 cd/syscall 0x80/imm8 71 - 72 # close(stream) + 72 # syscall(close, stream) 73 # load stream - 74 bb/copy . . . . . . . stream/imm32 # copy to EBX - 75 8b/copy 0/mod/indirect 3/rm32/EBX 3/r32/EBX # copy *EBX to EBX + 74 bb/copy-to-EBX stream/imm32 + 75 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX 76 # - 77 b8/copy . . . . . . . 6/imm32/close # copy to EAX + 77 b8/copy-to-EAX 6/imm32/close 78 cd/syscall 0x80/imm8 79 - 80 # unlink(filename) - 81 bb/copy . . . . . . . filename/imm32 # copy to EBX - 82 b8/copy . . . . . . . 0xa/imm32/unlink # copy to EAX + 80 # syscall(unlink, filename) + 81 bb/copy-to-EBX filename/imm32 + 82 b8/copy-to-EAX 0xa/imm32/unlink 83 cd/syscall 0x80/imm8 84 - 85 # exit(b) + 85 # syscall(exit, b) 86 # load b - 87 bb/copy . . . . . . . b/imm32 # copy to EBX - 88 8b/copy 0/mod/indirect 3/rm32/EBX 3/r32/EBX # copy *EBX to EBX + 87 bb/copy-to-EBX b/imm32 + 88 8b/copy 0/mod/indirect 3/rm32/EBX . . . 3/r32/EBX . . # copy *EBX to EBX 89 # - 90 b8/copy . . . . . . . 1/imm32/exit # copy to EAX + 90 b8/copy-to-EAX 1/imm32/exit 91 cd/syscall 0x80/imm8 92 93 == data @@ -156,7 +156,7 @@ if ('onhashchange' in window) { 100 filename: 101 2e 66 6f 6f 00 00 00 00 102 -103 # vim:ft=subx:nowrap:tw& +103 # vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0