[haiku-development] get_cpuid() broken by progress

  • From: Christian Packmann <Christian.Packmann@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 13 Feb 2009 16:46:52 +0100

The current get_cpuid() function is broken for modern CPUs, as some CPUID 
functions require an additional parameter in ECX.

E.g., on modern Intel CPUs CPUID function 4 (deterministic cache parameters) 
requires ECX to pass the required level of information. On my Intel Q9550 I need to 
call CPUID with EAX=4, ECX=0,1,2 to get all information about L1I, L1D & L2 
caches.

So maybe we should add an extended get_cpuid() function which takes a full input 
set of EAX, EBX, ECX & EDX (only EAX and ECX are currently needed, but who 
knows...). Or deprecate get_cpuid() and force users to write their own CPUID 
functions. Preferably in GCC inline asm. Hehe, that'll teach them. :)

Meanwhile, can I call code only on a specific CPU, or do I have to use 
call_all_cpus()? I looked at some of the kernel source, but I don't have the 
time to study all of it now, and I'm not sure what methods are available for 
these purposes ATM.

I think it would be useful if some kernel documentation would be added to the 
Haiku Book one of these days... ;)

Christian

Other related posts: