[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 07/14] target/m68k: use gdb_get_reg helpers
From: |
Laurent Vivier |
Subject: |
Re: [PATCH v2 07/14] target/m68k: use gdb_get_reg helpers |
Date: |
Sat, 30 Nov 2019 11:58:34 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 |
Le 30/11/2019 à 09:45, Alex Bennée a écrit :
> This is cleaner than poking memory directly and will make later
> clean-ups easier.
>
> Signed-off-by: Alex Bennée <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
> ---
> target/m68k/helper.c | 29 +++++++++++------------------
> 1 file changed, 11 insertions(+), 18 deletions(-)
>
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index ae766a6cb0b..70b0c0b5076 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(buf, floatx80_to_float64(env->fregs[n].d, &s));
Where is coming from "buf"? We were using "mem_buf".
> }
> switch (n) {
> case 8: /* fpcontrol */
> - stl_be_p(mem_buf, env->fpcr);
> - return 4;
> + return gdb_get_reg32(buf, env->fpcr);
> case 9: /* fpstatus */
> - stl_be_p(mem_buf, env->fpsr);
> - return 4;
> + return gdb_get_reg32(buf, env->fpsr);
> case 10: /* fpiar, not implemented */
> - memset(mem_buf, 0, 4);
> - return 4;
> + return gdb_get_reg32(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(buf, env->fregs[n].l.upper);
> + len += gdb_get_reg16(buf, 0);
len += gdb_get_reg16(buf + len, ...
> + len += gdb_get_reg64(buf, env->fregs[n].l.lower);
len += gdb_get_reg64(buf + len, ...
> + return len;
> }
> switch (n) {
> case 8: /* fpcontrol */
> - stl_be_p(mem_buf, env->fpcr);
> - return 4;
> + return gdb_get_reg32(buf, env->fpcr);
> case 9: /* fpstatus */
> - stl_be_p(mem_buf, env->fpsr);
> - return 4;
> + return gdb_get_reg32(buf, env->fpsr);
> case 10: /* fpiar, not implemented */
> - memset(mem_buf, 0, 4);
> - return 4;
> + return gdb_get_reg32(buf, 0);
> }
> return 0;
> }
>
Thanks,
Laurent
- [PATCH v2 00/14] gdbstub refactor and SVE support, Alex Bennée, 2019/11/30
- [PATCH v2 04/14] gdbstub: move mem_buf to GDBState and use GByteArray, Alex Bennée, 2019/11/30
- [PATCH v2 01/14] gdbstub: make GDBState static and have common init function, Alex Bennée, 2019/11/30
- [PATCH v2 05/14] gdbstub: add helper for 128 bit registers, Alex Bennée, 2019/11/30
- [PATCH v2 03/14] gdbstub: move str_buf to GDBState and use GString, Alex Bennée, 2019/11/30
- [PATCH v2 06/14] target/arm: use gdb_get_reg helpers, Alex Bennée, 2019/11/30
- [PATCH v2 07/14] target/m68k: use gdb_get_reg helpers, Alex Bennée, 2019/11/30
- Re: [PATCH v2 07/14] target/m68k: use gdb_get_reg helpers,
Laurent Vivier <=
- [PATCH v2 10/14] target/arm: explicitly encode regnum in our XML, Alex Bennée, 2019/11/30
- [PATCH v2 09/14] target/arm: prepare for multiple dynamic XMLs, Alex Bennée, 2019/11/30
- [PATCH v2 12/14] target/arm: generate xml description of our SVE registers, Alex Bennée, 2019/11/30
- [PATCH v2 02/14] gdbstub: stop passing GDBState * around and use global, Alex Bennée, 2019/11/30
- [PATCH v2 08/14] gdbstub: extend GByteArray to read register helpers, Alex Bennée, 2019/11/30
- [PATCH v2 11/14] target/arm: default SVE length to 64 bytes for linux-user, Alex Bennée, 2019/11/30
- [PATCH v2 13/14] tests/guest-debug: add a simple test runner, Alex Bennée, 2019/11/30
- [PATCH v2 14/14] tests/tcg: add a gdbstub testcase for SVE registers, Alex Bennée, 2019/11/30
- Re: [PATCH v2 00/14] gdbstub refactor and SVE support, no-reply, 2019/11/30