target/i386: Expand 64-bit definitions when TARGET_LONG_BITS == 64
Where both gdb_read/write_register() functions check for 'TARGET_LONG_BITS == 64' we can expand the following definitions: ldtul_p() -> ldq_p() gdb_get_regl() -> gdb_get_reg64() Do the same in i386_cpu_gdb_get_egprs(): check TARGET_LONG_BITS to effectively inline gdb_get_regl(). Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20260219191955.83815-31-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Feb 17, 2026 at 17:00 UTC
62b7f6df5614fed51bfb56002a31233c419a10ca
1 file changed
+6
-4
target/i386/gdbstub.c
+6
-4
@@ -129,7 +129,7 @@ int x86_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
129
return gdb_get_reg64(mem_buf,
130
env->regs[gpr_map[n]] & 0xffffffffUL);
131
} else {
132
- return gdb_get_regl(mem_buf, 0);
132
+ return gdb_get_reg64(mem_buf, 0);
133
}
134
} else {
135
return gdb_get_reg32(mem_buf, env->regs[gpr_map32[n]]);
@@ -283,9 +283,9 @@ int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
283
if (n < CPU_NB_REGS) {
284
if (TARGET_LONG_BITS == 64) {
285
if (env->hflags & HF_CS64_MASK) {
286
- env->regs[gpr_map[n]] = ldtul_p(mem_buf);
286
+ env->regs[gpr_map[n]] = ldq_p(mem_buf);
287
} else if (n < CPU_NB_REGS32) {
288
- env->regs[gpr_map[n]] = ldtul_p(mem_buf) & 0xffffffffUL;
288
+ env->regs[gpr_map[n]] = ldq_p(mem_buf) & 0xffffffffUL;
289
}
290
return sizeof(target_ulong);
291
} else if (n < CPU_NB_REGS32) {
@@ -449,8 +449,10 @@ static int i386_cpu_gdb_get_egprs(CPUState *cs, GByteArray *mem_buf, int n)
449
/* EGPRs can be only directly accessible in 64-bit mode. */
450
if (env->hflags & HF_CS64_MASK) {
451
return gdb_get_reg64(mem_buf, env->regs[gpr_map[n + CPU_NB_REGS]]);
452
+ } else if (TARGET_LONG_BITS == 64) {
453
+ return gdb_get_reg64(mem_buf, 0);
454
} else {
453
- return gdb_get_regl(mem_buf, 0);
455
+ return gdb_get_reg32(mem_buf, 0);
456
}
457
}
458