Freebsd assembly programming - IN/OUT commands.
Giorgos Keramidas
keramida at freebsd.org
Sun Oct 17 06:01:03 PDT 2004
On 2004-10-16 14:03, Jan Opacki <opacki at acn.waw.pl> wrote:
> I had a short look at your fbd assembly tutorial. I'm have a such
> problem useing IN, OUT commands. In my case i want to "speak" with cmos
> by port 70 and 71. We both know that fbsd as same as linux works in safe
> mode. So we need a permission to use each port. In linux it's a system
> call sys_ioperm (http://www.die.net/doc/linux/man/man2/ioperm.2.html).
> How to ask FreeBSD to allow us to use those ports ? And then we could
> simply do:
> mov al, 0
> out 70h, al
> nop
> nop
> nop
> nop
> in al, 71h
> Do you haveny any idea ?
Look at the io(4) manpage. You need superuser access to work with
/dev/io and even then your program should be very careful about not
messing up badly with the hardware, but I think it does what you need.
A typical use of /dev/io would look like:
if ((iofd = open("/dev/io", O_RDONLY)) == -1)
err(1, "open: /dev/io");
__asm__("insert your inline asm here");
if (close(iofd) == -1)
err(1, "close: /dev/io");
More information about the freebsd-hackers
mailing list