mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
powerpc: Move cache geometry information to ld diagnostics
From LD_SHOW_AUXV output. Checked on powerpc64le-linux-gnu. Reviewed-by: Peter Bergner <bergner@linux.ibm.com>
This commit is contained in:
@@ -38,6 +38,38 @@ print_hwcap_value (const char *label, int hwcap, unsigned long int value)
|
||||
_dl_printf ("\"\n");
|
||||
}
|
||||
|
||||
static void
|
||||
print_cache_geometry_value (const char *label, unsigned long int geometry)
|
||||
{
|
||||
unsigned long int assocty, line;
|
||||
|
||||
_dl_printf ("powerpc.cpu_features.%s=\"", label);
|
||||
|
||||
line = geometry & 0xffff;
|
||||
assocty = (geometry >> 16) & 0xffff;
|
||||
|
||||
if (line == 0)
|
||||
_dl_printf ("Unknown line size, ");
|
||||
else
|
||||
_dl_printf ("%luB line size, ", line);
|
||||
|
||||
switch (assocty)
|
||||
{
|
||||
case 0:
|
||||
_dl_printf ("Unknown associativity");
|
||||
break;
|
||||
case 1:
|
||||
_dl_printf ("Directly mapped");
|
||||
break;
|
||||
case 0xffff:
|
||||
_dl_printf ("Fully associative");
|
||||
break;
|
||||
default:
|
||||
_dl_printf ("%lu-way set associative", assocty);
|
||||
}
|
||||
_dl_printf ("\"\n");
|
||||
}
|
||||
|
||||
void
|
||||
_dl_diagnostics_cpu (void)
|
||||
{
|
||||
@@ -45,4 +77,21 @@ _dl_diagnostics_cpu (void)
|
||||
print_hwcap_value ("hwcap2", AT_HWCAP2, GLRO(dl_hwcap2));
|
||||
print_hwcap_value ("hwcap3", AT_HWCAP3, GLRO(dl_hwcap3));
|
||||
print_hwcap_value ("hwcap4", AT_HWCAP4, GLRO(dl_hwcap4));
|
||||
|
||||
for (ElfW(auxv_t) *av = GLRO(dl_auxv); av->a_type != AT_NULL; ++av)
|
||||
switch (av->a_type)
|
||||
{
|
||||
case AT_L1I_CACHEGEOMETRY:
|
||||
print_cache_geometry_value ("l1i_cachegeometry", av->a_un.a_val);
|
||||
break;
|
||||
case AT_L1D_CACHEGEOMETRY:
|
||||
print_cache_geometry_value ("l1d_cachegeometry", av->a_un.a_val);
|
||||
break;
|
||||
case AT_L2_CACHEGEOMETRY:
|
||||
print_cache_geometry_value ("l2_cachegeometry", av->a_un.a_val);
|
||||
break;
|
||||
case AT_L3_CACHEGEOMETRY:
|
||||
print_cache_geometry_value ("l3_cachegeometry", av->a_un.a_val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user