Commit Graph

672 Commits

Author SHA1 Message Date
Andrew Cagney
a4c97499d9 Instruction decode generator taken from the PowerPC simulator
and being made more generic.
1997-02-21 02:49:21 +00:00
Andrew Cagney
317df3b530 Add d30v simulator configuration but sanatize it out. 1997-02-21 02:44:57 +00:00
Andrew Cagney
332cb5d943 Make useful macro's and functions found in the PowerPC simulator
directory more widely available.
1997-02-21 02:42:48 +00:00
Michael Meissner
b934926eac Since d10v is public now, remove all sanitization statements 1997-02-20 17:00:14 +00:00
Michael Meissner
c6c7035cfb Since d10v is public now, remove all sanitization statements 1997-02-20 16:05:18 +00:00
Gavin Romig-Koch
528031fd49 Correct test for ISA dependent bits 1997-02-20 15:48:57 +00:00
Jeff Law
8f06365c2f * configure.in: Don't require GCC to build the mn10200
simulator anymore.
        * configure: Rebuilt.
1997-02-20 06:19:13 +00:00
Mark Alexander
7e05106dc8 * interp.c (simopen): Add support for LSI MiniRISC PMON vectors. 1997-02-19 22:44:02 +00:00
Gavin Romig-Koch
2d18fbc668 Correct flags for PMADDUW insn 1997-02-18 22:15:04 +00:00
Andrew Cagney
d7e89eaff8 Per PR 11678 - also need to maintan .Sanitize 1997-02-14 21:58:48 +00:00
Andrew Cagney
cdd3120398 PR 11678 - rename long decode-rule files to shorter ones, eliminate
need for multiple almost identical decode-rule files
1997-02-14 19:06:08 +00:00
Ian Lance Taylor
bd2f63470e * gencode.c (build_mips16_operands): Correct computation of base
address for extended PC relative instruction.
1997-02-13 19:08:55 +00:00
Michael Meissner
37404956b4 New version from Andrew; Portability fixes on top of that 1997-02-11 20:19:28 +00:00
Michael Meissner
f9114af581 Fix warnings when compiling callback.c 1997-02-11 18:56:35 +00:00
Michael Meissner
c45adab0b9 Silence warnings in ppc simulator 1997-02-11 18:48:40 +00:00
Gavin Romig-Koch
276c2d7dc8 Add r5900 1997-02-11 13:26:34 +00:00
Ian Lance Taylor
da0bce9c27 * interp.c (mips16_entry): Add support for floating point cases.
(SignalException): Pass floating point cases to mips16_entry.
	(ValueFPR): Don't restrict fmt_single and fmt_word to even
	registers.
	(StoreFPR): Likewise.  Also, don't clobber fpr + 1 for fmt_single
	or fmt_word.
	(COP_LW): Pass fmt_word rather than fmt_uninterpreted to StoreFPR,
	and then set the state to fmt_uninterpreted.
	(COP_SW): Temporarily set the state to fmt_word while calling
	ValueFPR.
1997-02-06 22:19:05 +00:00
David Edelsohn
4234ffa28d Fix thinkos in last change. 1997-02-05 21:46:43 +00:00
David Edelsohn
2a2eda4daf * configure.in: Don't configure any subdirs if no simulator
is being built.  Don't use erc32 for sparc64.
	* configure: Regenerated.
1997-02-05 21:29:32 +00:00
David Edelsohn
ce3189da63 * Makefile.in (@COMMON_MAKEFILE_FRAG): Use
COMMON_{PRE,POST}_CONFIG_FRAG instead.
	* configure.in: sinclude ../common/aclocal.m4.
	* configure: Regenerated.
1997-02-04 22:07:50 +00:00
David Edelsohn
cef84fb394 * configure.in: Fix typo in test for callback.c.
* configure: Regenerated.
1997-02-04 22:05:00 +00:00
Ian Lance Taylor
6389d8561c * gencode.c (build_instruction): The high order may be set in the
comparison flags at any ISA level, not just ISA 4.
1997-02-04 21:48:54 +00:00
David Edelsohn
19c5af72af * Makefile.in (@COMMON_MAKEFILE_FRAG): Use
COMMON_{PRE,POST}_CONFIG_FRAG instead.
	* configure.in: sinclude ../common/aclocal.m4.
	* configure: Regenerated.
1997-02-04 21:42:27 +00:00
David Edelsohn
1cc9ed2959 * Makefile.in (libcommon.a): Delete.
(callback.o,targ-map.o): Delete, moved to Make-common.in.
	(gentmap,targ-vals.h,targ-map.c): Likewise.
	(run-autoconf): Delete.
	* aclocal.m4 (SIM_AC_OUTPUT): Redo creation of Makefile.
	(common makefile fragment): Moved back into ...
	* Make-common.in: Resurrect.
	* configure.in (AC_LINK_FILES): Delete, unnecessary now.
	* configure: Regenerated.
1997-02-04 21:32:42 +00:00
David Edelsohn
111c0666a7 * Makefile.in (@COMMON_MAKEFILE_FRAG@): Use
COMMON_{PRE,POST}_CONFIG_FRAG instead.
	* configure.in: sinclude ../common/aclocal.m4.
	* configure: Regenerated.
1997-02-04 21:24:23 +00:00
David Edelsohn
27b9abfd02 * Makefile.in (autoconf-common): New target.
* configure.in: Do configure common.
	* configure: Regenerated.
1997-02-04 21:21:30 +00:00
David Edelsohn
117224eaaf Docs on configury mostly. 1997-02-04 21:19:08 +00:00
Ian Lance Taylor
736a306cb2 * configure: Rebuild after change to aclocal.m4. 1997-01-31 16:12:09 +00:00
David Edelsohn
8cd89e778d * aclocal.m4 (SIM_AC_COMMON): Move COMMON_MAKEFILE_FRAG from here.
(SIM_AC_OUTPUT): To here.
1997-01-31 15:20:26 +00:00
Michael Meissner
54973b801f Fix from Cagney so that new common files do not show up when using psim on old gdbs 1997-01-30 00:55:18 +00:00
Michael Meissner
d2e3d3af16 build callback and targ-map from the common directory 1997-01-29 17:42:14 +00:00
Michael Meissner
5c04f4f7fc January 23rd merge 1997-01-27 21:34:50 +00:00
Stu Grossman
ae0d7848d8 * ../common/aclocal.m4 (COMMON_MAKEFILE_FRAG): Quote a couple of $'s in
comments and single quotes.  Fixes a problem found on hpux.
1997-01-24 18:44:29 +00:00
Stu Grossman
76e2c9aeb7 * aclocal.m4 (COMMON_MAKEFILE_FRAG): Quote a couple of $'s in
comments and single quotes.  Fixes a problem found on hpux.
1997-01-24 18:42:34 +00:00
Jeff Law
018f9eb41f * interp.c (init_system): Allocate 2^19 bytes of space for the
simulator.
To match the linker.
1997-01-24 17:48:35 +00:00
Stu Grossman
a695143eae * configure: Remove targ-vals.def when doing distclean. (Change
is actually in ../common/aclocal.m4.)
1997-01-24 00:44:03 +00:00
Stu Grossman
42653e99b8 * (distclean): Remove targ-vals.def. 1997-01-24 00:38:32 +00:00
Stu Grossman
2757866e9e * configure: Remove Make-common.in from dependencies. (Actually in
../common/aclocal.m4).
1997-01-24 00:04:57 +00:00
Stu Grossman
e1dfb8c53c * aclocal.m4: Remove Make-common.in from dependencies. 1997-01-24 00:03:05 +00:00
Stu Grossman
295dbbe44c * configure configure.in Makefile.in: Update to new configure
scheme which is more compatible with WinGDB builds.
	* configure.in:  Improve comment on how to run autoconf.
	* configure:  Re-run autoconf to get new ../common/aclocal.m4.
	* Makefile.in:  Use autoconf substitution to install common
	makefile fragment.
1997-01-23 22:09:52 +00:00
Stu Grossman
80b7b3a50c * aclocal.m4 (SIM_AC_COMMON): Move contents of Make-common.in
into here.  Makes insertion into makefiles easier.  Also, change
	the way that callback.o, gentmap, targ-vals.h, targ-map.c,
	targ-map.o, and run are built.  They are now built in the
	individual simulator directories, taking sources from ../common as
	necessary.  This replaces the merging of libcommon.a into
	linsim.a, which was problematic for the WinGDB build process.
	* run.c:  Include config.h from . instead of ../common.
	* Make-common.in:  Remove.  It's no longer necessary.
1997-01-23 22:08:21 +00:00
Stu Grossman
6e1510a27d * configure configure.in: Don't configure common anymore. Files
from common are now built in the individual simualtor directories.
	This fixes problems with the WinGDB build procedure.
1997-01-23 22:07:08 +00:00
Jeff Law
f95251f068 * simops.c: Undo last change to "rol" and "ror", original code
was correct!
1997-01-21 22:03:39 +00:00
Michael Meissner
5a8023e5ba Multiply ops sign extend, not zero extend 1997-01-20 21:06:48 +00:00
Jeff Law
b4b290a020 * simops.c: Fix "rol" and "ror".
Something I noticed while working on the mn10200.
1997-01-16 18:28:46 +00:00
Jeff Law
898c77b856 * simops.c: Fix typo in last change. 1997-01-15 13:46:18 +00:00
Jeff Law
2da0bc1bf9 * simops.c: Use REG macros in few places not using them yet.
Something I noticed while working on the mn10200 simulator.
1997-01-13 20:28:37 +00:00
Jeff Law
c1848bd2ee * configure: Enable the mn10200 simulator. 1997-01-13 20:21:35 +00:00
Jim Wilson
b99125bc1c For NEC 4300 project, fix last remaining host/target endianness problem
* gencode.c (build_instruction): Use BigEndianCPU instead of
	ByteSwapMem.
1997-01-08 20:40:40 +00:00
Jeff Law
bbd1706224 * mn10300_sim.h (struct _state): Fix number of registers!
Just something I noticed while working on the mn10200 simulator.
1997-01-06 23:25:53 +00:00
Mark Alexander
e1db0d47c5 * interp.c (sim_monitor): Make output to stdout visible in
wingdb's I/O log window.
1997-01-03 06:28:21 +00:00
Jeff Law
b774c0e4b1 * mn10300_sim.h (struct _state): Put all registers into a single
array to make gdb implementation easier.
        (REG_*): Add definitions for all registers in the state array.
        (SEXT32, SEXT40, SEXT44, SEXT60): Remove unused macros.
        * simops.c: Related changes.
1996-12-31 23:26:11 +00:00
Michael Meissner
6ec96a0265 Deal with kill encoding the signal via the exit status. 1996-12-31 23:18:55 +00:00
Mark Alexander
2902e8ab51 * support.h: Undo previous change to SIGTRAP
and SIGQUIT values.
1996-12-31 15:05:46 +00:00
Ian Lance Taylor
7e6c297e82 * interp.c (store_word, load_word): New static functions.
(mips16_entry): New static function.
	(SignalException): Look for mips16 entry and exit instructions.
	(simulate): Use the correct index when setting fpr_state after
	doing a pending move.
1996-12-30 22:37:30 +00:00
Mark Alexander
0049ba7a8d * interp.c: Fix byte-swapping code throughout to work on
both little- and big-endian hosts.
1996-12-29 17:47:25 +00:00
Mark Alexander
2510786bd4 * support.h: Make definitions of SIGTRAP and SIGQUIT consistent
with gdb/config/i386/xm-windows.h.
1996-12-29 17:20:47 +00:00
Mark Alexander
39bf0ef4e6 * gencode.c (build_instruction): Work around MSVC++ code gen bug
that messes up arithmetic shifts.
1996-12-28 06:51:58 +00:00
Michael Meissner
ee3f2d4f6a Allow exit to work normally under gdb 1996-12-27 19:50:03 +00:00
Angela Marie Thomas
280f90e1a0 add flush_cache PMON routine 1996-12-25 06:14:26 +00:00
Stu Grossman
dbeec76839 * support.h: Use _WIN32 instead of __WIN32__. Also add defs for
SIGTRAP and SIGQUIT for _WIN32.
1996-12-20 19:05:28 +00:00
Ian Lance Taylor
deffd638b5 * gencode.c (build_instruction) [MUL]: Cast operands to word64, to
force a 64 bit multiplication.
	(build_instruction) [OR]: In mips16 mode, don't do anything if the
	destination register is 0, since that is the default mips16 nop
	instruction.
1996-12-19 19:08:46 +00:00
Jeff Law
d657034d38 * interp.c (sim_resume): Handle 0xff as a single byte insn.
* simops.c: Fix overflow computation for "add" and "inc"
        instructions.
1996-12-18 17:15:21 +00:00
David Edelsohn
5c8f1c0183 Getting there ... 1996-12-17 21:08:20 +00:00
Jeff Law
093e9a32d3 * simops.c: Handle "break" instruction. 1996-12-16 22:31:37 +00:00
Rob Savoye
af68520381 Link with SIM_EXTRA_LIBS, not just EXTRA_LIBS, which is never set. 1996-12-16 22:16:24 +00:00
Ian Lance Taylor
063443cf01 * gencode.c (MIPS16_DECODE): SWRASP is I8, not RI.
(build_endian_shift): Don't check proc64.
	(build_instruction): Always set memval to uword64.  Cast op2 to
	uword64 when shifting it left in memory instructions.  Always use
	the same code for stores--don't special case proc64.
1996-12-16 21:47:23 +00:00
Martin Hunt
dbdae3de36 Mon Dec 16 13:39:03 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (xfer_mem): Change unified memory to 0x0.
1996-12-16 21:39:47 +00:00
Ian Lance Taylor
aaff84371e * gencode.c (build_mips16_operands): Fix base PC value for PC
relative operands.
	(build_instruction): Call JALDELAYSLOT rather than DELAYSLOT for a
	jal instruction.
	* interp.c (simJALDELAYSLOT): Define.
 	(JALDELAYSLOT): Define.
	(INDELAYSLOT, INJALDELAYSLOT): Define.
	(simulate): Clear simJALDELAYSLOT when simDELAYSLOT is cleared.
1996-12-16 20:01:15 +00:00
Jeff Law
16d2e2b670 * simops.c: Fix restoring the PC for "ret" and "retf" instructions. 1996-12-16 17:08:10 +00:00
Jim Wilson
51c6d73375 For NEC 4100/4300 project: Add little endian support and misc cleanups.
* gencode.c (build_instruction): Use !ByteSwapMem instead of
	BigEndianMem.
	* interp.c (CONFIG, config_EP_{mask,shift,D,DxxDxx, config_BE): Delete.
	(BigEndianMem): Rename to ByteSwapMem and change sense.
	(BigEndianCPU, sim_write, LoadMemory, StoreMemory): Change
	BigEndianMem references to !ByteSwapMem.
	(set_endianness): New function, with prototype.
	(sim_open): Call set_endianness.
	(sim_info): Use simBE instead of BigEndianMem.
	(xfer_direct_word, xfer_direct_long, swap_direct_word,
	swap_direct_long, xfer_big_word, xfer_big_long, xfer_little_word,
	xfer_little_long, swap_word, swap_long): Delete unnecessary MSC_VER
	ifdefs, keeping the prototype declaration.
	(swap_word): Rewrite correctly.
	(ColdReset): Delete references to CONFIG.  Delete endianness related
	code; moved to set_endianness.
1996-12-11 22:04:46 +00:00
Jeff Law
191c9d73de * gencode.c (write_opcodes): Also write out the format of the
opcode.
        * mn10300_sim.h (simops): Add "format" field.
        * interp.c (sim_resume): Deal with endianness issues here.
1996-12-11 16:58:33 +00:00
Jeff Law
95d18eb74d * simops.c (REG0_4): Define.
Use REG0_4 for indexed loads/stores.
Fixes bugs exposed after minor codegen improvements in the compiler.
1996-12-10 22:10:07 +00:00
Jim Wilson
6429b29698 For NEC 4100/4300 project
* gencode.c (build_instruction, case JUMP): Truncate PC to 32 bits.
	* interp.c (CHECKHILO): Define away.
	(simSIGINT): New macro.
	(membank_size): Increase from 1MB to 2MB.
	(control_c): New function.
	(sim_resume): Rename parameter signal to signal_number.  Add local
	variable prev.  Call signal before and after simulate.
	(sim_stop_reason): Add simSIGINT support.
	(sim_warning, sim_error, dotrace, SignalException): Define as stdarg
	functions always.
	(sim_warning): Delete call to SignalException.  Do call printf_filtered
	if logfh is NULL.
	(AddressTranslation): Add #ifdef DEBUG around debugging message and
	a call to sim_warning.
1996-12-10 19:39:55 +00:00
Michael Meissner
3fbe064171 New revision from Andrew 1996-12-10 16:12:48 +00:00
David Edelsohn
966f47b470 * callback.c: #include <stdlib.h>
(os_error): New function.
	(default_callback): Add os_error.
1996-12-09 02:27:59 +00:00
Jeff Law
2e8f4133d7 * simops.c (REG0_16): Fix typo. 1996-12-07 16:54:57 +00:00
Jeff Law
5084d8e513 Add missing semicolons in last change. 1996-12-07 00:36:50 +00:00
Jeff Law
b2f7a7e5b3 * simops.c: Call abort for any instruction that's not currently
simulated.
1996-12-06 21:49:27 +00:00
Jeff Law
9f4a551e11 * simops.c: Define accessor macros to extract register
values from instructions.  Use them consistently.
1996-12-06 21:47:21 +00:00
Jeff Law
7c52bf32f2 * interp.c: Delete unused global variable "OP".
(sim_resume): Remove unused variable "opcode".
        * simops.c: Fix some uninitialized variable problems, add
        parens to fix various -Wall warnings.
Fixing assorted -Wall problems.
1996-12-06 21:33:48 +00:00
Jeff Law
fc038f5656 Opps. Forgot something in last change. 1996-12-06 21:20:17 +00:00
Jeff Law
d252301029 * gencode.c (write_header): Add "insn" and "extension" arguments
to the OP_* declarations.
        (write_template): Similarly for function templates.
        * interp.c (insn, extension): Remove global variables.  Instead
        pass them as arguments to the OP_* functions.
        * mn10300_sim.h: Remove decls for "insn" and "extension".
        * simops.c (OP_*): Accept "insn" and "extension" as arguments
        instead of using globals.
Starting to clean things up.
1996-12-06 21:19:37 +00:00
Jeff Law
e5a7a53799 * simops.c: Fix typos in "mov am,(d16,an)" and "mov am,(d32,an)"
Fixes remaining hangs while running c-torture execution tests.
Only 12 c-torture execution failures left:

  * 920625-1.c fails all 6 execution tests.

  * 960521-1.c fails all 6 execution tests.
1996-12-06 07:57:21 +00:00
Jeff Law
4d8ced6cb1 * simops.c: Fix thinkos in last change to "inc dn". 1996-12-06 05:30:24 +00:00
Jeff Law
61ecca95c0 * simops.c: "add imm,sp" does not effect the condition codes.
"inc dn" does effect the condition codes.
Just something I noticed.
1996-12-04 18:02:00 +00:00
Jeff Law
e4e1302293 * simops.c: Treat both operands as signed values for
"div" instruction.
Fixes another dozen c-torture execution failures.
1996-12-04 05:00:49 +00:00
Rob Savoye
a665caa644 * configure.in: Look for libtermcap.a.
* Makefile.in: Only link in -ltermcap if it exists.
	* erc32.c: Update to version 2.6a. Fix uart handling.
	* exec.c: Update to version 2.6a. Add sparclite support.
	* float.c: Update to version 2.6a. Convert comments to
	preprocessor warnings. Add __setfpucw() for i385 hosts so floating
	point exceptions work.
	* func.c: Update to version 2.6a. Fix uart handling, add support
	for user error traps.
	* help.c: Update to version 2.6a. Add help note on user error
	traps.
	* interf.c: Update to version 2.6a. Fix uart handling, and add
	sparclite support.
	* examples/gccx: Use sparclite cross compiler, not native gcc.
	* examples/srt0.S: Use "mov" rather than "wr" for manipulating
	the psr register.
1996-12-04 00:56:56 +00:00
Jeff Law
20e1ab85bf * simops.c: Fix simulation of division instructions.
Fix typos/thinkos in several "cmp" and "sub" instructions.
Another couple dozen c-torture failures fixed.
1996-12-04 00:42:01 +00:00
Jeff Law
216e65571a * simomps.c: Fix carry bit handling in "sub" and "cmp"
instructions.
Another dozen execution failures fixed.
1996-12-02 20:12:08 +00:00
Jeff Law
fcfaf40d78 * simops.c: Fix "mov imm8,an" and "mov imm16,dn".
Fixes 80 or so c-torture execution failures.  400 to go.
1996-12-02 19:35:55 +00:00
Jeff Law
b7b89deb44 * simops.c: Fix overflow computation for many instructions.
Fixes several hangs in the c-torture execution tests.  Also fixes about
40 failures.
1996-12-02 08:35:20 +00:00
Jeff Law
af388638ae * simops.c: Fix "movdm, an", "movbu dm, (an)", and "movhu dm, (an)".
Along with some compiler, bfd, assembler changes this fixes 90 or so
c-torture execution failures.
1996-12-02 07:38:10 +00:00
Jeff Law
c8f0171f5f * simops.c: Fix "mov am, dn".
Fixes more c-torture problems.
1996-12-02 04:23:37 +00:00
Jeff Law
6db7fc49d2 * simops.c: Fix more bugs in "add imm,an" and
"add imm,dn".
Fixes a half-dozen (of several hundred :( c-torture failures.
1996-12-01 23:10:04 +00:00
Jeff Law
6e7a01c144 * simops.c: Fix bugs in "movm" and "add imm,an".
main(){write (0, "hello world\n", 13);} works!
1996-11-27 23:20:24 +00:00
Jeff Law
3bb3fe44e0 * simops.c: Don't lose the upper 24 bits of the return
pointer in "call" and "calls" instructions.  Rough cut
        at emulated system calls.
1996-11-27 18:36:54 +00:00
Jeff Law
de0dce7c5c * simops.c: Implement the remaining 5, 6 and 7 byte instructions.
Everything except the extended instructions, the loop instructions,
trap, rti, and rtm.
1996-11-27 17:56:10 +00:00
Jeff Law
ecb4b5a357 * simops.c Implement remaining 4 byte instructions. 1996-11-27 17:19:44 +00:00
Ian Lance Taylor
279cca90f4 * gencode.c (process_instructions): If ! proc64, skip DOUBLEWORD
16 bit instructions.
1996-11-27 16:54:21 +00:00
Jeff Law
2e35551c74 * simops.c Implement remaining 3 byte instructions.
Moving right along...
1996-11-27 16:51:30 +00:00
Jeff Law
f5f13c1d73 * simops.c: Implement remaining 2 byte instructions. Call
abort for instructions we're not implementing now.
1996-11-27 16:25:03 +00:00
Ian Lance Taylor
350d33b87f Actually check in the right change to interp.c. 1996-11-27 16:01:34 +00:00
Jeff Law
707641f658 * simops.c: Implement lots of random instructions.
Implments most instructions with first nibble 0x0 - 0xe and
those with the first byte 0xf0 - 0xf2.
1996-11-27 07:20:36 +00:00
Jeff Law
1f3bea2169 * simops.c: Implement "movm" and "bCC" insns.
Function calls and conditional branches work!
1996-11-27 05:29:49 +00:00
Jeff Law
92284aaa35 * mn10300_sim.h (_state): Add another register (MDR).
(REG_MDR): Define.
        * simops.c: Implement "cmp", "calls", "rets", "jmp" and
        a few additional random insns.
We can now function calls.  We get out of crt0 into main now, then lose
when calls are nested (because don't handle movm yet).
1996-11-27 00:53:25 +00:00
Jeff Law
73e6529893 * mn10300_sim.h (PSW_*): Define for CC status tracking.
(REG_D0, REG_A0, REG_SP): Define.
        * simops.c: Implement "add", "addc" and a few other random
        instructions.
Starting to simulate instructions for the mn10300.  Executes some of
the crt0 code now!
1996-11-26 22:58:24 +00:00
Jeff Law
b5f831ac51 * gencode.c, interp.c: Snapshot current simulator code.
(crude) hashing works, along with dispatch to the OP_* functions.
1996-11-26 20:40:19 +00:00
Ian Lance Taylor
831f59a218 Add support for mips16 (16 bit MIPS implementation):
* gencode.c (inst_type): Add mips16 instruction encoding types.
	(GETDATASIZEINSN): Define.
	(MIPS_DECODE): Add REG flag to dsllv, dsrav, and dsrlv.  Add
	jalx.  Add LEFT flag to mfhi and mflo.  Add RIGHT flag to mthi and
	mtlo.
	(MIPS16_DECODE): New table, for mips16 instructions.
	(bitmap_val): New static function.
	(struct mips16_op): Define.
	(mips16_op_table): New table, for mips16 operands.
	(build_mips16_operands): New static function.
	(process_instructions): If PC is odd, decode a mips16
	instruction.  Break out instruction handling into new
	build_instruction function.
	(build_instruction): New static function, broken out of
	process_instructions.  Check modifiers rather than flags for SHIFT
	bit count and m[ft]{hi,lo} direction.
	(usage): Pass program name to fprintf.
	(main): Remove unused variable this_option_optind.  Change
	``*loptarg++'' to ``loptarg++''.
	(my_strtoul): Parenthesize && within ||.
	* interp.c (sim_trace): If tracefh is NULL, set it to stderr.
	(LoadMemory): Accept a halfword pAddr if vAddr is odd.
	(simulate): If PC is odd, fetch a 16 bit instruction, and
	increment PC by 2 rather than 4.
	* configure.in: Add case for mips16*-*-*.
	* configure: Rebuild.
1996-11-26 18:12:44 +00:00
David Edelsohn
fd14b47f78 Regenerated since aclocal.m4 changed. 1996-11-26 03:54:26 +00:00
David Edelsohn
72eeb00634 * config.in (WORDS_BIGENDIAN): Add.
* configure: Regenerated.
	* d10v_sim.h: #include "config.h"
1996-11-26 03:53:40 +00:00
Jeff Law
05ccbdfdd2 * Makefile.in, config.in, configure, configure.in: New files.
* gencode.c, interp.c, mn10300_sim.h, simops.c: New files.

Skeleton mn10300 simulator
1996-11-25 19:52:08 +00:00
Michael Meissner
24cbf0a416 Make address in I/O space a bus error; properly cast calloc 1996-11-21 00:44:48 +00:00
David Edelsohn
77f4c99cb4 * run.c: Deleted, using one in ../common now. 1996-11-20 21:06:21 +00:00
David Edelsohn
5f270267a7 * Makefile.in: Delete stuff moved to ../common/Make-common.in.
(SIM_OBJS,SIM_EXTRA_CFLAGS,SIM_EXTRA_CLEAN): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	Call AC_CHECK_HEADERS(unistd.h).
	* configure: Regenerated.
	* config.in: New file.
	* simops.c: #include "config.h".  #include <unistd.h> if present.
1996-11-20 10:27:55 +00:00
David Edelsohn
614984da76 * Makefile.in: Delete stuff moved to ../common/Make-common.in.
(SIM_OBJS,SIM_EXTRA_LIBS): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	Call AC_CHECK_HEADERS(unistd.h).
	* configure: Regenerated.
	* config.in: New file.
	* interp.c: #include "config.h".  #include <unistd.h> if present.
	(trap): Fetch errno value with callback->get_errno.
1996-11-20 10:18:18 +00:00
David Edelsohn
34452aa40a * Makefile.in (LIBCOMMON): Define.
($(TARGETLIB)): Add files from $(LIBCOMMON).
1996-11-20 10:02:44 +00:00
David Edelsohn
e3d12c6595 * Makefile.in: Delete stuff moved to ../common/Make-common.in.
(SIM_{OBJS,EXTRA_CFLAGS,EXTRA_CLEAN}): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	* configure: Regenerated.
	* tconfig.in: New file.
1996-11-20 10:00:42 +00:00
David Edelsohn
899232aba0 * Makefile.in: Delete stuff moved to ../common/Make-common.in.
(SIM_OBJS): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	* configure: Regenerated.
	* inst.h (enum sim_state): Define.
	(cpu_state_type): New member `state'.  Set it whenever `exception'
	is set.
	* compile.c (sim_callback): New global.
	(sim_set_simcache_size): Renamed from sim_csize.
	(sim_resume, case O_SLEEP): Add right way to decode r0 but #if 0 out
	'cus it can't work.  Change main loop exit test to use cpu.state.
	(sim_trace): New function.
	(sim_stop_reason): Add right way to set results, but #if 0 out.
	(sim_size): New function.
	(sim_info): Redirect calls to printf_filtered through callback.
	(sim_set_callbacks): Record callback.
	* run.c: Deleted, using one in ../common now.
	* tconfig.in: New file.
1996-11-20 09:47:57 +00:00
David Edelsohn
d70e3e2b7b * Makefile.in: Delete stuff moved to ../common/Make-common.in.
(SIM_{OBJS,EXTRA_LIBS,EXTRA_LIBDEPS,EXTRA_ALL,EXTRA_INSTALL}): Define.
	(SIM_{EXTRA_CLEAN,EXTRA_CFLAGS}): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	Call AC_CHECK_HEADERS(stdlib.h).
	* configure: Regenerated.
	* config.in: New file.
	* func.c (sim_set_callbacks): Delete, moved to
	* interf.c (sim_set_callbacks): here.
	(sim_callback): New global.
	Rewrite all calls to printf_filtered to go through callback.
	(sim_size,sim_trace): New functions.
	(sim_{insert,remove}_breakpoint): #if 0 out.
	* sis.c: #include "config.h".  #include <stdlib.h> if present.
	(main): Coerce fprintf arg to INIT_DISASSEMBLE_INFO to fprintf_ftype.
	* sis.h: #include "callback.h".
1996-11-20 09:38:10 +00:00
David Edelsohn
27bc3f8ecb New file. 1996-11-20 09:28:40 +00:00
David Edelsohn
cee402dd99 * Makefile.in: Delete all stuff moved to ../common/Make-common.in.
(SIM_OBJS,SIM_EXTRA_CFLAGS,SIM_EXTRA_CLEAN): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	Call AC_CHECK_HEADERS(unistd.h).
	* configure: Regenerated.
	* config.in: New file.
	* interp.c: #include "callback.h".
	* simops.c: #include "config.h".  #include <unistd.h> if present.
1996-11-20 09:27:24 +00:00
David Edelsohn
db7d7ff8dd Add new files. 1996-11-20 09:22:01 +00:00
David Edelsohn
58b72d7e20 * run.c: #include ../common/config.h, tconfig.h.
(myname): New static global.
	(main): Recognize new options -a, -c.  Also recognize -h if h8/300.
	Only process -c ifdef SIM_HAVE_SIMCACHE.
	Only process -p/-s ifdef SIM_HAVE_PROFILE.
	Parse program name from argv[0] and use in error messages.
	Pass sim_args to sim_open.  Pass prog_args to sim_create_inferior.
	Add support for incomplete h8/300 termination indicators.
	(usage): Make more verbose.
	* aclocal.m4,config.in,tconfig.in,configure.in,configure: New files.
	* Makefile.in,Make-common.in,callback.c: New files.
	* nltvals.def,gentmap.c,gentvals.sh: New files.
1996-11-20 09:20:55 +00:00
David Edelsohn
e01714ccda * run.c: Deleted, use one in ../common now.
* Makefile.in: Delete everything that's been moved to
	../common/Make-common.in.
	(SIM_OBJS): Define.
	* configure.in: Simplify using macros in ../common/aclocal.m4.
	* configure: Regenerated.
	* config.in: New file.
	* armos.c: #include config.h.
	* wrapper.c (mem_size): Value is in bytes now.
	(sim_callback): New global.
	(arm_sim_set_profile{,_size}): Delete.
	(arm_sim_set_mem_size): Rename to sim_size.
	(sim_do_command): Call printf_filtered via callback.
	(sim_set_callbacks): Record callback.
1996-11-20 09:10:22 +00:00
David Edelsohn
126d9d0a71 * configure.in (configdirs): Add common.
* configure: Regenerated.
1996-11-20 09:02:28 +00:00
David Edelsohn
939b233a57 * sim_calls.c (sim_resume): Reset sim_should_run if single stepping. 1996-11-20 08:38:13 +00:00
Michael Meissner
f8149dfee8 Fix some warnings 1996-11-15 20:24:54 +00:00
Martin Hunt
849c575f97 Fri Nov 8 16:19:55 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* d10v-sim.h (simops): Add flag is_long.
	(State): Add pc_changed.  Instructions which update the PC should
	use the JMP macro which sets this.
	(JMP): New macro.  Sets the PC and the pc_changed flag.

	* gencode.c (write_opcodes): Add is_long field.

	* interp.c (lookup_hash): If we blindly apply a short opcode's mask
	to a long opcode we could get a false match.  Check the opcode size.
	(hash): Add a size field to the hash table.
	(sim_open): Initialize size field in hash table.
	(sim_resume): Change to logic for setting the PC.  Used to increment the
	PC if it had not been changed.  This didn't allow single-instruction loops.
	Now checks the flag State.pc_changed.  Also now stops when ^C is received.
	(dmem_addr): Fix translation of data segments to unified memory.
	(sim_ctrl_c): New function.  When ^C is received, set stop_simulator flag.

	* simops.c: Changed all branch and jump instructions to use new JMP macro.
	(OP_20000000): Corrected trace information to show this is a ldi.l, not
	a ldi.s instruction.
1996-11-09 00:38:07 +00:00
Michael Meissner
cf1e294cc0 Powerpc-linux now builds the simulator 1996-11-01 13:08:43 +00:00
Martin Hunt
5c839c675a Thu Oct 31 19:13:55 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (sim_fetch_register, sim_store_register): Fix bug where
	updating the accumulators was overwriting other parts of the global
	State variable.
1996-11-01 03:15:44 +00:00
Gavin Romig-Koch
7fc45edb6c Fix linux build problem. 1996-10-31 19:58:14 +00:00
Michael Meissner
b30cdd3565 Fix -t option to work with memory mapping; Print PC in some error messages 1996-10-30 22:43:02 +00:00
Jeff Law
8824fb459b * simops.c (OP_10007E0): Handle SYS_times and SYS_gettimeofday.
Check it into devo too.
1996-10-30 16:30:59 +00:00
Jeff Law
6803f89b14 * simops.c (OP_10007E0): Handle SYS_time.
Check into devo too.
1996-10-30 15:51:39 +00:00
Michael Meissner
b9f74e0b24 Add access, sigaltstack, sigaction emulations 1996-10-29 23:02:33 +00:00
Jeff Law
c500c07496 * simops.c: Include <sys/stat.h>.
(OP_10007E0): Handle SYS_stat.
For RW testing.
1996-10-29 21:24:01 +00:00
Martin Hunt
c422ecc7a4 Tue Oct 29 12:13:52 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (sim_size): Now allocates unified memory for imap segments
	0,1,2, and 127. Initializes imap0 and imap1 to 0x1000.  Initializes dmap to 0.
	(sim_write): Just call xfer_mem().
	(sim_read): Just call xfer_mem().
	(xfer_mem): New function. Does appropriate memory mapping and copies bytes.
	(dmem_addr): New function. Reads dmap register and translates data
 	addresses to local addresses.
	(pc_addr): New function. Reads imap register and computes local address
	corresponding to contents of the PC.
	(sim_resume): Change to use pc_addr().
	(sim_create_inferior): Change reinitialization code. Also reinitializes
	imap[01] and dmap.
	(sim_fetch_register): Add fake registers 32,33,34 for imap0, imap1, and dmap.
	(sim_store_register): Add fake registers 32,33,34 for imap0, imap1, and dmap.

	* simops.c (MEMPTR): Redefine to use dmem_addr().
	(OP_5F00): Replace references to STate.imem with dmem_addr().

	* d10v-sim.h (State): Remove mem_min and mem_max. Add umem[128].
	(RB,SW,RW,SLW,RLW): Redefine to use dmem_addr().
	(IMAP0,IMAP1,DMAP,SET_IMAP,SET_IMAP1,SET_DMAP): Define.
1996-10-29 20:31:08 +00:00
Jeff Law
f009978996 * simops.c (OP_500): Mask off low bit in displacement
for sld.w.
        (OP_501): Similarly.
More bugs exposed by tda testing.
1996-10-24 21:19:22 +00:00
Jeff Law
85c09b0518 * simops.c (OP_500): Fix displacement handling for sld.w.
(OP_501): Similarly for sst.w.
More fixes exposed by tda testing.
1996-10-24 20:49:06 +00:00
Jeff Law
0a89af6efd * simops.c (trace_input): Remove all references to SEXT7.
(OP_300, OP_400, OP_500, OP_380, OP_480, OP_501): Displacement
        is zero extended for sst/sld instructions.
        * v850_sim.h (SEX7): Delete.  It's no longer needed (and it
        was incorrect anyway).
So we properly simulate sst/sld instructions.
1996-10-24 18:28:43 +00:00
Stu Grossman
968519095a * Makefile.in: Get rid of srcroot. Set all INSTALL macros via
autoconf.
	* gencode.c (write_opcodes):  Pad operands field to account for
	MSVC braindamage.
	* simops.c:  Include errno.h.  Exclude SYS_chown, since MSVC
	doesn't support it.  (Why is this here in the first place?!?)
	* v850_sim.h:  Get rid of 64 bit defs.  Also, get rid of #elif's.
	Change number of operands in struct simops from 9 to 6.  Define
	SIGTRAP and SIGQUIT for MSVC.
1996-10-24 17:39:30 +00:00
Michael Meissner
aeb1f26ba8 Provide better statistics, particularly for doing VLIW work; Fix ldb to correctly sign extend 1996-10-22 19:49:37 +00:00
Martin Hunt
eca43eb1f5 Mon Oct 21 16:16:26 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* interp.c (sim_resume): Change the way single-stepping and exceptions
 	are handled so single-stepping works again.
1996-10-21 23:17:43 +00:00
Michael Meissner
c7f6f3993c Add support for fsel 1996-10-18 16:22:35 +00:00
David Edelsohn
6cc77b01e7 * configure.in (--enable-sim-powerpc): Delete.
(--enable-sim): Add.
	* configure: Regenerated.
1996-10-17 20:11:31 +00:00
David Edelsohn
d9c0593f2a Add more m32r support. 1996-10-17 18:57:19 +00:00
Michael Meissner
55116079e2 Make simulated loads/stores faster on x86, AIX, and big endian hosts 1996-10-17 16:47:51 +00:00
Jeff Law
c929945aad Add missing v850 sanitization stuff. 1996-10-17 04:57:03 +00:00
Michael Meissner
d6fe5ca568 Make read/write memory functions inlined 1996-10-16 22:16:21 +00:00