diff --git a/concept.c b/concept.c deleted file mode 100644 index cc42ec2..0000000 --- a/concept.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -#define BLACK1 "\x1b[30;1m" -#define BLACK2 "30;1m" -#define BLUE "\x1b[36;1m" - - -#define BACK_WHITE "\x1b[47;" -#define RED "\x1b[31;1m" -#define GREEN "\x1b[32;1m" -#define RESET "\x1b[0m" - -int main(int argc, char const *argv[]) { - printf(BACK_WHITE BLACK2"%s"BLUE"%s\n","Name: ", "Intel Xeon E5 "); - printf(BLACK1"%s"BLUE"%s\n","N.Cores: ", "16 "); - printf(BLACK1"%s"BLUE"%s\n","Frecuency: ", "2.2GHz "); - printf(RESET); -} diff --git a/cpuidtest.c b/cpuidtest.c deleted file mode 100644 index b064d94..0000000 --- a/cpuidtest.c +++ /dev/null @@ -1,54 +0,0 @@ -static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ - /* ecx is often an input as well as an output. */ - asm volatile("cpuid" - : "=a" (*eax), - "=b" (*ebx), - "=c" (*ecx), - "=d" (*edx) - : "0" (*eax), "2" (*ecx)); -} - -#include - -int main(int argc, char **argv) -{ - unsigned mask1 = 0xFF; - unsigned mask2 = 0xFF00; - unsigned mask3 = 0xFF0000; - unsigned mask4 = 0xFF000000; - - unsigned eax, ebx, ecx, edx; - - eax = 2; /* processor info and feature bits */ - native_cpuid(&eax, &ebx, &ecx, &edx); - - /* - printf("AL = 0x%x\n",eax & 0xFF); - printf("0x%x(0x%x)\n",eax, (1 << 31) & eax); - printf("0x%x(0x%x)\n",ebx, (1 << 31) & ebx); - printf("0x%x(0x%x)\n",ecx, (1 << 31) & ecx); - printf("0x%x(0x%x)\n",edx, (1 << 31) & edx); - */ - - printf("eax[0]=0x%x\neax[1]=0x%x\neax[2]=0x%x\neax[3]=0x%x\n",eax & mask1, eax & mask2, eax & mask3, eax & mask4); - printf("ebx[0]=0x%x\nebx[1]=0x%x\nebx[2]=0x%x\nebx[3]=0x%x\n",ebx & mask1, ebx & mask2, ebx & mask3, ebx & mask4); - printf("ecx[0]=0x%x\necx[1]=0x%x\necx[2]=0x%x\necx[3]=0x%x\n",ecx & mask1, ecx & mask2, ecx & mask3, ecx & mask4); - printf("edx[0]=0x%x\nedx[1]=0x%x\nedx[2]=0x%x\nedx[3]=0x%x\n",edx & mask1, edx & mask2, edx & mask3, edx & mask4); - - - /* - if(((eax >> 31) & 1U) == 0) - printf("eax valid\n"); - - if(((ebx >> 31) & 1U) == 0) - printf("ebx valid\n"); - - if(((ecx >> 31) & 1U) == 0) - printf("ecx valid\n"); - - if(((edx >> 31) & 1U) == 0) - printf("edx valid\n"); - */ -} diff --git a/topology.c b/topology.c deleted file mode 100644 index a0f23a2..0000000 --- a/topology.c +++ /dev/null @@ -1,24 +0,0 @@ -void cpuid(unsigned int *eax, unsigned int *ebx, - unsigned int *ecx, unsigned int *edx) -{ - asm volatile("cpuid" - : "=a" (*eax), - "=b" (*ebx), - "=c" (*ecx), - "=d" (*edx) - : "0" (*eax), "2" (*ecx)); -} - -#include - -int main(int argc, char **argv) -{ - unsigned eax, ebx, ecx, edx; - - eax = 0x0000000B; - ecx = 0x00000000; - cpuid(&eax, &ebx, &ecx, &edx); - - printf("Threads per core=%d\n", ebx & 0xF); - -}