From: robertwessel2 on
On Apr 14, 11:45 pm, Yousuf Khan <bbb...(a)spammenot.yahoo.com> wrote:
> 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.


In segmented x86, a segment can be accessible at a particular
privilege level (or higher). Thus a segment mapping the I/O device
would be accessible at the ring the device drivers were running in.
Anyway, device drivers in OS/2 always ran in ring zero, so that part
of it is moot. OTOH, an application could have ring 2 segments (aka
"IOPL" segments), which *did* have certain amounts of access to the
real hardware (so selected applications could do user level I/O).
From: Terje Mathisen "terje.mathisen at on
Yousuf Khan wrote:
> 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.

Yousef, you need to read up on the x86 ring architecture!

OS/2 used a separate ring for drivers specifically because that ring had
intermediate privilege, in particular the OS can delegate IO port access
to such a driver.

I.e. a driver had full-speed access, but only to those hardware
resources the OS would agree to give it, so a buggy driver had less
chance of messing up some unrelated hardware/software subsystem.

Terje
--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"
From: Jonathan de Boyne Pollard on
>
>>
>> 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).
>
16-bit OS/2 most definitely uses three out of the four rings. 16-bit
OS/2 applications can define IOPL segments, that run in ring #2. It's
essentially an official way of Doing Naughty Things With The Hardware.

From: Joe Pfeiffer on
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.
--
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: Yousuf Khan on
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.

Yousuf Khan