pike.git / src / pike_cpulib.c

version» Context lines:

pike.git/src/pike_cpulib.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id$ +    */      #include "global.h"   #include "pike_cpulib.h"   #include "svalue.h"      #ifdef HAVE_X86_ASM      #if !defined (CL_X86_ASM_STYLE) && !defined (GCC_X86_ASM_STYLE)   #error Dont know how to inline assembler with this compiler
pike.git/src/pike_cpulib.c:69: Inside #if defined(CL_X86_ASM_STYLE)
   __asm {    mov eax, oper;    mov edi, cpuid_ptr;    cpuid;    mov [edi], eax;    mov [edi+4], ebx;    mov [edi+8], edx;    mov [edi+12], ecx;    };   #else /* GCC_X86_ASM_STYLE */ -  __asm__ __volatile__("cpuid" -  : "=a" (cpuid_ptr[0]), -  "=b" (cpuid_ptr[1]), -  "=d" (cpuid_ptr[2]), -  "=c" (cpuid_ptr[3]) -  : "0" (oper)); +  + #if SIZEOF_CHAR_P == 4 +  __asm__ __volatile__("pushl %%ebx \n\t" /* save %ebx */ +  "cpuid \n\t" +  "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ +  "popl %%ebx \n\t" /* restore the old %ebx */ +  : "=a"(cpuid_ptr[0]), +  "=r"(cpuid_ptr[1]), +  "=d"(cpuid_ptr[2]), +  "=c"(cpuid_ptr[3]) +  : "0"(oper) +  : "cc"); + #else +  __asm__ __volatile__("push %%rbx \n\t" /* save %rbx */ +  "cpuid \n\t" +  "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ +  "pop %%rbx \n\t" /* restore the old %rbx */ +  : "=a"(cpuid_ptr[0]), +  "=r"(cpuid_ptr[1]), +  "=d"(cpuid_ptr[2]), +  "=c"(cpuid_ptr[3]) +  : "0"(oper) +  : "cc");   #endif -  + #endif    } else {    cpuid_ptr[0] = cpuid_ptr[1] = cpuid_ptr[2] = cpuid_ptr[3] = 0;    }   }      #endif /* HAVE_IA32_ASM */ -  - #ifdef PIKE_NEED_MEMLOCK -  - #define PIKE_MEM_HASH 17903 - PIKE_MUTEX_T pike_memory_locks[PIKE_MEM_HASH]; -  - void init_pike_cpulib(void) - { -  int e; -  for(e=0;e<PIKE_MEM_HASH;e++) -  mt_init_recursive(pike_memory_locks+e); - } -  - #endif +