# HG changeset patch # User nickols_k # Date 997288011 0 # Node ID ab64a3fc62bf089e99a30e9d032beb356d149d55 # Parent 8068c4bce9c1e3d34108f0d2eed59a11bcdd07db Portability and testing issues diff -r 8068c4bce9c1 -r ab64a3fc62bf Makefile --- a/Makefile Tue Aug 07 22:49:50 2001 +0000 +++ b/Makefile Wed Aug 08 16:26:51 2001 +0000 @@ -37,7 +37,7 @@ TESTS= imgresample-test dct-test all: $(LIB) -tests: apiexample $(TESTS) +tests: apiexample cpuid_test $(TESTS) $(LIB): $(OBJS) $(ASM_OBJS) rm -f $@ @@ -70,6 +70,10 @@ apiexample: apiexample.c $(LIB) $(CC) $(CFLAGS) -o $@ $< $(LIB) -lm +# cpuid test +cpuid_test: i386/cputest.c + $(CC) $(CFLAGS) -D__TEST__ -o $@ $< + # testing progs imgresample-test: imgresample.c diff -r 8068c4bce9c1 -r ab64a3fc62bf i386/cputest.c --- a/i386/cputest.c Tue Aug 07 22:49:50 2001 +0000 +++ b/i386/cputest.c Wed Aug 08 16:26:51 2001 +0000 @@ -6,13 +6,13 @@ /* ebx saving is necessary for PIC. gcc seems unable to see it alone */ #define cpuid(index,eax,ebx,ecx,edx)\ - asm ("movl %%ebx, %%esi\n\t"\ + __asm __volatile\ + ("movl %%ebx, %%esi\n\t"\ "cpuid\n\t"\ "xchgl %%ebx, %%esi"\ : "=a" (eax), "=S" (ebx),\ "=c" (ecx), "=d" (edx)\ - : "0" (index)\ - : "cc")\ + : "0" (index)); /* Function to test if multimedia instructions are supported... */ int mm_support(void) @@ -102,3 +102,13 @@ return 0; } } + +#ifdef __TEST__ +int main ( void ) +{ + int mm_flags; + mm_flags = mm_support(); + printf("mm_support = 0x%08u\n",mm_flags); + return 0; +} +#endif