Gertjan Klein wrote:
Tim Roberts wrote:

However, I'll bet I know what it is.  CPUID trashes ebx, and in the x86
calling sequence, that's supposed to be saved and restored.

That's it! Now, both Python 2.5 and 2.6 (and 3.1, if I change the print
statement) run this code successfully. Does that mean there is a
difference in calling sequence between Python 2.5 and 2.6? Or do they
have different expectations of which registers are left untouched?

Thanks for sticking with this. I often save little bits of code from
this newsgroup that I might want to use later, and now I have a little
project that shows me how to create a DLL from assembly code and call it
from Python.

Gertjan.


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. 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.

DaveA

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to