Merge branch '86Box:master' into nec-v20
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/gdbstub.h>
|
||||
#include "386_common.h"
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#include "codegen.h"
|
||||
@@ -256,6 +257,11 @@ exec386(int cycs)
|
||||
|
||||
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc))
|
||||
timer_process_inline();
|
||||
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_instruction())
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/gdbstub.h>
|
||||
#ifdef USE_DYNAREC
|
||||
#include "codegen.h"
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
@@ -858,6 +859,11 @@ exec386_dynarec(int cycs)
|
||||
if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc))
|
||||
timer_process_inline();
|
||||
}
|
||||
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_instruction())
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
cycles_main -= (cycles_start - cycles);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <86box/mem.h>
|
||||
#include <86box/nmi.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/gdbstub.h>
|
||||
#include "codegen.h"
|
||||
|
||||
#define CPU_BLOCK_END() cpu_block_end = 1
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <86box/pic.h>
|
||||
#include <86box/ppi.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/gdbstub.h>
|
||||
|
||||
/* Is the CPU 8088 or 8086. */
|
||||
int is8086 = 0;
|
||||
@@ -2833,5 +2834,10 @@ execx86(int cycs)
|
||||
|
||||
cpu_alu_op = 0;
|
||||
}
|
||||
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_instruction())
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <86box/nmi.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/pci.h>
|
||||
#include <86box/gdbstub.h>
|
||||
#ifdef USE_DYNAREC
|
||||
# include "codegen.h"
|
||||
#endif
|
||||
@@ -1395,6 +1396,7 @@ cpu_set(void)
|
||||
cpu_exec = exec386;
|
||||
else
|
||||
cpu_exec = execx86;
|
||||
gdbstub_cpu_init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
static int opINT3(uint32_t fetchdat)
|
||||
{
|
||||
int cycles_old = cycles; UN_USED(cycles_old);
|
||||
#ifdef USE_GDBSTUB
|
||||
if (gdbstub_int3())
|
||||
return 1;
|
||||
#endif
|
||||
if ((cr0 & 1) && (cpu_state.eflags & VM_FLAG) && (IOPL != 3))
|
||||
{
|
||||
x86gpf(NULL,0);
|
||||
|
||||
@@ -239,89 +239,25 @@ static __inline int64_t x87_fround(double b)
|
||||
|
||||
return 0LL;
|
||||
}
|
||||
#define BIAS80 16383
|
||||
#define BIAS64 1023
|
||||
|
||||
#include "x87_ops_conv.h"
|
||||
|
||||
static __inline double x87_ld80()
|
||||
{
|
||||
int64_t exp64;
|
||||
int64_t blah;
|
||||
int64_t exp64final;
|
||||
int64_t mant64;
|
||||
int64_t sign;
|
||||
struct {
|
||||
int16_t begin;
|
||||
union
|
||||
{
|
||||
double d;
|
||||
uint64_t ll;
|
||||
} eind;
|
||||
} test;
|
||||
test.eind.ll = readmeml(easeg,cpu_state.eaaddr);
|
||||
test.eind.ll |= (uint64_t)readmeml(easeg,cpu_state.eaaddr+4)<<32;
|
||||
test.begin = readmemw(easeg,cpu_state.eaaddr+8);
|
||||
|
||||
exp64 = (((test.begin&0x7fff) - BIAS80));
|
||||
blah = ((exp64 >0)?exp64:-exp64)&0x3ff;
|
||||
exp64final = ((exp64 >0)?blah:-blah) +BIAS64;
|
||||
|
||||
mant64 = (test.eind.ll >> 11) & (0xfffffffffffffll);
|
||||
sign = (test.begin&0x8000)?1:0;
|
||||
|
||||
if ((test.begin & 0x7fff) == 0x7fff)
|
||||
exp64final = 0x7ff;
|
||||
if ((test.begin & 0x7fff) == 0)
|
||||
exp64final = 0;
|
||||
if (test.eind.ll & 0x400)
|
||||
mant64++;
|
||||
|
||||
test.eind.ll = (sign <<63)|(exp64final << 52)| mant64;
|
||||
|
||||
return test.eind.d;
|
||||
x87_conv_t test;
|
||||
test.eind.ll = readmeml(easeg,cpu_state.eaaddr);
|
||||
test.eind.ll |= (uint64_t)readmeml(easeg,cpu_state.eaaddr+4)<<32;
|
||||
test.begin = readmemw(easeg,cpu_state.eaaddr+8);
|
||||
return x87_from80(&test);
|
||||
}
|
||||
|
||||
static __inline void x87_st80(double d)
|
||||
{
|
||||
int64_t sign80;
|
||||
int64_t exp80;
|
||||
int64_t exp80final;
|
||||
int64_t mant80;
|
||||
int64_t mant80final;
|
||||
|
||||
struct {
|
||||
int16_t begin;
|
||||
union
|
||||
{
|
||||
double d;
|
||||
uint64_t ll;
|
||||
} eind;
|
||||
} test;
|
||||
|
||||
test.eind.d=d;
|
||||
|
||||
sign80 = (test.eind.ll&(0x8000000000000000ll))?1:0;
|
||||
exp80 = test.eind.ll&(0x7ff0000000000000ll);
|
||||
exp80final = (exp80>>52);
|
||||
mant80 = test.eind.ll&(0x000fffffffffffffll);
|
||||
mant80final = (mant80 << 11);
|
||||
|
||||
if (exp80final == 0x7ff) /*Infinity / Nan*/
|
||||
{
|
||||
exp80final = 0x7fff;
|
||||
mant80final |= (0x8000000000000000ll);
|
||||
}
|
||||
else if (d != 0){ /* Zero is a special case */
|
||||
/* Elvira wants the 8 and tcalc doesn't */
|
||||
mant80final |= (0x8000000000000000ll);
|
||||
/* Ca-cyber doesn't like this when result is zero. */
|
||||
exp80final += (BIAS80 - BIAS64);
|
||||
}
|
||||
test.begin = (((int16_t)sign80)<<15)| (int16_t)exp80final;
|
||||
test.eind.ll = mant80final;
|
||||
|
||||
writememl(easeg,cpu_state.eaaddr,test.eind.ll & 0xffffffff);
|
||||
writememl(easeg,cpu_state.eaaddr+4,test.eind.ll>>32);
|
||||
writememw(easeg,cpu_state.eaaddr+8,test.begin);
|
||||
x87_conv_t test;
|
||||
x87_to80(d, &test);
|
||||
writememl(easeg,cpu_state.eaaddr,test.eind.ll & 0xffffffff);
|
||||
writememl(easeg,cpu_state.eaaddr+4,test.eind.ll>>32);
|
||||
writememw(easeg,cpu_state.eaaddr+8,test.begin);
|
||||
}
|
||||
|
||||
static __inline void x87_st_fsave(int reg)
|
||||
|
||||
68
src/cpu/x87_ops_conv.h
Normal file
68
src/cpu/x87_ops_conv.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#define BIAS80 16383
|
||||
#define BIAS64 1023
|
||||
|
||||
typedef struct {
|
||||
int16_t begin;
|
||||
union {
|
||||
double d;
|
||||
uint64_t ll;
|
||||
} eind;
|
||||
} x87_conv_t;
|
||||
|
||||
static __inline double x87_from80(x87_conv_t *test)
|
||||
{
|
||||
int64_t exp64;
|
||||
int64_t blah;
|
||||
int64_t exp64final;
|
||||
int64_t mant64;
|
||||
int64_t sign;
|
||||
|
||||
exp64 = (((test->begin&0x7fff) - BIAS80));
|
||||
blah = ((exp64 >0)?exp64:-exp64)&0x3ff;
|
||||
exp64final = ((exp64 >0)?blah:-blah) +BIAS64;
|
||||
|
||||
mant64 = (test->eind.ll >> 11) & (0xfffffffffffffll);
|
||||
sign = (test->begin&0x8000)?1:0;
|
||||
|
||||
if ((test->begin & 0x7fff) == 0x7fff)
|
||||
exp64final = 0x7ff;
|
||||
if ((test->begin & 0x7fff) == 0)
|
||||
exp64final = 0;
|
||||
if (test->eind.ll & 0x400)
|
||||
mant64++;
|
||||
|
||||
test->eind.ll = (sign <<63)|(exp64final << 52)| mant64;
|
||||
|
||||
return test->eind.d;
|
||||
}
|
||||
|
||||
static __inline void x87_to80(double d, x87_conv_t *test)
|
||||
{
|
||||
int64_t sign80;
|
||||
int64_t exp80;
|
||||
int64_t exp80final;
|
||||
int64_t mant80;
|
||||
int64_t mant80final;
|
||||
|
||||
test->eind.d=d;
|
||||
|
||||
sign80 = (test->eind.ll&(0x8000000000000000ll))?1:0;
|
||||
exp80 = test->eind.ll&(0x7ff0000000000000ll);
|
||||
exp80final = (exp80>>52);
|
||||
mant80 = test->eind.ll&(0x000fffffffffffffll);
|
||||
mant80final = (mant80 << 11);
|
||||
|
||||
if (exp80final == 0x7ff) /*Infinity / Nan*/
|
||||
{
|
||||
exp80final = 0x7fff;
|
||||
mant80final |= (0x8000000000000000ll);
|
||||
}
|
||||
else if (d != 0){ /* Zero is a special case */
|
||||
/* Elvira wants the 8 and tcalc doesn't */
|
||||
mant80final |= (0x8000000000000000ll);
|
||||
/* Ca-cyber doesn't like this when result is zero. */
|
||||
exp80final += (BIAS80 - BIAS64);
|
||||
}
|
||||
test->begin = (((int16_t)sign80)<<15)| (int16_t)exp80final;
|
||||
test->eind.ll = mant80final;
|
||||
}
|
||||
Reference in New Issue
Block a user