[PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray

Philippe Mathieu-Daudé posted 1 patch 4 years ago
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
Test checkpatch passed
Test FreeBSD passed
Test asan passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200409172509.4078-1-philmd@redhat.com
Maintainers: Laurent Vivier <laurent@vivier.eu>
target/m68k/helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Philippe Mathieu-Daudé 4 years ago
Since a010bdbe719 the gdbstub API takes a GByteArray*.
Unfortunately we forgot to update the gdb_get_reg*()
calls.  Do it now.

Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
Reported-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Based-on: <20200409164954.36902-1-peterx@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/m68k/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/m68k/helper.c b/target/m68k/helper.c
index 014657c637..cad4083895 100644
--- a/target/m68k/helper.c
+++ b/target/m68k/helper.c
@@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
 {
     if (n < 8) {
         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);
+        len += gdb_get_reg16(mem_buf, 0);
+        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
         return len;
     }
     switch (n) {
-- 
2.21.1


Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Laurent Vivier 4 years ago
Le 09/04/2020 à 19:25, Philippe Mathieu-Daudé a écrit :
> Since a010bdbe719 the gdbstub API takes a GByteArray*.
> Unfortunately we forgot to update the gdb_get_reg*()
> calls.  Do it now.
> 
> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
> Reported-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20200409164954.36902-1-peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/m68k/helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 014657c637..cad4083895 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>  {
>      if (n < 8) {
>          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);
> +        len += gdb_get_reg16(mem_buf, 0);
> +        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
>          return len;
>      }
>      switch (n) {
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Peter Xu 4 years ago
On Thu, Apr 09, 2020 at 07:25:08PM +0200, Philippe Mathieu-Daudé wrote:
> Since a010bdbe719 the gdbstub API takes a GByteArray*.
> Unfortunately we forgot to update the gdb_get_reg*()
> calls.  Do it now.
> 
> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")

Should this be instead 462474d760 ("target/m68k: use gdb_get_reg
helpers", 2020-03-17)?

> Reported-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

> ---
> Based-on: <20200409164954.36902-1-peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

(One benigh extra line; same thing could happen to me when amending
 like this with "---")

> ---
>  target/m68k/helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 014657c637..cad4083895 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>  {
>      if (n < 8) {
>          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);
> +        len += gdb_get_reg16(mem_buf, 0);
> +        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
>          return len;
>      }
>      switch (n) {
> -- 
> 2.21.1
> 

-- 
Peter Xu


Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Laurent Vivier 4 years ago
Le 09/04/2020 à 20:22, Peter Xu a écrit :
> On Thu, Apr 09, 2020 at 07:25:08PM +0200, Philippe Mathieu-Daudé wrote:
>> Since a010bdbe719 the gdbstub API takes a GByteArray*.
>> Unfortunately we forgot to update the gdb_get_reg*()
>> calls.  Do it now.
>>
>> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
> 
> Should this be instead 462474d760 ("target/m68k: use gdb_get_reg
> helpers", 2020-03-17)?

No, this one is correct because it uses an "uint8_t *", then a010bdbe719
changed this to a GByteArray and didn't remove the "+ len".

Thanks,
Laurent

> 
>> Reported-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Reviewed-by: Peter Xu <peterx@redhat.com>
> 
>> ---
>> Based-on: <20200409164954.36902-1-peterx@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> (One benigh extra line; same thing could happen to me when amending
>  like this with "---")
> 
>> ---
>>  target/m68k/helper.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
>> index 014657c637..cad4083895 100644
>> --- a/target/m68k/helper.c
>> +++ b/target/m68k/helper.c
>> @@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>>  {
>>      if (n < 8) {
>>          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);
>> +        len += gdb_get_reg16(mem_buf, 0);
>> +        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
>>          return len;
>>      }
>>      switch (n) {
>> -- 
>> 2.21.1
>>
> 


Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Laurent Vivier 4 years ago
Le 09/04/2020 à 20:22, Peter Xu a écrit :
> On Thu, Apr 09, 2020 at 07:25:08PM +0200, Philippe Mathieu-Daudé wrote:
>> Since a010bdbe719 the gdbstub API takes a GByteArray*.
>> Unfortunately we forgot to update the gdb_get_reg*()
>> calls.  Do it now.
>>
>> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
> 
> Should this be instead 462474d760 ("target/m68k: use gdb_get_reg
> helpers", 2020-03-17)?

No, this one is correct because it uses an "uint8_t *", then a010bdbe719
changed this to a GByteArray and didn't remove the "+ len".

Thanks,
Laurent

>> Reported-by: Peter Xu <peterx@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Reviewed-by: Peter Xu <peterx@redhat.com>
> 
>> ---
>> Based-on: <20200409164954.36902-1-peterx@redhat.com>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> (One benigh extra line; same thing could happen to me when amending
>  like this with "---")
> 
>> ---
>>  target/m68k/helper.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
>> index 014657c637..cad4083895 100644
>> --- a/target/m68k/helper.c
>> +++ b/target/m68k/helper.c
>> @@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>>  {
>>      if (n < 8) {
>>          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);
>> +        len += gdb_get_reg16(mem_buf, 0);
>> +        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
>>          return len;
>>      }
>>      switch (n) {
>> -- 
>> 2.21.1
>>
> 


Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Peter Xu 4 years ago
On Thu, Apr 09, 2020 at 08:36:22PM +0200, Laurent Vivier wrote:
> Le 09/04/2020 à 20:22, Peter Xu a écrit :
> > On Thu, Apr 09, 2020 at 07:25:08PM +0200, Philippe Mathieu-Daudé wrote:
> >> Since a010bdbe719 the gdbstub API takes a GByteArray*.
> >> Unfortunately we forgot to update the gdb_get_reg*()
> >> calls.  Do it now.
> >>
> >> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
> > 
> > Should this be instead 462474d760 ("target/m68k: use gdb_get_reg
> > helpers", 2020-03-17)?
> 
> No, this one is correct because it uses an "uint8_t *", then a010bdbe719
> changed this to a GByteArray and didn't remove the "+ len".

Ah right...

-- 
Peter Xu


Re: [PATCH-for-5.0] target/m68k/helper: Fix m68k_fpu_gdb_get_reg() use of GByteArray
Posted by Alex Bennée 4 years ago
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Since a010bdbe719 the gdbstub API takes a GByteArray*.
> Unfortunately we forgot to update the gdb_get_reg*()
> calls.  Do it now.
>

Queued to for-5.0/more-random-fixes, thanks.

> Fixes: a010bdbe719 ("extend GByteArray to read register helpers")
> Reported-by: Peter Xu <peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20200409164954.36902-1-peterx@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  target/m68k/helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/m68k/helper.c b/target/m68k/helper.c
> index 014657c637..cad4083895 100644
> --- a/target/m68k/helper.c
> +++ b/target/m68k/helper.c
> @@ -109,8 +109,8 @@ static int m68k_fpu_gdb_get_reg(CPUM68KState *env, GByteArray *mem_buf, int n)
>  {
>      if (n < 8) {
>          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);
> +        len += gdb_get_reg16(mem_buf, 0);
> +        len += gdb_get_reg64(mem_buf, env->fregs[n].l.lower);
>          return len;
>      }
>      switch (n) {


-- 
Alex Bennée