From owner-freebsd-hackers@FreeBSD.ORG Sun Oct 17 14:46:01 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 A138016A4CE for ; Sun, 17 Oct 2004 14:46:01 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 8AF1043D2F for ; Sun, 17 Oct 2004 14:46:00 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 16283 invoked from network); 17 Oct 2004 14:45:54 -0000 Received: from unknown (HELO straylight.m.ringlet.net) (217.75.135.134) by gandalf.online.bg with SMTP; 17 Oct 2004 14:45:54 -0000 Received: (qmail 18755 invoked by uid 1000); 17 Oct 2004 14:46:10 -0000 Date: Sun, 17 Oct 2004 17:46:10 +0300 From: Peter Pentchev To: Giorgos Keramidas Message-ID: <20041017144610.GB4639@straylight.m.ringlet.net> Mail-Followup-To: Giorgos Keramidas , Jan Opacki , freebsd-hackers@freebsd.org References: <6.0.1.1.1.20041016135943.0353fb90@adamsatoms.com> <20041017130057.GA1132@gothmog.gr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="61jdw2sOBCFtR2d/" Content-Disposition: inline In-Reply-To: <20041017130057.GA1132@gothmog.gr> User-Agent: Mutt/1.5.6i cc: Jan Opacki cc: freebsd-hackers@freebsd.org Subject: Re: Freebsd assembly programming - IN/OUT commands. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list 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 14:46:01 -0000 --61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 ? >=20 > 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 --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@FreeBSD.org 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. --61jdw2sOBCFtR2d/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBcoWy7Ri2jRYZRVMRAphmAJ4m7h1Rn5p9Plu45cSoxAUxHytAWwCguxOT dj17H7F6o2R/2MfyNJE69Xs= =knZl -----END PGP SIGNATURE----- --61jdw2sOBCFtR2d/--