22 #include <sys/ptrace.h>
45 #define tdesc_mips_linux tdesc_mips64_linux
46 #define tdesc_mips_dsp_linux tdesc_mips64_dsp_linux
49 #ifndef PTRACE_GET_THREAD_AREA
50 #define PTRACE_GET_THREAD_AREA 25
57 #define mips_num_regs 73
58 #define mips_dsp_num_regs 80
60 #include <asm/ptrace.h>
64 #define DSP_CONTROL 77
78 #define mips_base_regs \
79 -1, 1, 2, 3, 4, 5, 6, 7, \
80 8, 9, 10, 11, 12, 13, 14, 15, \
81 16, 17, 18, 19, 20, 21, 22, 23, \
82 24, 25, 26, 27, 28, 29, 30, 31, \
84 -1, MMLO, MMHI, BADVADDR, CAUSE, PC, \
86 FPR_BASE, FPR_BASE + 1, FPR_BASE + 2, FPR_BASE + 3, \
87 FPR_BASE + 4, FPR_BASE + 5, FPR_BASE + 6, FPR_BASE + 7, \
88 FPR_BASE + 8, FPR_BASE + 9, FPR_BASE + 10, FPR_BASE + 11, \
89 FPR_BASE + 12, FPR_BASE + 13, FPR_BASE + 14, FPR_BASE + 15, \
90 FPR_BASE + 16, FPR_BASE + 17, FPR_BASE + 18, FPR_BASE + 19, \
91 FPR_BASE + 20, FPR_BASE + 21, FPR_BASE + 22, FPR_BASE + 23, \
92 FPR_BASE + 24, FPR_BASE + 25, FPR_BASE + 26, FPR_BASE + 27, \
93 FPR_BASE + 28, FPR_BASE + 29, FPR_BASE + 30, FPR_BASE + 31, \
96 #define mips_dsp_regs \
97 DSP_BASE, DSP_BASE + 1, DSP_BASE + 2, DSP_BASE + 3, \
98 DSP_BASE + 4, DSP_BASE + 5, \
116 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x80
159 const struct regs_info *regs_info = the_low_target.
regs_info ();
267 #define mips_breakpoint_len 4
287 if (insn == mips_breakpoint)
304 int pid = *(
int *) pid_p;
307 if (
pid_of (thread) == pid)
351 int len,
int watch_type)
359 new_watch->
type = watch_type;
360 new_watch->
next = NULL;
362 pw = &
private->current_watches;
522 if (w->
addr == addr && w->
len == len && w->
type == watch_type)
631 if (last_byte >= t_low && addr <= t_low + t_hi)
644 lwpid_t lwpid,
int idx,
void **base)
652 *base = (
void *) ((
char *)*base - idx);
657 #ifdef HAVE_PTRACE_GETREGS
660 mips_collect_register (
struct regcache *regcache,
673 reg->
reg64 = tmp_reg.reg32;
678 mips_supply_register (
struct regcache *regcache,
685 if (__BYTE_ORDER == __BIG_ENDIAN && !use_64bit)
692 mips_collect_register_32bit (
struct regcache *regcache,
693 int use_64bit,
int regno,
unsigned char *buf)
698 mips_collect_register (regcache, use_64bit, regno, &tmp_reg);
699 reg32 = tmp_reg.reg64;
700 memcpy (buf, ®32, 4);
704 mips_supply_register_32bit (
struct regcache *regcache,
705 int use_64bit,
int regno,
const unsigned char *buf)
710 memcpy (®32, buf, 4);
711 tmp_reg.reg64 =
reg32;
712 mips_supply_register (regcache, use_64bit, regno, &tmp_reg);
716 mips_fill_gregset (
struct regcache *regcache,
void *buf)
724 for (i = 1; i < 32; i++)
725 mips_collect_register (regcache, use_64bit, i, regset + i);
727 mips_collect_register (regcache, use_64bit,
729 mips_collect_register (regcache, use_64bit,
731 mips_collect_register (regcache, use_64bit,
733 mips_collect_register (regcache, use_64bit,
735 mips_collect_register (regcache, use_64bit,
737 mips_collect_register (regcache, use_64bit,
740 mips_collect_register (regcache, use_64bit,
745 mips_store_gregset (
struct regcache *regcache,
const void *buf)
752 for (i = 0; i < 32; i++)
753 mips_supply_register (regcache, use_64bit, i, regset + i);
755 mips_supply_register (regcache, use_64bit,
757 mips_supply_register (regcache, use_64bit,
759 mips_supply_register (regcache, use_64bit,
761 mips_supply_register (regcache, use_64bit,
763 mips_supply_register (regcache, use_64bit,
765 mips_supply_register (regcache, use_64bit,
768 mips_supply_register (regcache, use_64bit,
773 mips_fill_fpregset (
struct regcache *regcache,
void *buf)
776 int i, use_64bit, first_fp, big_endian;
780 big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
783 for (i = 0; i < 32; i++)
788 regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
790 mips_collect_register_32bit (regcache, use_64bit,
792 mips_collect_register_32bit (regcache, use_64bit,
798 mips_store_fpregset (
struct regcache *regcache,
const void *buf)
801 int i, use_64bit, first_fp, big_endian;
805 big_endian = (__BYTE_ORDER == __BIG_ENDIAN);
808 for (i = 0; i < 32; i++)
813 regset[i & ~1].buf + 4 * (big_endian != (i & 1)));
815 mips_supply_register_32bit (regcache, use_64bit,
818 mips_supply_register_32bit (regcache, use_64bit,
824 static struct regset_info mips_regsets[] = {
825 #ifdef HAVE_PTRACE_GETREGS
826 { PTRACE_GETREGS, PTRACE_SETREGS, 0, 38 * 8, GENERAL_REGS,
827 mips_fill_gregset, mips_store_gregset },
828 { PTRACE_GETFPREGS, PTRACE_SETFPREGS, 0, 33 * 8, FP_REGS,
829 mips_fill_fpregset, mips_store_fpregset },
831 { 0, 0, 0, -1, -1, NULL, NULL }
834 static struct regsets_info mips_regsets_info =
853 static struct regs_info dsp_regs_info =
860 static struct regs_info regs_info =
867 static const struct regs_info *
884 (
const unsigned char *) &mips_breakpoint,
912 initialize_regsets_info (&mips_regsets_info);
const struct target_desc * tdesc
struct arch_lwp_info * arch_private
enum target_hw_bp_type raw_bkpt_type_to_target_hw_bp_type(enum raw_bkpt_type raw_type)
static void mips_linux_new_thread(struct lwp_info *lwp)
struct thread_info * current_thread
void collect_register(struct regcache *regcache, int n, void *buf)
#define mips_dsp_num_regs
struct usrregs_info * usrregs
const struct target_desc * tdesc_mips_dsp_linux
#define mips_breakpoint_len
void supply_register_by_name(struct regcache *regcache, const char *name, const void *buf)
static int mips_cannot_fetch_register(int regno)
static void mips_linux_prepare_to_resume(struct lwp_info *lwp)
int watch_registers_changed
struct mips_watchpoint * next
CORE_ADDR mips_linux_watch_get_watchlo(struct pt_watch_regs *regs, int n)
static void mips_add_watchpoint(struct arch_process_info *private, CORE_ADDR addr, int len, int watch_type)
static struct usrregs_info mips_usrregs_info
struct process_info * find_process_pid(int pid)
int mips_linux_watch_try_one_watch(struct pt_watch_regs *regs, CORE_ADDR addr, int len, uint32_t irw)
void init_registers_mips64_linux(void)
void init_registers_mips64_dsp_linux(void)
ps_err_e ps_get_thread_area(const struct ps_prochandle *ph, lwpid_t lwpid, int idx, void **base)
const struct regs_info *(* regs_info)(void)
static int update_watch_registers_callback(struct inferior_list_entry *entry, void *pid_p)
static struct usrregs_info * get_usrregs_info(void)
#define get_thread_lwp(thr)
struct target_ops * the_target
struct pt_watch_regs watch_mirror
const struct target_desc * tdesc
const struct target_desc * tdesc_mips64_dsp_linux
struct arch_process_info * arch_private
void collect_register_by_name(struct regcache *regcache, const char *name, void *buf)
struct mips_watchpoint * current_watches
static const struct regs_info * mips_regs_info(void)
static const struct target_desc * mips_read_description(void)
static struct arch_process_info * mips_linux_new_process(void)
static struct regs_info dsp_regs_info
static int mips_supports_z_point_type(char z_type)
#define get_lwp_thread(lwp)
int register_size(const struct target_desc *tdesc, int n)
static void mips_arch_setup(void)
static int mips_insert_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
struct process_info * current_process(void)
static int mips_cannot_store_register(int regno)
struct process_info_private * priv
struct inferior_list all_threads
int mips_linux_read_watch_registers(long lwpid, struct pt_watch_regs *watch_readback, int *watch_readback_valid, int force)
static const unsigned int mips_breakpoint
static int mips_remove_point(enum raw_bkpt_type type, CORE_ADDR addr, int len, struct raw_breakpoint *bp)
static struct usrregs_info mips_dsp_usrregs_info
int ptid_get_pid(ptid_t ptid)
const struct target_desc * tdesc_mips_linux
static int mips_breakpoint_at(CORE_ADDR where)
int find_regno(const struct target_desc *tdesc, const char *name)
static unsigned char mips_dsp_regset_bitmap[(mips_dsp_num_regs+7)/8]
uint32_t mips_linux_watch_get_watchhi(struct pt_watch_regs *regs, int n)
#define MAX_DEBUG_REGISTER
#define PTRACE_SET_WATCH_REGS
int(* read_memory)(CORE_ADDR memaddr, unsigned char *myaddr, int len)
struct regcache * get_thread_regcache(struct thread_info *thread, int fetch)
uint32_t mips_linux_watch_type_to_irw(int type)
#define Z_PACKET_ACCESS_WP
void perror_with_name(const char *string)
static void mips_linux_new_fork(struct process_info *parent, struct process_info *child)
void init_registers_mips_linux(void)
void mips_linux_watch_populate_regs(struct mips_watchpoint *current_watches, struct pt_watch_regs *regs)
static int mips_regmap[mips_num_regs]
struct pt_watch_regs watch_readback
static int mips_stopped_by_watchpoint(void)
long ptid_get_lwp(ptid_t ptid)
void initialize_low_arch(void)
uint32_t mips_linux_watch_get_num_valid(struct pt_watch_regs *regs)
static CORE_ADDR mips_reinsert_addr(void)
void linux_stop_lwp(struct lwp_info *lwp)
void supply_register(struct regcache *regcache, int n, const void *buf)
static int mips_dsp_regmap[mips_dsp_num_regs]
PTR xcalloc(size_t number, size_t size)
static CORE_ADDR mips_stopped_data_address(void)
static struct regs_info regs_info
static void mips_set_pc(struct regcache *regcache, CORE_ADDR pc)
#define PTRACE_GET_THREAD_AREA
#define Z_PACKET_WRITE_WP
struct inferior_list_entry * find_inferior(struct inferior_list *list, int(*func)(struct inferior_list_entry *, void *), void *arg)
const struct target_desc * tdesc_mips64_linux
static CORE_ADDR mips_get_pc(struct regcache *regcache)
void init_registers_mips_dsp_linux(void)
static struct regset_info mips_regsets[]