Re: Proposed floating point changes (Re: Using float emulator on a system with FPU?)

1999-07-22 Thread Douglas Thomas Crosher


> +  * The macro to choose one of these values does these steps: 1) Throw
> +  * away status word bits that cannot be masked. 2) Throw away the bits
> +  * currently masked in the control word, assuming the user isn't
> +  * interested in them anymore. 3) Reinsert status word bit 7 (stack

Throwing away the status bits is rather restricting.  This restriction
could be avoided by passing back the status word within the third
argument. A library function could be provided to implement your error
code mapping while not limiting the kernel interface.

Regards
Douglas Crosher


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



Proposed floating point changes (Re: Using float emulator on a system with FPU?)

1999-07-22 Thread Martin Cracauer

In <[EMAIL PROTECTED]>, Bruce Evans wrote: 
> >Guessing from LINT's comments, you had to leave out npx and include
> >one of the emulators, but -current's config refuses to config a kernel
> >file without npx support.
> 
> This was broken by adding "mandatory" to the npx line in file.i386.
> 
> >I also tried to add "disable" to npx's config line, which compiles and
> >runs ok, but still uses the hardware FPU (timing and exception test). 
> 
> This may be because npx0 now attaches to nexus, but "disable" only works
> for isa devices.  It's annoying that userconfig doesn't support displaying
> or changing npx0.  BTW, PCI devices are no longer displayed by userconfig.

The following diff makes FPU and FPU emulators selectable from
userconfig. npx0 is still mandatory, but it gets an additional flag
bit 0x08, which requests the hardware FPU to be ignored and an
emulator to be used if one is compiled in. If none is compiled into
the kernel, a warning is printed and the hardware FPU is used.

The diff also contains the FPE trapcode stuff, which is now found to
run with GPL_MATH_EMUL (although actualy computing of error codes
isn't done in this case) and not to make things worse for (non-GPL)
MATH_EMUL.

I plan to commit this, unless someone objets (the impressive-looking
trapcode table is only 127 bytes in size, to pre-comment on one
issue).

Martin
-- 
%
Martin Cracauer <[EMAIL PROTECTED]> http://www.cons.org/cracauer/
  Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536


Index: i386/conf/LINT
===
RCS file: /home/CVS-FreeBSD/src/sys/i386/conf/LINT,v
retrieving revision 1.617
diff -c -r1.617 LINT
*** LINT1999/07/09 04:29:56 1.617
--- LINT1999/07/22 22:16:32
***
*** 956,973 
  options   SC_NO_SYSMOUSE
  
  #
! # The Numeric Processing eXtension driver.  This should be configured if
! # your machine has a math co-processor, unless the coprocessor is very
! # buggy. If it is not configured then you *must* configure math emulation
! # (see above).  If both npx0 and emulation are configured, then only npx0
! # is used (provided it works).
  devicenpx0at nexus? port IO_NPX flags 0x0 irq 13
  
  #
  # `flags' for npx0:
! # 0x01don't use the npx registers to optimize bcopy
! # 0x02don't use the npx registers to optimize bzero
  # 0x04don't use the npx registers to optimize copyin or copyout.
  # The npx registers are normally used to optimize copying and zeroing when
  # all of the following conditions are satisfied:
  # I586_CPU is an option
--- 956,975 
  options   SC_NO_SYSMOUSE
  
  #
! # The Numeric Processing eXtension driver. In addition to this, you
! # may configure a math emulator (see above). If your machine has a
! # hardware FPU and the kernel configuration includes the npx device
! # *and* a math emulator compiled into the kernel, the hardware FPU
! # will be used, unless it is found to be broken or unless "flags" to
! # npx0 includes "0x08", which requests preference for the emulator.
  devicenpx0at nexus? port IO_NPX flags 0x0 irq 13
  
  #
  # `flags' for npx0:
! # 0x01don't use the npx registers to optimize bcopy.
! # 0x02don't use the npx registers to optimize bzero.
  # 0x04don't use the npx registers to optimize copyin or copyout.
+ # 0x08use emulator even if hardware FPU is available.
  # The npx registers are normally used to optimize copying and zeroing when
  # all of the following conditions are satisfied:
  # I586_CPU is an option
***
*** 978,983 
--- 980,988 
  # The flags can be used to control cases where it doesn't work or is slower.
  # Setting them at boot time using userconfig works right (the optimizations
  # are not used until later in the bootstrap when npx0 is attached).
+ # Flag 0x08 does not imply any settings of the other flags, you may run
+ # with FPU preference set to emulator, but still using the i586 optimized
+ # memory routines.
  #
  
  #
***
*** 1149,1154 
--- 1154,1160 
  # higher priority console).  This replaces the COMCONSOLE option.
  # 0x40reserve this unit for low level console operations.  Do not
  # access the device in any normal way.
+ # 0x80use this port for serial line gdb support in ddb.
  #
  # PnP `flags' (set via userconfig using pnp x flags y)
  # 0x1 disable probing of this device.  Used to prevent your modem
Index: i386/i386/trap.c
===
RCS file: /home/CVS-FreeBSD/src/sys/i386/i386/trap.c,v
retrieving revision 1.139
diff -c -r1.139 trap.c
*** trap.c  1999/06/18 14:32:16 1.139
--- trap.c  1999/07/22 19:13:55
***
*** 360,366 
break;
  
case T_DIVIDE: