Re: Freebsd assembly programming - IN/OUT commands.
On Sun, Oct 17, 2004 at 09:46:29PM +0200, Jan Opacki wrote: > Thanks for help. i386_set_ioperm() is exactly what i need. I have to say though I've had processes dump core the first time I've tried doing I/O port accesses after calling i386_set_ioperm() on 5.x since 5.0. This behaviour is sporadic. With opening /dev/io, I have had no problem. Also, the /dev/io method appears to work on amd64, whereas the i386_set_ioperm() method does not. BMS ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Freebsd assembly programming - IN/OUT commands.
Hi, Thanks for help. i386_set_ioperm() is exactly what i need. Regards, Jan Opacki On Sun, 2004-10-17 at 16:46, Peter Pentchev wrote: > On Sun, Oct 17, 2004 at 04:00:57PM +0300, Giorgos Keramidas wrote: > > On 2004-10-16 14:03, Jan Opacki <[EMAIL PROTECTED]> 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. > > Of course, a bit more controlled way (as described in the io(4) manpage, > too), would be to use the i386_set_ioperm(2) syscall :) It is a bit > non-portable, true, but since Jan uses MASM-style assembly and mentions > ports 70h and 71h, I think it would do what he needs. > > G'luck, > Peter ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Freebsd assembly programming - IN/OUT commands.
On Sun, Oct 17, 2004 at 04:00:57PM +0300, Giorgos Keramidas wrote: > On 2004-10-16 14:03, Jan Opacki <[EMAIL PROTECTED]> 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. Of course, a bit more controlled way (as described in the io(4) manpage, too), would be to use the i386_set_ioperm(2) syscall :) It is a bit non-portable, true, but since Jan uses MASM-style assembly and mentions ports 70h and 71h, I think it would do what he needs. G'luck, Peter -- Peter Pentchev [EMAIL PROTECTED][EMAIL PROTECTED][EMAIL PROTECTED] PGP key:http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain. pgpHuMEmliiOf.pgp Description: PGP signature
Re: Freebsd assembly programming - IN/OUT commands.
On 2004-10-16 14:03, Jan Opacki <[EMAIL PROTECTED]> 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"); ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Freebsd assembly programming - IN/OUT commands.
Hi Adam, AT the beggining i want to sorry about my poor english. 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 ? Best regards, Jan Opacki. ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"