x86_cpuid_info.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int _x86_cache_info (PAPI_mh_info_t *mh_info)
int _x86_detect_hypervisor (char *vendor_name)

Function Documentation

int _x86_cache_info ( PAPI_mh_info_t mh_info  ) 

Definition at line 51 of file x86_cpuid_info.c.

00052 {
00053     int retval = 0;
00054     union
00055     {
00056         struct
00057         {
00058             unsigned int ax, bx, cx, dx;
00059         } e;
00060         char vendor[20];               /* leave room for terminator bytes */
00061     } reg;
00062 
00063     /* Don't use cpu_type to determine the processor.
00064      * get the information directly from the chip.
00065      */
00066     reg.e.ax = 0;            /* function code 0: vendor string */
00067     /* The vendor string is composed of EBX:EDX:ECX.
00068      * by swapping the register addresses in the call below,
00069      * the string is correctly composed in the char array.
00070      */
00071     cpuid( &reg.e.ax, &reg.e.bx, &reg.e.dx, &reg.e.cx );
00072     reg.vendor[16] = 0;
00073     MEMDBG( "Vendor: %s\n", &reg.vendor[4] );
00074 
00075     init_mem_hierarchy( mh_info );
00076 
00077     if ( !strncmp( "GenuineIntel", &reg.vendor[4], 12 ) ) {
00078             init_intel( mh_info, &mh_info->levels);
00079     } else if ( !strncmp( "AuthenticAMD", &reg.vendor[4], 12 ) ) {
00080       init_amd( mh_info, &mh_info->levels );
00081     } else {
00082         MEMDBG( "Unsupported cpu type; Not Intel or AMD x86\n" );
00083         return PAPI_ENOIMPL;
00084     }
00085 
00086     /* This works only because an empty cache element is initialized to 0 */
00087     MEMDBG( "Detected L1: %d L2: %d  L3: %d\n",
00088             mh_info->level[0].cache[0].size + mh_info->level[0].cache[1].size,
00089             mh_info->level[1].cache[0].size + mh_info->level[1].cache[1].size,
00090             mh_info->level[2].cache[0].size + mh_info->level[2].cache[1].size );
00091     return retval;
00092 }

Here is the call graph for this function:

int _x86_detect_hypervisor ( char *  vendor_name  ) 

Definition at line 1508 of file x86_cpuid_info.c.

01509 {
01510   unsigned int eax, ebx, ecx, edx;
01511   char hyper_vendor_id[13];
01512 
01513   cpuid2(&eax, &ebx, &ecx, &edx,0x1,0);
01514   /* This is the hypervisor bit, ecx bit 31 */
01515   if  (ecx&0x80000000) {
01516     /* There are various values in the 0x4000000X range */
01517     /* It is questionable how standard they are         */
01518     /* For now we just return the name.                 */
01519     cpuid2(&eax, &ebx, &ecx, &edx, 0x40000000,0);
01520     memcpy(hyper_vendor_id + 0, &ebx, 4);
01521     memcpy(hyper_vendor_id + 4, &ecx, 4);
01522     memcpy(hyper_vendor_id + 8, &edx, 4);
01523     hyper_vendor_id[12] = '\0';
01524     strncpy(vendor_name,hyper_vendor_id,PAPI_MAX_STR_LEN);
01525     return 1;
01526   }
01527   else {
01528     strncpy(vendor_name,"none",PAPI_MAX_STR_LEN);
01529   }
01530   return 0;
01531 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 17 Nov 2016 for PAPI by  doxygen 1.6.1