On Nov 23, 2007 7:04 PM, Mladen Nikitovic <[EMAIL PROTECTED]> wrote:
> hi gavinm,
>
> I've looked at the opensolaris code and I found the functions you mentioned.  
> For i86p, in the mp_machdep.c file idle_cpu is either defined as cpu_idle 
> (that in turn calls mach_cpu_idle and finally executes i86_halt) or 
> cpu_idle_mwait which uses the mwait approach.
>
> Since I'm interested in using the sparc architecture I also found idle_cpu 
> being assigned to cpu_halt function within os/mach_startup.c (sun4u) file. 
> This function calls cpu_halt_cpu which is supposed to halt the cpu if the 
> global flag enable_halt_idle_cpus is enabled.
>
> However, I also saw that idle_cpu is defined as generic_idle_cpu in the 
> common/disp/disp.c file which is actually empty. Since,
>
> So in conclusion, I'm confused about which definition of idle_cpu will 
> actually be used when I'm compiling my code on a sparc machine. Will idle_cpu 
> be an empty function or something that actually halts? Is there a way to 
> verify this?
>

I hope the following describtion is clear to you, although it's not
exactly what the code is.

idle_cpu = generic_idle_cpu;

#if ARCH=x86/64
idle_cpu = cpu_idle;
if (mwait is supported)
    idle_cpu = cpu_idle_mwait;
#endif

#if ARCH=SPARC
idle_cpu = cpu_halt;
#endif

the function pointer (*idle_cpu)() will be called when the system is idle.
So now you'll get which definition of idle_cpu will actually be used.

-Aubrey
Intel OpenSolaris Team.
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to