Modify to make work on Aarch64

This commit is contained in:
Tom Bloor 2026-07-04 13:55:04 +01:00
parent 325c449616
commit 75b33ae8f1
4 changed files with 18 additions and 16 deletions

View file

@ -33,8 +33,8 @@
# File Type - e_type - Executable binary # File Type - e_type - Executable binary
02 00 02 00
# Architecture - e_machine - AMD 64 Architecture # Architecture - e_machine - Aarch 64 Architecture
3e 00 b7 00
# Version Spec - e_version - Version 1 # Version Spec - e_version - Version 1
01 00 00 00 01 00 00 00
@ -48,8 +48,8 @@
40 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
# Section Header Table Offset - e_shoff # Section Header Table Offset - e_shoff
# 64 + 56 + 16 + 16 # 64 + 56 + 12 + 16
98 00 00 00 00 00 00 00 94 00 00 00 00 00 00 00
# Processor Flags - e_flags - No flags set # Processor Flags - e_flags - No flags set
00 00 00 00 00 00 00 00

View file

@ -24,12 +24,12 @@
# p_filesz - size of the file to load # p_filesz - size of the file to load
# This is to the end of the .text section, which for us is just # This is to the end of the .text section, which for us is just
# the program size, ELF header, and program header # the program size, ELF header, and program header
# so 64 + 56 + 16 = 136 = 0x88 # so 64 + 56 + 12 = 132 = 0x84
88 00 00 00 00 00 00 00 84 00 00 00 00 00 00 00
# p_memsz - size of the file once loaded into memory # p_memsz - size of the file once loaded into memory
# For us this is the same as above for now # For us this is the same as above for now
88 00 00 00 00 00 00 00 84 00 00 00 00 00 00 00
# p_align - something to do with alignment, p_offset and p_vaddr # p_align - something to do with alignment, p_offset and p_vaddr
# need more reading on that # need more reading on that

View file

@ -1,12 +1,14 @@
# Program Code # Program Code - 12 bytes
# ============ # ============
# mov $60, %rax # mov w8 #93
48 c7 c0 3c 00 00 00 # d2 80 0b a8
a8 0b 80 d2
# mov $42, %rdi # mov x0 #42
48 c7 c7 2a 00 00 00 # d2 80 05 40
40 05 80 d2
# syscall
0f 05
# svc #0
# d4 00 00 01
01 00 00 d4

View file

@ -16,7 +16,7 @@
78 00 00 00 00 00 00 00 78 00 00 00 00 00 00 00
# size of this section in the file: 16 bytes # size of this section in the file: 16 bytes
10 00 00 00 00 00 00 00 0c 00 00 00 00 00 00 00
# sh_link -- not used for this section # sh_link -- not used for this section
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00