I have a _write function that expects the pointer to the string and the string length as parameters.
section .data
string_literal_at_index_0: db 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x77,0x6f,0x72,0x6c,0x64,0x21
global _start
section .text
_start:
push string_literal_at_index_0 ; argument for the write function
push 12 ; argument for the write function
call _write
mov rax, 60
mov rdi, 0
syscall
_write:
pop r8 ; pop return address so i can acess the arguments
mov rax, 1
mov rdi, 1
pop rdx
pop rsi
syscall
push r8 ; push the return address back
ret
I have to pop the return address so I can access the parameters for the function
NOTE : I know that accessing them using EBP is much better, but I have to use this way
My question is : is it okay to do it this way and will it mess up the stack?
NOTE : This might be a very stupid question but I am a beginner in assembly. So correct me if anything I said in this question is wrong!