From 58c643c2c2ab227142977ee24108b0dcdd2cda39 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 13 Jul 2019 15:43:32 -0700 Subject: fixed fifth bug, hit sixth --- subx/apps/survey | Bin 40160 -> 40163 bytes subx/apps/survey.subx | 11 ++++++----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'subx') diff --git a/subx/apps/survey b/subx/apps/survey index cb80f099..0a9ad45c 100755 Binary files a/subx/apps/survey and b/subx/apps/survey differ diff --git a/subx/apps/survey.subx b/subx/apps/survey.subx index 737205c3..102e5793 100644 --- a/subx/apps/survey.subx +++ b/subx/apps/survey.subx @@ -2375,7 +2375,7 @@ emit-headers: # out : (address buffered-file), segments : (address stream {stri # max = segments->data + segments->write # while true # if (curr-segment >= max) break - # emit-elf-program-header-entry(curr-segment) + # emit-elf-program-header-entry(out, curr-segment) # curr-segment += 20 # size of a row # # . prolog @@ -2474,13 +2474,14 @@ $emit-headers:loop: #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP #? # }}} - # emit-elf-program-header-entry(curr-segment) + # emit-elf-program-header-entry(out, curr-segment) # . . push args 50/push-EAX + ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) # . . call e8/call emit-elf-program-header-entry/disp32 # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP + 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 e9/jump $emit-headers:loop/disp32 @@ -2551,7 +2552,7 @@ $emit-elf-header:end: 5d/pop-to-EBP c3/return -emit-elf-program-header-entry: # curr-segment : (address {string, segment-info}) +emit-elf-program-header-entry: # out : (address buffered-file), curr-segment : (address {string, segment-info}) # pseudocode: # *Elf_p_offset = curr-segment->file-offset # *Elf_p_vaddr = curr-segment->address @@ -2571,7 +2572,7 @@ emit-elf-program-header-entry: # curr-segment : (address {string, segment-info} 50/push-EAX 56/push-ESI # ESI = curr-segment - 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI + 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 . # copy *(EBP+12) to ESI # *Elf_p_offset = curr-segment->file-offset # . EAX = curr-segment->file-offset 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 8/disp8 . # copy *(ESI+8) to EAX -- cgit 1.4.1-2-gfad0