OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: How to write drivers?

From: Sviatoslav Chagaev (slavazb.lv)
Date: Thu May 01 2008 - 13:33:50 CDT


Yes, by default these are blocked. But there are two ways in which you
can gain access to I/O ports:
1) Enable access to all I/O ports for all processes with i386_iopl(2)
2) Enable access to individual I/O ports for the current process with
i386_set_ioperm(2)
Both calls must be called with superuser privileges (and i386_iopl has
even more restrictions).

I'm a CS student, I really like all this low-level stuff, and I want
to learn how OS'es work.

On Thu, 1 May 2008 20:00:38 +0200
Jonathan Schleifer <jswebkeks.org> wrote:

> Sviatoslav Chagaev <slavazb.lv> wrote:
>
> > Yes, I even wrote a program which "talks" with the device directly,
> > with the help of inb()/outb().
>
> I doubt you could use inb/outb in OpenBSD. The kernel will prevent that.
> Just talk with the device in /dev directly - there is really no need to
> write a driver. OpenBSD already has an LPT driver that gives access to
> it to the userland, so why reinvent the wheel here?
>
> --
> Jonathan