I am trying to understand how to declare and use function pointers in assembly.
In this example I want call_add
to call add_fnct
. Which may be passed as a pointer. However when CALL [rdx]
is executed, it results in an segmentation fault.
MOV rdx, add_fnct
CALL call_add
ret
add_fnct:
ADD rdi,rsi
MOV rax,rdi
RET
call_add:
MOV rdi, 5
MOV rsi, 6
CALL [rdx]
RET