xref: /freebsd/share/man/man4/man4.i386/npx.4 (revision ee2ea5ceafed78a5bd9810beb9e3ca927180c226)
1.\"
2.\" Copyright (c) 1993 Christopher G. Demetriou
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\" 3. All advertising materials mentioning features or use of this software
14.\"    must display the following acknowledgement:
15.\"      This product includes software developed by Christopher G. Demetriou.
16.\" 3. The name of the author may not be used to endorse or promote products
17.\"    derived from this software without specific prior written permission
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\"	$Id: npx.4,v 1.1 1993/08/06 10:58:03 cgd Exp $
31.\" $FreeBSD$
32.\"
33.Dd August 28, 1993
34.Dt NPX 4 i386
35.Os
36.Sh NAME
37.Nm npx
38.Nd Numeric Processing Extension coprocessor and emulator
39.Sh SYNOPSIS
40.Cd "device npx"
41.Cd hint.npx.0.at="nexus"
42.Cd hint.npx.0.port="0x0F0"
43.Cd hint.npx.0.flags="0x0"
44.Cd hint.npx.0.irq="13"
45.Pp
46For hosts without a FPU coprocessor add:
47.Cd "options MATH_EMULATE"
48or
49.Cd "options GPL_MATH_EMULATE"
50.Sh DESCRIPTION
51The
52.Nm
53driver enables the use of the system's Numeric Processing Extension
54coprocessor,
55if one is present.
56Numeric processing extensions are present in
57systems with
58.Tn 486DX
59CPUs and in systems with
60.Tn 387
61or
62.Tn 487SX
63coprocessors.
64The
65.Nm
66driver is required for proper system functioning regardless
67of whether or not a NPX is present.
68.Pp
69If there is no NPX present in the system, the
70.Dv MATH_EMULATE
71or
72.Dv GPL_MATH_EMULATE
73option must be defined in the kernel configuration
74file.
75It will provide support for the instructions normally executed by the NPX.
76If there is no NPX in the system and the kernel is not built with math
77emulation, the system will not boot.
78.Pp
79You can choose to use a much more fully-featured math emulator (under the
80GPL license) by including the
81.Cd "options GPL_MATH_EMULATE"
82in your kernel
83configuration file instead of the
84.Dv MATH_EMULATE
85option.
86.Pp
87The
88.Pa GENERIC
89kernel configuration uses the
90.Dv MATH_EMULATE
91option.
92.Pp
93The flags for
94.Pa npx0
95are:
96.Pp
97.Bl -tag -width indent -compact
98.It 0x01
99do not use the NPX registers to optimize bcopy.
100.It 0x02
101do not use the NPX registers to optimize bzero.
102.It 0x04
103do not use the NPX registers to optimize copyin or copyout.
104.It 0x08
105use emulator even if hardware FPU is available.
106.El
107.Pp
108The NPX registers are normally used
109to optimize copying and zeroing
110when all of the following conditions are satisfied:
111.Pp
112.Bl -enum -compact
113.It
114.Cd "cpu I586_CPU"
115is an option
116.It
117the CPU is an i586 (perhaps not a Pentium)
118.It
119the probe for
120.Pa npx0
121succeeds
122.It
123INT 16 exception handling works.
124.El
125.Pp
126Then copying and zeroing
127using the NPX registers
128is normally 30-100% faster.
129.Pp
130The flags can be used
131to control cases
132where it does not work or is slower.
133Setting them at boot time
134using userconfig works correctly
135(the optimizations are not used
136until later in the bootstrap
137when
138.Pa npx0
139is attached).
140Flag 0x08 automatically disables the i586 optimized routines.
141.Sh CAVEATS
142The emulator is much slower than the NPX coprocessor.
143This will result in poor floating-point math performance
144if the emulator must be used.
145.Pp
146The non-GPL emulator does not support the whole set of NPX
147instructions.
148It is sufficient for booting and configuring a system, but it cannot
149support a system with normal workload unless care is taken to compile
150the whole system (including third-party packages) with compiler
151options that avoid the use of the non-emulated instructions.
152.Sh BUGS
153There are lots of them, especially on old cheap motherboards.
154In particular, some motherboards do not have the interrupt lines from
155the NPX to the CPU wired properly.
156If this is the case, the emulator must be used if consistent system
157operation is desired.
158.Pp
159When using the default
160.Dv MATH_EMULATE
161option,
162transcendental function instructions are not implemented.
163Emulation of other instructions is suspect.
164