/[svn]/linuxsampler/trunk/src/common/Features.cpp
ViewVC logotype

Contents of /linuxsampler/trunk/src/common/Features.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 361 - (show annotations) (download)
Wed Feb 9 01:22:18 2005 UTC (19 years, 1 month ago) by schoenebeck
File size: 2624 byte(s)
* bunch of fixes for OSX (patch by Stephane Letz)

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #include "Features.h"
24
25 #if ARCH_X86
26 bool Features::bMMX(false);
27 bool Features::bSSE(false);
28
29 unsigned int edx = 0;
30 unsigned int eax_temp = 0;
31 unsigned int ebx_temp = 0;
32 unsigned int ecx_temp = 0;
33 unsigned int edx_temp = 0;
34
35 void Features::detect() {
36 // we store and restore all registers modified by 'cpuid' the old fashioned way
37 __asm__ __volatile__ ("mov %eax,eax_temp\n\t"
38 "mov %ebx,ebx_temp\n\t"
39 "mov %ecx,ecx_temp\n\t"
40 "mov %edx,edx_temp\n\t"
41 "mov $1,%eax\n\t"
42 "cpuid\n\t"
43 "mov %edx,edx\n\t"
44 "mov eax_temp,%eax\n\t"
45 "mov ebx_temp,%ebx\n\t"
46 "mov ecx_temp,%ecx\n\t"
47 "mov edx_temp,%edx\n\t"
48 );
49 bMMX = (edx & 0x00800000);
50 bSSE = (edx & 0x02000000);
51 }
52 #else
53 void Features::detect() {}
54 #endif // ARCH_X86

  ViewVC Help
Powered by ViewVC