Thu Dec 26 15:15:21 1996 Michael Snyder <msnyder@cleaver.cygnus.com>

* sparclet-rom.c: Remove includes of Unix system files.
          Add function "sparclet_supply_register" so that parse_register_dump
          will not seg-fault by calling a null function pointer.
          Remove XMODEM support (unfinished work?).
          Remove flag "MO_HANDLE_NL", so monitor's output can be read by humans.
          Add fill command.
          Remove colon from getreg.resp_delim so PSR register will work.
          Remove pointer to sparclet_load (downloading SREC's doesn't work).
          Null out local register names for %g0, all %cc and all %asr regs,
          since the monitor can't report them.  Will return zero instead.
        * sparclet-stub.c: New -- remote protocol support for sparclet CPU.
        * config/sparc/tm-sparclet.h: Re-arrange REGISTER_NAMES:
          Add back %g0 and %psr, add %cc coprocessor regs, add %asr regs.
          Adjust NUM_REGS and REGISTER_BYTES accordingly
This commit is contained in:
Michael Snyder 1996-12-26 23:16:27 +00:00
parent 280f90e1a0
commit a7f6f9ed4d
4 changed files with 1355 additions and 55 deletions

View File

@ -1,3 +1,20 @@
Thu Dec 26 15:15:21 1996 Michael Snyder <msnyder@cleaver.cygnus.com>
* sparclet-rom.c: Remove includes of Unix system files.
Add function "sparclet_supply_register" so that parse_register_dump
will not seg-fault by calling a null function pointer.
Remove XMODEM support (unfinished work?).
Remove flag "MO_HANDLE_NL", so monitor's output can be read by humans.
Add fill command.
Remove colon from getreg.resp_delim so PSR register will work.
Remove pointer to sparclet_load (downloading SREC's doesn't work).
Null out local register names for %g0, all %cc and all %asr regs,
since the monitor can't report them. Will return zero instead.
* sparclet-stub.c: New -- remote protocol support for sparclet CPU.
* config/sparc/tm-sparclet.h: Re-arrange REGISTER_NAMES:
Add back %g0 and %psr, add %cc coprocessor regs, add %asr regs.
Adjust NUM_REGS and REGISTER_BYTES accordingly
Tue Dec 24 10:27:37 1996 Jeffrey A Law (law@cygnus.com)
* remote-e7000.c (want_h8300h, want_nopc_h8300h): Renamed

View File

@ -37,6 +37,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define BIG_BREAKPOINT {0x91, 0xd0, 0x20, 0x01}
#define LITTLE_BREAKPOINT {0x01, 0x20, 0xd0, 0x91}
#undef NUM_REGS /* formerly "72" */
/* WIN FP CPU CCP ASR AWR APSR */
#define NUM_REGS (32 + 32 + 8 + 8 + 8/*+ 32 + 1*/)
#undef REGISTER_BYTES /* formerly "(32*4 + 32*4 + 8*4)" */
#define REGISTER_BYTES (32*4 + 32*4 + 8*4 + 8*4 + 8*4/* + 32*4 + 1*4*/)
/* Initializer for an array of names of registers.
There should be NUM_REGS strings in this initializer. */
/* Sparclet has no fp! */
@ -44,44 +51,56 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
change the numbers here. */
#undef REGISTER_NAMES
/* g0 removed - Sparclet returns error if attempt to access. */
/* psr removed - Sparclet does not return ": " in response,
the monitor is therefore unable to get the expected response delimiter,
causing a timeout. */
#define REGISTER_NAMES \
{ "", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7", \
"o0", "o1", "o2", "o3", "o4", "o5", "o6", "o7", \
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", \
"i0", "i1", "i2", "i3", "i4", "i5", "i6", "i7", \
\
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, \
\
"y", 0, "wim", "tbr", "pc", "npc", 0, 0 }
\
"", "", "", "", "", "", "", "", /* no FPU regs */ \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
"", "", "", "", "", "", "", "", \
/* no CPSR, FPSR */ \
"y", "psr", "wim", "tbr", "pc", "npc", "", "", \
\
"ccsr", "ccpr", "cccrcr", "ccor", "ccobr", "ccibr", "ccir", "", \
\
"asr1", "asr15", "asr17", "asr18", "asr19", "asr20", "asr21", "asr22", \
/* \
"awr0", "awr1", "awr2", "awr3", "awr4", "awr5", "awr6", "awr7", \
"awr8", "awr9", "awr10", "awr11", "awr12", "awr13", "awr14", "awr15", \
"awr16", "awr17", "awr18", "awr19", "awr20", "awr21", "awr22", "awr23", \
"awr24", "awr25", "awr26", "awr27", "awr28", "awr29", "awr30", "awr31", \
"apsr", \
*/ \
}
/* Remove FP dependant code which was defined in tm-sparc.h */
#undef FP0_REGNUM /* Floating point register 0 */
#undef FPS_REGNUM /* Floating point status register */
#undef CPS_REGNUM /* Coprocessor status register */
/* sparclet register numbers */
#define CCSR_REGNUM 72
#undef EXTRACT_RETURN_VALUE
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
{ \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \
(TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \
? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \
TYPE_LENGTH(TYPE)); \
memcpy ((VALBUF), \
(char *)(REGBUF) + REGISTER_RAW_SIZE (O0_REGNUM) * 8 + \
(TYPE_LENGTH(TYPE) >= REGISTER_RAW_SIZE (O0_REGNUM) \
? 0 : REGISTER_RAW_SIZE (O0_REGNUM) - TYPE_LENGTH(TYPE)), \
TYPE_LENGTH(TYPE)); \
}
#undef STORE_RETURN_VALUE
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
{ \
/* Other values are returned in register %o0. */ \
write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \
TYPE_LENGTH (TYPE)); \
{ \
/* Other values are returned in register %o0. */ \
write_register_bytes (REGISTER_BYTE (O0_REGNUM), (VALBUF), \
TYPE_LENGTH (TYPE)); \
}
#undef PRINT_REGISTER_HOOK
#define PRINT_REGISTER_HOOK(regno)

View File

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "symtab.h"
#include "symfile.h" /* for generic_load */
#if 0 /* Do we really need all this Unix stuff here? */
#if !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) && !defined (HAVE_SGTTY)
#define HAVE_SGTTY
#endif
@ -39,6 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <sys/file.h>
#include <signal.h>
#include <sys/stat.h>
#endif /* Unix stuff */
#define USE_GENERIC_LOAD
#define USE_SW_BREAKS
@ -64,7 +66,9 @@ sparclet_load_gen (filename, from_tty)
inferior_pid = 0; /* No process now */
}
#else
#endif
#ifdef USE_XMODEM_LOAD
static void
sparclet_xmodem_load (desc, file, hashmark)
@ -130,7 +134,7 @@ sparclet_load (desc, file, hashmark)
{
???
}
#endif /* USE_GENERIC_LOAD */
#endif /* USE_XMODEM_LOAD */
/* This array of registers need to match the indexes used by GDB.
This exists because the various ROM monitors use different strings
@ -160,6 +164,26 @@ y: 0x00000000
/* monitor wants lower case */
static char *sparclet_regnames[NUM_REGS] = REGISTER_NAMES;
/* Function: sparclet_supply_register
Just returns with no action.
This function is required, because parse_register_dump (monitor.c)
expects to be able to call it. If we don't supply something, it will
call a null pointer and core-dump. Since this function does not
actually do anything, GDB will request the registers individually. */
static void
sparclet_supply_register (regname, regnamelen, val, vallen)
char *regname;
int regnamelen;
char *val;
int vallen;
{
return;
}
/* Define the monitor command strings. Since these are passed directly
through to a printf style function, we may include formatting
strings. We also need a CR or LF on the end. */
@ -170,32 +194,31 @@ static char *sparclet_inits[] = {"\n\r\r\n", NULL};
static struct monitor_ops sparclet_cmds =
{
MO_CLR_BREAK_USES_ADDR
| MO_HEX_PREFIX
| MO_HANDLE_NL
| MO_NO_ECHO_ON_OPEN
| MO_NO_ECHO_ON_SETMEM
| MO_RUN_FIRST_TIME
| MO_GETMEM_READ_SINGLE, /* flags */
sparclet_inits, /* Init strings */
MO_CLR_BREAK_USES_ADDR |
MO_HEX_PREFIX |
MO_NO_ECHO_ON_OPEN |
MO_NO_ECHO_ON_SETMEM |
MO_RUN_FIRST_TIME |
MO_GETMEM_READ_SINGLE, /* flags */
sparclet_inits, /* Init strings */
"cont\r", /* continue command */
"step\r", /* single step */
"\r", /* break interrupts the program */
"+bp %x\r", /* set a breakpoint */
"\r", /* break interrupts the program */
"+bp %x\r", /* set a breakpoint */
/* can't use "br" because only 2 hw bps are supported */
"-bp %x\r", /* clear a breakpoint */
"-bp\r", /* clear all breakpoints */
NULL, /* fill (start end val) */
"-bp %x\r", /* clear a breakpoint */
"-bp\r", /* clear all breakpoints */
"fill %x -n %x -v %x -b\r", /* fill (start length val) */
/* can't use "fi" because it takes words, not bytes */
{
/* ex [addr] [-n count] [-b|-s|-l] default: ex cur -n 1 -b */
"ex %x -b\r%x\rq\r", /* setmem.cmdb (addr, value) */
"ex %x -s\r%x\rq\r", /* setmem.cmdw (addr, value) */
"ex %x -l\r%x\rq\r",
"ex %x -b\r%x\rq\r", /* setmem.cmdb (addr, value) */
"ex %x -s\r%x\rq\r", /* setmem.cmdw (addr, value) */
"ex %x -l\r%x\rq\r", /* setmem.cmdl (addr, value) */
NULL, /* setmem.cmdll (addr, value) */
NULL, /*": ", /* setmem.resp_delim */
NULL, /*"? ", /* setmem.term */
NULL, /*"q\r", /* setmem.term_cmd */
NULL, /*": " */ /* setmem.resp_delim */
NULL, /*"? " */ /* setmem.term */
NULL, /*"q\r" */ /* setmem.term_cmd */
},
{
/* since the parsing of multiple bytes is difficult due to
@ -205,7 +228,7 @@ static struct monitor_ops sparclet_cmds =
"ex %x -n 1 -b\r", /* getmem.cmdb (addr, #bytes) */
"ex %x -n 1 -s\r", /* getmem.cmdw (addr, #swords) */
"ex %x -n 1 -l\r", /* getmem.cmdl (addr, #words) */
NULL, /* getmem.cmdll (addr, #dwords) */
NULL, /* getmem.cmdll (addr, #dwords) */
": ", /* getmem.resp_delim */
NULL, /* getmem.term */
NULL, /* getmem.term_cmd */
@ -217,29 +240,29 @@ static struct monitor_ops sparclet_cmds =
NULL /* setreg.term_cmd */
},
{
"reg %s\r", /* getreg.cmd (name) */
": ", /* getreg.resp_delim */
"reg %s\r", /* getreg.cmd (name) */
" ", /* getreg.resp_delim */
NULL, /* getreg.term */
NULL, /* getreg.term_cmd */
},
"reg\r", /* dump_registers */
"\\(\\w+\\)=\\([0-9a-fA-F]+\\)", /* register_pattern */
NULL, /* supply_register */
sparclet_supply_register, /* supply_register */
#ifdef USE_GENERIC_LOAD
NULL, /* load_routine (defaults to SRECs) */
NULL, /* download command */
NULL, /* load response */
#else
sparclet_load, /* load_routine (defaults to SRECs) */
/* load [c|a] [s|f|r] [addr count] */
"load a s %x\r", /* download command */
"load: ", /* load response */
NULL, /* load_routine (defaults to SRECs) */
/* load [c|a] [s | f | r [addr count]] */
"load c s\r", /* download command (srecs on console) */
"load: ", /* load response */
#endif
"monitor>", /* monitor command prompt */
"monitor>", /* monitor command prompt */
/* yikes! gdb core dumps without this delimitor!! */
"\r", /* end-of-command delimitor */
"\r", /* end-of-command delimitor */
NULL, /* optional command terminator */
&sparclet_ops, /* target operations */
&sparclet_ops, /* target operations */
SERIAL_1_STOPBITS, /* number of stop bits */
sparclet_regnames, /* registers names */
MONITOR_OPS_MAGIC /* magic */
@ -256,8 +279,16 @@ sparclet_open (args, from_tty)
void
_initialize_sparclet ()
{
init_monitor_ops (&sparclet_ops);
int i;
for (i = 0; i < NUM_REGS; i++)
if (sparclet_regnames[i][0] == 'c' ||
sparclet_regnames[i][0] == 'a')
sparclet_regnames[i] = 0; /* mon can't report c* or a* regs */
sparclet_regnames[0] = 0; /* mon won't report %G0 */
init_monitor_ops (&sparclet_ops);
sparclet_ops.to_shortname = "sparclet"; /* for the target command */
sparclet_ops.to_longname = "SPARC Sparclet monitor";
#ifdef USE_GENERIC_LOAD

1233
gdb/sparclet-stub.c Normal file

File diff suppressed because it is too large Load Diff