vendredi 4 mars 2016

Calling assembly functions to test them

I'm learning how to recode standard libc function in assembly but I've some probleme to understand how to test my functions.

For moment I'm coding a strlen fucntion. This is my code :

    global strlen
        section .text
strlen:
        push rbp
        mov rbp, rsp
        mov rax, 0      

begin:
        cmp byte[rdi], 0        
        je end                                        
        inc rax                
        inc rdi               
        jmp begin
end:
        mov rsp, rbp
        pop rbp
        ret

Does someone can tell me how to launch my function and how to print its returns value?

Aucun commentaire:

Enregistrer un commentaire