[openbeos] Re: app_server: MMX/SSE help wanted

  • From: "François Revol" <revol@xxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 11 Aug 2004 18:46:55 +0200 CEST

> On 2004-08-10 20:40:45 [+0200], Axel Dörfler wrote:
> 
> > What we could also do is to add another bitmap flag to force an 
> > ideal
> > alignment for the current CPU.
> 
> This would be perfect. 
> 
> One other thing: will the kernel have some kind of CPU feature 
> identification? A quick grep on the headers didn't turn up any 
> relevant hit 
> on MMX (only B_CPU_INTEL_PENTIUM_MMX*). A function returning the CPUs 
> features would be very useful, to write code like this:
> 
> uint32 cpuFlags = get_cpu_capabilities();
> if(cpuFlags & CPU_HAS_SSE) {
>  ...
> } else if(cpuFlags & CPU_HAS_MMX) {
>  ...
> } else { 
>  ...
> }
> 
> I already do it this way, using my own CPU ID routine; but this 
> should 
> really be a kernel function. Of course that routine should also 
> identify 
> all other relevant features, not only SIMD instruction sets. I can 
> write 
> that routine if you want, I imagine the kernel team has other things 
> to 
> do...
It's called CPUID, and even userland apps can use a syscall which 
returns the value of that opcode.
(note using the kernel's get_cpuid() instead of the opcode directly 
ensures it is run on the CPU you want, not any, even thougth SMP 
systems are supposed to have "ideally" equal CPUs.

François.


Other related posts: