STI, HLT in acpi_cpu_idle_c1

Don Bowman don at sandvine.com
Thu Jun 17 19:44:58 GMT 2004


From: Julian Elischer [mailto:julian at elischer.org]
> On Thu, 17 Jun 2004, Don Bowman wrote:
> 
> > 
> > in the intel instruction manual, the effect
> > of STI is that interrupts are enabled
> > *after* the next instruction.
> > 
> > ie:
> > 
> >  sti
> >  ret
> >  ...
> > 
> > the return is still run with interrupts disabled
> > (if they were prior to the STI).
> > 
> > In acpi_cpu_idle_c1, it does:
> > 
> >  sti
> >  hlt
> > 
> > shouldn't there be a NOP in there so that interrupts
> > are guaranteed on?
> 
> I think your reading of it is right..
> but I also think that if it was ALWAYS right we'd see processors
> go idle and never wake up again....
> Since this doesn't seem to happen, maybe ther eis a bug in 
> the emulator?

My theory is there are two code paths to get there,
1 with interrupts enabled, and one without. The 'STI'
seems to be there as a form of protection for
the 2nd case.

I'm adding the nop and restarting the test.

The emulator is correct, in the normal case it shows
interrupts enabled on entry to that function.


More information about the freebsd-current mailing list