verify hex1

This commit is contained in:
janis 2026-06-05 08:19:25 +02:00
parent ff22a96106
commit d54b7ba1a9
Signed by: janis
SSH key fingerprint: SHA256:bB1qbbqmDXZNT0KKD5c2Dfjg53JGhj7B3CFcLIzSqq8
2 changed files with 11 additions and 68 deletions

View file

@ -31,4 +31,15 @@ $(BUILD)/stage1-hex1.text: $(BUILD)/stage0
$(BUILD)/stage1-hex1: $(BUILD)/stage1-elf $(BUILD)/stage1-hex1.text
$(BUILD)/stage1-elf $(BUILD)/stage1-hex1 $(BUILD)/stage1-hex1.text
chmod +x $@
verify-hex1: $(BUILD)/stage1-elf $(BUILD)/stage1-hex1
$(BUILD)/stage1-hex1 < hex1/helloworld.h1 > $(BUILD)/helloworld.text
$(BUILD)/stage1-elf $(BUILD)/helloworld.elf $(BUILD)/helloworld.text
chmod +x $(BUILD)/helloworld.elf
$(BUILD)/helloworld.elf
clean:
rm -rf $(BUILD)
mkdir -p $(BUILD)

View file

@ -1,71 +1,3 @@
; ELF header
; e_ident: u128
; Magic number: 0x7f454c46 = "\x7fELF"
7f 45 4c 46
; EI_CLASS: u8 = ELFCLASS64
02
; EI_DATA: u8 = ELFDATA2LSB
01
; EI_VERSION: u8 = EV_CURRENT
01
; EI_OSABI: u8 = ELFOSABI_NONE
00
; EI_ABIVERSION: u8 = 0
00
; EI_PAD: [u8; 7]
00 00 00 00 00 00 00
; e_type: u16 = E_EXEC
02 00
; e_machine: u16 = EM_X86_64
3e 00
; e_version: u32 = EV_CURRENT
01 00 00 00
; e_entry: u64 = 0x400084
84 00 40 00 00 00 00 00
; e_phoff: u64 = 0x40
40 00 00 00 00 00 00 00
; e_shoff: u64 = 0x0
00 00 00 00 00 00 00 00
; e_flags: u32 = 0
00 00 00 00
; e_ehsize: u16 = 64
40 00
; e_phentsize: u16 = 56
38 00
; e_phnum: u16 = 1
01 00
; e_shentsize: u16 = 0
00 00
; e_shnum: u16 = 0
00 00
; e_shstrndx: u16 = 0
00 00
; End of ELF header
;
; Program header
; p_type: u32 = PT_LOAD
01 00 00 00
; p_flags: u32 = PF_R | PF_X
05 00 00 00
; p_offset: u64 = 0
00 00 00 00 00 00 00 00
; p_vaddr: u64 = 0x400000
00 00 40 00 00 00 00 00
; p_paddr: u64 = 0x0
00 00 00 00 00 00 00 00
; p_filesz: u64
ae 00 00 00 00 00 00 00
; p_memsz: u64
ae 00 00 00 00 00 00 00
; p_align: u64 = 0x1000
00 10 00 00 00 00 00 00
; End of program header
;
; Ehdr size = 64 = 0x40
; Phdr size = 56 = 0x38
; .text size = 54 = 0x36
; total 0xae
;
; Code segment
;
; _start