Skip to content

Commit ea80930

Browse files
48cfN00byEdge
authored andcommitted
elf_load: Avoid the xor by using the byproduct of rep movsb
Saves 2 bytes
1 parent b1eafac commit ea80930

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

elf_load.asm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ do_phdr:
2626
mov esi, [rdx + phdr_offset]
2727
add esi, ebx
2828

29+
mov rax, [rdx + phdr_memsz]
2930
mov ecx, [rdx + phdr_filesz]
30-
mov eax, ecx
31+
sub rax, rcx
3132
rep movsb
3233

33-
mov rcx, [rdx + phdr_memsz]
34-
sub rcx, rax
35-
xor al, al
34+
xchg rax, rcx
3635
rep stosb
3736

3837
next_phdr:

0 commit comments

Comments
 (0)