Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog committed Jun 16, 2024
1 parent b79b239 commit 229a2db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions elf.inc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ elf_binary_calculate_fields:

pop rax
mov qword [program_code_section_header.offset], rax
;
; above needs to be:
;
assert elf_binary_headers_length + 0x2a + 0x0e + 0x10 = 0xc0


mov edi, eax
add edi, elf_binary.base_address
Expand Down
10 changes: 10 additions & 0 deletions elf_test.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ entry $
mov ecx, program_code.length
call elf_binary_calculate_fields

mov edi, 1
cmp qword [elf_header.start_address], 0x400078
jne exit

mov edi, 2
cmp qword [elf_header.section_header_offset], 0xc0
jne exit

;
; exit cleanly
;
xor edi, edi

exit:
mov eax, SYS_EXIT
syscall

0 comments on commit 229a2db

Please sign in to comment.