From 6f516bbb93bacd55aa238e3b966c8e42543867a4 Mon Sep 17 00:00:00 2001 From: janis Date: Thu, 4 Jun 2026 08:05:40 +0200 Subject: [PATCH] almost works! --- stages/hex0/hex0.in | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/stages/hex0/hex0.in b/stages/hex0/hex0.in index dd179ed..0176254 100644 --- a/stages/hex0/hex0.in +++ b/stages/hex0/hex0.in @@ -2,12 +2,18 @@ # e_ident: u128 # Magic number: 0x7f454c46 = "\x7fELF" 7f 45 4c 46 -02 # EI_CLASS: u8 = ELFCLASS64 -01 # EI_DATA: u8 = ELFDATA2LSB -01 # EI_VERSION: u8 = EV_CURRENT -00 # EI_OSABI: u8 = ELFOSABI_NONE -00 # EI_ABIVERSION: u8 = 0 -00 00 00 00 00 00 00 # EI_PAD: [u8; 7] +# 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 @@ -78,7 +84,7 @@ # cmp rax, 0 48 83 f8 00 # jle die -0f 8e b0 00 00 00 +0f 8e b3 00 00 00 ## (162) # ; end = r8 # mov r8, rax @@ -98,7 +104,7 @@ # cmp r9, r8 4d 39 c1 # jge .L3 -0f 8d 6f 00 00 00 +0f 8d 72 00 00 00 # (190) # # ; if (*pos == '#') { @@ -111,9 +117,8 @@ # (202) # cmp al, '#' 3c 23 -# jne .L1 +# jne .L1 0f 85 15 00 00 00 -# (210) # ; while (*pos != '\n') pos++; # ; .L2: (210) # inc r9 @@ -180,11 +185,13 @@ c0 e0 04 # je .L0 0f 84 8d ff ff ff ## (296) +# inc r9 +49 ff c1 # jmp .L1 ; -e9 ba ff ff ff -## (301) +e9 b7 ff ff ff +## (304) # ; } -# .L3: (301) +# .L3: (304) # ; write the decoded bytes to stdout # mov rax, 1 (sys_write) 48 c7 c0 01 00 00 00 @@ -201,14 +208,14 @@ e9 ba ff ff ff # syscall 0f 05 # jmp .READ ; -e9 30 ff ff ff -## (338) +e9 2d ff ff ff +## (341) # -# die: (338) +# die: (341) # mov rax, 60 (sys_exit) 48 c7 c0 3c 00 00 00 # xor rdi, rdi 48 31 ff # syscall 0f 05 -# _start+215 +# _start+215 \ No newline at end of file