direct I/O access

Eygene Ryabinkin rea-fbsd at codelabs.ru
Thu May 31 04:44:40 UTC 2007


Mike, good day.

Wed, May 30, 2007 at 02:43:07AM -0400, Mike Meyer wrote:
> I believe this should be $0x4, as you want to *set* the values, not
> get them.

Right.

> You also need to open the file "/dev/io".  I believe that leaving this
> file open for anything more than a handful of instructions would be a
> bad thing, but I'm not going to verify it.

I feel that the i386_set_ioperm directly manipulates the task's I/O
bitmap referenced by the task state segment (TSS), so you don't
need to mangle with /dev/io.  /dev/io itself is the higher-level
semi machine-indenepdent abstraction.  Opening /dev/io grants the
global access to all ports, while using i386_set_ioperm gives the
fine-grained access.  When you closing /dev/io, the port I/O access
is revoked.

To summarise: either you open /dev/io and do all your port I/O as
in the good old days of the real-mode programs, or you're using
i386_set_ioperm to obtain the access permissions to the I/O port
range and again, do all port I/O as usual.
-- 
Eygene


More information about the freebsd-hackers mailing list