在ios模拟器上成功构建skia,但无法在我的iphone上运行

时间:2013-02-16 03:48:42

标签: ios skia

大家。 我已经完成了在ios模拟器上运行的skia.But无法在我的iphone上运行。它在这里停了。

    #if defined(__x86_64__) || defined(_WIN64)
    /* All x86_64 machines have SSE2, so don't even bother checking. */
    static inline bool hasSSE2() {
        return true;
    }
    #else
    #ifdef _MSC_VER
    static inline void getcpuid(int info_type, int info[4]) {
__asm {
    mov    eax, [info_type]
    cpuid
    mov    edi, [info]
    mov    [edi], eax
    mov    [edi+4], ebx
    mov    [edi+8], ecx
    mov    [edi+12], edx
}
}
#else
static inline void getcpuid(int info_type, int info[4]) {
// We save and restore ebx, so this code can be compatible with -fPIC
asm volatile (
    "pushl %%ebx      \n\t"
    "cpuid            \n\t"
    "movl %%ebx, %1   \n\t"
    "popl %%ebx       \n\t"
    : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3])
    : "a"(info_type)
);
 }
#endif

static inline bool hasSSE2() {
int cpu_info[4] = { 0 };
getcpuid(1, cpu_info);
return (cpu_info[3] & (1<<26)) != 0;
return true;
}
#endif

在getcpuid方法中,它说“asm中的Invaild输出约束'a'”。 它出什么问题了?? 任何人吗?

1 个答案:

答案 0 :(得分:1)

它破解的代码是试图为arm芯片构建x86组件。毫不奇怪,这赢得了“在设备上工作”。它适用于模拟器,因为模拟器在x86芯片上运行。 a约束是一个x86约束,表示在eax:edx(IIRC)中返回64位值。

您需要使用适当的标志对其进行编译,以使其通过arm代码路径。

你读过这个吗?

https://sites.google.com/site/skiadocs/user-documentation/quick-start-guides/how-to-check-out-and-build-skia-on-ios