X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fpalacios%2Fvmm_lowlevel.h;h=af1f8209caf98526fcafb0e8d4f3ce7138164333;hp=331a3076b48df57445e223ab0de312e981c9ba73;hb=571979dad8fc2138a7e11c4fe61e812a0a0b17d1;hpb=99af50a89f5eb27e7e1c84aba01d72c06edc229a diff --git a/palacios/include/palacios/vmm_lowlevel.h b/palacios/include/palacios/vmm_lowlevel.h index 331a307..af1f820 100644 --- a/palacios/include/palacios/vmm_lowlevel.h +++ b/palacios/include/palacios/vmm_lowlevel.h @@ -69,11 +69,24 @@ 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__ __asm__ __volatile__ ( "cpuid\n\t" : "=a" (*eax), "=b" (*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; }