Comment 1 for bug 1029981

Revision history for this message
Steve Langasek (vorlon) wrote :

Disassembly of the _cpuFlags function on i386:

Dump of assembler code for function _cpuFlags:
=> 0xf7425030 <+0>: sub $0x10,%esp
   0xf7425033 <+3>: pusha
   0xf7425034 <+4>: mov $0x1,%eax
   0xf7425039 <+9>: cpuid
   0xf742503b <+11>: mov %edx,0xc(%esp)
   0xf742503f <+15>: popa
   0xf7425040 <+16>: mov 0xc(%esp),%eax
   0xf7425044 <+20>: add $0x10,%esp
   0xf7425047 <+23>: ret

The problem here is that popa modifies the stack pointer, so at +16 when we try to copy back off the stack into %eax, we're copying from the wrong place - pulling an arbitrary value off the stack.

I've prepared a patch for sdlgfx that appears to correct this.