Line 34... |
Line 34... |
#include "gdb_string.h"
|
#include "gdb_string.h"
|
#include "tm.h"
|
#include "tm.h"
|
#include "event-loop.h"
|
#include "event-loop.h"
|
#include "event-top.h"
|
#include "event-top.h"
|
#include "inf-loop.h"
|
#include "inf-loop.h"
|
|
#include "regcache.h"
|
|
|
#include <signal.h>
|
#include <signal.h>
|
#include <sys/types.h>
|
#include <sys/types.h>
|
#include <sys/stat.h>
|
#include <sys/stat.h>
|
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
Line 62... |
Line 63... |
extern void jtag_done PARAMS ((void));
|
extern void jtag_done PARAMS ((void));
|
extern int jtag_read_block PARAMS ((unsigned int regno, void* block, int nRegisters));
|
extern int jtag_read_block PARAMS ((unsigned int regno, void* block, int nRegisters));
|
extern int jtag_write_block PARAMS ((unsigned int regno, void* block, int nRegisters));
|
extern int jtag_write_block PARAMS ((unsigned int regno, void* block, int nRegisters));
|
extern void jtag_set_chain PARAMS ((int chain));
|
extern void jtag_set_chain PARAMS ((int chain));
|
struct target_ops or1k_jtag_ops;
|
struct target_ops or1k_jtag_ops;
|
|
|
static struct or1k_target_ops or1k_target_jtag =
|
static struct or1k_target_ops or1k_target_jtag =
|
{
|
{
|
"jtag",
|
"jtag",
|
jtag_init,
|
jtag_init,
|
jtag_done,
|
jtag_done,
|
Line 1021... |
Line 1023... |
for or1k_read_reg to finish, otherwise we would interrupt transaction. */
|
for or1k_read_reg to finish, otherwise we would interrupt transaction. */
|
if (interrupt_count)
|
if (interrupt_count)
|
or1k_stop ();
|
or1k_stop ();
|
|
|
usleep (10);
|
usleep (10);
|
debug ("%i", val);
|
debug ("%d", val);
|
} while ((val & 1) == 0);
|
} while ((val & 1) == 0);
|
|
|
/* If we had an error, wait just a while, so user can press another ^C */
|
/* If we had an error, wait just a while, so user can press another ^C */
|
if (quit_flag)
|
if (quit_flag)
|
sleep(1);
|
sleep(1);
|
Line 1338... |
Line 1340... |
if SHOULD_WRITE is nonzero. Returns length of data written or
|
if SHOULD_WRITE is nonzero. Returns length of data written or
|
read; 0 for error. Note that protocol gives us the correct value
|
read; 0 for error. Note that protocol gives us the correct value
|
for a longword, since it transfers values in ASCII. We want the
|
for a longword, since it transfers values in ASCII. We want the
|
byte values, so we have to swap the longword values. */
|
byte values, so we have to swap the longword values. */
|
|
|
|
static int or1k_load_block(CORE_ADDR addr,void* buffer,int nRegisters);
|
|
|
static int
|
static int
|
or1k_xfer_memory (memaddr, myaddr, len, write, ignore)
|
or1k_xfer_memory (memaddr, myaddr, len, write, ignore)
|
CORE_ADDR memaddr;
|
CORE_ADDR memaddr;
|
char *myaddr;
|
char *myaddr;
|
int len;
|
int len;
|
Line 1521... |
Line 1525... |
location in the target machine. CONTENTS_CACHE is a pointer to
|
location in the target machine. CONTENTS_CACHE is a pointer to
|
memory allocated for saving the target contents. It is guaranteed
|
memory allocated for saving the target contents. It is guaranteed
|
by the caller to be long enough to save sizeof BREAKPOINT bytes (this
|
by the caller to be long enough to save sizeof BREAKPOINT bytes (this
|
is accomplished via BREAKPOINT_MAX). */
|
is accomplished via BREAKPOINT_MAX). */
|
|
|
|
static int set_breakpoint (CORE_ADDR addr);
|
|
|
int
|
int
|
or1k_insert_breakpoint (addr, contents_cache)
|
or1k_insert_breakpoint (addr, contents_cache)
|
CORE_ADDR addr;
|
CORE_ADDR addr;
|
char *contents_cache;
|
char *contents_cache;
|
{
|
{
|
Line 1554... |
Line 1560... |
int
|
int
|
or1k_can_use_hardware_watchpoint (bp_type, cnt)
|
or1k_can_use_hardware_watchpoint (bp_type, cnt)
|
enum bptype bp_type;
|
enum bptype bp_type;
|
int cnt;
|
int cnt;
|
{
|
{
|
|
#if 0
|
|
// We can't rely on or1k_implementation.num_matchpoints, since that is only valid
|
|
// with JTAG. This function must work with remote gdbstub too, and the default
|
|
// remote handler does not know how many matchpoints there are.
|
/* Are there at least two matchpoints left for watch? - estimate lower bound */
|
/* Are there at least two matchpoints left for watch? - estimate lower bound */
|
return cnt + ((bp_type == bp_hardware_watchpoint)?(1):(0))
|
return cnt + ((bp_type == bp_hardware_watchpoint)?(1):(0))
|
<= or1k_implementation.num_matchpoints;
|
<= or1k_implementation.num_matchpoints;
|
|
#endif
|
|
if (cnt <= OR1K_MAX_MATCHPOINTS)
|
|
return 1;
|
|
else
|
|
return -1;
|
}
|
}
|
|
|
/* Moves matchpoint. This is very tricky - we have to update
|
/* Moves matchpoint. This is very tricky - we have to update
|
all references to matchpoint indexes. We assume here that
|
all references to matchpoint indexes. We assume here that
|
matchpoint with index to is unused! */
|
matchpoint with index to is unused! */
|
Line 1959... |
Line 1974... |
or1k_dummy_ops.to_prepare_to_store = or1k_prepare_to_store;
|
or1k_dummy_ops.to_prepare_to_store = or1k_prepare_to_store;
|
or1k_dummy_ops.to_xfer_memory = or1k_xfer_memory;
|
or1k_dummy_ops.to_xfer_memory = or1k_xfer_memory;
|
or1k_dummy_ops.to_files_info = or1k_files_info;
|
or1k_dummy_ops.to_files_info = or1k_files_info;
|
or1k_dummy_ops.to_insert_breakpoint = or1k_insert_breakpoint;
|
or1k_dummy_ops.to_insert_breakpoint = or1k_insert_breakpoint;
|
or1k_dummy_ops.to_remove_breakpoint = or1k_remove_breakpoint;
|
or1k_dummy_ops.to_remove_breakpoint = or1k_remove_breakpoint;
|
|
or1k_dummy_ops.to_insert_hw_breakpoint = or1k_insert_breakpoint;
|
|
or1k_dummy_ops.to_remove_hw_breakpoint = or1k_remove_breakpoint;
|
|
or1k_dummy_ops.to_insert_watchpoint = or1k_insert_watchpoint;
|
|
or1k_dummy_ops.to_remove_watchpoint = or1k_remove_watchpoint;
|
|
or1k_dummy_ops.to_stopped_by_watchpoint = or1k_stopped_by_watchpoint;
|
or1k_dummy_ops.to_kill = or1k_kill;
|
or1k_dummy_ops.to_kill = or1k_kill;
|
or1k_dummy_ops.to_load = generic_load;
|
or1k_dummy_ops.to_load = generic_load;
|
or1k_dummy_ops.to_create_inferior = or1k_create_inferior;
|
or1k_dummy_ops.to_create_inferior = or1k_create_inferior;
|
or1k_dummy_ops.to_mourn_inferior = or1k_mourn_inferior;
|
or1k_dummy_ops.to_mourn_inferior = or1k_mourn_inferior;
|
or1k_dummy_ops.to_stratum = process_stratum;
|
or1k_dummy_ops.to_stratum = process_stratum;
|