Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/openal-0.0.8/src/arch/i386/x86_cpu_caps_detect_prk.nasm @ 17

Last change on this file since 17 was 17, checked in by landauf, 17 years ago

added openal

File size: 2.3 KB
Line 
1;***************************************************************************
2;*   Copyright (C) 2005 by Prakash Punnoor                                 *
3;*   prakash@punnoor.de                                                    *
4;*                                                                         *
5;*   This program is free software; you can redistribute it and/or modify  *
6;*   it under the terms of the GNU Library General Public License as       *
7;*   published by the Free Software Foundation; either version 2 of the    *
8;*   License, or (at your option) any later version.                       *
9;*                                                                         *
10;*   This program is distributed in the hope that it will be useful,       *
11;*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12;*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13;*   GNU General Public License for more details.                          *
14;*                                                                         *
15;*   You should have received a copy of the GNU Library General Public     *
16;*   License along with this program; if not, write to the                 *
17;*   Free Software Foundation, Inc.,                                       *
18;*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19;***************************************************************************
20
21; int _alDetectx86CPUCaps(uint* caps1, uint* caps2, uint* caps3);
22; derived from loki_cpuinfo.c, 1997-98 by H. Dietz and R. Fisher
23; using infos from sandpile.org
24
25; returns 0 if no CPUID available
26global __alDetectx86CPUCaps
27global _alDetectx86CPUCaps
28
29__alDetectx86CPUCaps:
30_alDetectx86CPUCaps:
31
32pushf
33pop     eax
34mov     ecx, eax
35
36xor     eax, 0x200000
37push    eax
38popf
39
40pushf
41pop     eax
42
43xor     ecx, eax
44xor     eax, eax
45test    ecx, 0x200000
46jz      .Return
47
48; standard CPUID
49push ebx
50mov     eax, 1
51cpuid
52mov     eax, [esp + 8]  ;caps1 - MMX, SSE, SSE2
53mov     [eax], edx
54mov     eax, [esp + 12] ;caps2 - SSE3
55mov     [eax], ecx
56
57; extended CPUID
58mov     eax, 0x80000001
59cpuid
60mov     eax, [esp + 16] ;caps3 - 3DNOW!, 3DNOW!EXT, CYRIX-MMXEXT, AMD-MMX-SSE
61mov     [eax], edx
62pop ebx
63
64; End
65.Return
66ret
67
68; prevent executable stack
69%ifidn __OUTPUT_FORMAT__,elf
70section .note.GNU-stack noalloc noexec nowrite progbits
71%endif
Note: See TracBrowser for help on using the repository browser.