static int fpu_gdb_set_reg(CPUState *env, uint8_t *mem_buf, int n) { if (n < 8) { env->fregs[n] = ldfq_p(mem_buf); return 8; } if (n < 11) { /* FP control registers (not implemented) */ return 4; } return 0; }
int ppc_cpu_gdb_write_register_apple(CPUState *cs, uint8_t *mem_buf, int n) { PowerPCCPU *cpu = POWERPC_CPU(cs); CPUPPCState *env = &cpu->env; int r = ppc_gdb_register_len_apple(n); if (!r) { return r; } if (msr_le) { /* If cpu is in LE mode, convert memory contents to LE. */ ppc_gdb_swap_register(mem_buf, n, r); } if (n < 32) { /* gprs */ env->gpr[n] = ldq_p(mem_buf); } else if (n < 64) { /* fprs */ env->fpr[n-32] = ldfq_p(mem_buf); } else { switch (n) { case 64 + 32: env->nip = ldq_p(mem_buf); break; case 65 + 32: ppc_store_msr(env, ldq_p(mem_buf)); break; case 66 + 32: { uint32_t cr = ldl_p(mem_buf); int i; for (i = 0; i < 8; i++) { env->crf[i] = (cr >> (32 - ((i + 1) * 4))) & 0xF; } break; } case 67 + 32: env->lr = ldq_p(mem_buf); break; case 68 + 32: env->ctr = ldq_p(mem_buf); break; case 69 + 32: env->xer = ldq_p(mem_buf); break; case 70 + 32: /* fpscr */ store_fpscr(env, ldq_p(mem_buf), 0xffffffff); break; } } return r; }
int ppc_cpu_gdb_write_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; } ppc_maybe_bswap_register(env, mem_buf, r); if (n < 32) { /* gprs */ env->gpr[n] = ldtul_p(mem_buf); } else if (n < 64) { /* fprs */ env->fpr[n-32] = ldfq_p(mem_buf); } else { switch (n) { case 64: env->nip = ldtul_p(mem_buf); break; case 65: ppc_store_msr(env, ldtul_p(mem_buf)); break; case 66: { uint32_t cr = ldl_p(mem_buf); int i; for (i = 0; i < 8; i++) { env->crf[i] = (cr >> (32 - ((i + 1) * 4))) & 0xF; } break; } case 67: env->lr = ldtul_p(mem_buf); break; case 68: env->ctr = ldtul_p(mem_buf); break; case 69: env->xer = ldtul_p(mem_buf); break; case 70: /* fpscr */ store_fpscr(env, ldtul_p(mem_buf), 0xffffffff); break; } } return r; }