[python-win32] Still looking for a method to get CPUID info ...

Tim Roberts timr at probo.com
Fri Jan 8 19:04:36 CET 2010


Dave Angel wrote:
>>   
> On general principle, I'd use
>    push ebx
> ...
>    pop ebx
>
> pairs around the cpuid instruction, if trashing ebx is a problem. 
> Seems to me it's safer than making any assumptions about implicit
> saves/restores.

That's what the "uses ebx" clause that I added to the "proc" statement
does.  It pushes ebx on entry, and pops it at every "ret".  The
advantage of that is that I don't have to worry about saving it
repeatedly throughout the function.  I'm free to do whatever I want to
ebx internally.


> I haven't looked at the cpuid instruction for years, but I'd push/pop
> any register (other than EAX) it modifies, and in between them do the
> cpuid and an appropriate move of whichever register.

Well, cpuid is kind of an odd exception, because it modifies all of the
general purpose registers (eax, ebx, ecx, edx) in one fell swoop.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list