static int cpu_read_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n) { switch (n) { case S390_C0_REGNUM ... S390_C15_REGNUM: return gdb_get_regl(mem_buf, env->cregs[n]); default: return 0; } }
int s390_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; uint64_t val; int cc_op; switch (n) { case S390_PSWM_REGNUM: if (tcg_enabled()) { cc_op = calc_cc(env, env->cc_op, env->cc_src, env->cc_dst, env->cc_vr); val = deposit64(env->psw.mask, 44, 2, cc_op); return gdb_get_regl(mem_buf, val); } return gdb_get_regl(mem_buf, env->psw.mask); case S390_PSWA_REGNUM: return gdb_get_regl(mem_buf, env->psw.addr); case S390_R0_REGNUM ... S390_R15_REGNUM: return gdb_get_regl(mem_buf, env->regs[n - S390_R0_REGNUM]); } return 0; }
int ppc_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; int r = ppc_gdb_register_len(n); if (!r) { return r; } if (n < 32) { /* gprs */ gdb_get_regl(mem_buf, env->gpr[n]); } else if (n < 64) { /* fprs */ stfq_p(mem_buf, env->fpr[n-32]); } else { switch (n) { case 64: gdb_get_regl(mem_buf, env->nip); break; case 65: gdb_get_regl(mem_buf, env->msr); break; case 66: { uint32_t cr = 0; int i; for (i = 0; i < 8; i++) { cr |= env->crf[i] << (32 - ((i + 1) * 4)); } gdb_get_reg32(mem_buf, cr); break; } case 67: gdb_get_regl(mem_buf, env->lr); break; case 68: gdb_get_regl(mem_buf, env->ctr); break; case 69: gdb_get_regl(mem_buf, env->xer); break; case 70: gdb_get_reg32(mem_buf, env->fpscr); break; } } if (msr_le) { /* If cpu is in LE mode, convert memory contents to LE. */ ppc_gdb_swap_register(mem_buf, n, r); } return r; }
static int cpu_read_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n) { switch (n) { case S390_VIRT_CKC_REGNUM: return gdb_get_regl(mem_buf, env->ckc); case S390_VIRT_CPUTM_REGNUM: return gdb_get_regl(mem_buf, env->cputm); case S390_VIRT_BEA_REGNUM: return gdb_get_regl(mem_buf, env->gbea); case S390_VIRT_PREFIX_REGNUM: return gdb_get_regl(mem_buf, env->psa); case S390_VIRT_PP_REGNUM: return gdb_get_regl(mem_buf, env->pp); case S390_VIRT_PFT_REGNUM: return gdb_get_regl(mem_buf, env->pfault_token); case S390_VIRT_PFS_REGNUM: return gdb_get_regl(mem_buf, env->pfault_select); case S390_VIRT_PFC_REGNUM: return gdb_get_regl(mem_buf, env->pfault_compare); default: return 0; } }
int superh_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { SuperHCPU *cpu = SUPERH_CPU(cs); CPUSH4State *env = &cpu->env; switch (n) { case 0 ... 7: if ((env->sr & (1u << SR_MD)) && (env->sr & (1u << SR_RB))) { return gdb_get_regl(mem_buf, env->gregs[n + 16]); } else { return gdb_get_regl(mem_buf, env->gregs[n]); } case 8 ... 15: return gdb_get_regl(mem_buf, env->gregs[n]); case 16: return gdb_get_regl(mem_buf, env->pc); case 17: return gdb_get_regl(mem_buf, env->pr); case 18: return gdb_get_regl(mem_buf, env->gbr); case 19: return gdb_get_regl(mem_buf, env->vbr); case 20: return gdb_get_regl(mem_buf, env->mach); case 21: return gdb_get_regl(mem_buf, env->macl); case 22: return gdb_get_regl(mem_buf, cpu_read_sr(env)); case 23: return gdb_get_regl(mem_buf, env->fpul); case 24: return gdb_get_regl(mem_buf, env->fpscr); case 25 ... 40: if (env->fpscr & FPSCR_FR) { stfl_p(mem_buf, env->fregs[n - 9]); } else { stfl_p(mem_buf, env->fregs[n - 25]); } return 4; case 41: return gdb_get_regl(mem_buf, env->ssr); case 42: return gdb_get_regl(mem_buf, env->spc); case 43 ... 50: return gdb_get_regl(mem_buf, env->gregs[n - 43]); case 51 ... 58: return gdb_get_regl(mem_buf, env->gregs[n - (51 - 16)]); } return 0; }
int mips_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n) { MIPSCPU *cpu = MIPS_CPU(cs); CPUMIPSState *env = &cpu->env; if (n < 32) { return gdb_get_regl(mem_buf, env->active_tc.gpr[n]); } if (env->CP0_Config1 & (1 << CP0C1_FP)) { if (n >= 38 && n < 70) { if (env->CP0_Status & (1 << CP0St_FR)) { return gdb_get_regl(mem_buf, env->active_fpu.fpr[n - 38].d); } else { return gdb_get_regl(mem_buf, env->active_fpu.fpr[n - 38].w[FP_ENDIAN_IDX]); } } switch (n) { case 70: return gdb_get_regl(mem_buf, (int32_t)env->active_fpu.fcr31); case 71: return gdb_get_regl(mem_buf, (int32_t)env->active_fpu.fcr0); } } switch (n) { case 32: return gdb_get_regl(mem_buf, (int32_t)env->CP0_Status); case 33: return gdb_get_regl(mem_buf, env->active_tc.LO[0]); case 34: return gdb_get_regl(mem_buf, env->active_tc.HI[0]); case 35: return gdb_get_regl(mem_buf, env->CP0_BadVAddr); case 36: return gdb_get_regl(mem_buf, (int32_t)env->CP0_Cause); case 37: return gdb_get_regl(mem_buf, env->active_tc.PC | !!(env->hflags & MIPS_HFLAG_M16)); case 72: return gdb_get_regl(mem_buf, 0); /* fp */ case 89: return gdb_get_regl(mem_buf, (int32_t)env->CP0_PRid); } if (n >= 73 && n <= 88) { /* 16 embedded regs. */ return gdb_get_regl(mem_buf, 0); } return 0; }