summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-06 17:25:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-06 17:25:02 +0000
commit9dc91b2f8a7723caff7661850bbd18b894909e11 (patch)
tree50a532521d54e07a5a9ec930609b60dd2ef1b2e1
parentc01bcf976617c6a6c18f39514350a7e4f9e09213 (diff)
update from jtk@kolvir.arlington.ma.us; netbsd pr#1650
-rw-r--r--lib/libarch/i386/i386_get_ioperm.228
-rw-r--r--lib/libarch/i386/i386_get_ldt.23
-rw-r--r--lib/libarch/i386/i386_iopl.29
3 files changed, 37 insertions, 3 deletions
diff --git a/lib/libarch/i386/i386_get_ioperm.2 b/lib/libarch/i386/i386_get_ioperm.2
index aaf8cfaecd3..aab8d7bdba4 100644
--- a/lib/libarch/i386/i386_get_ioperm.2
+++ b/lib/libarch/i386/i386_get_ioperm.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91
-.\" $Id: i386_get_ioperm.2,v 1.1 1995/10/18 08:41:19 deraadt Exp $
+.\" $NetBSD: i386_get_ioperm.2,v 1.2 1996/01/05 14:56:42 pk Exp $
.\"
.Dd October 14, 1995
.Dt I386_GET_IOPERM 2
@@ -40,6 +40,7 @@
.Nm i386_set_ioperm
.Nd manage i386 per-process I/O permission bitmap
.Sh SYNOPSIS
+.Fd #include <sys/types.h>
.Fd #include <machine/sysarch.h>
.Ft int
.Fn i386_get_ioperm "u_long *iomap"
@@ -54,6 +55,20 @@ copies the current I/O permission bitmap into the memory referenced by
sets the I/O permission bitmap from the data pointed to by
.Ar iomap .
This call is restricted to the super-user.
+.Pp
+The permission bitmap contains
+1024
+bits in 32 longwords.
+If bit
+.Va n
+is clear in the bitmap, then access is granted to I/O port
+.Va n .
+If bit
+.Va n
+is set in the bitmap, then an attempt to access I/O port
+.Va n
+results in delivery of a SIGBUS signal unless the process's I/O
+permission level would grant I/O access.
.Sh RETURN VALUES
Upon successful completion,
.Fn i386_get_ioperm
@@ -76,5 +91,16 @@ points outside the process's allocated address space.
.It Bq Er EPERM
The caller was not the super-user.
.El
+.Sh BUGS
+The bitmap should really cover 65536 bits, but that's just too big for
+allocation in a kernel structure. If you need access to ports beyond
+1024,
+use
+.Xr i386_iopl 2 .
+.Sh SEE ALSO
+.Xr i386_iopl 2
.Sh REFERENCES
i386 Microprocessor Programmer's Reference Manual, Intel
+.Sh WARNING
+You can really hose your machine if you enable user-level I/O and
+write to hardware ports without care.
diff --git a/lib/libarch/i386/i386_get_ldt.2 b/lib/libarch/i386/i386_get_ldt.2
index 8a9fd362cb7..ef29887af11 100644
--- a/lib/libarch/i386/i386_get_ldt.2
+++ b/lib/libarch/i386/i386_get_ldt.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91
-.\" $Id: i386_get_ldt.2,v 1.1 1995/10/18 08:41:19 deraadt Exp $
+.\" $NetBSD: i386_get_ldt.2,v 1.3 1996/01/05 14:56:44 pk Exp $
.\"
.Dd September 20, 1993
.Dt I386_GET_LDT 2
@@ -40,6 +40,7 @@
.Nm i386_set_ldt
.Nd manage i386 per-process Local Descriptor Table entries
.Sh SYNOPSIS
+.Fd #include <sys/types.h>
.Fd #include <machine/segments.h>
.Fd #include <machine/sysarch.h>
.Ft int
diff --git a/lib/libarch/i386/i386_iopl.2 b/lib/libarch/i386/i386_iopl.2
index 5bc72ef77eb..85ccc1d2ef6 100644
--- a/lib/libarch/i386/i386_iopl.2
+++ b/lib/libarch/i386/i386_iopl.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91
-.\" $Id: i386_iopl.2,v 1.1 1995/10/18 08:41:19 deraadt Exp $
+.\" $NetBSD: i386_iopl.2,v 1.2 1996/01/05 14:56:45 pk Exp $
.\"
.Dd October 14, 1995
.Dt I386_IOPL 2
@@ -39,6 +39,7 @@
.Nm i386_iopl
.Nd change the i386 I/O privilege level
.Sh SYNOPSIS
+.Fd #include <sys/types.h>
.Fd #include <machine/sysarch.h>
.Ft int
.Fn i386_iopl "int iopl"
@@ -62,5 +63,11 @@ will fail if:
.It Bq Er EPERM
The caller was not the super-user.
.El
+.Sh SEE ALSO
+.Xr i386_set_ioperm 2 ,
+.Xr i386_get_ioperm 2 .
.Sh REFERENCES
i386 Microprocessor Programmer's Reference Manual, Intel
+.Sh WARNING
+You can really hose your machine if you enable user-level I/O and
+write to hardware ports without care.