Question

everyone. I have done that skia running on ios simulator.But cannot run on my iphone.It stopped here.

    #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

In the getcpuid method,it said "Invaild output constraint 'a' in asm". What's wrong with it?? anyone?

Was it helpful?

Solution

The code its breaking at is attempting to build x86 assembly for an arm chip. This, unsurprisingly, won' work on the device. It works on the simulator because the simulator runs on an x86 chip. The a constraint is an x86 constraint indicating the return of a 64 bit value in eax:edx (IIRC).

You will need to compile it with the appropriate flags to put it through the arm code path.

Have you read this?

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top