wok-6.x diff memtest/stuff/memtest86+-5.01-386.patch @ rev 25013
updated openal and openal-dev (1.20.1 -> 1.22.0)
author | Hans-G?nter Theisgen |
---|---|
date | Tue May 17 07:38:28 2022 +0100 (2022-05-17) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/memtest/stuff/memtest86+-5.01-386.patch Tue May 17 07:38:28 2022 +0100 1.3 @@ -0,0 +1,105 @@ 1.4 +--- memtest86+-5.01/cpuid.c 1.5 ++++ memtest86+-5.01/cpuid.c 1.6 +@@ -14,6 +14,15 @@ 1.7 + unsigned int *v, dummy[3]; 1.8 + char *p, *q; 1.9 + 1.10 ++ switch (has_cpuid(AC_BIT|CPUID_BIT)) { 1.11 ++ case 0: 1.12 ++ cpu_id.vers.bits.family = 3; 1.13 ++ return; 1.14 ++ case AC_BIT: 1.15 ++ cpu_id.vers.bits.family = 4; 1.16 ++ return; 1.17 ++ } 1.18 ++ 1.19 + /* Get max std cpuid & vendor ID */ 1.20 + cpuid(0x0, &cpu_id.max_cpuid, &cpu_id.vend_id.uint32_array[0], 1.21 + &cpu_id.vend_id.uint32_array[2], &cpu_id.vend_id.uint32_array[1]); 1.22 +--- memtest86+-5.01/cpuid.h 1.23 ++++ memtest86+-5.01/cpuid.h 1.24 +@@ -11,6 +11,26 @@ 1.25 + 1.26 + extern struct cpu_ident cpu_id; 1.27 + 1.28 ++#define AC_BIT (1<<18) 1.29 ++#define CPUID_BIT (1<<21) 1.30 ++static inline int has_cpuid(int bits) 1.31 ++{ 1.32 ++ int eax, edx; 1.33 ++ asm __volatile__( 1.34 ++ "pushfl\n\t" 1.35 ++ "popl %0\n\t" 1.36 ++ "movl %0,%1\n\t" 1.37 ++ "xorl %2,%0\n\t" 1.38 ++ "pushl %0\n\t" 1.39 ++ "popfl\n\t" 1.40 ++ "pushfl\n\t" 1.41 ++ "popl %0\n\t" 1.42 ++ "pushl %1\n\t" 1.43 ++ "popfl\n\t" 1.44 ++ "xorl %1,%0":"=a" (eax),"=d" (edx):"c" (bits)); 1.45 ++ return eax; 1.46 ++} 1.47 ++ 1.48 + static inline void __cpuid(unsigned int *eax, unsigned int *ebx, 1.49 + unsigned int *ecx, unsigned int *edx) 1.50 + { 1.51 +--- memtest86+-5.01/init.c 1.52 ++++ memtest86+-5.01/init.c 1.53 +@@ -77,6 +77,7 @@ 1.54 + cprint(19, 15, "==> Press F2 to force Multi-Threading (SMP) <=="); 1.55 + } 1.56 + 1.57 ++ if (cpu_id.fid.bits.rdtsc) { 1.58 + /* save the starting time */ 1.59 + asm __volatile__( 1.60 + "rdtsc":"=a" (sl),"=d" (sh)); 1.61 +@@ -122,6 +123,7 @@ 1.62 + } 1.63 + 1.64 + } 1.65 ++ } 1.66 + 1.67 + cprint(18, 18, " "); 1.68 + cprint(19, 15, " "); 1.69 +@@ -321,7 +323,9 @@ 1.70 + beep(1000); 1.71 + 1.72 + /* Record the start time */ 1.73 ++ if (cpu_id.fid.bits.rdtsc) { 1.74 + asm __volatile__ ("rdtsc":"=a" (v->startl),"=d" (v->starth)); 1.75 ++ } 1.76 + v->snapl = v->startl; 1.77 + v->snaph = v->starth; 1.78 + if (l1_cache == 0) { l1_cache = 64; } 1.79 +@@ -998,10 +1002,18 @@ 1.80 + default: 1.81 + /* Make a guess at the family */ 1.82 + switch(cpu_id.vers.bits.family) { 1.83 ++ case 3: 1.84 ++ cprint(0, COL_MID, "386"); 1.85 ++ break; 1.86 ++ case 4: 1.87 ++ cprint(0, COL_MID, "486"); 1.88 ++ break; 1.89 + case 5: 1.90 + cprint(0, COL_MID, "586"); 1.91 ++ break; 1.92 + case 6: 1.93 + cprint(0, COL_MID, "686"); 1.94 ++ break; 1.95 + default: 1.96 + cprint(0, COL_MID, "Unidentified Processor"); 1.97 + } 1.98 +--- memtest86+-5.01/test.c 1.99 ++++ memtest86+-5.01/test.c 1.100 +@@ -1501,6 +1501,8 @@ 1.101 + { 1.102 + ulong sh, sl, l, h, t, ip=0; 1.103 + 1.104 ++ if (cpu_id.fid.bits.rdtsc == 0) return; 1.105 ++ 1.106 + /* save the starting time */ 1.107 + asm __volatile__( 1.108 + "rdtsc":"=a" (sl),"=d" (sh));