1 /*****************************************************************************
2 * tests.c: several test functions needed by the plugins
3 * Functions are prototyped in tests.h.
4 *****************************************************************************
5 * Copyright (C) 2000 VideoLAN
7 * Authors: Samuel Hocevar <sam@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
37 /*****************************************************************************
38 * TestVersion: tests if the given string equals the current version
39 *****************************************************************************/
40 int TestVersion( char * psz_version )
42 return( !strcmp( psz_version, VERSION ) );
45 /*****************************************************************************
46 * TestProgram: tests if the given string equals the program name
47 *****************************************************************************/
48 int TestProgram( char * psz_program )
50 return( !strcmp( psz_program, p_main->psz_arg0 ) );
53 /*****************************************************************************
54 * TestMethod: tests if the given method was requested
55 *****************************************************************************/
56 int TestMethod( char * psz_var, char * psz_method )
58 return( !strcmp( psz_method, main_GetPszVariable( psz_var, "" ) ) );
61 /*****************************************************************************
62 * TestMMX: tests if the processor has MMX support.
63 *****************************************************************************
64 * This function is called if HAVE_MMX is enabled, to check whether the
65 * CPU really supports MMX.
66 *****************************************************************************/
72 /* FIXME: under beos, gcc does not support the following inline assembly */
77 int i_reg, i_dummy = 0;
79 /* test for a 386 CPU */
80 asm volatile ( "pushfl
95 /* test for a 486 CPU */
96 asm volatile ( "movl %%ecx, %%eax
105 andl $0x200000, %%eax"
111 /* the CPU supports the CPUID instruction - get its level */
112 asm volatile ( "cpuid"
117 : "a" ( 0 ), /* level 0 */
118 "b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
120 /* this shouldn't happen on a normal CPU */
124 /* test for the MMX flag */
125 asm volatile ( "cpuid
126 andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
131 : "a" ( 1 ), /* level 1 */
132 "b" ( i_dummy ) ); /* buggy compiler shouldn't complain */