/* Miscellaneous i80960-dependent routines.
Most are called from macros defined in "tm-i960.h". */
-#include <stdio.h>
-#include <signal.h>
#include "defs.h"
-#include "param.h"
+#include <signal.h>
#include "symtab.h"
#include "value.h"
#include "frame.h"
-#include "signame.h"
#include "ieee-float.h"
+#include "target.h"
/* Structure of i960 extended floating point format. */
*/
for ( i = 0; i < TYPELEN; i++ ){
if ( types[i].hostsize != types[i].i960size ){
- printf("sizeof(%s) != %d: PROCEED AT YOUR OWN RISK!\n",
+ printf_unfiltered("sizeof(%s) != %d: PROCEED AT YOUR OWN RISK!\n",
types[i].typename, types[i].i960size );
}
cache_fsr = (struct frame_saved_regs *)
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_saved_regs));
- bzero (cache_fsr, sizeof (struct frame_saved_regs));
+ memset (cache_fsr, '\0', sizeof (struct frame_saved_regs));
fi->fsr = cache_fsr;
/* Find the start and end of the function prologue. If the PC
ap = 0;
else
ap = read_register (G14_REGNUM);
+ if (ap == 0)
+ ap = fi->frame;
}
fi->arg_pointer = ap; /* Cache it for next time */
return ap;
leafproc_return (ip)
CORE_ADDR ip; /* ip from currently executing function */
{
- int i;
- register struct misc_function *mf;
+ register struct minimal_symbol *msymbol;
char *p;
int dst;
unsigned int insn1, insn2;
CORE_ADDR return_addr;
- char *index ();
- if ((i = find_pc_misc_function (ip)) >= 0)
+ if ((msymbol = lookup_minimal_symbol_by_pc (ip)) != NULL)
{
- mf = &misc_function_vector[i];
- if ((p = index (mf->name, '.')) && !strcmp (p, ".lf"))
+ if ((p = strchr(SYMBOL_NAME (msymbol), '.')) && STREQ (p, ".lf"))
{
- if (next_insn (mf->address, &insn1, &insn2)
+ if (next_insn (SYMBOL_VALUE_ADDRESS (msymbol), &insn1, &insn2)
&& (insn1 & 0xff87ffff) == 0x5c80161e /* mov g14, gx */
&& (dst = REG_SRCDST (insn1)) <= G0_REGNUM + 7)
{
the return address from g14; otherwise, read it
from the register into which g14 was moved. */
- return_addr = read_register ((ip == mf->address)
+ return_addr =
+ read_register ((ip == SYMBOL_VALUE_ADDRESS (msymbol))
? G14_REGNUM : dst);
/* We know we are in a leaf procedure, but we don't know
if (!next_insn (return_addr, &insn1, &insn2)
|| (insn1 & 0xff000000) != 0xa000000 /* ret */
- || find_pc_misc_function (return_addr) != i)
+ || lookup_minimal_symbol_by_pc (return_addr) != msymbol)
return (return_addr);
}
}
set_current_frame (create_new_frame (read_register (FP_REGNUM), read_pc ()));
}
-/* Print out text describing a "signal number" with which the i80960 halted.
-
- See the file "fault.c" in the nindy monitor source code for a list
- of stop codes. */
+/* Given a 960 stop code (fault or trace), return the signal which
+ corresponds. */
-void
-print_fault( siggnal )
- int siggnal; /* Signal number, as returned by target_wait() */
+enum target_signal
+i960_fault_to_signal (fault)
+ int fault;
{
- static char unknown[] = "Unknown fault or trace";
- static char *sigmsgs[] = {
- /* FAULTS */
- "parallel fault", /* 0x00 */
- unknown, /* 0x01 */
- "operation fault", /* 0x02 */
- "arithmetic fault", /* 0x03 */
- "floating point fault", /* 0x04 */
- "constraint fault", /* 0x05 */
- "virtual memory fault", /* 0x06 */
- "protection fault", /* 0x07 */
- "machine fault", /* 0x08 */
- "structural fault", /* 0x09 */
- "type fault", /* 0x0a */
- "reserved (0xb) fault", /* 0x0b */
- "process fault", /* 0x0c */
- "descriptor fault", /* 0x0d */
- "event fault", /* 0x0e */
- "reserved (0xf) fault", /* 0x0f */
-
- /* TRACES */
- "single-step trace", /* 0x10 */
- "branch trace", /* 0x11 */
- "call trace", /* 0x12 */
- "return trace", /* 0x13 */
- "pre-return trace", /* 0x14 */
- "supervisor call trace",/* 0x15 */
- "breakpoint trace", /* 0x16 */
- };
-# define NUMMSGS ((int)( sizeof(sigmsgs) / sizeof(sigmsgs[0]) ))
-
- if (siggnal < NSIG) {
- printf ("\nProgram received signal %d, %s\n",
- siggnal,
- sys_siglist[siggnal]);
- } else {
- /* The various target_wait()s bias the 80960 "signal number"
- by adding NSIG to it, so it won't get confused with any
- of the Unix signals elsewhere in GDB. We need to
- "unbias" it before using it. */
- siggnal -= NSIG;
-
- printf("Program stopped for reason #%d: %s.\n", siggnal,
- (siggnal < NUMMSGS && siggnal >= 0)?
- sigmsgs[siggnal] : unknown );
- }
+ switch (fault)
+ {
+ case 0: return TARGET_SIGNAL_BUS; /* parallel fault */
+ case 1: return TARGET_SIGNAL_UNKNOWN;
+ case 2: return TARGET_SIGNAL_ILL; /* operation fault */
+ case 3: return TARGET_SIGNAL_FPE; /* arithmetic fault */
+ case 4: return TARGET_SIGNAL_FPE; /* floating point fault */
+
+ /* constraint fault. This appears not to distinguish between
+ a range constraint fault (which should be SIGFPE) and a privileged
+ fault (which should be SIGILL). */
+ case 5: return TARGET_SIGNAL_ILL;
+
+ case 6: return TARGET_SIGNAL_SEGV; /* virtual memory fault */
+
+ /* protection fault. This is for an out-of-range argument to
+ "calls". I guess it also could be SIGILL. */
+ case 7: return TARGET_SIGNAL_SEGV;
+
+ case 8: return TARGET_SIGNAL_BUS; /* machine fault */
+ case 9: return TARGET_SIGNAL_BUS; /* structural fault */
+ case 0xa: return TARGET_SIGNAL_ILL; /* type fault */
+ case 0xb: return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
+ case 0xc: return TARGET_SIGNAL_BUS; /* process fault */
+ case 0xd: return TARGET_SIGNAL_SEGV; /* descriptor fault */
+ case 0xe: return TARGET_SIGNAL_BUS; /* event fault */
+ case 0xf: return TARGET_SIGNAL_UNKNOWN; /* reserved fault */
+ case 0x10: return TARGET_SIGNAL_TRAP; /* single-step trace */
+ case 0x11: return TARGET_SIGNAL_TRAP; /* branch trace */
+ case 0x12: return TARGET_SIGNAL_TRAP; /* call trace */
+ case 0x13: return TARGET_SIGNAL_TRAP; /* return trace */
+ case 0x14: return TARGET_SIGNAL_TRAP; /* pre-return trace */
+ case 0x15: return TARGET_SIGNAL_TRAP; /* supervisor call trace */
+ case 0x16: return TARGET_SIGNAL_TRAP; /* breakpoint trace */
+ default: return TARGET_SIGNAL_UNKNOWN;
+ }
}
/* Initialization stub */
+void
_initialize_i960_tdep ()
{
check_host ();