24 #include <asm/ptrace.h>
91 #define ppc_num_regs 73
97 {PT_R0 * 8, PT_R1 * 8, PT_R2 * 8, PT_R3 * 8,
98 PT_R4 * 8, PT_R5 * 8, PT_R6 * 8, PT_R7 * 8,
99 PT_R8 * 8, PT_R9 * 8, PT_R10 * 8, PT_R11 * 8,
100 PT_R12 * 8, PT_R13 * 8, PT_R14 * 8, PT_R15 * 8,
101 PT_R16 * 8, PT_R17 * 8, PT_R18 * 8, PT_R19 * 8,
102 PT_R20 * 8, PT_R21 * 8, PT_R22 * 8, PT_R23 * 8,
103 PT_R24 * 8, PT_R25 * 8, PT_R26 * 8, PT_R27 * 8,
104 PT_R28 * 8, PT_R29 * 8, PT_R30 * 8, PT_R31 * 8,
105 PT_FPR0*8, PT_FPR0*8 + 8, PT_FPR0*8+16, PT_FPR0*8+24,
106 PT_FPR0*8+32, PT_FPR0*8+40, PT_FPR0*8+48, PT_FPR0*8+56,
107 PT_FPR0*8+64, PT_FPR0*8+72, PT_FPR0*8+80, PT_FPR0*8+88,
108 PT_FPR0*8+96, PT_FPR0*8+104, PT_FPR0*8+112, PT_FPR0*8+120,
109 PT_FPR0*8+128, PT_FPR0*8+136, PT_FPR0*8+144, PT_FPR0*8+152,
110 PT_FPR0*8+160, PT_FPR0*8+168, PT_FPR0*8+176, PT_FPR0*8+184,
111 PT_FPR0*8+192, PT_FPR0*8+200, PT_FPR0*8+208, PT_FPR0*8+216,
112 PT_FPR0*8+224, PT_FPR0*8+232, PT_FPR0*8+240, PT_FPR0*8+248,
113 PT_NIP * 8, PT_MSR * 8, PT_CCR * 8, PT_LNK * 8,
114 PT_CTR * 8, PT_XER * 8, PT_FPR0*8 + 256,
118 static int ppc_regmap[] =
119 {PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4,
120 PT_R4 * 4, PT_R5 * 4, PT_R6 * 4, PT_R7 * 4,
121 PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
122 PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4,
123 PT_R16 * 4, PT_R17 * 4, PT_R18 * 4, PT_R19 * 4,
124 PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
125 PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4,
126 PT_R28 * 4, PT_R29 * 4, PT_R30 * 4, PT_R31 * 4,
127 PT_FPR0*4, PT_FPR0*4 + 8, PT_FPR0*4+16, PT_FPR0*4+24,
128 PT_FPR0*4+32, PT_FPR0*4+40, PT_FPR0*4+48, PT_FPR0*4+56,
129 PT_FPR0*4+64, PT_FPR0*4+72, PT_FPR0*4+80, PT_FPR0*4+88,
130 PT_FPR0*4+96, PT_FPR0*4+104, PT_FPR0*4+112, PT_FPR0*4+120,
131 PT_FPR0*4+128, PT_FPR0*4+136, PT_FPR0*4+144, PT_FPR0*4+152,
132 PT_FPR0*4+160, PT_FPR0*4+168, PT_FPR0*4+176, PT_FPR0*4+184,
133 PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216,
134 PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248,
135 PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4,
136 PT_CTR * 4, PT_XER * 4, PT_FPSCR * 4,
141 {PT_R0 * 4, PT_R1 * 4, PT_R2 * 4, PT_R3 * 4,
142 PT_R4 * 4, PT_R5 * 4, PT_R6 * 4, PT_R7 * 4,
143 PT_R8 * 4, PT_R9 * 4, PT_R10 * 4, PT_R11 * 4,
144 PT_R12 * 4, PT_R13 * 4, PT_R14 * 4, PT_R15 * 4,
145 PT_R16 * 4, PT_R17 * 4, PT_R18 * 4, PT_R19 * 4,
146 PT_R20 * 4, PT_R21 * 4, PT_R22 * 4, PT_R23 * 4,
147 PT_R24 * 4, PT_R25 * 4, PT_R26 * 4, PT_R27 * 4,
148 PT_R28 * 4, PT_R29 * 4, PT_R30 * 4, PT_R31 * 4,
157 PT_NIP * 4, PT_MSR * 4, PT_CCR * 4, PT_LNK * 4,
158 PT_CTR * 4, PT_XER * 4, -1,
168 #ifndef __powerpc64__
192 memset (buf, 0,
sizeof (
long));
194 if (__BYTE_ORDER == __LITTLE_ENDIAN)
199 else if (__BYTE_ORDER == __BIG_ENDIAN)
206 if (size <
sizeof (
long))
217 int regno,
const char *buf)
219 if (__BYTE_ORDER == __LITTLE_ENDIAN)
224 else if (__BYTE_ORDER == __BIG_ENDIAN)
231 if (size <
sizeof (
long))
241 #define INSTR_SC 0x44000002
242 #define NR_spu_run 0x0116
256 unsigned int pc, r0, r3, r4;
268 unsigned long pc, r0, r3, r4;
281 (
unsigned char *) &curr_insn, 4) != 0)
328 unsigned int newpc = pc;
333 unsigned int newpc = pc;
338 unsigned long newpc = pc;
349 unsigned char *data =
alloca (2 * wordsize);
356 unsigned int *data_p = (
unsigned int *)data;
357 if (data_p[0] == AT_HWCAP)
365 unsigned long *data_p = (
unsigned long *)data;
366 if (data_p[0] == AT_HWCAP)
373 offset += 2 * wordsize;
382 #ifndef __powerpc64__
405 if (ppc64_64bit_inferior_p (msr))
461 #ifndef __powerpc64__
465 if (!ppc_regmap_adjusted)
467 if (ppc_hwcap & PPC_FEATURE_HAS_SPE)
475 ppc_regmap[70] = (48 + 2*32) *
sizeof (
long);
477 ppc_regmap_adjusted = 1;
487 #define ppc_breakpoint_len 4
497 sprintf (mem_annex,
"%d/mem", (
int)((where >> 32) & 0x7fffffff));
499 NULL, where & 0xffffffff, 4);
506 if (insn == ppc_breakpoint)
522 for (i = 0; i < 32; i++)
525 for (i = 64; i < 70; i++)
528 for (i = 71; i < 73; i++)
532 #define SIZEOF_VSXREGS 32*8
544 for (i = 0; i < 32; i++)
552 const char *regset = buf;
558 for (i = 0; i < 32; i++)
562 #define SIZEOF_VRREGS 33*16+4
574 for (i = 0; i < 32; i++)
585 const char *regset = buf;
591 for (i = 0; i < 32; i++)
615 for (i = 0; i < 32; i++)
632 for (i = 0; i < 32; i++)
651 { 0, 0, 0, -1, -1, NULL, NULL }
667 static struct regs_info regs_info =
674 static const struct regs_info *
688 (
const unsigned char *) &ppc_breakpoint,
723 initialize_regsets_info (&ppc_regsets_info);
const struct target_desc * tdesc
const struct target_desc * tdesc_powerpc_cell64l
const struct target_desc * tdesc_powerpc_altivec32l
void collect_register(struct regcache *regcache, int n, void *buf)
const struct target_desc * tdesc_powerpc_isa205_vsx64l
void init_registers_powerpc_isa205_altivec32l(void)
static struct regsets_info ppc_regsets_info
static void ppc_store_vsxregset(struct regcache *regcache, const void *buf)
struct regcache * new_register_cache(const struct target_desc *tdesc)
void supply_register_by_name(struct regcache *regcache, const char *name, const void *buf)
const struct target_desc * tdesc_powerpc_altivec64l
void init_registers_powerpc_altivec64l(void)
void init_registers_powerpc_64l(void)
static int ppc_cannot_fetch_register(int regno)
static void ppc_collect_ptrace_register(struct regcache *regcache, int regno, char *buf)
const struct target_desc * tdesc_powerpc_e500l
void init_registers_powerpc_altivec32l(void)
static struct regset_info ppc_regsets[]
static void ppc_fill_evrregset(struct regcache *regcache, void *buf)
static int ppc_breakpoint_at(CORE_ADDR where)
static int parse_spufs_run(struct regcache *regcache, int *fd, CORE_ADDR *addr)
void init_registers_powerpc_32l(void)
static struct usrregs_info ppc_usrregs_info
const struct target_desc * tdesc_powerpc_isa205_vsx32l
#define PTRACE_GETEVRREGS
const struct target_desc * tdesc_powerpc_vsx32l
struct target_ops * the_target
const struct target_desc * tdesc
static void ppc_store_evrregset(struct regcache *regcache, const void *buf)
#define PPC_FEATURE_HAS_DFP
static int ppc_get_hwcap(unsigned long *valp)
#define ppc_breakpoint_len
void collect_register_by_name(struct regcache *regcache, const char *name, void *buf)
const struct target_desc * tdesc_powerpc_isa205_altivec64l
static void ppc_fill_vrregset(struct regcache *regcache, void *buf)
#define PTRACE_SETEVRREGS
int(* write_memory)(CORE_ADDR memaddr, const unsigned char *myaddr, int len)
void init_registers_powerpc_isa205_32l(void)
static int ppc_cannot_store_register(int regno)
static void ppc_fill_vsxregset(struct regcache *regcache, void *buf)
const struct target_desc * tdesc_powerpc_32l
static void ppc_supply_ptrace_register(struct regcache *regcache, int regno, const char *buf)
#define PPC_FEATURE_HAS_ALTIVEC
void init_registers_powerpc_cell64l(void)
int register_size(const struct target_desc *tdesc, int n)
const struct target_desc * tdesc_powerpc_isa205_32l
struct process_info * current_process(void)
void init_registers_powerpc_vsx32l(void)
const struct target_desc * tdesc_powerpc_cell32l
void init_registers_powerpc_isa205_vsx64l(void)
static CORE_ADDR ppc_get_pc(struct regcache *regcache)
const struct target_desc * tdesc_powerpc_isa205_64l
static int ppc_regmap_adjusted
int(* qxfer_spu)(const char *annex, unsigned char *readbuf, unsigned const char *writebuf, CORE_ADDR offset, int len)
void init_registers_powerpc_vsx64l(void)
void init_registers_powerpc_cell32l(void)
int find_regno(const struct target_desc *tdesc, const char *name)
void init_registers_powerpc_e500l(void)
const struct target_desc * tdesc_powerpc_vsx64l
#define PPC_FEATURE_HAS_SPE
#define fetch_inferior_registers(regcache, regno)
int(* read_auxv)(CORE_ADDR offset, unsigned char *myaddr, unsigned int len)
#define PTRACE_GETVSXREGS
int(* read_memory)(CORE_ADDR memaddr, unsigned char *myaddr, int len)
void init_registers_powerpc_isa205_altivec64l(void)
const struct target_desc * tdesc_powerpc_64l
static void ppc_arch_setup(void)
static int ppc_regmap_e500[]
void perror_with_name(const char *string)
void free_register_cache(struct regcache *regcache)
void init_registers_powerpc_isa205_vsx32l(void)
static const unsigned int ppc_breakpoint
void initialize_low_arch(void)
#define PTRACE_SETVSXREGS
static struct regs_info regs_info
void supply_register(struct regcache *regcache, int n, const void *buf)
static unsigned long ppc_hwcap
static const struct regs_info * ppc_regs_info(void)
static void ppc_set_pc(struct regcache *regcache, CORE_ADDR pc)
static void ppc_store_vrregset(struct regcache *regcache, const void *buf)
#define PPC_FEATURE_HAS_VSX
static void ppc_fill_gregset(struct regcache *regcache, void *buf)
void init_registers_powerpc_isa205_64l(void)
const struct target_desc * tdesc_powerpc_isa205_altivec32l