[syslinux] cpuid() fails on Syslinux 4

H. Peter Anvin hpa at zytor.com
Tue May 11 13:42:06 PDT 2010


On 05/11/2010 12:20 PM, Sebastian Herbszt wrote:
> 
> The cpuid() code
> 
> static inline void cpuid(uint32_t op, uint32_t * eax, uint32_t * ebx,
>                         uint32_t * ecx, uint32_t * edx)
> {
> asm("pushl %%ebx ; cpuid ; movl %%ebx,%0 ; popl %%ebx":"=a"(*eax),
> "=SD"(*ebx), "=c"(*ecx),
>        "=d"(*edx)
> :       "a"(op));
> }
> 
> gets compiled to
> 
> 00160d5f: (                    ): push ebx                  ; 53
> 00160d60: (                    ): cpuid                     ; 0fa2
> 00160d62: (                    ): mov eax, ebx              ; 89d8
> 00160d64: (                    ): pop ebx                   ; 5b
> 00160d65: (                    ): mov ebp, edi              ; 89fd
> 00160d67: (                    ): mov edi, dword ptr ss:[esp] ; 8b3c24
> 00160d6a: (                    ): mov dword ptr ds:[edi+8], eax ; 894708
> 00160d6d: (                    ): mov dword ptr ds:[edi+40], ebp ; 896f28
> 00160d70: (                    ): mov dword ptr ds:[esi+8], ecx ; 894e08
> 00160d73: (                    ): mov dword ptr ds:[esi+4], edx ; 895604
> 
> eax gets trashed with the content of ebx. Unfortunatelly i am no good at
> gcc inline assembly either.
> 

Just fixed it.  The %0 should have been %1, of course.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.




More information about the Syslinux mailing list