[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 02/10] gdbstub: Clarify no more than @gdb_num_core_regs ca
From: |
Alex Bennée |
Subject: |
Re: [PATCH v2 02/10] gdbstub: Clarify no more than @gdb_num_core_regs can be accessed |
Date: |
Wed, 22 Jan 2025 20:55:44 +0000 |
User-agent: |
mu4e 1.12.8; emacs 29.4 |
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> Both CPUClass::gdb_read_register() and CPUClass::gdb_write_register()
> handlers are called from common gdbstub code, and won't be called with
> register index over CPUClass::gdb_num_core_regs:
>
> int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
> {
> CPUClass *cc = CPU_GET_CLASS(cpu);
>
> if (reg < cc->gdb_num_core_regs) {
> return cc->gdb_read_register(cpu, buf, reg);
> }
> ...
> }
>
> static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg)
> {
> CPUClass *cc = CPU_GET_CLASS(cpu);
>
> if (reg < cc->gdb_num_core_regs) {
> return cc->gdb_write_register(cpu, mem_buf, reg);
> }
> ...
> }
>
> Clarify that in CPUClass docstring, and remove unreachable code on
> the microblaze and tricore implementations.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
- [PATCH v2 00/10] cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 01/10] hw/core/generic-loader: Do not open-code cpu_set_pc(), Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 02/10] gdbstub: Clarify no more than @gdb_num_core_regs can be accessed, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 04/10] cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 03/10] cpus: Cache CPUClass early in instance_init() handler, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 05/10] accel: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 06/10] user: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 07/10] disas: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 08/10] gdbstub: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 09/10] hw/acpi: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22
- [PATCH v2 10/10] target/arm: Prefer cached CpuClass over CPU_GET_CLASS() macro, Philippe Mathieu-Daudé, 2025/01/22