zombie-lib/strlen.asm
2021-10-02 21:37:52 -04:00

28 lines
269 B
NASM

global libz_strlen
section .text
libz_strlen:
sub rsp, 8 ;enter
push rdi
mov r10, rdi
_loop67865432:
mov r9b, [rdi]
cmp r9b, 0
jz _exitloop4323567
inc rdi
jmp _loop67865432
_exitloop4323567:
sub rdi, r10
mov rax, rdi
pop rdi
add rsp, 8 ;exit
ret