-
-
有没有懂X86汇编的,问个问题哈
-
发表于:
2023-11-25 13:38
2841
-
long orig_Syscall(long num, void *arg0, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5) {
long ret;
asm volatile (
"movl %1, %%eax\n\t"
"movl %2, %%ebx\n\t"
"movl %3, %%ecx\n\t"
"movl %4, %%edx\n\t"
"movl %5, %%esi\n\t"
"movl %6, %%edi\n\t"
"movl %7, %%ebp\n\t"
"int $0x80\n\t"
"movl %%eax, %0\n\t"
:"=r"(ret)
:"r"(num), "r"(arg0), "r"(arg1), "r"(arg2), "r"(arg3), "r"(arg4), "r"(arg5)
:"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "%ebp"
);
return ret;
}
然后用Androidstudio编译时候出现
error: inline assembly requires more registers than available
查过很多资料,说将libavutils/x86/asm.h中#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))修改为#define HAVE_7REGS (ARCH_X86_64)的方式可以编译通过,但都没这个文件,ndk文件内容搜索也没有HAVE_EBX_AVAILABLE
似此怎生奈何?
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!