-
Check SSE2 support
int check_sse2(void){
int test;
__asm__ (
"mov $0, %%rax \n\t"
"cpuid \n\t"
"xor %%rax, %%rax \n\t"
"mov %%edx, %%eax \n\t"
"mov %%eax, %0 \n\t"
: "=r" (test)
);
if (!(test & 0x4000000))
return -1;
return 0;
}
- get stack pointer
static void* get_sp(void) {
void* sp;
__asm__ volatile("mov %0, sp" : "=r"(sp));
return sp;
}