mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
gdbstub: Change gdb_get_reg_cb and gdb_set_reg_cb
Align the parameters of gdb_get_reg_cb and gdb_set_reg_cb with the gdb_read_register and gdb_write_register members of CPUClass to allow to unify the logic to access registers of the core and coprocessors in the future. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20231213-gdb-v17-6-777047380591@daynix.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240227144335.1196131-11-alex.bennee@linaro.org>
This commit is contained in:
parent
c494f8f529
commit
66260159a7
14 changed files with 238 additions and 93 deletions
|
@ -68,8 +68,11 @@ int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
|
|||
#define S390_A0_REGNUM 0
|
||||
#define S390_A15_REGNUM 15
|
||||
|
||||
static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n)
|
||||
static int cpu_read_ac_reg(CPUState *cs, GByteArray *buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_A0_REGNUM ... S390_A15_REGNUM:
|
||||
return gdb_get_reg32(buf, env->aregs[n]);
|
||||
|
@ -78,8 +81,11 @@ static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n)
|
|||
}
|
||||
}
|
||||
|
||||
static int cpu_write_ac_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_ac_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_A0_REGNUM ... S390_A15_REGNUM:
|
||||
env->aregs[n] = ldl_p(mem_buf);
|
||||
|
@ -95,8 +101,11 @@ static int cpu_write_ac_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_F0_REGNUM 1
|
||||
#define S390_F15_REGNUM 16
|
||||
|
||||
static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n)
|
||||
static int cpu_read_fp_reg(CPUState *cs, GByteArray *buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_FPC_REGNUM:
|
||||
return gdb_get_reg32(buf, env->fpc);
|
||||
|
@ -107,8 +116,11 @@ static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n)
|
|||
}
|
||||
}
|
||||
|
||||
static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_FPC_REGNUM:
|
||||
env->fpc = ldl_p(mem_buf);
|
||||
|
@ -127,8 +139,10 @@ static int cpu_write_fp_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_V16_REGNUM 16
|
||||
#define S390_V31_REGNUM 31
|
||||
|
||||
static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n)
|
||||
static int cpu_read_vreg(CPUState *cs, GByteArray *buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
int ret;
|
||||
|
||||
switch (n) {
|
||||
|
@ -146,8 +160,11 @@ static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_V0L_REGNUM ... S390_V15L_REGNUM:
|
||||
env->vregs[n][1] = ldtul_p(mem_buf + 8);
|
||||
|
@ -166,8 +183,11 @@ static int cpu_write_vreg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_C15_REGNUM 15
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n)
|
||||
static int cpu_read_c_reg(CPUState *cs, GByteArray *buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_C0_REGNUM ... S390_C15_REGNUM:
|
||||
return gdb_get_regl(buf, env->cregs[n]);
|
||||
|
@ -176,8 +196,11 @@ static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n)
|
|||
}
|
||||
}
|
||||
|
||||
static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_C0_REGNUM ... S390_C15_REGNUM:
|
||||
env->cregs[n] = ldtul_p(mem_buf);
|
||||
|
@ -197,8 +220,11 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_VIRT_BEA_REGNUM 2
|
||||
#define S390_VIRT_PREFIX_REGNUM 3
|
||||
|
||||
static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
|
||||
static int cpu_read_virt_reg(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_VIRT_CKC_REGNUM:
|
||||
return gdb_get_regl(mem_buf, env->ckc);
|
||||
|
@ -213,24 +239,27 @@ static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
|
|||
}
|
||||
}
|
||||
|
||||
static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_VIRT_CKC_REGNUM:
|
||||
env->ckc = ldtul_p(mem_buf);
|
||||
cpu_synchronize_post_init(env_cpu(env));
|
||||
cpu_synchronize_post_init(cs);
|
||||
return 8;
|
||||
case S390_VIRT_CPUTM_REGNUM:
|
||||
env->cputm = ldtul_p(mem_buf);
|
||||
cpu_synchronize_post_init(env_cpu(env));
|
||||
cpu_synchronize_post_init(cs);
|
||||
return 8;
|
||||
case S390_VIRT_BEA_REGNUM:
|
||||
env->gbea = ldtul_p(mem_buf);
|
||||
cpu_synchronize_post_init(env_cpu(env));
|
||||
cpu_synchronize_post_init(cs);
|
||||
return 8;
|
||||
case S390_VIRT_PREFIX_REGNUM:
|
||||
env->psa = ldtul_p(mem_buf);
|
||||
cpu_synchronize_post_init(env_cpu(env));
|
||||
cpu_synchronize_post_init(cs);
|
||||
return 8;
|
||||
default:
|
||||
return 0;
|
||||
|
@ -243,8 +272,11 @@ static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_VIRT_KVM_PFS_REGNUM 2
|
||||
#define S390_VIRT_KVM_PFC_REGNUM 3
|
||||
|
||||
static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
|
||||
static int cpu_read_virt_kvm_reg(CPUState *cs, GByteArray *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_VIRT_KVM_PP_REGNUM:
|
||||
return gdb_get_regl(mem_buf, env->pp);
|
||||
|
@ -259,8 +291,11 @@ static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n)
|
|||
}
|
||||
}
|
||||
|
||||
static int cpu_write_virt_kvm_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
switch (n) {
|
||||
case S390_VIRT_KVM_PP_REGNUM:
|
||||
env->pp = ldtul_p(mem_buf);
|
||||
|
@ -290,13 +325,19 @@ static int cpu_write_virt_kvm_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
|||
#define S390_GS_GSSM_REGNUM 2
|
||||
#define S390_GS_GSEPLA_REGNUM 3
|
||||
|
||||
static int cpu_read_gs_reg(CPUS390XState *env, GByteArray *buf, int n)
|
||||
static int cpu_read_gs_reg(CPUState *cs, GByteArray *buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
return gdb_get_regl(buf, env->gscb[n]);
|
||||
}
|
||||
|
||||
static int cpu_write_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
|
||||
static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n)
|
||||
{
|
||||
S390CPU *cpu = S390_CPU(cs);
|
||||
CPUS390XState *env = &cpu->env;
|
||||
|
||||
env->gscb[n] = ldtul_p(mem_buf);
|
||||
cpu_synchronize_post_init(env_cpu(env));
|
||||
return 8;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue