From: James Harris on
On 15 Apr, 18:11, Yousuf Khan <bbb...(a)spammenot.yahoo.com> wrote:
> Joe Pfeiffer wrote:
> > One of the many clever features of the x86 is an IO protection bitmap,
> > permitting a process at any level (even user level) to access hardware
> > directly, without a kernel trap.
>
> Oh yes, you're right IOPL allowed that, but my impression was that IOPL
> could not differentiate between ring levels. That is, if you allowed
> IOPL to anything other than ring 0, then all other rings from 1 through
> 3 would have direct access to the i/o ports in that map. You couldn't
> for example, limit the access only upto ring 1.

The IO protection bitmap allows *unprivileged* routines to use certain
IO ports. That's fine but to use it properly it needs to be changed on
each task switch (which modern operating systems could do but tend not
to for speed of thread switching). Note how the IOPL is checked first.
Only if IOPL does not grant privilege is the bitmap used.

http://pdos.csail.mit.edu/6.828/2007/readings/i386/s08_03.htm

Other options for port access from non-privileged routines were
discussed at

http://groups.google.co.uk/group/alt.os.development/browse_frm/thread/8585f38fa09a6da

James
From: Peter Flass on
Yousuf Khan wrote:
> Joe Pfeiffer wrote:
>> One of the many clever features of the x86 is an IO protection bitmap,
>> permitting a process at any level (even user level) to access hardware
>> directly, without a kernel trap.
>
> Oh yes, you're right IOPL allowed that, but my impression was that IOPL
> could not differentiate between ring levels. That is, if you allowed
> IOPL to anything other than ring 0, then all other rings from 1 through
> 3 would have direct access to the i/o ports in that map. You couldn't
> for example, limit the access only upto ring 1.
>

I haven't looked at this in a while, but I believe IOPL >0 allowed that
ring and any lower to have access. That is, if IOPL=1, then 0 and 1
could access H/W, 2 and 3 couldn't.

BTW, I see OS/2 may be making a comeback;-)
From: Joe Pfeiffer on
Yousuf Khan <bbbl67(a)spammenot.yahoo.com> writes:

> Joe Pfeiffer wrote:
>> One of the many clever features of the x86 is an IO protection bitmap,
>> permitting a process at any level (even user level) to access hardware
>> directly, without a kernel trap.
>
> Oh yes, you're right IOPL allowed that, but my impression was that
> IOPL could not differentiate between ring levels. That is, if you
> allowed IOPL to anything other than ring 0, then all other rings from
> 1 through 3 would have direct access to the i/o ports in that map. You
> couldn't for example, limit the access only upto ring 1.

The bitmap is per-process, so if the process has the access then it has
it at whatever level it's running at.
--
As we enjoy great advantages from the inventions of others, we should
be glad of an opportunity to serve others by any invention of ours;
and this we should do freely and generously. (Benjamin Franklin)
From: Walter Bushell on
In article <1b7ho8abrg.fsf(a)snowball.wb.pfeifferfamily.net>,
Joe Pfeiffer <pfeiffer(a)cs.nmsu.edu> wrote:

> Yousuf Khan <bbbl67(a)spammenot.yahoo.com> writes:
>
> > Peter Flass wrote:
> >> OS/2 uses three: one for the kernel, one for drivers, etc., and the
> >> third for user programs.
> >
> > Are you sure OS/2 actually uses that? The Intel architecture allowed
> > for upto 4 privilege rings (now it's 5 rings with
> > virtualization). However, most OS software never used more than 2
> > rings, highest (for OS & drivers) and lowest (for apps).
> >
> > The reason I'm skeptical is because running drivers in anything other
> > than highest privilege level means you run into performance penalties,
> > since all hardware accesses by the driver will result in a exception
> > fault requiring a redirection through the OS first. Not great if your
> > driver has to respond to hardware signals fast.
>
> One of the many clever features of the x86 is an IO protection bitmap,
> permitting a process at any level (even user level) to access hardware
> directly, without a kernel trap.

To clever by half, judging by the results.

--
A computer without Microsoft is like a chocolate cake without mustard.
From: Jonathan de Boyne Pollard on
>
>>
>> One of the many clever features of the x86 is an IO protection
>> bitmap, permitting a process at any level (even user level) to access
>> hardware directly, without a kernel trap.
>>
> To clever by half, judging by the results.
>
Which results?