Skip to content

Commit a4090b5

Browse files
committed
fpu, config: introduce $_ignore_fpe
To be able to run ipp540s, we can completely ignore floating point exceptions, by masking CWD and returning, so IRQ13 is never triggered. Fixes dosemu2#2724
1 parent 9e0e524 commit a4090b5

File tree

6 files changed

+19
-2
lines changed

6 files changed

+19
-2
lines changed

etc/dosemu.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777

7878
# $_mathco = (on)
7979

80+
# ignore floating point exceptions, (off) or (on), default = (off)
81+
# this helps for e.g. ipp540s which FPEs on CPUs that are fast enough
82+
83+
# $_ignore_fpe = (off)
84+
8085
# 0 = all CPU power to DOSEMU; default = 1 = nicest, then higher:more CPU power
8186

8287
# $_hogthreshold = (1)

etc/global.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ else
107107

108108
timer 0
109109
mathco $_mathco
110+
ignore_fpe $_ignore_fpe
110111
$xxx = "cpu ", $_cpu;
111112
$$xxx
112113
cpuemu $$_cpuemu

src/base/emu-i386/cpu.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,15 @@ static void raise_fpu_irq(void)
361361

362362
int fpu_fpe_handler (unsigned char *csp)
363363
{
364+
if (config.ignore_fpe) {
365+
if (_CPU_VM_CURRENT() == CPUVM_KVM)
366+
kvm_get_fpu();
367+
dbug_printf("coprocessor exception, ignoring by masking in CW because of $_ignore_fpe\n");
368+
vm86_fpu_state.cwd |= 0x7f;
369+
if (_CPU_VM_CURRENT() == CPUVM_KVM)
370+
kvm_update_fpu();
371+
return 0;
372+
}
364373
if (fpu_ignne) {
365374
/* do some basic emulation:
366375
we only deal with control FPU instructions,

src/base/init/lexer.l

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ terminal RETURN(TERMINAL);
321321
video RETURN(VIDEO);
322322
emuretrace RETURN(EMURETRACE);
323323
mathco RETURN(MATHCO);
324+
ignore_fpe RETURN(IGNORE_FPE);
324325
cpu RETURN(CPU);
325326
cpuspeed RETURN(CPUSPEED);
326327
bootdrive RETURN(BOOTDRIVE);

src/base/init/parser.y

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ enum {
232232
%token FASTFLOPPY HOGTHRESH SPEAKER IPXSUPPORT IPXNETWORK NOVELLHACK
233233
%token ETHDEV TAPDEV VDESWITCH SLIRPARGS NETSOCK VNET
234234
%token DEBUG MOUSE SERIAL COM KEYBOARD TERMINAL VIDEO EMURETRACE TIMER
235-
%token MATHCO CPU CPUSPEED BOOTDRIVE SWAP_BOOTDRIVE
235+
%token MATHCO IGNORE_FPE CPU CPUSPEED BOOTDRIVE SWAP_BOOTDRIVE
236236
%token L_XMS L_DPMI DPMI_BASE PM_DOS_API NO_NULL_CHECKS
237237
%token PORTS DISK DOSMEM EXT_MEM
238238
%token L_EMS UMB_A0 UMB_B0 UMB_B8 UMB_F0 HMA DOS_UP
@@ -637,6 +637,7 @@ line: CHARSET '{' charset_flags '}' {}
637637
if ($2 > 0) c_printf("CONF: %dk bytes XMS memory\n", $2);
638638
}
639639
| MATHCO bool { config.mathco = ($2!=0); }
640+
| IGNORE_FPE bool { config.ignore_fpe = ($2!=0); }
640641
| IPXSUPPORT bool
641642
{
642643
config.ipxsup = ($2!=0);

src/include/emu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ typedef struct config_info {
225225
boolean exitearly;
226226
boolean quiet;
227227
int realcpu;
228-
boolean mathco, smp, cpuprefetcht0, cpufxsr, cpusse, umip;
228+
boolean mathco, ignore_fpe, smp, cpuprefetcht0, cpufxsr, cpusse, umip;
229229
boolean ipxsup;
230230
unsigned ipx_net;
231231
int vnet;

0 commit comments

Comments
 (0)