2021-10-02 13:33:15 -04:00
|
|
|
global libz_strlen
|
2021-09-26 17:30:13 -04:00
|
|
|
section .text
|
|
|
|
|
2021-10-02 13:33:15 -04:00
|
|
|
libz_strlen:
|
2021-09-26 17:30:13 -04:00
|
|
|
sub rsp, 8 ;enter
|
|
|
|
|
2021-10-02 21:37:52 -04:00
|
|
|
push rdi
|
|
|
|
|
|
|
|
|
2021-09-26 17:30:13 -04:00
|
|
|
mov r10, rdi
|
|
|
|
_loop67865432:
|
|
|
|
|
|
|
|
mov r9b, [rdi]
|
|
|
|
cmp r9b, 0
|
|
|
|
jz _exitloop4323567
|
|
|
|
inc rdi
|
|
|
|
|
|
|
|
jmp _loop67865432
|
|
|
|
_exitloop4323567:
|
|
|
|
|
|
|
|
sub rdi, r10
|
|
|
|
mov rax, rdi
|
|
|
|
|
|
|
|
|
2021-10-02 21:37:52 -04:00
|
|
|
pop rdi
|
|
|
|
|
2021-09-26 17:30:13 -04:00
|
|
|
add rsp, 8 ;exit
|
|
|
|
ret
|