3 |
* LinuxSampler - modular, streaming capable sampler * |
* LinuxSampler - modular, streaming capable sampler * |
4 |
* * |
* * |
5 |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
* Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck * |
6 |
* Copyright (C) 2005 Christian Schoenebeck * |
* Copyright (C) 2005 - 2007 Christian Schoenebeck * |
7 |
* * |
* * |
8 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
9 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
28 |
bool Features::bSSE(false); |
bool Features::bSSE(false); |
29 |
bool Features::bSSE2(false); |
bool Features::bSSE2(false); |
30 |
|
|
|
unsigned int edx = 0; |
|
|
unsigned int eax_temp = 0; |
|
|
unsigned int ebx_temp = 0; |
|
|
unsigned int ecx_temp = 0; |
|
|
unsigned int edx_temp = 0; |
|
|
|
|
31 |
void Features::detect() { |
void Features::detect() { |
32 |
// we store and restore all registers modified by 'cpuid' the old fashioned way |
int edx; |
33 |
__asm__ __volatile__ ( |
__asm__ __volatile__ ( |
34 |
"mov %eax,eax_temp\n\t" |
"movl %%ebx,%%edi\n\t" /*save PIC register*/ |
35 |
"mov %ebx,ebx_temp\n\t" |
"movl $1,%%eax\n\t" |
|
"mov %ecx,ecx_temp\n\t" |
|
|
"mov %edx,edx_temp\n\t" |
|
|
"mov $1,%eax\n\t" |
|
36 |
"cpuid\n\t" |
"cpuid\n\t" |
37 |
"mov %edx,edx\n\t" |
"movl %%edi,%%ebx\n\t" /*restore PIC register*/ |
38 |
"mov eax_temp,%eax\n\t" |
: "=d" (edx) |
39 |
"mov ebx_temp,%ebx\n\t" |
: : "%eax", "%ecx", "%edi" |
|
"mov ecx_temp,%ecx\n\t" |
|
|
"mov edx_temp,%edx\n\t" |
|
40 |
); |
); |
41 |
bMMX = (edx & 0x00800000); |
bMMX = (edx & 0x00800000); |
42 |
bSSE = (edx & 0x02000000); |
bSSE = (edx & 0x02000000); |