All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH-for-10.1 v2] target/riscv/gdbstub: Replace ldtul_p() -> ldn_p(sizeof(target_ulong))
@ 2025-03-25 15:49 Philippe Mathieu-Daudé
  2025-03-25 18:43 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-03-25 15:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Zhao Liu, Alistair Francis, qemu-riscv,
	Anton Johansson, Daniel Henrique Barboza, Palmer Dabbelt,
	Liu Zhiwei, Weiwei Li, Pierrick Bouvier, Alex Bennée,
	Philippe Mathieu-Daudé

Replace the few ldtul_p() calls by a generic ldn_p() ones.
No logical change.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/riscv/gdbstub.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/target/riscv/gdbstub.c b/target/riscv/gdbstub.c
index 18e88f416af..c1dc54e47d6 100644
--- a/target/riscv/gdbstub.c
+++ b/target/riscv/gdbstub.c
@@ -193,7 +193,7 @@ static int riscv_gdb_set_csr(CPUState *cs, uint8_t *mem_buf, int n)
     CPURISCVState *env = &cpu->env;
 
     if (n < CSR_TABLE_SIZE) {
-        target_ulong val = ldtul_p(mem_buf);
+        target_ulong val = ldn_p(mem_buf, sizeof(val));
         int result;
 
         result = riscv_csrrw_debug(env, n, NULL, val, -1);
@@ -229,15 +229,17 @@ static int riscv_gdb_set_virtual(CPUState *cs, uint8_t *mem_buf, int n)
         RISCVCPU *cpu = RISCV_CPU(cs);
         CPURISCVState *env = &cpu->env;
 
-        target_ulong new_priv = ldtul_p(mem_buf) & 0x3;
+        target_ulong new_priv;
+        size_t regsize = sizeof(new_priv);
         bool new_virt = 0;
 
+        new_priv = ldn_p(mem_buf, regsize) & 0x3;
         if (new_priv == PRV_RESERVED) {
             new_priv = PRV_S;
         }
 
         if (new_priv != PRV_M) {
-            new_virt = (ldtul_p(mem_buf) & BIT(2)) >> 2;
+            new_virt = (ldn_p(mem_buf, regsize) & BIT(2)) >> 2;
         }
 
         if (riscv_has_ext(env, RVH) && new_virt != env->virt_enabled) {
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-26 16:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25 15:49 [PATCH-for-10.1 v2] target/riscv/gdbstub: Replace ldtul_p() -> ldn_p(sizeof(target_ulong)) Philippe Mathieu-Daudé
2025-03-25 18:43 ` Richard Henderson
2025-03-26  4:29 ` Alistair Francis
2025-03-26 11:26 ` Alex Bennée
2025-12-26 16:21   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.