From owner-freebsd-bugs Thu Oct 29 10:20:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA27067 for freebsd-bugs-outgoing; Thu, 29 Oct 1998 10:20:05 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA27054 for ; Thu, 29 Oct 1998 10:20:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id KAA08750; Thu, 29 Oct 1998 10:20:01 -0800 (PST) Received: from pinhead.parag.codegen.com (ppp-asfm08--172.sirius.net [205.134.241.172]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA25992 for ; Thu, 29 Oct 1998 10:12:18 -0800 (PST) (envelope-from parag@pinhead.parag.codegen.com) Received: (from parag@localhost) by pinhead.parag.codegen.com (8.9.1/8.8.8) id KAA24349; Thu, 29 Oct 1998 10:12:23 -0800 (PST) (envelope-from parag) Message-Id: <199810291812.KAA24349@pinhead.parag.codegen.com> Date: Thu, 29 Oct 1998 10:12:23 -0800 (PST) From: parag@codegen.com Reply-To: parag@codegen.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/8486: doscmd port.c change to access real device ports Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8486 >Category: bin >Synopsis: doscmd port.c change to access real device ports >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Oct 29 10:20:00 PST 1998 >Last-Modified: >Originator: Parag Patel >Organization: CodeGen, Inc. >Release: FreeBSD 3.0-CURRENT i386 >Environment: Dual SMP Pentium-II/300, 256Mb RAM, 2 IBM 4Gb SCSI disks (not that it matters) >Description: doscmd does not currently allow access to the physical device ports on the system. The relevant code in port.c has not been ported to FreeBSD. As I need it to access a Needhams EMP-10 EPROM programmer, I added the relevant code. >How-To-Repeat: This command allows access to the physical parallel port from doscmd using the patch below: rtprio 10 doscmd -x -b -i0x378:8 -o0x378:8 >Fix: I had posted a similar patch to current@freebsd.org that had a bug in it. In the original patch, iounmap() did not set the ioperm back to zero. This patch fixes that problem. Index: port.c =================================================================== RCS file: /src/freebsd/src/usr.bin/doscmd/port.c,v retrieving revision 1.1 diff -c -r1.1 port.c *** port.c 1997/08/09 01:42:54 1.1 --- port.c 1998/10/29 17:56:15 *************** *** 59,73 **** static void iomap(int port, int cnt) { ! fatal("iomap not supported"); } static void iounmap(int port, int cnt) { ! fatal("iomap not supported"); } - #else static void iomap(int port, int cnt) --- 59,88 ---- static void iomap(int port, int cnt) { ! if (port + cnt >= MAXPORT) { ! errno = ERANGE; ! goto bad; ! } ! if (i386_set_ioperm(port, cnt, 1) < 0) { ! bad: ! perror("iomap"); ! quit(1); ! } } static void iounmap(int port, int cnt) { ! if (port + cnt >= MAXPORT) { ! errno = ERANGE; ! goto bad; ! } ! if (i386_set_ioperm(port, cnt, 0) < 0) { ! bad: ! perror("iounmap"); ! quit(1); ! } } #else static void iomap(int port, int cnt) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message