Hey all,
I have an application (autopano:
http://autopano.kolor.com/autopano_v103.zip) that I've ran on 32 bit
systems for a while successfully. However, when I try to run it on my
64 bit desktop using either the 32 or 64 bit version of WINE I am having
difficulties by getting a "divide by 0 error". There are no other
console messages (such as WINE FIXMEs) before this. After attaching a
debugger (ollydbg) I found the following sequence seems to be the
culprit (simplified to Cish code):
(start @ 0x0041AF35)
CPUID, RDTSC func
CPUID, RDTSC func
QueryPerformanceFrequency(&Frequency);
QueryPerformanceCounter(&PerformanceCount1)
CPUID, RDTSC func
QueryPerformanceCounter(&PerformanceCount2)
CPUID, RDTSC func
do some math related to something
blah = something * Frequency / (PerformanceCount2 - PerformanceCount1);
The key issue being that PerformanceCount2 == PerformanceCount1 and so
things blow up. Note that the actual exception occurs in __alldiv() @
0x00469CA0 because it got bad input. I think its throwing away the
RDTSC results and from what I read the CPUID is somehow related to
synchronizing it to out or order execution issues...no idea why they
call it multiple times in a row though. Anyway, I ran this in a Windows
VM for comparison and got the divisor to be consistently a pretty large
positive number. There are a lot of factors here and, in part because
I'm not familiar with the Windows API, I am not sure if this is an
application error or an issue with WINE with how it reports high
performance timing or my system setup. Should I dive into the high
performance timing code to look at this a little more or does anyone
have any thoughts before I dump some time into this? One last piece of
info that might be helpful is that if I use a debugger to step through
the code it seems not to crash as the counter values become
significantly different from the step delays.
John