我想了解哪些来源于此内联汇编代码_hypercall0 在这里.
asm volatile ("call hypercall_page+%c[offset]" \
: "=r" (__res) \
: [offset] "i" (__HYPERVISOR_##name * sizeof(hypercall_page[0])) \
: "memory", "edi", "esi", "edx", "ecx", "ebx", "eax")
Run Code Online (Sandbox Code Playgroud)
我无法找到%c第一行含义的信息.我没有在GCC手册最明显的部分找到任何信息,但这解释了%[name],但没有%c[name].还有其他我应该看的地方吗?
我正在尝试使用内联汇编将一堆结构成员(Particle是指向此类结构的指针)加载到某些寄存器中。这是我最初的解决方案:
asm("mov %1(%0), %%edx\n"
"fld %2(%0)\n"
"fld %3(%0)\n"
"fld %4(%0)\n"
"fld %5(%0)\n"
"movups %6(%0), %%xmm1\n"
"movups %7(%0), %%xmm2\n"
"movups %8(%0), %%xmm3\n"
"movups %9(%0), %%xmm4\n"
:
: "r" (Particle),
"n" (offsetof(ptcParticle, Active)),
"n" (offsetof(ptcParticle, Size)),
"n" (offsetof(ptcParticle, Rotation)),
"n" (offsetof(ptcParticle, Time)),
"n" (offsetof(ptcParticle, TimeScale)),
"n" (offsetof(ptcParticle, Colour)),
"n" (offsetof(ptcParticle, Location)),
"n" (offsetof(ptcParticle, Velocity)),
"n" (offsetof(ptcParticle, Accel))
: "%edx", "%st", "%st(1)", "%st(2)", "%st(3)", "%xmm1", "%xmm2",
"%xmm3", "%xmm4"
);
Run Code Online (Sandbox Code Playgroud)
但它不起作用,因为 GCC 将这些偏移量输出为立即数字文字,如下所示:
mov $0(%eax), %edx
fld $44(%eax)
fld $40(%eax)
fld $8(%eax) …Run Code Online (Sandbox Code Playgroud)