I am trying to use the value of a variable I've declared in C as the argument of a mov instruction in assembly. I've tried using a conversion character like this (where ptr is the variable):
asm("mov x9, %p\n\t" : : "r"(ptr));
But it doesn't compile and outputs an error of:
error: invalid % escape in inline assembly string
asm("mov x9, %p\n\t" : : "r"(ptr));
~~~~~~~~~~~^~~~~
I've also tried it without the \n\t and it gives the same error. It's not really specific as to what's wrong with it so I'm not sure how to deal with this. How can I get it to compile or achieve the same outcome in a different way?