Let's say I have a nasm function like this:
inc:
mov rax,[rsp + 8]
add [rax],BYTE 1
ret
And I am calling this function like this:
push some_var
call inc
I want to pass an argument to the function through the stack, so I push some_var
and then call my function. In the function my item is second on the stack so I take it like: mov rax,[rsp+8]
My question is: after calling function should I somehow pop my argument from the stack? If so, can I somehow delete it from the stack, I mean pop it, but not to register? (Because I don't need this argument anymore.)
UPDATE: I found that I can simply add rsp,8
and that's how I can remove item from stack. But is that good practice? To remove the argument from the stack after calling function?