[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 03/12] plugins: Ensure register handles are not NULL
From: |
Alex Bennée |
Subject: |
[PATCH v2 03/12] plugins: Ensure register handles are not NULL |
Date: |
Thu, 20 Jun 2024 16:22:11 +0100 |
From: Akihiko Odaki <akihiko.odaki@daynix.com>
Ensure register handles are not NULL so that a plugin can assume NULL is
invalid as a register handle.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240612153508.1532940-4-alex.bennee@linaro.org>
Message-Id: <20240229-null-v1-1-e716501d981e@daynix.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
plugins/api.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/api.c b/plugins/api.c
index 5a0a7f8c71..6bdb26bbe3 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -507,7 +507,7 @@ static GArray *create_register_handles(GArray *gdbstub_regs)
}
/* Create a record for the plugin */
- desc.handle = GINT_TO_POINTER(grd->gdb_reg);
+ desc.handle = GINT_TO_POINTER(grd->gdb_reg + 1);
desc.name = g_intern_string(grd->name);
desc.feature = g_intern_string(grd->feature_name);
g_array_append_val(find_data, desc);
@@ -528,7 +528,7 @@ int qemu_plugin_read_register(struct qemu_plugin_register
*reg, GByteArray *buf)
{
g_assert(current_cpu);
- return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg));
+ return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1);
}
struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_size)
--
2.39.2
- [PATCH v2 00/12] maintainer updates pre-PR (gdbstub, plugins, time control), Alex Bennée, 2024/06/20
- [PATCH v2 01/12] include/exec: add missing include guard comment, Alex Bennée, 2024/06/20
- [PATCH v2 02/12] gdbstub: move enums into separate header, Alex Bennée, 2024/06/20
- [PATCH v2 04/12] sysemu: add set_virtual_time to accel ops, Alex Bennée, 2024/06/20
- [PATCH v2 06/12] sysemu: generalise qtest_warp_clock as qemu_clock_advance_virtual_time, Alex Bennée, 2024/06/20
- [PATCH v2 03/12] plugins: Ensure register handles are not NULL,
Alex Bennée <=
- [PATCH v2 07/12] qtest: move qtest_{get, set}_virtual_clock to accel/qtest/qtest.c, Alex Bennée, 2024/06/20
- [PATCH v2 05/12] qtest: use cpu interface in qtest_clock_warp, Alex Bennée, 2024/06/20
- [PATCH v2 08/12] plugins: add time control API, Alex Bennée, 2024/06/20
- [PATCH v2 09/12] plugins: add migration blocker, Alex Bennée, 2024/06/20
- [PATCH v2 10/12] contrib/plugins: add Instructions Per Second (IPS) example for cost modeling, Alex Bennée, 2024/06/20
- [PATCH v2 12/12] accel/tcg: Avoid unnecessary call overhead from qemu_plugin_vcpu_mem_cb, Alex Bennée, 2024/06/20