Answer the question
In order to leave comments, you need to log in
How to access local variable from asm insert?
I am writing a program in C, and it so happened that assembler inserts are required (because the code is very small), the main problem is that from the asm insert I need to access a local variable, I tried to implement access to this variable through the frame pointer (rsp), but it didn't work for me. Here is an example of how I did it:
...
int a = 0;
asm("movq $5, (%rsp)\n");
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question