* compile.c (sim_resume): Watch for calls to abort.
* run.c: #include <signal.h>. (main): Abort if program got SIGILL.
This commit is contained in:
parent
89a8a65d62
commit
e656ecf90c
|
@ -1,3 +1,33 @@
|
||||||
|
Mon Mar 11 09:53:25 1996 Doug Evans <dje@charmed.cygnus.com>
|
||||||
|
|
||||||
|
* compile.c (sim_resume): Watch for calls to abort.
|
||||||
|
* run.c: #include <signal.h>.
|
||||||
|
(main): Abort if program got SIGILL.
|
||||||
|
|
||||||
|
Wed Feb 21 12:15:00 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* configure: Regenerate with autoconf 2.7.
|
||||||
|
|
||||||
|
Thu Jan 4 11:52:53 1996 Doug Evans <dje@canuck.cygnus.com>
|
||||||
|
|
||||||
|
* inst.h (MPOWER,MSIZE): Deleted.
|
||||||
|
(H8300{,H}_MSIZE): Define.
|
||||||
|
* compile.c (memory_size): New static global.
|
||||||
|
(init_pointers): Set memory size from one of H8300{,H}_MSIZE.
|
||||||
|
(sim_write,sim_read): Use memory_size.
|
||||||
|
|
||||||
|
Fri Oct 13 15:03:19 1995 steve chamberlain <sac@slash.cygnus.com>
|
||||||
|
|
||||||
|
* compile.c (sim_set_callbacks): New.
|
||||||
|
|
||||||
|
Tue Oct 10 11:11:26 1995 Fred Fish <fnf@cygnus.com>
|
||||||
|
|
||||||
|
* Makefile.in (BISON): Remove macro.
|
||||||
|
|
||||||
|
Wed Sep 20 13:35:02 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* Makefile.in (maintainer-clean): New synonym for realclean.
|
||||||
|
|
||||||
Fri Sep 8 12:18:53 1995 Ian Lance Taylor <ian@cygnus.com>
|
Fri Sep 8 12:18:53 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
* Makefile.in (install): Don't install in $(tooldir).
|
* Makefile.in (install): Don't install in $(tooldir).
|
||||||
|
|
|
@ -17,13 +17,18 @@
|
||||||
* AND FITNESS FOR A PARTICULAR PURPOSE.
|
* AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifndef WIN32
|
#ifdef HAVE_TIME_H
|
||||||
#include <sys/times.h>
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include "ansidecl.h"
|
#include "ansidecl.h"
|
||||||
#include "sysdep.h"
|
#include "callback.h"
|
||||||
#include "remote-sim.h"
|
#include "remote-sim.h"
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
|
|
||||||
|
@ -79,13 +84,13 @@ static cpu_state_type cpu;
|
||||||
|
|
||||||
int h8300hmode = 0;
|
int h8300hmode = 0;
|
||||||
|
|
||||||
|
static int memory_size;
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
get_now ()
|
get_now ()
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
struct tms b;
|
|
||||||
|
|
||||||
return time (0);
|
return time (0);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -665,10 +670,18 @@ init_pointers ()
|
||||||
init = 1;
|
init = 1;
|
||||||
littleendian.i = 1;
|
littleendian.i = 1;
|
||||||
|
|
||||||
cpu.memory = (unsigned char *) calloc (sizeof (char), MSIZE);
|
if (h8300hmode)
|
||||||
cpu.cache_idx = (unsigned short *) calloc (sizeof (short), MSIZE);
|
memory_size = H8300H_MSIZE;
|
||||||
|
else
|
||||||
|
memory_size = H8300_MSIZE;
|
||||||
|
cpu.memory = (unsigned char *) calloc (sizeof (char), memory_size);
|
||||||
|
cpu.cache_idx = (unsigned short *) calloc (sizeof (short), memory_size);
|
||||||
|
|
||||||
|
/* `msize' must be a power of two */
|
||||||
|
if ((memory_size & (memory_size - 1)) != 0)
|
||||||
|
abort ();
|
||||||
|
cpu.mask = memory_size - 1;
|
||||||
|
|
||||||
cpu.mask = (1 << MPOWER) - 1;
|
|
||||||
for (i = 0; i < 9; i++)
|
for (i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
cpu.regs[i] = 0;
|
cpu.regs[i] = 0;
|
||||||
|
@ -1241,6 +1254,11 @@ sim_resume (step, siggnal)
|
||||||
cpu.exception = SIGILL;
|
cpu.exception = SIGILL;
|
||||||
goto end;
|
goto end;
|
||||||
case O (O_SLEEP, SB):
|
case O (O_SLEEP, SB):
|
||||||
|
if ((short) cpu.regs[0] == -255)
|
||||||
|
cpu.exception = SIGILL;
|
||||||
|
else
|
||||||
|
cpu.exception = SIGTRAP;
|
||||||
|
goto end;
|
||||||
case O (O_BPT, SB):
|
case O (O_BPT, SB):
|
||||||
cpu.exception = SIGTRAP;
|
cpu.exception = SIGTRAP;
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -1556,7 +1574,7 @@ sim_write (addr, buffer, size)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
init_pointers ();
|
init_pointers ();
|
||||||
if (addr < 0 || addr + size > MSIZE)
|
if (addr < 0 || addr + size > memory_size)
|
||||||
return 0;
|
return 0;
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
|
@ -1573,7 +1591,7 @@ sim_read (addr, buffer, size)
|
||||||
int size;
|
int size;
|
||||||
{
|
{
|
||||||
init_pointers ();
|
init_pointers ();
|
||||||
if (addr < 0 || addr + size > MSIZE)
|
if (addr < 0 || addr + size > memory_size)
|
||||||
return 0;
|
return 0;
|
||||||
memcpy (buffer, cpu.memory + addr, size);
|
memcpy (buffer, cpu.memory + addr, size);
|
||||||
return size;
|
return size;
|
||||||
|
@ -1816,3 +1834,20 @@ sim_create_inferior (start_address, argv, env)
|
||||||
{
|
{
|
||||||
cpu.pc = start_address;
|
cpu.pc = start_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sim_do_command (cmd)
|
||||||
|
char *cmd;
|
||||||
|
{
|
||||||
|
printf_filtered ("This simulator does not accept any commands.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
sim_set_callbacks (ptr)
|
||||||
|
struct host_callback_struct *ptr;
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,6 +46,8 @@ main (ac, av)
|
||||||
int verbose = 0;
|
int verbose = 0;
|
||||||
int trace = 0;
|
int trace = 0;
|
||||||
char *name = "";
|
char *name = "";
|
||||||
|
int sigrc;
|
||||||
|
enum sim_stop reason;
|
||||||
|
|
||||||
while ((i = getopt (ac, av, "c:htv")) != EOF)
|
while ((i = getopt (ac, av, "c:htv")) != EOF)
|
||||||
switch (i)
|
switch (i)
|
||||||
|
@ -95,6 +98,11 @@ main (ac, av)
|
||||||
sim_resume(0,0);
|
sim_resume(0,0);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
sim_info (verbose - 1);
|
sim_info (verbose - 1);
|
||||||
|
sim_stop_reason (&reason, &sigrc);
|
||||||
|
/* FIXME: this test is insufficient but we can't do much
|
||||||
|
about it until sim_stop_reason is cleaned up. */
|
||||||
|
if (sigrc == SIGILL)
|
||||||
|
abort ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue