summaryrefslogtreecommitdiffstats
path: root/usr.bin/doscmd
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>1999-01-20 17:55:22 +0000
committerimp <imp@FreeBSD.org>1999-01-20 17:55:22 +0000
commit3d26b017dd1f79af0ff6531cfc9e84abea7b47dc (patch)
tree9c7421d2236085ab9bfe4de984436dbdd2cc1ed3 /usr.bin/doscmd
parent46541593cd4e664eee12431612d7275edf8ab97c (diff)
downloadFreeBSD-src-3d26b017dd1f79af0ff6531cfc9e84abea7b47dc.zip
FreeBSD-src-3d26b017dd1f79af0ff6531cfc9e84abea7b47dc.tar.gz
Add support for accessing ports. This was done to access parallel
ports, but should work for others as well. Submitted by: Parag Patel <parag@cgt.com>
Diffstat (limited to 'usr.bin/doscmd')
-rw-r--r--usr.bin/doscmd/port.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/usr.bin/doscmd/port.c b/usr.bin/doscmd/port.c
index 7bcc539..c9a06b2 100644
--- a/usr.bin/doscmd/port.c
+++ b/usr.bin/doscmd/port.c
@@ -29,7 +29,7 @@
*
* BSDI port.c,v 2.2 1996/04/08 19:33:03 bostic Exp
*
- * $Id: port.c,v 1.2 1996/09/22 05:53:08 miff Exp $
+ * $Id: port.c,v 1.1 1997/08/09 01:42:54 dyson Exp $
*/
#include "doscmd.h"
@@ -59,15 +59,30 @@ u_long ioports[MAXPORT/32];
static void
iomap(int port, int cnt)
{
- fatal("iomap not supported");
+ 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)
{
- fatal("iomap not supported");
+ 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)
OpenPOWER on IntegriCloud