diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-04-03 12:35:53 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-04-03 12:35:53 -0700 |
commit | bfcc0f858aa324739ad645e2056d73a47ab66f82 (patch) | |
tree | 24a22e364b2c1d535013c604b7a9620a31606e71 /apps | |
parent | f730f2f2c7934f52091a848b71f9031ea99e2377 (diff) | |
download | mu-bfcc0f858aa324739ad645e2056d73a47ab66f82.tar.gz |
6182 - start of support for safe handles
So far it's unclear how to do this in a series of small commits. Still nibbling around the edges. In this commit we standardize some terminology: The length of an array or stream is denominated in the high-level elements. The _size_ is denominated in bytes. The thing we encode into the type is always the size, not the length. There's still an open question of what to do about the Mu `length` operator. I'd like to modify it to provide the length. Currently it provides the size. If I can't fix that I'll rename it.
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/assort | bin | 40844 -> 40838 bytes | |||
-rwxr-xr-x | apps/braces | bin | 42645 -> 42633 bytes | |||
-rwxr-xr-x | apps/calls | bin | 47306 -> 47294 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 40247 -> 40241 bytes | |||
-rw-r--r-- | apps/crenshaw2-1.subx | 12 | ||||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 40794 -> 40788 bytes | |||
-rw-r--r-- | apps/crenshaw2-1b.subx | 12 | ||||
-rwxr-xr-x | apps/dquotes | bin | 44489 -> 44483 bytes | |||
-rw-r--r-- | apps/ex11.subx | 14 | ||||
-rwxr-xr-x | apps/factorial | bin | 39266 -> 39260 bytes | |||
-rwxr-xr-x | apps/handle | bin | 40164 -> 40158 bytes | |||
-rwxr-xr-x | apps/hex | bin | 43086 -> 43080 bytes | |||
-rwxr-xr-x | apps/mu | bin | 210776 -> 210762 bytes | |||
-rw-r--r-- | apps/mu.subx | 40 | ||||
-rwxr-xr-x | apps/pack | bin | 53231 -> 53225 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 55030 -> 55018 bytes | |||
-rwxr-xr-x | apps/survey | bin | 49850 -> 49844 bytes | |||
-rw-r--r-- | apps/survey.subx | 40 | ||||
-rwxr-xr-x | apps/tests | bin | 39637 -> 39631 bytes |
19 files changed, 59 insertions, 59 deletions
diff --git a/apps/assort b/apps/assort index 9f6aa9a6..3c24b4a6 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/braces b/apps/braces index 34f18f11..f26cc91a 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index dbe0e219..15e8b095 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index 599fcfc0..8f59dc7e 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1.subx b/apps/crenshaw2-1.subx index e37b58e7..8e20342b 100644 --- a/apps/crenshaw2-1.subx +++ b/apps/crenshaw2-1.subx @@ -108,12 +108,12 @@ compile: # in: (addr buffered-file), out: fd or (addr stream byte), err: fd or # var num/ecx: (stream byte 7) # Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes. # Sizing the stream just right buys us overflow-handling for free inside 'get-num'. - # Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex. + # Add 12 bytes for 'read', 'write' and 'size' fields, for a total of 19 bytes, or 0x13 in hex. # The stack pointer is no longer aligned, so dump_stack() can be misleading past this point. 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x13/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # initialize the stream - # . num->length = 7 + # . num->size = 7 c7 0/subop/copy 1/mod/*+disp8 1/rm32/ecx . . . . 8/disp8 7/imm32 # copy to *(ecx+8) # . clear-stream(num) # . . push args @@ -194,7 +194,7 @@ $compile:end: get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # pseudocode: # if (!is-digit?(Look)) expected(ed, err, "integer") - # if out->write >= out->length + # if out->write >= out->size # write(err, "Error: too many digits in number\n") # stop(ed, 1) # out->data[out->write] = LSB(Look) @@ -205,7 +205,7 @@ get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr # in: esi # out: edi # out->write: ecx (cached copy; need to keep in sync) - # out->length: edx + # out->size: edx # temporaries: eax, ebx # We can't allocate Look to a register because it gets written implicitly in # get-char in each iteration of the loop. (Thereby demonstrating that it's @@ -250,10 +250,10 @@ $get-num:main: 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi # ecx = out->write 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # copy *edi to ecx - # edx = out->length + # edx = out->size 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 8/disp8 . # copy *(edi+8) to edx $get-num:loop: - # if (out->write >= out->length) error + # if (out->write >= out->size) error 39/compare 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # compare edx with ecx 7d/jump-if-< $get-num:stage2/disp8 # . error(ed, err, msg) # TODO: show full number diff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index 838c0c58..62ca8b7a 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/crenshaw2-1b.subx b/apps/crenshaw2-1b.subx index 89791bea..62e56312 100644 --- a/apps/crenshaw2-1b.subx +++ b/apps/crenshaw2-1b.subx @@ -108,12 +108,12 @@ compile: # in: (addr buffered-file), out: fd or (addr stream byte), err: fd or # var num/ecx: (stream byte 7) # Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes. # Sizing the stream just right buys us overflow-handling for free inside 'get-num'. - # Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex. + # Add 12 bytes for 'read', 'write' and 'size' fields, for a total of 19 bytes, or 0x13 in hex. # The stack pointer is no longer aligned, so dump_stack() can be misleading past this point. 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x13/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # initialize the stream - # . num->length = 7 + # . num->size = 7 c7 0/subop/copy 1/mod/*+disp8 1/rm32/ecx . . . . 8/disp8 7/imm32 # copy to *(ecx+8) # . clear-stream(num) # . . push args @@ -195,7 +195,7 @@ get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr # pseudocode: # if (!is-digit?(Look)) expected(ed, err, "integer") # do - # if out->write >= out->length + # if out->write >= out->size # write(err, "Error: too many digits in number\n") # stop(ed, 1) # out->data[out->write] = LSB(Look) @@ -210,7 +210,7 @@ get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr # in: esi # out: edi # out->write: ecx (cached copy; need to keep in sync) - # out->length: edx + # out->size: edx # temporaries: eax, ebx # We can't allocate Look to a register because it gets written implicitly in # get-char in each iteration of the loop. (Thereby demonstrating that it's @@ -255,10 +255,10 @@ $get-num:main: 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi # ecx = out->write 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . . # copy *edi to ecx - # edx = out->length + # edx = out->size 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 8/disp8 . # copy *(edi+8) to edx $get-num:loop: - # if (out->write >= out->length) error + # if (out->write >= out->size) error 39/compare 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . . # compare edx with ecx 7d/jump-if-< $get-num:loop-stage2/disp8 # . error(ed, err, msg) # TODO: show full number diff --git a/apps/dquotes b/apps/dquotes index 12f43de6..9f1d1b4d 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/ex11.subx b/apps/ex11.subx index cacd22da..9ff43a73 100644 --- a/apps/ex11.subx +++ b/apps/ex11.subx @@ -1,9 +1,9 @@ -# Null-terminated vs length-prefixed ascii strings. +# Null-terminated vs size-prefixed ascii strings. # -# By default we create strings with a 4-byte length prefix rather than a null suffix. +# By default we create strings with a 4-byte size prefix rather than a null suffix. # However we still need null-prefixed strings when interacting with the Linux # kernel in a few places. This layer implements a function for comparing -# a null-terminated 'kernel string' with a length-prefixed 'SubX string'. +# a null-terminated 'kernel string' with a size-prefixed 'SubX string'. # # To run: # $ ./bootstrap translate init.linux apps/ex11.subx -o apps/ex11 @@ -25,11 +25,11 @@ Entry: # run all tests 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx e8/call syscall_exit/disp32 -# compare a null-terminated ascii string with a more idiomatic length-prefixed byte array +# compare a null-terminated ascii string with a more idiomatic size-prefixed byte array # reason for the name: the only place we should have null-terminated ascii strings is from commandline args -kernel-string-equal?: # s: null-terminated ascii string, benchmark: length-prefixed ascii string -> eax: boolean +kernel-string-equal?: # s: null-terminated ascii string, benchmark: size-prefixed ascii string -> eax: boolean # pseudocode: - # n = benchmark->length + # n = benchmark->size # s1 = s # s2 = benchmark->data # i = 0 @@ -60,7 +60,7 @@ kernel-string-equal?: # s: null-terminated ascii string, benchmark: length-pref 57/push-edi # s1/edi = s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 . # copy *(ebp+8) to edi - # n/edx = benchmark->length + # n/edx = benchmark->size 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx # s2/esi = benchmark->data diff --git a/apps/factorial b/apps/factorial index 3f09218b..0bb8b2c8 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/handle b/apps/handle index b149425c..51b34f63 100755 --- a/apps/handle +++ b/apps/handle Binary files differdiff --git a/apps/hex b/apps/hex index a9664006..55e10f7f 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/mu b/apps/mu index adcf5d8a..d9c0a92c 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index 9965447a..bd35b7e6 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -380,7 +380,7 @@ Max-type-id: Type-id: # (stream (address array byte)) 0x1c/imm32/write 0/imm32/read - 0x100/imm32/length + 0x100/imm32/size # data "literal"/imm32 # 0 "int"/imm32 # 1 @@ -2478,7 +2478,7 @@ test-convert-index-into-array-with-literal: (check-next-stream-line-equal _test-output-stream "$foo:0x00000001:loop:" "F - test-convert-index-into-array-with-literal/5") (check-next-stream-line-equal _test-output-stream " ff 6/subop/push %eax" "F - test-convert-index-into-array-with-literal/6") (check-next-stream-line-equal _test-output-stream " b8/copy-to-eax 0/imm32" "F - test-convert-index-into-array-with-literal/7") - # 2 * 4 bytes/elem + 4 bytes for length = offset 12 + # 2 * 4 bytes/elem + 4 bytes for size = offset 12 (check-next-stream-line-equal _test-output-stream " 8d/copy-address *(eax + 0x0000000c) 0x00000000/r32" "F - test-convert-index-into-array-with-literal/8") (check-next-stream-line-equal _test-output-stream " 8f 0/subop/pop %eax" "F - test-convert-index-into-array-with-literal/9") (check-next-stream-line-equal _test-output-stream " }" "F - test-convert-index-into-array-with-literal/10") @@ -3163,7 +3163,7 @@ parse-mu: # in: (addr buffered-file) 57/push-edi # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 - 68/push 0x200/imm32/length + 68/push 0x200/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp @@ -3177,7 +3177,7 @@ parse-mu: # in: (addr buffered-file) be/copy-to-esi _Program-types/imm32 # var vars/ebx: (stack (addr var) 256) 81 5/subop/subtract %esp 0x400/imm32 - 68/push 0x400/imm32/length + 68/push 0x400/imm32/size 68/push 0/imm32/top 89/<- %ebx 4/r32/esp { @@ -3486,7 +3486,7 @@ test-function-header-with-arg: (zero-out %ecx *Function-size) # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ebx 4/r32/esp # convert @@ -3519,7 +3519,7 @@ test-function-header-with-multiple-args: (zero-out %ecx *Function-size) # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ebx 4/r32/esp # convert @@ -3571,7 +3571,7 @@ test-function-with-multiple-args-and-outputs: (zero-out %ecx *Function-size) # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ebx 4/r32/esp # convert @@ -4666,7 +4666,7 @@ parse-mu-block: # in: (addr buffered-file), vars: (addr stack (handle var)), fn 57/push-edi # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 - 68/push 0x200/imm32/length + 68/push 0x200/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp @@ -4809,7 +4809,7 @@ new-block-name: # fn: (handle function) -> result/eax: (handle var) # var n/ecx: int = len(fn->name) + 10 for an int + 2 for '$:' 8b/-> *(ebp+8) 0/r32/eax 8b/-> *eax 0/r32/eax # Function-name - 8b/-> *eax 0/r32/eax # String-length + 8b/-> *eax 0/r32/eax # String-size 05/add-to-eax 0xd/imm32 # 10 + 2 for '$:' 89/<- %ecx 0/r32/eax # var name/edx: (stream byte n) @@ -5019,7 +5019,7 @@ test-parse-mu-var-def: (write _test-input-stream "n: int\n") # caller has consumed the 'var' # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ecx 4/r32/esp (clear-stack %ecx) @@ -5049,7 +5049,7 @@ test-parse-mu-reg-var-def: (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ecx 4/r32/esp (clear-stack %ecx) @@ -5428,7 +5428,7 @@ lookup-var-helper: # name: (addr array byte), vars: (addr stack (handle var)) - 8b/-> *(ebp+0xc) 6/r32/esi # ebx = vars->top 8b/-> *esi 3/r32/ebx - # if (vars->top > vars->length) abort + # if (vars->top > vars->size) abort 3b/compare<- *(esi+4) 0/r32/eax 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 # var min/edx: (addr handle var) = vars->data @@ -5548,7 +5548,7 @@ test-parse-mu-stmt: (write _test-input-stream "increment n\n") # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ecx 4/r32/esp (clear-stack %ecx) @@ -5584,7 +5584,7 @@ test-parse-mu-stmt-with-comma: (write _test-input-stream "copy-to n, 3\n") # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 - 68/push 0x10/imm32/length + 68/push 0x10/imm32/size 68/push 0/imm32/top 89/<- %ecx 4/r32/esp (clear-stack %ecx) @@ -6141,7 +6141,7 @@ populate-mu-type: # in: (addr stream byte), t: (handle typeinfo) 8b/-> *(ebp+0xc) 7/r32/edi # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 - 68/push 0x200/imm32/length + 68/push 0x200/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp @@ -6685,7 +6685,7 @@ size-of-array: # a: (handle tree type-id) -> result/eax: int # return array-size * size-of(elem-type) (size-of-type-id %edx) # => eax f7 4/subop/multiply-into-eax %ecx - 05/add-to-eax 4/imm32 # for array length + 05/add-to-eax 4/imm32 # for array size $size-of-array:end: # . restore registers 5a/pop-to-edx @@ -6822,7 +6822,7 @@ emit-subx-function: # out: (addr buffered-file), f: (handle function) 8b/-> *(ebp+0xc) 1/r32/ecx # var vars/edx: (stack (addr var) 256) 81 5/subop/subtract %esp 0x400/imm32 - 68/push 0x400/imm32/length + 68/push 0x400/imm32/size 68/push 0/imm32/top 89/<- %edx 4/r32/esp # @@ -7223,7 +7223,7 @@ Reverse-branch: # (table string string) # a table is a stream 0xa0/imm32/write 0/imm32/read - 0xa0/imm32/length + 0xa0/imm32/size # data "break-if-="/imm32 "0f 85/jump-if-!="/imm32 "loop-if-="/imm32 "0f 85/jump-if-!="/imm32 @@ -7689,7 +7689,7 @@ emit-subx-var-def: # out: (addr buffered-file), stmt: (handle stmt) (is-mu-array? *(ecx+4)) # Var-type => eax 3d/compare-eax-and 0/imm32/false 0f 84/jump-if-= break/disp32 - # var array-size-without-length/edx: int = n-4 + # var array-size-without-size/edx: int = n-4 81 5/subop/subtract %edx 4/imm32 (emit-indent *(ebp+8) *Curr-block-depth) (write-buffered *(ebp+8) "(push-n-zero-bytes ") @@ -7732,7 +7732,7 @@ emit-subx-stmt: # out: (addr buffered-file), stmt: (handle stmt), primitives: ( # - some special-case primitives that don't actually use the 'primitives' data structure # ecx = stmt 8b/-> *(ebp+0xc) 1/r32/ecx - # array length + # array size { # if (!string-equal?(stmt->operation, "length")) break (string-equal? *(ecx+4) "length") # Stmt1-operation => eax diff --git a/apps/pack b/apps/pack index cc967d24..d9c6b804 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index 9f288109..6b79497e 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/survey b/apps/survey index 98f75e9e..e4f5c1cf 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/survey.subx b/apps/survey.subx index e3184815..00218ef2 100644 --- a/apps/survey.subx +++ b/apps/survey.subx @@ -133,14 +133,14 @@ subx-survey: # infile: (addr buffered-file), out: (addr buffered-file) 56/push-esi # var segments/ecx: (stream {string, segment-info} 160) # 10 rows * 16 bytes/row 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp - 68/push 0xa0/imm32/length + 68/push 0xa0/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # var labels/edx: (stream label-info Max-labels*16) # . data 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32 # subtract *Max-labels from esp - # . length + # . size ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32 # push *Max-labels # . read 68/push 0/imm32/read @@ -150,7 +150,7 @@ subx-survey: # infile: (addr buffered-file), out: (addr buffered-file) # var in/esi: (stream byte Input-size) # . data 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32 # subtract *Input-size from esp - # . length + # . size ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32 # push *Input-size # . read 68/push 0/imm32/read @@ -690,7 +690,7 @@ compute-offsets: # in: (addr stream byte), segments: (addr stream {string, segm c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32 # copy to *compute-offsets:word-slice # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp - 68/push 0x200/imm32/length + 68/push 0x200/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -1222,13 +1222,13 @@ test-compute-offsets: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # var segments/ecx: (stream byte 2*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp - 68/push 0x20/imm32/length + 68/push 0x20/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # var labels/edx: (stream byte 2*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp - 68/push 0x20/imm32/length + 68/push 0x20/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -1624,13 +1624,13 @@ test-compute-addresses: # setup # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp - 68/push 0xa0/imm32/length + 68/push 0xa0/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp - 68/push 0x2000/imm32/length + 68/push 0x2000/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -1793,13 +1793,13 @@ test-compute-addresses-large-segments: # setup # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp - 68/push 0xa0/imm32/length + 68/push 0xa0/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp - 68/push 0x2000/imm32/length + 68/push 0x2000/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -1989,7 +1989,7 @@ emit-segments: # in: (addr stream byte), out: (addr buffered-file), labels: (ad 57/push-edi # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp - 68/push 0x200/imm32/length + 68/push 0x200/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2156,8 +2156,8 @@ $emit-segments:check-for-segment-header: 3d/compare-eax-and 0/imm32/false 0f 85/jump-if-!= $emit-segments:line-loop/disp32 $emit-segments:2-character: - # if (length(word-slice) != 2) goto next check - # . eax = length(word-slice) + # if (size(word-slice) != 2) goto next check + # . eax = size(word-slice) 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 . # copy *(edx+4) to eax 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . . # subtract *edx from eax # . if (eax != 2) goto next check @@ -2579,7 +2579,7 @@ test-emit-segments-global-variable: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp - 68/push 0x2000/imm32/length + 68/push 0x2000/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -2789,7 +2789,7 @@ test-emit-segments-code-label: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp - 68/push 0x2000/imm32/length + 68/push 0x2000/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -2974,7 +2974,7 @@ test-emit-segments-code-label-absolute: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp - 68/push 0x2000/imm32/length + 68/push 0x2000/imm32/size 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -3423,8 +3423,8 @@ stream-add4: # in: (addr stream byte), key: addr, val1: addr, val2: addr, val3: 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax # . eax = esi+eax+12 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 . # copy esi+eax+12 to eax - # max/edx = &in->data[in->length] - # . edx = in->length + # max/edx = &in->data[in->size] + # . edx = in->size 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 . # copy *(esi+8) to edx # . edx = esi+edx+12 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 . # copy esi+edx+12 to edx @@ -4609,7 +4609,7 @@ test-num-bytes-handles-imm32: # some fields (the ones with labels capitalized) filled in. # http://www.sco.com/developers/gabi/latest/ch4.eheader.html Elf_header: - # - length + # - size 0x34/imm32 # - data $e_ident: @@ -4647,7 +4647,7 @@ $e_shstrndx: # Some fields need filling in each time. # https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-83432/index.html Elf_program_header_entry: - # - length + # - size 0x20/imm32 # - data $p_type: diff --git a/apps/tests b/apps/tests index 68c0753e..9d5a07b4 100755 --- a/apps/tests +++ b/apps/tests Binary files differ |