How do I pass the value of a variable in C to an argument of an instruction in inline assembly? [duplicate]

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?



from Recent Questions - Stack Overflow https://ift.tt/34pA88m
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation