mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
added cpuid helper func
This commit is contained in:
parent
ff61158491
commit
a1956bc83b
51
amxmodx/helpers-x86.asm
Normal file
51
amxmodx/helpers-x86.asm
Normal file
@ -0,0 +1,51 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; (C)2006 by David "BAILOPAN" Anderson ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;Licensed under the GNU General Public License, version 2
|
||||
;;This is a portion of AMX Mod X
|
||||
;; and is maintained by the AMX Mod X development team.
|
||||
|
||||
section .text
|
||||
|
||||
global amxx_CpuSupport, _amxx_CpuSupport
|
||||
|
||||
amxx_CpuSupport:
|
||||
_amxx_CpuSupport:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
||||
push ebx
|
||||
|
||||
mov eax, 0
|
||||
cpuid
|
||||
cmp eax, 1
|
||||
jl .fail
|
||||
|
||||
mov eax, 1
|
||||
cpuid
|
||||
;check if family == 5 or 4
|
||||
and eax, 0780h ;family mask
|
||||
shr eax, 7 ;family shift
|
||||
cmp eax, 5
|
||||
je .fail
|
||||
cmp eax, 4
|
||||
je .fail
|
||||
;check if CMOV exists
|
||||
shr edx, 15
|
||||
and edx, 1
|
||||
cmp edx, 0
|
||||
je .fail
|
||||
|
||||
mov eax, 1
|
||||
jmp .end
|
||||
|
||||
.fail:
|
||||
xor eax, eax
|
||||
|
||||
.end
|
||||
|
||||
pop ebx
|
||||
|
||||
pop ebp
|
||||
ret
|
@ -1084,12 +1084,22 @@
|
||||
<File
|
||||
RelativePath="..\amxjitsn.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\helpers-x86.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\natives-amd64.asm">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\natives-x86.asm">
|
||||
</File>
|
||||
<Filter
|
||||
Name="Builds"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath="..\Jit\helpers-x86.obj">
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="SDK"
|
||||
|
@ -99,7 +99,12 @@ void _Setup_Optimizer_Stage2(AMX *amx, cell *oplist, cell *cip)
|
||||
}
|
||||
if (g_opt_level & 2)
|
||||
{
|
||||
FIND_NATIVE("floatcmp", N_Float_Cmp);
|
||||
if (amxx_CpuSupport())
|
||||
{
|
||||
FIND_NATIVE("floatcmp", N_Float_Cmp);
|
||||
} else {
|
||||
g_opt_level &= ~(2);
|
||||
}
|
||||
}
|
||||
//we don't do these yet because of radix stuff >:\
|
||||
//FIND_NATIVE("floatsin", N_Float_Sin);
|
||||
|
@ -22,6 +22,7 @@ struct optimizer_s
|
||||
};
|
||||
|
||||
void SetupOptimizer(AMX *amx);
|
||||
extern "C" int amxx_CpuSupport();
|
||||
|
||||
extern int g_opt_level;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user