I'm using 64-bit Windows 7 (SP1). The QueryPerformanceFrequency functions trashes xmm0 thru xmm5. Is anyone aware of other Windows functions that trash registers unexpectedly? Run this code on your system to see if it behaves. It sets all registers to known values; place a break point just before ExitProcess and look at the registers. I saw one blog comment about this a year ago, stating that 32-bit Windows 7 works properly.
format PE CONSOLE 4.0
display "Compression tool being compiled...", 13, 10
stack 4000h, 4000h
entry Start
include 'Win32A.Inc'
section '.data' data readable writeable
align 4
PerfFrequency dd ?
align 16
label XmmData xword
times 128 db % ; load consecutive 8-bit values
label FpuData qword
rept 8 n:1 { dq n#.0 }
section '.code' code readable executable
Start:
; Load all regs with known values...
rept 8 n:0 {
movdqa xmm#n, [XmmData + n*16] ; Load xmm regs
}
rept 8 n:0 { fld [FpuData + n*8] }
irps reg, eax ebx ecx edx esi edi ebp
{ or reg, -1 }
invoke QueryPerformanceFrequency, PerfFrequency
invoke ExitProcess
section '.idata' import data readable writeable
library kernel32,'KERNEL32.DLL',user32,'USER32.DLL',gdi32,'GDI32.DLL'
include 'API\Kernel32.Inc'
After invoking QueryPerformanceFrequency, the lower 5 xmm registers are set to 0 (this is BAD!!), and eax, ecx, and edx are modified (this is OK). The FPU registers are not affected (this is good!).
Eric