File testgart.diff of Package testgart

diff -u ../testgart.old/testgart.c ./testgart.c
--- ../testgart.old/testgart.c	2004-04-16 12:02:48.000000000 +0200
+++ ./testgart.c	2004-04-16 12:05:46.000000000 +0200
@@ -15,12 +15,16 @@
 #include <sys/time.h>
 #include <linux/types.h>
 #include <linux/agpgart.h>
-#include <asm/mtrr.h>
+#if defined (__i386__) || defined (__x86_64__)
+# include <asm/mtrr.h>
+#endif
 #include <errno.h>
 
 unsigned char *gart;
 int gartfd;
+#if defined (__i386__) || defined (__x86_64__)
 int mtrr;
+#endif
 
 int usec( void ) {
   struct timeval tv;
@@ -136,6 +140,7 @@
    return(0);
 }
 
+#if defined (__i386__) || defined (__x86_64__)
 void openmtrr(void) 
 {
    if ((mtrr = open("/proc/mtrr", O_WRONLY, 0)) == -1) 
@@ -171,8 +176,9 @@
 	 exit(1);
       }
    }
-   
+   return 0;   
 }
+#endif
 
 int init_agp(void)
 {
@@ -205,11 +211,13 @@
    printf("pg_system: %i\n", info.pg_system);
    printf("pg_used: %i\n", info.pg_used);
 
+#if defined (__i386__) || defined (__x86_64__)
    openmtrr();
    if (mtrr != -1) { 
      CoverRangeWithMTRR(info.aper_base, info.aper_size * 0x100000, 
        MTRR_TYPE_WRCOMB);
    }
+#endif
 
    gart = mmap(NULL, info.aper_size * 0x100000, PROT_READ | PROT_WRITE, MAP_SHARED, gartfd, 0);
 
@@ -235,10 +243,12 @@
 
 int xchangeDummy;
 
+#if defined (__i386__) || defined (__x86_64__)
 void FlushWriteCombining( void ) {
 	__asm__ volatile( " push %%eax ; xchg %%eax, %0 ; pop %%eax" : : "m" (xchangeDummy));
 	__asm__ volatile( " push %%eax ; push %%ebx ; push %%ecx ; push %%edx ; movl $0,%%eax ; cpuid ; pop %%edx ; pop %%ecx ; pop %%ebx ; pop %%eax" : /* no outputs */ :  /* no inputs */ );
 }
+#endif
 
 void BenchMark()
 {
@@ -252,16 +262,19 @@
   
   printf("Testing data integrity (1st pass): ");
   fflush(stdout);
-   
-  FlushWriteCombining();
   
+#if defined (__i386__) || defined (__x86_64__) 
+  FlushWriteCombining();
+#endif 
+ 
   for (i=0; i < 8 * 0x100000; i++)
     {
       gart[i] = i % 256;
     }
    
+#if defined (__i386__) || defined (__x86_64__)
   FlushWriteCombining();
-   
+#endif 
   
   for (i=0; i < 8 * 0x100000; i++)
     {
@@ -359,5 +372,6 @@
      }
    
    close(gartfd);
+   return 0;
 }
openSUSE Build Service is sponsored by