target/arm/gdbstub: make compilation unit common

Expose and stubs aarch64 functions. All call sites are under a
"is_aarch64" check.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109053158.2800705-4-pierrick.bouvier@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Pierrick Bouvier
2026-01-08 21:31:32 -08:00
committed by Philippe Mathieu-Daudé
parent 7e274980f2
commit f445b4a4b6
3 changed files with 27 additions and 14 deletions

View File

@@ -24,3 +24,24 @@ void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
{
g_assert_not_reached();
}
int aarch64_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
{
g_assert_not_reached();
}
int aarch64_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg)
{
g_assert_not_reached();
}
void aarch64_cpu_register_gdb_commands(ARMCPU *cpu, GString *qsupported,
GPtrArray *qtable, GPtrArray *stable)
{
g_assert_not_reached();
}
void aarch64_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
{
g_assert_not_reached();
}

View File

@@ -44,11 +44,9 @@ int arm_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
ARMCPU *cpu = ARM_CPU(cs);
CPUARMState *env = &cpu->env;
#ifdef TARGET_AARCH64
if (arm_gdbstub_is_aarch64(cpu)) {
return aarch64_cpu_gdb_read_register(cs, mem_buf, n);
}
#endif
if (n < 16) {
/* Core integer register. */
@@ -72,11 +70,9 @@ int arm_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
CPUARMState *env = &cpu->env;
uint32_t tmp;
#ifdef TARGET_AARCH64
if (arm_gdbstub_is_aarch64(cpu)) {
return aarch64_cpu_gdb_write_register(cs, mem_buf, n);
}
#endif
tmp = ldl_p(mem_buf);
@@ -504,10 +500,8 @@ void arm_cpu_register_gdb_commands(ARMCPU *cpu)
g_autoptr(GString) qsupported_features = g_string_new(NULL);
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
#ifdef TARGET_AARCH64
aarch64_cpu_register_gdb_commands(cpu, qsupported_features, query_table,
set_table);
#endif
}
/* Set arch-specific handlers for 'q' commands. */
@@ -536,9 +530,7 @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
* The lower part of each SVE register aliases to the FPU
* registers so we don't need to include both.
*/
#ifdef TARGET_AARCH64
aarch64_cpu_register_gdb_regs_for_features(cpu);
#endif
} else {
if (arm_feature(env, ARM_FEATURE_NEON)) {
gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg,

View File

@@ -1,8 +1,11 @@
arm_ss = ss.source_set()
arm_common_ss = ss.source_set()
arm_ss.add(files(
'gdbstub.c',
))
arm_common_system_ss = ss.source_set()
arm_system_ss = ss.source_set()
arm_user_ss = ss.source_set()
arm_common_system_ss.add(files('gdbstub.c'))
arm_user_ss.add(files('gdbstub.c'))
arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
'cpu64.c',
@@ -13,15 +16,12 @@ arm_common_ss.add(files(
'mmuidx.c',
))
arm_system_ss = ss.source_set()
arm_common_system_ss = ss.source_set()
arm_system_ss.add(files(
'arm-qmp-cmds.c',
))
arm_system_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'))
arm_system_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
arm_user_ss = ss.source_set()
arm_user_ss.add(files('cpu.c'))
arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files(
'cpu32-stubs.c',