Hi, On Wed, Jan 08, 2025 at 10:25:41AM +0100, Luca wrote: > > Il 08/01/25 02:30, dnie...@gmail.com ha scritto: > > From: Diego Nieto Cid <dnie...@gmail.com> > > > > Beside that, I probably need to cache the CPUID provided information > > as I don't think it would change over time. > > I think the information could be considered constant, at least gnumach > should enable all supported features at startup. > > I don't know if the cpuid performance impact is relevant compared to > performing an rpc, but you can easily estimate it by measuring a few > thousand reads, and then comparing with a version where you don't use cpuid > but you return constant values. >
Yes, that should work as a comparison. > > > > + > > +static char * features_edx[] = > > + { > > + "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce", "cx8", "apic", > > + NULL, "sep", "mtrr", "pge", "mca", "cmov", "pat", "pse36", "psn", > > "clfsh", > > + NULL, "ds", "acpi", "mmx", "fxsr", "sse", "sse2", "ss", "htt", "tm", > > + "ia64", "pbe" > > + }; > > + > > +static char * features_ecx[] = > > + { > > + "sse3", "pclmulqdq", "dtes64", "monitor", "ds-cpl", "vmx", "smx", > > "est", > > + "tm3", "ssse3", "cnxt-id", "sdbg", "fma", "cx16", "xtpr", "pdcm", > > + NULL, "pcid", "dca", "sse4_1", "sse4_2", "x2apic", "movbe", "popcnt", > > + "tsc_deadline", "aes_ni", "xsave", "osxsave", "avx", "f16c", "rdrnd", > > "hypervisor" > > + }; > > Are these names reflecting the gcc header cpuid.h? It seems there is some > difference with e.g. Linux naming (rdrnd vs rdrand), I'm not sure what would > be the best reference. > These were taken from the Wikipedia article and replaced some dots and dashes with underscores. I didn't know if looking at Linux code would break some licensing stuff :/ and the output of /proc/cpuinfo didn't tell me what bit to look for in each case. > > maybe this can be already made arch-specific. > Hmm, maybe. As is it only makes sense for x86 based architectures. What would be the right approach at making pieces of code architechture based on the Hurd repo? There isn't much code in that fashion, probably pfinet only. -- Diego