Kartik K. Agaram 1 year ago
parent
commit
eede9e222f
  1. 2
      102keyboard.subx
  2. 2
      103grapheme.subx
  3. 2
      311decimal-int.subx
  4. 2
      315stack-debug.subx
  5. 2
      boot.subx
  6. 2
      linux/304screen.subx
  7. 2
      linux/311decimal-int.subx
  8. BIN
      linux/braces
  9. 4
      linux/braces.subx
  10. BIN
      linux/calls
  11. 28
      linux/calls.subx
  12. BIN
      linux/labels_baremetal
  13. 2
      linux/labels_baremetal.subx
  14. BIN
      linux/mu
  15. 56
      linux/mu.subx
  16. BIN
      linux/sigils
  17. 34
      linux/sigils.subx
  18. BIN
      linux/survey_elf
  19. 4
      linux/survey_elf.subx

2
102keyboard.subx

@ -37,7 +37,7 @@ read-key: # kbd: (addr keyboard) -> result/eax: byte
# var next-key/eax: byte = *buffer-byte-addr
8a/byte-> *ecx 0/r32/AL
# if (next-key != 0) lock and remove from keyboard buffer
81 7/subop/compare %eax 0/imm32
3d/compare-eax-with 0/imm32
{
74/jump-if-= break/disp8
fa/disable-interrupts

2
103grapheme.subx

@ -45,7 +45,7 @@ draw-grapheme-on-real-screen: # g: grapheme, x: int, y: int, color: int, backgr
# var xcurr/eax: int = x*8 + 7
8b/-> *(ebp+0xc) 0/r32/eax # font-width - 1
c1 4/subop/shift-left %eax 3/imm8
81 0/subop/add %eax 7/imm32
05/add-to-eax 7/imm32
# var xmin/ecx: int = x*8
8b/-> *(ebp+0xc) 1/r32/ecx
c1 4/subop/shift-left %ecx 3/imm8

2
311decimal-int.subx

@ -66,7 +66,7 @@ parse-decimal-int-from-stream: # in: (addr stream byte) -> result/eax: int
4a/decrement-edx
# if it's a newline, break
8a/byte-> *edx 0/r32/eax
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0xa/imm32/newline
74/jump-if-= break/disp8
# not a newline, so restore it

2
315stack-debug.subx

@ -10,7 +10,7 @@ check-stack:
50/push-eax
#
89/<- %eax 4/r32/esp
81 7/subop/compare %eax 0x01000000/imm32
3d/compare-eax-and 0x01000000/imm32
{
7f/jump-if-> break/disp8
(abort "stack overflow")

2
boot.subx

@ -1520,7 +1520,7 @@ wait-for-ack-from-mouse:
50/push-eax
{
(read-keyboard-controller-data) # => eax
81 7/subop/compare %eax 0xfa/imm32
3d/compare-eax-with 0xfa/imm32
75/jump-if-!= loop/disp8
}
$wait-for-ack-from-mouse:end:

2
linux/304screen.subx

@ -56,7 +56,7 @@ real-screen-size: # -> nrows/eax: int, ncols/ecx: int
e8/call syscall_ioctl/disp32
# some bitworking to extract 2 16-bit shorts
8b/-> *esi 0/r32/eax
81 4/subop/and %eax 0xffff/imm32
25/and-eax-with 0xffff/imm32
8b/-> *esi 1/r32/ecx
c1/shift 5/subop/logical-right %ecx 0x10/imm8
$real-screen-size:end:

2
linux/311decimal-int.subx

@ -66,7 +66,7 @@ parse-decimal-int-from-stream: # in: (addr stream byte) -> result/eax: int
4a/decrement-edx
# if it's a newline, break
8a/byte-> *edx 0/r32/eax
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0xa/imm32/newline
74/jump-if-= break/disp8
# not a newline, so restore it

BIN
linux/braces

Binary file not shown.

4
linux/braces.subx

@ -152,7 +152,7 @@ $subx-braces:check-for-curly-open:
# . eax = line->data[line->read]
8b/-> *(ecx+4) 0/r32/eax
8a/copy-byte *(ecx+eax+0xc) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax != '{') continue
3d/compare-eax-and 0x7b/imm32/open-curly
0f 85/jump-if-!= $subx-braces:check-for-curly-closed/disp32
@ -192,7 +192,7 @@ $subx-braces:check-for-comment:
# . eax = *word-slice->start
8b/-> *edi 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax == '#') continue
3d/compare-eax-and 0x23/imm32/hash
74/jump-if-= $subx-braces:word-loop/disp8

BIN
linux/calls

Binary file not shown.

28
linux/calls.subx

@ -428,7 +428,7 @@ $emit-call:push-loop:
# . . eax = *(curr->start+4)
8b/-> *ecx 0/r32/eax
8a/copy-byte *(eax+4) 0/r32/eax
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . . push args
50/push-eax
ff 6/subop/push *(ebp+8)
@ -451,7 +451,7 @@ $emit-call:push-int:
8b/-> *ecx 0/r32/eax
# . var c/eax: byte = *eax
8b/-> *eax 0/r32/eax
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (c == '%') goto push-rm32
3d/compare-eax-and 0x25/imm32/percent
74/jump-if-= $emit-call:push-rm32/disp8
@ -1361,7 +1361,7 @@ test-next-word-string-or-expression-without-metadata:
68/push 0xe/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1374,7 +1374,7 @@ test-next-word-string-or-expression-without-metadata:
68/push 0x10/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1434,7 +1434,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-comment:
68/push 0xe/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1447,7 +1447,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-comment:
68/push 0x11/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1497,7 +1497,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-literal:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1510,7 +1510,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-literal:
68/push 0x12/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1560,7 +1560,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-with-escapes
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1573,7 +1573,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-with-escapes
68/push 0x13/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1623,7 +1623,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-expression:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1636,7 +1636,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-expression:
68/push 0x13/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1851,7 +1851,7 @@ test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/-> *ecx 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1864,7 +1864,7 @@ test-next-word-string-or-expression-without-metadata-stops-at-close-paren:
68/push 0x10/imm32
# . . push slice->end - _test-input-stream
8b/-> *(ecx+4) 0/r32/eax
81 5/subop/subtract %eax _test-input-stream/imm32
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32

BIN
linux/labels_baremetal

Binary file not shown.

2
linux/labels_baremetal.subx

@ -2075,7 +2075,7 @@ $far-jump-or-call?:check-second-word:
8b/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . . # copy *edx to eax
# . c/eax = *start
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
# . if (eax != '8') return
3d/compare-eax-and 0x38/imm32/8
75/jump-if-!= $far-jump-or-call?:end/disp8

BIN
linux/mu

Binary file not shown.

56
linux/mu.subx

@ -15807,7 +15807,7 @@ $parse-mu:line-loop:
# . eax = *word-slice->start
8b/-> *edx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax == '#') continue
3d/compare-eax-and 0x23/imm32/hash
0f 84/jump-if-= loop/disp32
@ -16619,7 +16619,7 @@ type-tree-contains?: # t: (addr type-tree), n: type-id -> result/eax: boolean
8b/-> *(ebp+0xc) 1/r32/ecx
39/compare *(eax+4) 1/r32/ecx # Type-tree-value
0f 94/set-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
eb/jump $type-tree-contains?:end/disp8
}
# if t->left contains n, return true
@ -17094,7 +17094,7 @@ float-register?: # r: (addr array byte) -> result/eax: boolean
(get Mu-registers-unique *(ebp+8) 0xc "Mu-registers-unique") # => eax
81 7/subop/compare *eax 8/imm32/start-of-floating-point-registers
0f 9d/set-if->= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$float-register?:end:
# . epilogue
89/<- %esp 5/r32/ebp
@ -17179,7 +17179,7 @@ $parse-type:check-for-int:
# var tmp/eax: byte = *s->slice
8b/-> *ecx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# TODO: raise an error on `var x: (array int a)`
(decimal-digit? %eax) # => eax
3d/compare-eax-and 0/imm32/false
@ -17202,7 +17202,7 @@ $parse-type:check-for-type-parameter:
# var tmp/eax: byte = *s->slice
8b/-> *ecx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# if (tmp != '_') break
3d/compare-eax-and 0x5f/imm32/_
75/jump-if-!= break/disp8
@ -17800,7 +17800,7 @@ identifier?: # in: (addr slice) -> result/eax: boolean
8b/-> *(ebp+8) 0/r32/eax
8b/-> *eax 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# if (c == '$') return true
3d/compare-eax-and 0x24/imm32/$
74/jump-if-= $identifier?:true/disp8
@ -18213,7 +18213,7 @@ $parse-mu-block:line-loop:
# . eax = *word-slice->start
8b/-> *edx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax == '#') continue
3d/compare-eax-and 0x23/imm32/hash
0f 84/jump-if-= loop/disp32
@ -18249,7 +18249,7 @@ $parse-mu-block:check-for-named-block:
8b/-> *(edx+4) 0/r32/eax
48/decrement-eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax != ':') break
3d/compare-eax-and 0x3a/imm32/colon
0f 85/jump-if-!= break/disp32
@ -18417,7 +18417,7 @@ check-no-tokens-left: # line: (addr stream byte)
# . eax = *s->start
8b/-> *edx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax == '#') continue
3d/compare-eax-and 0x23/imm32/hash
74/jump-if-= $check-no-tokens-left:end/disp8
@ -18823,7 +18823,7 @@ $parse-mu-stmt:read-outputs:
# if slice-starts-with?(name, "*") abort
8b/-> *ecx 0/r32/eax # Slice-start
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x2a/imm32/asterisk
0f 84/jump-if-= $parse-mu-stmt:error-output-dereferenced/disp32
# assert(identifier?(name))
@ -18953,7 +18953,7 @@ $add-operation-and-inputs-to-stmt:read-inouts:
# if (slice-starts-with?(name, '*')) ++name->start and set is-deref?
8b/-> *ecx 0/r32/eax # Slice-start
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x2a/imm32/asterisk
{
75/jump-if-!= break/disp8
@ -19067,7 +19067,7 @@ stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean
# . eax = *word-slice->start
8b/-> *ecx 0/r32/eax
8a/copy-byte *eax 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# . if (eax == '#') break
3d/compare-eax-and 0x23/imm32/hash
b8/copy-to-eax 0/imm32/false/result # restore result (if we're here it's still false)
@ -20255,7 +20255,7 @@ container?: # t: type-id -> result/eax: boolean
c1/shift 4/subop/left %eax 2/imm8
3b/compare 0/r32/eax *Primitive-type-ids
0f 9d/set-if->= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$container?:end:
# . epilogue
89/<- %esp 5/r32/ebp
@ -26520,7 +26520,7 @@ $type-component-match?:is-atom:
8b/-> *(ecx+4) 0/r32/eax # Type-tree-value
39/compare *(edx+4) 0/r32/eax # Type-tree-value
0f 94/set-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
e9/jump $type-component-match?:end/disp32
}
$type-component-match?:check-left:
@ -26687,7 +26687,7 @@ mu-array?: # t: (addr type-tree) -> result/eax: boolean
# return t->left->value == array
81 7/subop/compare *(eax+4) 3/imm32/array-type-id # Type-tree-value
0f 94/set-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
eb/jump $mu-array?:end/disp8
$mu-array?:return-false:
b8/copy-to-eax 0/imm32/false
@ -26752,7 +26752,7 @@ mu-stream?: # t: (addr type-tree) -> result/eax: boolean
# return t->left->value == stream
81 7/subop/compare *(eax+4) 0xb/imm32/stream-type-id # Type-tree-value
0f 94/set-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
eb/jump $mu-stream?:end/disp8
$mu-stream?:return-false:
b8/copy-to-eax 0/imm32/false
@ -26941,7 +26941,7 @@ $type-equal?:is-atom:
8b/-> *(ecx+4) 0/r32/eax # Type-tree-value
39/compare *(edx+4) 0/r32/eax # Type-tree-value
0f 94/set-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
e9/jump $type-equal?:end/disp32
}
$type-equal?:check-left:
@ -27459,7 +27459,7 @@ $emit-outputs:loop:
89/<- %ecx 0/r32/eax
# if curr-output-register starts with "x", emit a floating-point copy
8a/copy-byte *(ecx+4) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x78/imm32/x
{
75/jump-if-!= break/disp8
@ -27905,7 +27905,7 @@ emit-push-register: # out: (addr buffered-file), reg: (addr array byte)
8b/-> *(ebp+0xc) 0/r32/eax
# var prefix/eax: byte = reg->data[0]
8a/copy-byte *(eax+4) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# if (prefix == 'x') push xmm register
{
3d/compare-eax-and 0x78/imm32/x
@ -27918,7 +27918,7 @@ emit-push-register: # out: (addr buffered-file), reg: (addr array byte)
# var prefix/eax: byte = reg->data[3]
8b/-> *(ebp+0xc) 0/r32/eax
8a/copy-byte *(eax+7) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
(write-byte-buffered *(ebp+8) %eax)
(write-buffered *(ebp+8) "/x32\n")
e9/jump $emit-push-register:end/disp32
@ -27944,7 +27944,7 @@ emit-pop-register: # out: (addr buffered-file), reg: (addr array byte)
8b/-> *(ebp+0xc) 0/r32/eax
# var prefix/eax: byte = reg->data[0]
8a/copy-byte *(eax+4) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
# if (prefix == 'x') pop to xmm register
{
3d/compare-eax-and 0x78/imm32/x
@ -27955,7 +27955,7 @@ emit-pop-register: # out: (addr buffered-file), reg: (addr array byte)
# var prefix/eax: byte = reg->data[3]
8b/-> *(ebp+0xc) 0/r32/eax
8a/copy-byte *(eax+7) 0/r32/AL
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
(write-byte-buffered *(ebp+8) %eax)
(write-buffered *(ebp+8) "/x32\n")
(emit-indent *(ebp+8) *Curr-block-depth)
@ -30269,7 +30269,7 @@ power-of-2?: # n: int, err: (addr buffered-file), ed: (addr exit-descriptor) ->
# return (tmp2 == 0)
3d/compare-eax-and 0/imm32
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$power-of-2?:end:
# . epilogue
89/<- %esp 5/r32/ebp
@ -36139,7 +36139,7 @@ subx-type-category-match?: # a: (addr type-tree), b: (addr type-tree) -> result
# return cata == catb
39/compare %eax 1/r32/ecx
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$subx-type-category-match?:end:
# . restore registers
59/pop-to-ecx
@ -36182,7 +36182,7 @@ simple-mu-type?: # a: (addr type-tree), n: type-id -> result/eax: boolean
8b/-> *(ebp+8) 0/r32/eax
39/compare *(eax+4) 1/r32/ecx # Type-tree-value
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$simple-mu-type?:end:
# . restore registers
59/pop-to-ecx
@ -36206,7 +36206,7 @@ mu-addr-type?: # a: (addr type-tree) -> result/eax: boolean
# return (a->value == addr)
81 7/subop/compare *(eax+4) 2/imm32/addr # Type-tree-value
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$mu-addr-type?:end:
# . epilogue
89/<- %esp 5/r32/ebp
@ -36228,7 +36228,7 @@ mu-array-type?: # a: (addr type-tree) -> result/eax: boolean
# return (a->value == array)
81 7/subop/compare *(eax+4) 3/imm32/array # Type-tree-value
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$mu-array-type?:end:
# . epilogue
89/<- %esp 5/r32/ebp
@ -36290,7 +36290,7 @@ mu-stream-type?: # a: (addr type-tree) -> result/eax: boolean
# return (a->value == stream)
81 7/subop/compare *(eax+4) 0xb/imm32/stream # Type-tree-value
0f 94/set-byte-if-= %al
81 4/subop/and %eax 0xff/imm32
25/and-eax-with 0xff/imm32
$mu-stream-type?:end:
# . epilogue
89/<- %esp 5/r32/ebp

BIN
linux/sigils

Binary file not shown.

34
linux/sigils.subx

@ -1895,7 +1895,7 @@ test-next-word-or-expression:
68/push 0xe/imm32
# . . push slice->start - _test-input-stream
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1908,7 +1908,7 @@ test-next-word-or-expression:
68/push 0x10/imm32
# . . push slice->end - _test-input-stream
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1968,7 +1968,7 @@ test-next-word-or-expression-returns-whole-comment:
68/push 0xe/imm32
# . . push slice->start - _test-input-stream
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -1981,7 +1981,7 @@ test-next-word-or-expression-returns-whole-comment:
68/push 0x11/imm32
# . . push slice->end - _test-input-stream
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2073,7 +2073,7 @@ test-next-word-or-expression-returns-string-literal:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2086,7 +2086,7 @@ test-next-word-or-expression-returns-string-literal:
68/push 0x18/imm32
# . . push slice->end - _test-input-stream
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2136,7 +2136,7 @@ test-next-word-or-expression-returns-string-with-escapes:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2149,7 +2149,7 @@ test-next-word-or-expression-returns-string-with-escapes:
68/push 0x15/imm32
# . . push slice->end - _test-input-stream
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2199,7 +2199,7 @@ test-next-word-or-expression-returns-whole-expression:
68/push 0xd/imm32
# . . push slice->start - _test-input-stream
8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . . # copy *ecx to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2212,7 +2212,7 @@ test-next-word-or-expression-returns-whole-expression:
68/push 0x19/imm32
# . . push slice->end - _test-input-stream
8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 . # copy *(ecx+4) to eax
81 5/subop/subtract 3/mod/direct 0/rm32/eax . . . . . _test-input-stream/imm32 # subtract from eax
2d/subtract-from-eax _test-input-stream/imm32
50/push-eax
# . . call
e8/call check-ints-equal/disp32
@ -2291,7 +2291,7 @@ $parse-effective-address:check-for-simple-register:
# if (*local-slice->start == '(') goto compound expression
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x28/imm32/open-paren
74/jump-if-= $parse-effective-address:compound-expression/disp8
$parse-effective-address:simple-register:
@ -2357,7 +2357,7 @@ $parse-effective-address:compound-expression:
89/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy eax to *esi
# if (*local-slice->start == ')') goto end
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x29/imm32/close-paren
0f 84/jump-if-= $parse-effective-address:end/disp32
# if (*local-slice->start == '-') goto displacement
@ -2434,7 +2434,7 @@ $parse-effective-address:index:
89/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy eax to *esi
# if (*local-slice->start == ')') goto end
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x29/imm32/close-paren
0f 84/jump-if-= $parse-effective-address:end/disp32
$parse-effective-address:check-for-scale:
@ -2446,7 +2446,7 @@ $parse-effective-address:check-for-scale:
# if (*local-slice->start != '<') goto error2
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x3c/imm32/less-than
0f 85/jump-if-!= $parse-effective-address:error2/disp32
# ++local-slice->start to skip '<'
@ -2486,7 +2486,7 @@ $parse-effective-address:scale:
89/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy eax to *esi
# if (*local-slice->start == ')') goto end
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x29/imm32/close-paren
74/jump-if-= $parse-effective-address:end/disp8
$parse-effective-address:check-for-displacement:
@ -2520,7 +2520,7 @@ $parse-effective-address:displacement:
89/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy eax to *esi
# if (*local-slice->start != ')') goto error4
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x29/imm32/close-paren
0f 85/jump-if-!= $parse-effective-address:error4/disp32
$parse-effective-address:end:
@ -3895,7 +3895,7 @@ disp32-mode?: # in: (addr slice) -> reg/eax: boolean
# if (*local-slice->start == '(') return false
8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
3d/compare-eax-and 0x28/imm32/open-paren
74/jump-if-= $disp32-mode?:false/disp8
$disp32-mode?:check-for-register:

BIN
linux/survey_elf

Binary file not shown.

4
linux/survey_elf.subx

@ -3119,7 +3119,7 @@ $far-jump-or-call?:check-second-word:
8b/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . . # copy *edx to eax
# . c/eax = *start
8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . . # copy byte at *eax to AL
81 4/subop/and 3/mod/direct 0/rm32/eax . . . . . 0xff/imm32 # bitwise and of eax
25/and-eax-with 0xff/imm32
# . if (eax != '8') return
3d/compare-eax-and 0x38/imm32/8
75/jump-if-!= $far-jump-or-call?:end/disp8
@ -3257,7 +3257,7 @@ $emit-headers:loop:
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp
# curr-segment += 20 # size of a row
81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0x14/imm32 # add to eax
05/add-to-eax 0x14/imm32
e9/jump $emit-headers:loop/disp32
$emit-headers:end:
# . restore registers

Loading…
Cancel
Save