Can anyone please explain what is the meaning of this code for ARM?
__asm__ __volatile__("mov %0, pc \n":"=r"(val)::"memory")
I think it stores the value of program counter in the variable val. Am I correct?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That’s right, it puts the program counter into
val.The
=rmeans that it’s an output write-only variable."memory"tells the compiler not to cache values across the inline assembly. I’m not 100% sure why"memory"has been used here though.