- fixed signal number calculation

git-svn-id: http://moon:8086/svn/mips@89 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2017-01-16 22:03:35 +00:00
parent f882fd5bb9
commit 1f75695e9f
+20 -20
View File
@@ -115,7 +115,6 @@ void flush_i_cache()
/* at least NUMREGBYTES*2 are needed for register packets */ /* at least NUMREGBYTES*2 are needed for register packets */
#define BUFMAX 2048 #define BUFMAX 2048
static int initialized = 0; /* !0 means we've been initialized */
static const char hexchars[]="0123456789abcdef"; static const char hexchars[]="0123456789abcdef";
#define NUMREGS 72 #define NUMREGS 72
@@ -335,11 +334,13 @@ hex2mem (unsigned char *buf, unsigned char *mem, int count, int may_fault)
signals, which are primarily what GDB understands. It also indicates signals, which are primarily what GDB understands. It also indicates
which hardware traps we need to commandeer when initializing the stub. */ which hardware traps we need to commandeer when initializing the stub. */
static struct hard_trap_info struct hard_trap_info_t
{ {
unsigned char tt; /* Trap type code for SPARClite */ unsigned long tt; /* Trap type code for SPARClite */
unsigned char signo; /* Signal that we map this trap into */ unsigned long signo; /* Signal that we map this trap into */
} hard_trap_info[] = };
static struct hard_trap_info_t hard_trap_info[] =
{ {
{0, SIGINT}, /* Interrupt (Int) */ {0, SIGINT}, /* Interrupt (Int) */
{1, SIGSEGV}, /* TLB modification (Mod) */ {1, SIGSEGV}, /* TLB modification (Mod) */
@@ -357,21 +358,20 @@ static struct hard_trap_info
{0, 0} /* Must be last */ {0, 0} /* Must be last */
}; };
/* Set up exception handlers for tracing and breakpoints */
void
set_debug_traps (void)
{
// Register exception handler
initialized = 1;
}
/* Convert the SPARC hardware trap type code to a unix signal number. */ /* Convert the SPARC hardware trap type code to a unix signal number. */
static unsigned long static unsigned long
computeSignal (unsigned long tt) computeSignal (unsigned long tt)
{ {
// Determine linux signal from CPU specific exception code // Determine linux signal from CPU specific exception code
struct hard_trap_info_t *ht;
for (ht = hard_trap_info; ht->signo != 0; ht++)
{
if (ht->tt == tt)
{
return ht->signo;
}
}
return SIGHUP; /* default for things we don't know about */ return SIGHUP; /* default for things we don't know about */
} }
@@ -424,7 +424,7 @@ handle_exception (unsigned long *registers)
registers[PC] += 4; registers[PC] += 4;
} }
sp = (unsigned long *)registers[R29]; sp = (unsigned long *)&registers[R29];
tt = (registers[CR] >> 2) & 0x1f; tt = (registers[CR] >> 2) & 0x1f;
@@ -436,14 +436,14 @@ handle_exception (unsigned long *registers)
*ptr++ = hexchars[sigval >> 4]; *ptr++ = hexchars[sigval >> 4];
*ptr++ = hexchars[sigval & 0xf]; *ptr++ = hexchars[sigval & 0xf];
*ptr++ = hexchars[PC >> 4]; *ptr++ = hexchars[37 >> 4];
*ptr++ = hexchars[PC & 0xf]; *ptr++ = hexchars[37 & 0xf];
*ptr++ = ':'; *ptr++ = ':';
ptr = mem2hex((char *)&registers[PC], ptr, 4, 0); ptr = mem2hex((char *)&registers[PC], ptr, 4, 0);
*ptr++ = ';'; *ptr++ = ';';
*ptr++ = hexchars[R29 >> 4]; *ptr++ = hexchars[29 >> 4];
*ptr++ = hexchars[R29 & 0xf]; *ptr++ = hexchars[29 & 0xf];
*ptr++ = ':'; *ptr++ = ':';
ptr = mem2hex((char *)sp, ptr, 4, 0); ptr = mem2hex((char *)sp, ptr, 4, 0);
*ptr++ = ';'; *ptr++ = ';';