Date: Mon, 07 Oct 2013 14:26:23 -0600 From: Ian Lepore <ian@FreeBSD.org> To: Adrian Chadd <adrian@FreeBSD.org> Cc: Zbigniew Bodek <zbb@FreeBSD.org>, "freebsd-arm@freebsd.org" <freebsd-arm@FreeBSD.org>, freebsd-current <freebsd-current@FreeBSD.org>, "freebsd-embedded@freebsd.org" <freebsd-embedded@FreeBSD.org> Subject: Re: Changes to UART ns8250 Message-ID: <1381177583.1130.17.camel@revolution.hippie.lan> In-Reply-To: <CAJ-VmokZHvLpUvvD9s8ES0PT%2BE1oVfHWhdbiXF77osBOK2_Yqg@mail.gmail.com> References: <CALF_Tx=AwVnr0d75-K-yu97iVgmTJC7aaABoix73zHD%2B5eKJnQ@mail.gmail.com> <CAJ-VmokZHvLpUvvD9s8ES0PT%2BE1oVfHWhdbiXF77osBOK2_Yqg@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2013-10-07 at 13:15 -0700, Adrian Chadd wrote:
> Hi,
> 
> You should add:
> 
> *[snip]
> * a DELAY(1) or something.
> 
Why?  Why oh why do people write 
  
 while (!read_some_status_register())
    DELAY(n);
when DELAY() is implemented as, roughly:
  while (read_some_counter_register() < something)
     continue;
The whole point of DELAY() is to busy-wait.  
What might be nice is some function that we can call in such a loop such
as cpu_busywait(), so that when running in an emulated or virtualized
environment the emulator or hypervisor could use that as a hint to do
something smart.
-- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1381177583.1130.17.camel>
