mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
added float support
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@15 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
@@ -8,6 +8,7 @@ LDFLAGS=-g
|
||||
LIBS=
|
||||
CC=gcc
|
||||
DEFINES=-DHAVE_BYTESWAP_H
|
||||
OP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),ppc)
|
||||
@@ -24,6 +25,7 @@ CRTEND=$(GCC_LIBS_DIR)/crtend.o
|
||||
LDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN)
|
||||
LIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN)
|
||||
DEFINES=-Dsocklen_t=int
|
||||
OP_CFLAGS=$(CFLAGS)
|
||||
endif
|
||||
|
||||
#########################################################
|
||||
@@ -31,7 +33,7 @@ endif
|
||||
DEFINES+=-D_GNU_SOURCE -DGEMU -DDOSEMU -DNO_TRACE_MSGS
|
||||
DEFINES+=-DCONFIG_PREFIX=\"/usr/local\"
|
||||
LDSCRIPT=$(ARCH).ld
|
||||
LIBS+=-ldl
|
||||
LIBS+=-ldl -lm
|
||||
|
||||
OBJS= i386/fp87.o i386/interp_main.o i386/interp_modrm.o i386/interp_16_32.o \
|
||||
i386/interp_32_16.o i386/interp_32_32.o i386/emu-utils.o \
|
||||
@@ -67,7 +69,7 @@ op-i386.h: op-i386.o dyngen
|
||||
./dyngen -o $@ $<
|
||||
|
||||
op-i386.o: op-i386.c opreg_template.h ops_template.h
|
||||
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
$(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
- threads
|
||||
- fix printf for doubles (fp87.c bug ?)
|
||||
- make it self runnable (use same trick as ld.so : include its own relocator and libc)
|
||||
- better FPU comparisons (ucom/com)
|
||||
|
||||
+51
@@ -75,6 +75,16 @@ enum {
|
||||
CC_OP_NB,
|
||||
};
|
||||
|
||||
#ifdef __i386__
|
||||
#define USE_X86LDOUBLE
|
||||
#endif
|
||||
|
||||
#ifdef USE_X86LDOUBLE
|
||||
typedef long double CPU86_LDouble;
|
||||
#else
|
||||
typedef double CPU86_LDouble;
|
||||
#endif
|
||||
|
||||
typedef struct CPU86State {
|
||||
/* standard registers */
|
||||
uint32_t regs[8];
|
||||
@@ -91,10 +101,18 @@ typedef struct CPU86State {
|
||||
uint8_t *segs_base[6];
|
||||
uint32_t segs[6];
|
||||
|
||||
/* FPU state */
|
||||
CPU86_LDouble fpregs[8];
|
||||
uint8_t fptags[8]; /* 0 = valid, 1 = empty */
|
||||
unsigned int fpstt; /* top of stack index */
|
||||
unsigned int fpus;
|
||||
unsigned int fpuc;
|
||||
|
||||
/* emulator internal variables */
|
||||
uint32_t t0; /* temporary t0 storage */
|
||||
uint32_t t1; /* temporary t1 storage */
|
||||
uint32_t a0; /* temporary a0 storage (address) */
|
||||
CPU86_LDouble ft0;
|
||||
} CPU86State;
|
||||
|
||||
static inline int ldub(void *ptr)
|
||||
@@ -122,6 +140,10 @@ static inline int ldl(void *ptr)
|
||||
return *(uint32_t *)ptr;
|
||||
}
|
||||
|
||||
static inline uint64_t ldq(void *ptr)
|
||||
{
|
||||
return *(uint64_t *)ptr;
|
||||
}
|
||||
|
||||
static inline void stb(void *ptr, int v)
|
||||
{
|
||||
@@ -138,11 +160,40 @@ static inline void stl(void *ptr, int v)
|
||||
*(uint32_t *)ptr = v;
|
||||
}
|
||||
|
||||
static inline void stq(void *ptr, int v)
|
||||
{
|
||||
*(uint64_t *)ptr = v;
|
||||
}
|
||||
|
||||
/* float access */
|
||||
|
||||
static inline float ldfl(void *ptr)
|
||||
{
|
||||
return *(float *)ptr;
|
||||
}
|
||||
|
||||
static inline double ldfq(void *ptr)
|
||||
{
|
||||
return *(double *)ptr;
|
||||
}
|
||||
|
||||
static inline void stfl(void *ptr, float v)
|
||||
{
|
||||
*(float *)ptr = v;
|
||||
}
|
||||
|
||||
static inline void stfq(void *ptr, double v)
|
||||
{
|
||||
*(double *)ptr = v;
|
||||
}
|
||||
|
||||
#ifndef IN_OP_I386
|
||||
void port_outb(int addr, int val);
|
||||
void port_outw(int addr, int val);
|
||||
void port_outl(int addr, int val);
|
||||
int port_inb(int addr);
|
||||
int port_inw(int addr);
|
||||
int port_inl(int addr);
|
||||
#endif
|
||||
|
||||
#endif /* CPU_I386_H */
|
||||
|
||||
@@ -243,6 +243,8 @@ void gen_code(const char *name, unsigned long offset, unsigned long size,
|
||||
if (n >= MAX_ARGS)
|
||||
error("too many arguments in %s", name);
|
||||
args_present[n - 1] = 1;
|
||||
} else {
|
||||
fprintf(outfile, "extern char %s;\n", sym_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,6 +259,8 @@ void gen_code(const char *name, unsigned long offset, unsigned long size,
|
||||
if (n >= MAX_ARGS)
|
||||
error("too many arguments in %s", name);
|
||||
args_present[n - 1] = 1;
|
||||
} else {
|
||||
fprintf(outfile, "extern char %s;\n", sym_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+150
-160
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user