Commit Graph

489 Commits

Author SHA1 Message Date
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