Changeset 2291
- Timestamp:
- Aug 21, 2005, 12:57:05 AM (20 years ago)
- Location:
- trunk/src/libctests/libc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libctests/libc/Makefile
-
Property cvs2svn:cvs-rev
changed from
1.8
to1.9
r2290 r2291 90 90 smoketests/fork-exec-1.c \ 91 91 smoketests/kill-children-1.c \ 92 smoketests/kill-children-2.c 92 smoketests/kill-children-2.c \ 93 smoketests/memcpy-amd-1.c 93 94 94 95 # smoketests/weak-export-1.c - dll -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/libctests/libc/smoketests/memcpy-amd-1.c
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r2290 r2291 28 28 #include <string.h> 29 29 #include <stdlib.h> 30 #include <stdint.h> 30 31 31 32 char abSrc[0x40000]; … … 113 114 } 114 115 116 /** 117 * Checks if the current CPU supports CPUID. 118 * 119 * @returns 1 if CPUID is supported, 0 if it doesn't. 120 */ 121 static inline int HasCpuId(void) 122 { 123 int fRet = 0; 124 uint32_t u1; 125 uint32_t u2; 126 __asm__ ("pushf\n\t" 127 "pop %1\n\t" 128 "mov %1, %2\n\t" 129 "xorl $0x200000, %1\n\t" 130 "push %1\n\t" 131 "popf\n\t" 132 "pushf\n\t" 133 "pop %1\n\t" 134 "cmpl %1, %2\n\t" 135 "setne %0\n\t" 136 "push %2\n\t" 137 "popf\n\t" 138 : "=m" (fRet), "=r" (u1), "=r" (u2)); 139 return fRet; 140 } 141 142 static int IsAmd(void) 143 { 144 if (HasCpuId()) 145 { 146 uint32_t eax, ebx, ecx, edx; 147 __asm__ __volatile__ ("cpuid" : "=a" (eax), "=d" (edx), "=c" (ecx), "=b" (ebx) : "0" (0)); 148 if (edx == 0x69746e65 && ecx == 0x444d4163 && ebx == 0x68747541) 149 return 1; 150 } 151 return 0; 152 } 153 115 154 int main() 116 155 { 117 156 size_t i, j; 157 if (!IsAmd()) 158 { 159 printf("amd-memcpy-1: skipping, not right amd cpu\n"); 160 return 0; 161 } 118 162 init(); 119 163 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.