* configure.in: Add calls to AC_CONFIG_HEADER, AC_CHECK_HEADERS,

AC_CHECK_LIB, and AC_CHECK_FUNCS.  Change AC_OUTPUT to set
	stamp-h.
	* configure: Rebuild.
	* config.in: New file, generated by autoheader.
	* interp.c: Include "config.h".  Include <stdlib.h>, <string.h>,
	and <strings.h> if they exist.  Replace #ifdef sun with #ifdef
	HAVE_ANINT and HAVE_AINT, as appropriate.
	* Makefile.in (run): Use @LIBS@ rather than -lm.
	(interp.o): Depend upon config.h.
	(Makefile): Just rebuild Makefile.
	(clean): Remove stamp-h.
	(mostlyclean): Make the same as clean, not as distclean.
	(config.h, stamp-h): New targets.
This commit is contained in:
Ian Lance Taylor 1996-06-03 15:58:45 +00:00
parent 3b426f5a60
commit 4fa134beac
5 changed files with 1549 additions and 44 deletions

View File

@ -1,3 +1,25 @@
Mon Jun 3 11:55:03 1996 Ian Lance Taylor <ian@cygnus.com>
* configure.in: Add calls to AC_CONFIG_HEADER, AC_CHECK_HEADERS,
AC_CHECK_LIB, and AC_CHECK_FUNCS. Change AC_OUTPUT to set
stamp-h.
* configure: Rebuild.
* config.in: New file, generated by autoheader.
* interp.c: Include "config.h". Include <stdlib.h>, <string.h>,
and <strings.h> if they exist. Replace #ifdef sun with #ifdef
HAVE_ANINT and HAVE_AINT, as appropriate.
* Makefile.in (run): Use @LIBS@ rather than -lm.
(interp.o): Depend upon config.h.
(Makefile): Just rebuild Makefile.
(clean): Remove stamp-h.
(mostlyclean): Make the same as clean, not as distclean.
(config.h, stamp-h): New targets.
Fri May 10 00:41:17 1996 James G. Smith <jsmith@cygnus.co.uk>
* interp.c (ColdReset): Fix boolean test. Make all simulator
globals static.
Wed May 8 15:12:58 1996 James G. Smith <jsmith@cygnus.co.uk>
* interp.c (xfer_direct_word, xfer_direct_long,

136
sim/mips/Makefile.in Normal file
View File

@ -0,0 +1,136 @@
# Makefile template for Configure for the MIPS simulator.
# Written by Cygnus Support.
VPATH = @srcdir@:@srcdir@/../common:@srcdir@/../../gdb/
srcdir = @srcdir@
srcroot = $(srcdir)/../..
prefix = @prefix@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
target_alias = @target_alias@
program_transform_name = @program_transform_name@
bindir = $(exec_prefix)/bin
libdir = $(exec_prefix)/lib
tooldir = $(libdir)/$(target_alias)
datadir = $(prefix)/lib
mandir = $(prefix)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
man9dir = $(mandir)/man9
infodir = $(prefix)/info
includedir = $(prefix)/include
docdir = $(datadir)/doc
SHELL = /bin/sh
INSTALL = $(srcroot)/install.sh -c
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)
INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
AR = @AR@
AR_FLAGS = rc
CC = @CC@
CFLAGS = @CFLAGS@
MAKEINFO = makeinfo
RANLIB = @RANLIB@
CC_FOR_BUILD = @CC_FOR_BUILD@
HDEFINES = @HDEFINES@
TDEFINES =
.NOEXPORT:
MAKEOVERRIDES=
X=xstuff.o
XL=-lX11
X=
XL=
INCDIR = $(srcdir)/../../include
CSEARCH = -I. -I$(srcdir) -I../../include \
-I../../bfd -I$(INCDIR) -I$(srcdir)/../../bfd -I$(srcdir)/../../gdb -I$(srcdir)/../../newlib/libc/sys/idt
DEP = mkdep
all: run libsim.a
run: interp.o $(X) callback.o run.o
$(CC) $(CFLAGS) -o run $(X) interp.o callback.o run.o ../../bfd/libbfd.a ../../libiberty/libiberty.a $(XL) @LIBS@
interp.o:interp.c engine.c support.h config.h
run.o:run.c
libsim.a:interp.o
$(AR) $(ARFLAGS) $@ interp.o
$(RANLIB) $@
engine.c:gencode
./gencode -mips0 --warnings > $@
gencode:${srcdir}/gencode.c
$(CC_FOR_BUILD) -I${srcroot}/include -o $@ $< -liberty
.c.o:
$(CC) -c -DINSIDE_SIMULATOR $(CFLAGS) $(HDEFINES) $(TDEFINES) $(CSEARCH) $(CSWITCHES) $<
check:
info:
clean-info:
install-info:
tags etags: TAGS
TAGS: force
etags $(INCDIR)/*.h $(srcdir)/*.h $(srcdir)/*.c
clean mostlyclean:
rm -f *.[oa] *~ core *.E *.p *.ip aout-params.h gen-aout stamp-h
rm -f run libsim.a
distclean maintainer-clean realclean: clean
rm -f TAGS
rm -f Makefile config.cache config.log config.status
# Dummy target to force execution of dependent targets.
#
force:
# Copy the files into directories where they will be run.
install:
$(INSTALL_XFORM) run $(bindir)/run
install-man: run.1
$(INSTALL_XFORM1) $(srcdir)/run.1 $(man1dir)/run.1
Makefile: Makefile.in config.status
CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
config.h: stamp-h ; @true
stamp-h: config.in config.status
CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
config.status: configure
$(SHELL) ./config.status --recheck
dep: $(CFILES)
mkdep $(CFLAGS) $?
# What appears below is generated by a hacked mkdep using gcc -MM.
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY

1328
sim/mips/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.3)dnl
AC_INIT(Makefile.in)
AC_CONFIG_HEADER(config.h:config.in)
AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/../..)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
@ -24,4 +26,9 @@ else
fi
AC_SUBST(CC_FOR_BUILD)
AC_OUTPUT(Makefile)
AC_CHECK_HEADERS(string.h strings.h stdlib.h)
AC_CHECK_LIB(m, fabs)
AC_CHECK_FUNCS(aint anint)
AC_OUTPUT(Makefile,
[case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac])

View File

@ -40,6 +40,8 @@ code on the hardware.
#define PROFILE (1)
#endif
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <ansidecl.h>
@ -47,6 +49,16 @@ code on the hardware.
#include <ctype.h>
#include <limits.h>
#include <math.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#else
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#endif
#include "getopt.h"
#include "libiberty.h"
@ -177,8 +189,8 @@ static host_callback *callback = NULL; /* handle onto the current callback struc
/* To keep this default simulator simple, and fast, we use a direct
vector of registers. The internal simulator engine then uses
manifests to access the correct slot. */
ut_reg registers[LAST_EMBED_REGNUM + 1];
int register_widths[LAST_EMBED_REGNUM + 1];
static ut_reg registers[LAST_EMBED_REGNUM + 1];
static int register_widths[LAST_EMBED_REGNUM + 1];
#define GPR (&registers[0])
#if defined(HASFPU)
@ -208,19 +220,19 @@ int register_widths[LAST_EMBED_REGNUM + 1];
#define SP (registers[29])
#define RA (registers[31])
ut_reg EPC = 0; /* Exception PC */
static ut_reg EPC = 0; /* Exception PC */
#if defined(HASFPU)
/* Keep the current format state for each register: */
FP_formats fpr_state[32];
static FP_formats fpr_state[32];
#endif /* HASFPU */
/* VR4300 CP0 configuration register: */
unsigned int CONFIG = 0;
static unsigned int CONFIG = 0;
/* The following are internal simulator state variables: */
ut_reg IPC = 0; /* internal Instruction PC */
ut_reg DSPC = 0; /* delay-slot PC */
static ut_reg IPC = 0; /* internal Instruction PC */
static ut_reg DSPC = 0; /* delay-slot PC */
/* TODO : these should be the bitmasks for these bits within the
@ -301,12 +313,12 @@ ut_reg DSPC = 0; /* delay-slot PC */
the register update to be delayed for a single instruction
cycle. */
#define PSLOTS (5) /* Maximum number of instruction cycles */
int pending_in;
int pending_out;
int pending_total;
int pending_slot_count[PSLOTS];
int pending_slot_reg[PSLOTS];
ut_reg pending_slot_value[PSLOTS];
static int pending_in;
static int pending_out;
static int pending_total;
static int pending_slot_count[PSLOTS];
static int pending_slot_reg[PSLOTS];
static ut_reg pending_slot_value[PSLOTS];
/* The following are not used for MIPS IV onwards: */
#define PENDING_FILL(r,v) {\
@ -324,7 +336,7 @@ printf("DBG: FILL reg %d value = 0x%08X%08X\n",(r),WORD64HI(v),WORD64LO(v
printf("DBG: FILL AFTER pending_in = %d, pending_out = %d, pending_total = %d\n",pending_in,pending_out,pending_total);\
}
int LLBIT = 0;
static int LLBIT = 0;
/* LLBIT = Load-Linked bit. A bit of "virtual" state used by atomic
read-write instructions. It is set when a linked load occurs. It is
tested and cleared by the conditional store. It is cleared (during
@ -332,8 +344,8 @@ int LLBIT = 0;
be atomic. In particular, it is cleared by exception return
instructions. */
int HIACCESS = 0;
int LOACCESS = 0;
static int HIACCESS = 0;
static int LOACCESS = 0;
/* The HIACCESS and LOACCESS counts are used to ensure that
corruptions caused by using the HI or LO register to close to a
following operation are spotted. */
@ -384,9 +396,9 @@ int LOACCESS = 0;
/* At the moment these values will be the same, since we do not have
access to the pipeline cycle count information from the simulator
engine. */
unsigned int instruction_fetches = 0;
unsigned int instruction_fetch_overflow = 0;
unsigned int pipeline_ticks = 0;
static unsigned int instruction_fetches = 0;
static unsigned int instruction_fetch_overflow = 0;
static unsigned int pipeline_ticks = 0;
#endif
/* Flags in the "state" variable: */
@ -408,8 +420,8 @@ unsigned int pipeline_ticks = 0;
#define simEXCEPTION (1 << 26) /* 0 = no exception; 1 = exception has occurred */
#define simEXIT (1 << 27) /* 0 = do nothing; 1 = run-time exit() processing */
unsigned int state = 0;
unsigned int rcexit = 0; /* _exit() reason code holder */
static unsigned int state = 0;
static unsigned int rcexit = 0; /* _exit() reason code holder */
#define DELAYSLOT() {\
if (state & simDELAYSLOT) callback->printf_filtered(callback,"SIM Warning: Delay slot already activated (branch in delay slot?)\n");\
@ -427,27 +439,27 @@ unsigned int rcexit = 0; /* _exit() reason code holder */
#define K1SIZE (0x20000000)
/* Very simple memory model to start with: */
unsigned char *membank = NULL;
ut_reg membank_base = K1BASE;
unsigned membank_size = (1 << 20); /* (16 << 20); */ /* power-of-2 */
static unsigned char *membank = NULL;
static ut_reg membank_base = K1BASE;
static unsigned membank_size = (1 << 20); /* (16 << 20); */ /* power-of-2 */
/* Simple run-time monitor support */
unsigned char *monitor = NULL;
ut_reg monitor_base = 0xBFC00000;
unsigned monitor_size = (1 << 11); /* power-of-2 */
static unsigned char *monitor = NULL;
static ut_reg monitor_base = 0xBFC00000;
static unsigned monitor_size = (1 << 11); /* power-of-2 */
#if defined(TRACE)
char *tracefile = "trace.din"; /* default filename for trace log */
FILE *tracefh = NULL;
static char *tracefile = "trace.din"; /* default filename for trace log */
static FILE *tracefh = NULL;
#endif /* TRACE */
#if defined(PROFILE)
unsigned profile_frequency = 256;
unsigned profile_nsamples = (128 << 10);
unsigned short *profile_hist = NULL;
ut_reg profile_minpc;
ut_reg profile_maxpc;
int profile_shift = 0; /* address shift amount */
static unsigned profile_frequency = 256;
static unsigned profile_nsamples = (128 << 10);
static unsigned short *profile_hist = NULL;
static ut_reg profile_minpc;
static ut_reg profile_maxpc;
static int profile_shift = 0; /* address shift amount */
#endif /* PROFILE */
/* The following are used to provide shortcuts to the required version
@ -458,10 +470,10 @@ typedef unsigned int (*fnptr_swap_word) PARAMS((unsigned int data));
typedef uword64 (*fnptr_read_long) PARAMS((unsigned char *memory));
typedef uword64 (*fnptr_swap_long) PARAMS((uword64 data));
fnptr_read_word host_read_word;
fnptr_read_long host_read_long;
fnptr_swap_word host_swap_word;
fnptr_swap_long host_swap_long;
static fnptr_read_word host_read_word;
static fnptr_read_long host_read_long;
static fnptr_swap_word host_swap_word;
static fnptr_swap_long host_swap_long;
/*---------------------------------------------------------------------------*/
/*-- GDB simulator interface ------------------------------------------------*/
@ -3185,7 +3197,7 @@ Convert(rm,op,from,to)
/* Round result to nearest representable value. When two
representable values are equally near, round to the value
that has a least significant bit of zero (i.e. is even). */
#if defined(sun)
#ifdef HAVE_ANINT
tmp = (float)anint((double)tmp);
#else
/* TODO: Provide round-to-nearest */
@ -3195,7 +3207,7 @@ Convert(rm,op,from,to)
case FP_RM_TOZERO:
/* Round result to the value closest to, and not greater in
magnitude than, the result. */
#if defined(sun)
#ifdef HAVE_AINT
tmp = (float)aint((double)tmp);
#else
/* TODO: Provide round-to-zero */
@ -3241,7 +3253,7 @@ Convert(rm,op,from,to)
switch (rm) {
case FP_RM_NEAREST:
#if defined(sun)
#ifdef HAVE_ANINT
tmp = anint(*(double *)&tmp);
#else
/* TODO: Provide round-to-nearest */
@ -3249,7 +3261,7 @@ Convert(rm,op,from,to)
break;
case FP_RM_TOZERO:
#if defined(sun)
#ifdef HAVE_AINT
tmp = aint(*(double *)&tmp);
#else
/* TODO: Provide round-to-zero */