Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inline asm in iOS error

int x;
__asm __volatile("movl %0, %%sp":"=r"(x)::"%sp");
I want to store sp to x.
The error:


error: unexpected token in operand
    __asm __volatile("movl  %0,  %%sp":"=r"(x)::"%sp");
                     ^
:1:13: note: instantiated into assembly here
        movl  r0,  %sp
                   ^
1 warning and 1 error generated.
like image 681
teddy Avatar asked Jun 15 '26 22:06

teddy


1 Answers

I have found my solution:

asm volatile("mov %0, sp \n\t":"=r"(x));
like image 141
teddy Avatar answered Jun 17 '26 11:06

teddy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!