X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_lowlevel.h;h=eec0d91a29bda138054e1c64fc3a8d813ba19d88;hb=2cb41f7db5b9f89113432d6b3daff4807ba8e5f2;hp=331a3076b48df57445e223ab0de312e981c9ba73;hpb=ed8feff1d5dd6bf028cd5ba0960ec125505d7597;p=palacios.git diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 331a307..eec0d91 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -69,11 +69,29 @@ struct sys_segment64 { static void __inline__ v3_cpuid(uint32_t target, uint32_t * eax, uint32_t * ebx, uint32_t * ecx, uint32_t * edx) { +#ifdef __V3_64BIT__ + // avoid rbx on -FPIC - gcc likes to own rbx even on 64 bit PIC code __asm__ __volatile__ ( + "pushq %%rbx\n\t" + "movq %%rdi, %%rbx\n\t" "cpuid\n\t" - : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) + "movq %%rbx, %%rdi\n\t" + "popq %%rbx\n\t" + : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx) : "0" (target), "2" (*ecx) ); +#elif __V3_32BIT__ + // 32 bit code compiled with -fPIC, cannot use ebx as an ouput reg. Fantastic. + __asm__ __volatile__ ( + "pushl %%ebx\n\t" + "movl %%edi, %%ebx\n\t" + "cpuid\n\t" + "movl %%ebx, %%edi\n\t" + "popl %%ebx\n\t" + : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx) + : "0" (target), "2" (*ecx) + ); +#endif return; }