diff --git a/subx/036global_variables.cc b/subx/036global_variables.cc index 2299b3bf..78824262 100644 --- a/subx/036global_variables.cc +++ b/subx/036global_variables.cc @@ -104,9 +104,26 @@ void replace_global_variables_in_data_segment(segment& data, const map 0a $error: 0 +:(scenario raw_number_with_imm32_in_data_segment) +== 0x1 +b9 x/imm32 +== 0x0a000000 +x: + 1/imm32 +# check that we loaded 'x' with the address of 1 ++load: 0x0a000000 -> 01 ++load: 0x0a000001 -> 00 ++load: 0x0a000002 -> 00 ++load: 0x0a000003 -> 00 +$error: 0 + :(scenario duplicate_global_variable) % Hide_errors = true; == 0x1 diff --git a/subx/051test.subx b/subx/051test.subx index 2ae907c1..ceccc076 100644 --- a/subx/051test.subx +++ b/subx/051test.subx @@ -82,12 +82,12 @@ $check-ints-equal:end: # convenient to have when printing messages and so on Newline: # size - 01 00 00 00 + 1/imm32 # data 0a/newline # every test failure increments this counter Num-test-failures: - 00 00 00 00 + 0/imm32 # . . vim:nowrap:textwidth=0 diff --git a/subx/053new-segment.subx b/subx/053new-segment.subx index 0aee0539..fd7203b9 100644 --- a/subx/053new-segment.subx +++ b/subx/053new-segment.subx @@ -48,16 +48,16 @@ $new-segment:end: # various constants used here were found in the Linux sources (search for file mman-common.h) _mmap-new-segment: # type mmap_arg_struct # addr - 00 00 00 00 # null + 0/imm32 # len - 00 00 00 00 # 0x1000 + 0/imm32 # protection flags - 03 00 00 00 # PROT_READ | PROT_WRITE + 3/imm32 # PROT_READ | PROT_WRITE # sharing flags - 22 00 00 00 # MAP_PRIVATE | MAP_ANONYMOUS + 0x22/imm32 # MAP_PRIVATE | MAP_ANONYMOUS # fd - ff ff ff ff # -1 since MAP_ANONYMOUS is specified + -1/imm32 # since MAP_ANONYMOUS is specified # offset - 00 00 00 00 # 0 since MAP_ANONYMOUS is specified + 0/imm32 # since MAP_ANONYMOUS is specified # . . vim:nowrap:textwidth=0 diff --git a/subx/056trace.subx b/subx/056trace.subx index aa73bbdd..479569a7 100644 --- a/subx/056trace.subx +++ b/subx/056trace.subx @@ -22,17 +22,17 @@ # We'll save the address of the trace segment here. Trace-stream: - 00 00 00 00 + 0/imm32 # Fake trace-stream for tests. # Also illustrates the layout of the real trace-stream (segment). _test-trace-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/057write.subx b/subx/057write.subx index c1712996..2a111dd3 100644 --- a/subx/057write.subx +++ b/subx/057write.subx @@ -154,11 +154,11 @@ test-write-appends: _test-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/060read.subx b/subx/060read.subx index a54b3f02..fcf38dde 100644 --- a/subx/060read.subx +++ b/subx/060read.subx @@ -351,11 +351,11 @@ test-read-returns-0-on-end-of-file: _test-tmp-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/061read-byte.subx b/subx/061read-byte.subx index a915d436..d3192ce1 100644 --- a/subx/061read-byte.subx +++ b/subx/061read-byte.subx @@ -13,13 +13,13 @@ # buffered-file. Stdin: # file descriptor or (address stream) - 00 00 00 00 # 0 = standard input + 0/imm32 # standard input # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes @@ -291,11 +291,11 @@ _test-buffered-file: # file descriptor or (address stream) _test-stream/imm32 # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (6) - 06 00 00 00 + 0/imm32 + # length + 6/imm32 # data 00 00 00 00 00 00 # 6 bytes diff --git a/subx/062write-stream.subx b/subx/062write-stream.subx index a4dd73b7..b273336b 100644 --- a/subx/062write-stream.subx +++ b/subx/062write-stream.subx @@ -228,12 +228,12 @@ test-write-stream-appends: _test-stream2: # current write index - 04 00 00 00 + 4/imm32 # current read index - 01 00 00 00 - # length (= 8) - 08 00 00 00 + 1/imm32 + # length + 8/imm32 # data - 41 42 43 44 00 00 00 00 # 8 bytes + 41/A 42/B 43/C 44/D 00 00 00 00 # 8 bytes # . . vim:nowrap:textwidth=0 diff --git a/subx/064write-byte.subx b/subx/064write-byte.subx index 1d14b06b..61ed4197 100644 --- a/subx/064write-byte.subx +++ b/subx/064write-byte.subx @@ -9,13 +9,13 @@ # The buffered file for standard output. Stdout: # file descriptor or (address stream) - 01 00 00 00 # 1 = standard output + 1/imm32 # standard output # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/068error-byte.subx b/subx/068error-byte.subx index 5f9a4ada..1bf77be5 100644 --- a/subx/068error-byte.subx +++ b/subx/068error-byte.subx @@ -96,13 +96,13 @@ $error-byte:dead-end: # The buffered file for standard error. Stderr: # file descriptor or (address stream) - 02 00 00 00 # 1 = standard error + 2/imm32 # standard error # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/069allocate.subx b/subx/069allocate.subx index 1d9e043a..7efeb678 100644 --- a/subx/069allocate.subx +++ b/subx/069allocate.subx @@ -22,7 +22,7 @@ # hitherto unused bit of memory. Heap: Start-of-heap/imm32 # curr - 00 00 00 0b # limit = 0x0b000000; keep sync'd with DATA_SEGMENT + SEGMENT_ALIGNMENT + 0x0b000000/imm32 # limit; keep sync'd with DATA_SEGMENT + SEGMENT_ALIGNMENT == code # instruction effective address register displacement immediate diff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index 53b59263..ad8dad46 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -574,26 +574,26 @@ $is-digit?:end: == data -Look: # (char) - 00 00 00 00 # = 0 +Look: # (char with some extra padding) + 0/imm32 _test-output-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes _test-error-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/apps/crenshaw2-1b.subx b/subx/apps/crenshaw2-1b.subx index 3b828735..044221eb 100644 --- a/subx/apps/crenshaw2-1b.subx +++ b/subx/apps/crenshaw2-1b.subx @@ -771,26 +771,26 @@ $is-digit?:end: == data -Look: # (char) - 00 00 00 00 # = 0 +Look: # (char with some extra padding) + 0/imm32 _test-output-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes _test-error-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes diff --git a/subx/apps/handle.subx b/subx/apps/handle.subx index bf452cc1..3848eb76 100644 --- a/subx/apps/handle.subx +++ b/subx/apps/handle.subx @@ -356,6 +356,6 @@ test-lookup-failure: # Monotonically increasing counter for calls to 'new' Next-alloc-id: - 01 00 00 00 # 1 + 1/imm32 # . . vim:nowrap:textwidth=0 diff --git a/subx/apps/hex.subx b/subx/apps/hex.subx index d841fd8b..49ca3bd4 100644 --- a/subx/apps/hex.subx +++ b/subx/apps/hex.subx @@ -1511,11 +1511,11 @@ test-skip-until-newline: _test-error-stream: # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (= 8) - 08 00 00 00 + 0/imm32 + # length + 8/imm32 # data 00 00 00 00 00 00 00 00 # 8 bytes @@ -1524,11 +1524,11 @@ _test-error-buffered-file: # file descriptor or (address stream) _test-error-stream/imm32 # current write index - 00 00 00 00 + 0/imm32 # current read index - 00 00 00 00 - # length (6) - 06 00 00 00 + 0/imm32 + # length + 6/imm32 # data 00 00 00 00 00 00 # 6 bytes diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx index bb3c8e23..071a855b 100644 --- a/subx/examples/ex11.subx +++ b/subx/examples/ex11.subx @@ -343,7 +343,7 @@ write-stderr: # s : (address array byte) -> Newline: # size - 01 00 00 00 + 1/imm32 # data 0a/newline diff --git a/subx/examples/ex12.subx b/subx/examples/ex12.subx index 9cf5e14a..4518aecc 100644 --- a/subx/examples/ex12.subx +++ b/subx/examples/ex12.subx @@ -29,16 +29,16 @@ # various constants used here were found in the Linux sources (search for file mman-common.h) Mmap-new-segment: # type mmap_arg_struct # addr - 00 00 00 00 # null + 0/imm32 # len - 00 01 00 00 # 0x1000 + 0x100/imm32 # protection flags - 03 00 00 00 # PROT_READ | PROT_WRITE + 3/imm32 # PROT_READ | PROT_WRITE # sharing flags - 22 00 00 00 # MAP_PRIVATE | MAP_ANONYMOUS + 0x22/imm32 # MAP_PRIVATE | MAP_ANONYMOUS # fd - ff ff ff ff # -1 since MAP_ANONYMOUS is specified + -1/imm32 # since MAP_ANONYMOUS is specified # offset - 00 00 00 00 # 0 since MAP_ANONYMOUS is specified + 0/imm32 # since MAP_ANONYMOUS is specified # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex4.subx b/subx/examples/ex4.subx index 3060ae3f..b18a5da0 100644 --- a/subx/examples/ex4.subx +++ b/subx/examples/ex4.subx @@ -35,6 +35,6 @@ cd/syscall 0x80/imm8 == data X: - 00 00 00 00 # space for read() to write to + 0/imm32 # space for read() to write to # . . vim:nowrap:textwidth=0 diff --git a/subx/examples/ex6.subx b/subx/examples/ex6.subx index dece5b13..3375fb43 100644 --- a/subx/examples/ex6.subx +++ b/subx/examples/ex6.subx @@ -28,7 +28,7 @@ == data Size: # size of string - 0e 00 00 00 # 14 + 0x0e/imm32 # 14 X: # string to print 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 0a 00 # H e l l o , ␣ w o r l d ! newline null diff --git a/subx/examples/ex7.subx b/subx/examples/ex7.subx index 47b51734..c6dd3423 100644 --- a/subx/examples/ex7.subx +++ b/subx/examples/ex7.subx @@ -94,12 +94,13 @@ == data Stream: - 00 00 00 00 + 0/imm32 A: - 61 00 00 00 + 61/imm32/A B: - 00 00 00 00 + 0/imm32 Filename: 2e 66 6f 6f 00 00 00 00 +# . f o o null # . . vim:nowrap:textwidth=0