[haiku-appserver] Re: CPU-idle-loop and HALT instruction?

  • From: Ingo Weinhold <bonefish@xxxxxxxxxxxxxxx>
  • To: haiku-appserver@xxxxxxxxxxxxx
  • Date: Tue, 13 Dec 2005 00:26:58 +0100

On 2005-12-12 at 23:52:06 [+0100], Stephan Assmus <superstippi@xxxxxx> wrote:
> > > Or, is it already in there and can I somehow enable it?
> > 
> > From src/system/kernel/arch/x86/arch_cpu.c:
> > 
> > void
> > arch_cpu_idle(void)
> > {
> >     switch (smp_get_num_cpus()) {
> >         case 0:
> >             panic("You need at least 1 CPU to run Haiku\n");
> >         case 1:
> >             asm("hlt");
> >         default:
> >             break;
> >     }
> > }
> > 
> > So, if you have more than one CPU, the only thing you can do is change 
> > this
> > code. There might be a reason, why it is implemented like it is, though. 
> > On
> > the other hand there's also no comment that you computer will explode when
> > executing "hlt" on a multi CPU machine either...
> 
> I seem to recall that on my dual CPU machine, there is simply two idle
> threads running. Or is my memory failing me?

No. The question was, what the idle threads are executing, though. And that's 
the above function (in an endless loop).

CU, Ingo

Other related posts: