aboutsummaryrefslogtreecommitdiff
path: root/target/m68k/helper.c
diff options
context:
space:
mode:
authorAlex Bennée <alex.bennee@linaro.org>2020-03-16 17:21:39 +0000
committerAlex Bennée <alex.bennee@linaro.org>2020-03-17 17:38:38 +0000
commit462474d760cd94933ff7d5cba39de92fb0985c1a (patch)
treec7623ba40157cdc55f8d7b6c1a46a894713b2ba1 /target/m68k/helper.c
parent8b1ca58c3b0789a41c75d8626ba65a8c35e16b58 (diff)
downloadqemu-462474d760cd94933ff7d5cba39de92fb0985c1a.zip
qemu-462474d760cd94933ff7d5cba39de92fb0985c1a.tar.gz
qemu-462474d760cd94933ff7d5cba39de92fb0985c1a.tar.bz2
target/m68k: use gdb_get_reg helpers
This is cleaner than poking memory directly and will make later clean-ups easier. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200316172155.971-13-alex.bennee@linaro.org>
Diffstat (limited to 'target/m68k/helper.c')
-rw-r--r--target/m68k/helper.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index baf7729..c23b70f 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -72,19 +72,15 @@ static int cf_fpu_gdb_get_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
{
if (n < 8) {
float_status s;
- stfq_p(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));
- return 8;
+ return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));
}
switch (n) {
case 8: /* fpcontrol */
- stl_be_p(mem_buf, env->fpcr);
- return 4;
+ return gdb_get_reg32(mem_buf, env->fpcr);
case 9: /* fpstatus */
- stl_be_p(mem_buf, env->fpsr);
- return 4;
+ return gdb_get_reg32(mem_buf, env->fpsr);
case 10: /* fpiar, not implemented */
- memset(mem_buf, 0, 4);
- return 4;
+ return gdb_get_reg32(mem_buf, 0);
}
return 0;
}
@@ -112,21 +108,18 @@ static int cf_fpu_gdb_set_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
static int m68k_fpu_gdb_get_reg(CPUM68KState *env, uint8_t *mem_buf, int n)
{
if (n < 8) {
- stw_be_p(mem_buf, env->fregs[n].l.upper);
- memset(mem_buf + 2, 0, 2);
- stq_be_p(mem_buf + 4, env->fregs[n].l.lower);
- return 12;
+ int len = gdb_get_reg16(mem_buf, env->fregs[n].l.upper);
+ len += gdb_get_reg16(mem_buf + len, 0);
+ len += gdb_get_reg64(mem_buf + len, env->fregs[n].l.lower);
+ return len;
}
switch (n) {
case 8: /* fpcontrol */
- stl_be_p(mem_buf, env->fpcr);
- return 4;
+ return gdb_get_reg32(mem_buf, env->fpcr);
case 9: /* fpstatus */
- stl_be_p(mem_buf, env->fpsr);
- return 4;
+ return gdb_get_reg32(mem_buf, env->fpsr);
case 10: /* fpiar, not implemented */
- memset(mem_buf, 0, 4);
- return 4;
+ return gdb_get_reg32(mem_buf, 0);
}
return 0;
}