Clean up.
This commit is contained in:
Kartik Agaram 2019-07-13 19:48:39 -07:00
parent ae30c4682c
commit 7f23be0107
2 changed files with 132 additions and 132 deletions

Binary file not shown.

View File

@ -135,15 +135,15 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void
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
# write(2/stderr, "compute-offsets\n") {{{
# . . push args
68/push "compute-offsets\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "compute-offsets\n") {{{
#? # . . push args
#? 68/push "compute-offsets\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# compute-offsets(in, segments, labels)
# . . push args
52/push-EDX
@ -153,15 +153,15 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void
e8/call compute-offsets/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# write(2/stderr, "compute-addresses\n") {{{
# . . push args
68/push "compute-addresses\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "compute-addresses\n") {{{
#? # . . push args
#? 68/push "compute-addresses\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# compute-addresses(segments, labels)
# . . push args
52/push-EDX
@ -177,15 +177,15 @@ convert: # in : (address buffered-file), out : (address buffered-file) -> <void
e8/call rewind-stream/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# write(2/stderr, "emit-output\n") {{{
# . . push args
68/push "emit-output\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "emit-output\n") {{{
#? # . . push args
#? 68/push "emit-output\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
#? # dump *Trace-stream {{{
#? # . write(2/stderr, "^")
#? # . . push args
@ -1639,15 +1639,15 @@ emit-output: # in : (address buffered-file), out : (address buffered-file), seg
# . prolog
55/push-EBP
89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP
# write(2/stderr, "emit-headers\n") {{{
# . . push args
68/push "emit-headers\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "emit-headers\n") {{{
#? # . . push args
#? 68/push "emit-headers\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# emit-headers(out, segments, labels)
# . . push args
ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 . # push *(EBP+20)
@ -1657,15 +1657,15 @@ emit-output: # in : (address buffered-file), out : (address buffered-file), seg
e8/call emit-headers/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP
# write(2/stderr, "emit-segments\n") {{{
# . . push args
68/push "emit-segments\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "emit-segments\n") {{{
#? # . . push args
#? 68/push "emit-segments\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# emit-segments(in, out, segments, labels)
# . . push args
ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 . # push *(EBP+20)
@ -2455,15 +2455,15 @@ emit-headers: # out : (address buffered-file), segments : (address stream {stri
# . save registers
50/push-EAX
51/push-ECX
# write(2/stderr, "emit-elf-header\n") {{{
# . . push args
68/push "emit-elf-header\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # write(2/stderr, "emit-elf-header\n") {{{
#? # . . push args
#? 68/push "emit-elf-header\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# emit-elf-header(out, segments, labels)
# . . push args
ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 . # push *(EBP+16)
@ -2485,84 +2485,84 @@ $emit-headers:loop:
# if (curr-segment >= max) break
39/compare 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . . # compare EAX with ECX
0f 83/jump-if-greater-or-equal-unsigned $emit-headers:end/disp32
# dump curr-segment->name {{{
# . write(2/stderr, "about to emit ph entry: segment->name: ")
# . . push args
68/push "about to emit ph entry: segment->name: "/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . clear-stream(Stderr+4)
# . . save EAX
50/push-EAX
# . . push args
b8/copy-to-EAX Stderr/imm32
05/add-to-EAX 4/imm32
50/push-EAX
# . . call
e8/call clear-stream/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . . restore EAX
58/pop-to-EAX
# . print-int32-buffered(Stderr, &curr-segment)
# . . push args
50/push-EAX
68/push Stderr/imm32
# . . call
e8/call print-int32-buffered/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . flush(Stderr)
# . . push args
68/push Stderr/imm32
# . . call
e8/call flush/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . write(2/stderr, " -> ")
# . . push args
68/push " -> "/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . print-int32-buffered(Stderr, curr-segment->name)
# . . push args
ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . . # push *EAX
68/push Stderr/imm32
# . . call
e8/call print-int32-buffered/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# . flush(Stderr)
# . . push args
68/push Stderr/imm32
# . . call
e8/call flush/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
# . write(2/stderr, "\n")
# . . push args
68/push "\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
# write(2/stderr, "emit-segment-header\n") {{{
# . . push args
68/push "emit-segment-header\n"/imm32
68/push 2/imm32/stderr
# . . call
e8/call write/disp32
# . . discard args
81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
# }}}
#? # dump curr-segment->name {{{
#? # . write(2/stderr, "about to emit ph entry: segment->name: ")
#? # . . push args
#? 68/push "about to emit ph entry: segment->name: "/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # . clear-stream(Stderr+4)
#? # . . save EAX
#? 50/push-EAX
#? # . . push args
#? b8/copy-to-EAX Stderr/imm32
#? 05/add-to-EAX 4/imm32
#? 50/push-EAX
#? # . . call
#? e8/call clear-stream/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
#? # . . restore EAX
#? 58/pop-to-EAX
#? # . print-int32-buffered(Stderr, &curr-segment)
#? # . . push args
#? 50/push-EAX
#? 68/push Stderr/imm32
#? # . . call
#? e8/call print-int32-buffered/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # . flush(Stderr)
#? # . . push args
#? 68/push Stderr/imm32
#? # . . call
#? e8/call flush/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
#? # . write(2/stderr, " -> ")
#? # . . push args
#? 68/push " -> "/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # . print-int32-buffered(Stderr, curr-segment->name)
#? # . . push args
#? ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . . # push *EAX
#? 68/push Stderr/imm32
#? # . . call
#? e8/call print-int32-buffered/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # . flush(Stderr)
#? # . . push args
#? 68/push Stderr/imm32
#? # . . call
#? e8/call flush/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP
#? # . write(2/stderr, "\n")
#? # . . push args
#? 68/push "\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
#? # write(2/stderr, "emit-segment-header\n") {{{
#? # . . push args
#? 68/push "emit-segment-header\n"/imm32
#? 68/push 2/imm32/stderr
#? # . . call
#? e8/call write/disp32
#? # . . discard args
#? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP
#? # }}}
# emit-elf-program-header-entry(out, curr-segment)
# . . push args
50/push-EAX