3

int x;
__asm __volatile("movl %0, %%sp":"=r"(x)::"%sp");
spをxに格納したい。
エラー:


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.
4

3 に答える 3

2

この特定のケースで機能するのは次のとおりです。

register void* sp __asm__("sp");
__asm__("" : "+r"(sp) :: "memory");

ARM と x86 の間でも移植可能です...

于 2013-08-09T13:19:53.487 に答える
0

ARM CPU の x86 アセンブリをアセンブルしようとしています。

于 2013-08-13T18:34:36.733 に答える