Subject: lib/1650: i386 libarch man pages need
To: None <gnats-bugs@gnats.netbsd.org>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: netbsd-bugs
Date: 10/18/1995 19:07:45
>Number:         1650
>Category:       lib
>Synopsis:       i386 libarch man pages need <sys/types.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 18 19:35:01 1995
>Last-Modified:
>Originator:     John Kohl
>Organization:
NetBSD Kernel Hackers `R` Us
>Release:        NetBSD-1.1_ALPHA
>Environment:
	
System: NetBSD pattern 1.1_ALPHA NetBSD 1.1_ALPHA (PATTERN) #192: Tue Oct 17 23:54:10 EDT 1995 jtk@pattern:/u1/NetBSD-current/src/sys/arch/i386/compile/PATTERN i386


>Description:
the man pages on i386_* functions in libarch could use a bit of polish.
Suggestions below.

>How-To-Repeat:
Read the pages.

>Fix:
diff -c /usr/src/lib/libarch/i386/i386_get_ioperm.2 lib/libarch/i386/i386_get_ioperm.2
*** /usr/src/lib/libarch/i386/i386_get_ioperm.2	Sun Oct 15 06:24:26 1995
--- lib/libarch/i386/i386_get_ioperm.2	Wed Oct 18 19:04:44 1995
***************
*** 30,36 ****
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$Id: i386_get_ioperm.2,v 1.1 1995/10/15 02:29:09 mycroft Exp $
  .\"
  .Dd October 14, 1995
  .Dt I386_GET_IOPERM 2
--- 30,36 ----
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$NetBSD$
  .\"
  .Dd October 14, 1995
  .Dt I386_GET_IOPERM 2
***************
*** 40,45 ****
--- 40,46 ----
  .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,59 ****
--- 55,74 ----
  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,80 ****
--- 91,106 ----
  .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 -c /usr/src/lib/libarch/i386/i386_get_ldt.2 lib/libarch/i386/i386_get_ldt.2
*** /usr/src/lib/libarch/i386/i386_get_ldt.2	Fri Oct 13 20:38:20 1995
--- lib/libarch/i386/i386_get_ldt.2	Wed Oct 18 19:05:11 1995
***************
*** 30,36 ****
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$Id: i386_get_ldt.2,v 1.2 1993/10/09 00:59:10 cgd Exp $
  .\"
  .Dd September 20, 1993
  .Dt I386_GET_LDT 2
--- 30,36 ----
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$NetBSD$
  .\"
  .Dd September 20, 1993
  .Dt I386_GET_LDT 2
***************
*** 40,45 ****
--- 40,46 ----
  .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 -c /usr/src/lib/libarch/i386/i386_iopl.2 lib/libarch/i386/i386_iopl.2
*** /usr/src/lib/libarch/i386/i386_iopl.2	Sun Oct 15 06:24:27 1995
--- lib/libarch/i386/i386_iopl.2	Wed Oct 18 19:04:19 1995
***************
*** 30,36 ****
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$Id: i386_iopl.2,v 1.1 1995/10/15 02:29:11 mycroft Exp $
  .\"
  .Dd October 14, 1995
  .Dt I386_IOPL 2
--- 30,36 ----
  .\" SUCH DAMAGE.
  .\"
  .\"     from: @(#)fork.2	6.5 (Berkeley) 3/10/91
! .\"	$NetBSD$
  .\"
  .Dd October 14, 1995
  .Dt I386_IOPL 2
***************
*** 39,44 ****
--- 39,45 ----
  .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,66 ****
--- 63,73 ----
  .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.
>Audit-Trail:
>Unformatted: