fix a crash when translating apps/ex1
This commit is contained in:
parent
5dc0ddfc9d
commit
fb18cadaa7
BIN
apps/survey
BIN
apps/survey
Binary file not shown.
|
@ -3177,7 +3177,7 @@ $emit-headers:end:
|
|||
emit-elf-header: # out: (addr buffered-file), segments: (addr stream {(handle array byte), segment-info}), labels: (addr stream {(handle array byte), label-info})
|
||||
# pseudocode
|
||||
# *$Elf_e_entry = get(labels, "Entry")->address
|
||||
# *$Elf_e_phnum = segments->write / 16 # size of a row
|
||||
# *$Elf_e_phnum = segments->write / 20 # size of a row
|
||||
# emit-hex-array(out, Elf_header)
|
||||
# write-buffered(out, "\n")
|
||||
#
|
||||
|
@ -3191,10 +3191,10 @@ emit-elf-header: # out: (addr buffered-file), segments: (addr stream {(handle a
|
|||
# *$Elf_e_entry = get(labels, "Entry")->address
|
||||
# . eax = labels
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 . # copy *(ebp+16) to eax
|
||||
# . label-info/eax = get(labels, "Entry", row-size=16, "label table")
|
||||
# . label-info/eax = get(labels, "Entry", row-size=24, "label table")
|
||||
# . . push args
|
||||
68/push "label table"/imm32
|
||||
68/push 0x10/imm32/row-size
|
||||
68/push 0x18/imm32/row-size
|
||||
68/push "Entry"/imm32
|
||||
50/push-eax
|
||||
# . . call
|
||||
|
@ -3205,13 +3205,13 @@ emit-elf-header: # out: (addr buffered-file), segments: (addr stream {(handle a
|
|||
8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 8/disp8 . # copy *(eax+8) to eax
|
||||
# . *$Elf_e_entry = eax
|
||||
89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax $Elf_e_entry/disp32 # copy eax to *$Elf_e_entry
|
||||
# *$Elf_e_phnum = segments->write / 0x10
|
||||
# *$Elf_e_phnum = segments->write / 20
|
||||
# . eax = segments
|
||||
8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax
|
||||
# . len/eax = segments->write
|
||||
8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . . # copy *eax to eax
|
||||
# . eax = len / 0x10 (destroying edx)
|
||||
b9/copy-to-ecx 0x10/imm32
|
||||
# . eax = len / 20 (clobbering ecx and edx)
|
||||
b9/copy-to-ecx 0x14/imm32
|
||||
31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx
|
||||
f7 7/subop/idiv 3/mod/direct 1/rm32/ecx . . . . . . # divide edx:eax by ecx, storing quotient in eax and remainder in edx
|
||||
# . *$Elf_e_phnum = eax
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
# sets of debug files.)
|
||||
# Again, that's for subsequent scripts.
|
||||
|
||||
set -e
|
||||
set -ev
|
||||
|
||||
./build
|
||||
|
||||
|
|
Loading…
Reference in New Issue