Mercurial > sdl-ios-xcode
comparison src/cpuinfo/SDL_cpuinfo.c @ 787:07760c8854d1
Date: Sat, 24 Jan 2004 14:49:58 +0100
From: Stephane Marchesin
Subject: Re: [SDL] 3DNow! detection on a P4 system
Well... I found another bug : 3dnow was detected on P2/P3 cpus. So I
took one more look at the code and found a mistake in
CPU_getCPUIDFeaturesExt :
The condition for having extended cpuinfo is that when we query extended
cpuinfo we get a result >= 0x80000001. So we must exit if eax < 0x80000001.
The attached patch does that.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 24 Jan 2004 15:55:00 +0000 |
parents | e1e0a0a94570 |
children | c20f08c4f437 |
comparison
equal
deleted
inserted
replaced
786:e1e0a0a94570 | 787:07760c8854d1 |
---|---|
126 __asm__ ( | 126 __asm__ ( |
127 " movl %%ebx,%%edi\n" | 127 " movl %%ebx,%%edi\n" |
128 " movl $0x80000000,%%eax # Query for extended functions \n" | 128 " movl $0x80000000,%%eax # Query for extended functions \n" |
129 " cpuid # Get extended function limit \n" | 129 " cpuid # Get extended function limit \n" |
130 " cmpl $0x80000001,%%eax \n" | 130 " cmpl $0x80000001,%%eax \n" |
131 " jbe 1f # Nope, we dont have function 800000001h\n" | 131 " jl 1f # Nope, we dont have function 800000001h\n" |
132 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" | 132 " movl $0x80000001,%%eax # Setup extended function 800000001h\n" |
133 " cpuid # and get the information \n" | 133 " cpuid # and get the information \n" |
134 " movl %%edx,%0 \n" | 134 " movl %%edx,%0 \n" |
135 "1: \n" | 135 "1: \n" |
136 " movl %%edi,%%ebx\n" | 136 " movl %%edi,%%ebx\n" |
141 #elif defined(_MSC_VER) | 141 #elif defined(_MSC_VER) |
142 __asm { | 142 __asm { |
143 mov eax,80000000h ; Query for extended functions | 143 mov eax,80000000h ; Query for extended functions |
144 cpuid ; Get extended function limit | 144 cpuid ; Get extended function limit |
145 cmp eax,80000001h | 145 cmp eax,80000001h |
146 jbe done ; Nope, we dont have function 800000001h | 146 jl done ; Nope, we dont have function 800000001h |
147 mov eax,80000001h ; Setup extended function 800000001h | 147 mov eax,80000001h ; Setup extended function 800000001h |
148 cpuid ; and get the information | 148 cpuid ; and get the information |
149 mov features,edx | 149 mov features,edx |
150 done: | 150 done: |
151 } | 151 } |