From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 17 19:45:13 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F5B716A4CE; Sun, 17 Oct 2004 19:45:13 +0000 (GMT) Received: from mail2.astercity.net (mail2.aster.pl [212.76.33.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 87D6D43D1D; Sun, 17 Oct 2004 19:45:12 +0000 (GMT) (envelope-from opacki@acn.waw.pl) Received: from [62.121.87.200] (200-ego-4.acn.waw.pl [62.121.87.200]) by mail2.astercity.net (sendmail) with ESMTP id AA539AA2CB; Sun, 17 Oct 2004 21:45:10 +0200 (CEST) From: Jan Opacki To: Peter Pentchev In-Reply-To: <20041017144610.GB4639@straylight.m.ringlet.net> References: <6.0.1.1.1.20041016135943.0353fb90@adamsatoms.com> <20041017130057.GA1132@gothmog.gr> <20041017144610.GB4639@straylight.m.ringlet.net> Content-Type: text/plain Message-Id: <1098042389.372.33.camel@200-ego-4.acn.waw.pl> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 17 Oct 2004 21:46:29 +0200 Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org cc: Giorgos Keramidas Subject: Re: Freebsd assembly programming - IN/OUT commands. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: opacki@acn.waw.pl List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Oct 2004 19:45:13 -0000 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 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