On 12 April 2013 16:38, Jens Axboe <axboe@xxxxxxxxx> wrote: > On Fri, Apr 12 2013, Aaron Carroll wrote: >> On 12 April 2013 16:30, Jens Axboe <axboe@xxxxxxxxx> wrote: >> > Great, thanks! Will see if I can't get that asm android happy too. >> >> Thanks. Does it make sense to use the GCC builtin __get_cpuid() ? >> That seems to build fine both native x86 and Android/x86 here. > > Depends on when that was introduced. You'd be surprised to find the > ancient distros that some people build it on... But the cpuid stuff > should be basic enough that it isn't a lot of trouble to carry it. At > least when we figure out why the Android NDK doesn't like the current > restraints :-) Digging around the GCC headers seems to have helped. If you change the constraint on ebx to: : "=a" (*eax), "=r" (*ebx), "=c" (*ecx), "=d" (*edx) then it builds. The relevant comment from cpuid.h: /* %ebx may be the PIC register. */ which is ifdef'd on __PIC__ Dunno what that means, but it builds with that, plus a very small Android-specific fix. Both in attached patch. -- Aaron
Attachment:
android-x86.patch
Description: Binary data