All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
@ 2018-11-11  0:02 Philippe Mathieu-Daudé
  2018-11-11 11:27 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-11  0:02 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Philippe Mathieu-Daudé,
	qemu-devel, Peter Crosthwaite, Paolo Bonzini, Eduardo Habkost,
	Cleber Rosa

Python internal representation is signed, so unsigned values
bigger than 31-bit are interpreted as signed (and printed with
a '-' signed).
Mask out to force unsigned values.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scripts/decodetree.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 5dea15e7a5..a24017d33e 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -895,10 +895,10 @@ class Tree:
                 return '0x{0:x}'.format(b >> sh)
         else:
             def str_switch(b):
-                return 'insn & 0x{0:08x}'.format(b)
+                return 'insn & 0x{0:08x}'.format(b & 0xffffffff)
 
             def str_case(b):
-                return '0x{0:08x}'.format(b)
+                return '0x{0:08x}'.format(b & 0xffffffff)
 
         output(ind, 'switch (', str_switch(self.thismask), ') {\n')
         for b, s in sorted(self.subs):
-- 
2.19.1

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

* Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
  2018-11-11  0:02 [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values Philippe Mathieu-Daudé
@ 2018-11-11 11:27 ` Richard Henderson
  2018-11-11 23:06   ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2018-11-11 11:27 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Richard Henderson
  Cc: Eduardo Habkost, Peter Crosthwaite, qemu-devel, Cleber Rosa,
	Paolo Bonzini

On 11/11/18 1:02 AM, Philippe Mathieu-Daudé wrote:
> Python internal representation is signed, so unsigned values
> bigger than 31-bit are interpreted as signed (and printed with
> a '-' signed).
> Mask out to force unsigned values.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  scripts/decodetree.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Queued, thanks.


r~

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

* Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
  2018-11-11 11:27 ` Richard Henderson
@ 2018-11-11 23:06   ` Philippe Mathieu-Daudé
  2018-11-12  8:10     ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-11 23:06 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Richard Henderson, Eduardo Habkost, Peter Crosthwaite,
	qemu-devel@nongnu.org Developers, Cleber Rosa, Paolo Bonzini

Hi Richard,

On Sun, Nov 11, 2018 at 12:27 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
> On 11/11/18 1:02 AM, Philippe Mathieu-Daudé wrote:
> > Python internal representation is signed, so unsigned values
> > bigger than 31-bit are interpreted as signed (and printed with
> > a '-' signed).
> > Mask out to force unsigned values.
> >
> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> > ---
> >  scripts/decodetree.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Queued, thanks.

Can you drop this from your queue? I'll send a cleaner approach (as
RFC, and I also want to log the error I got in the commit msg).

Thanks,

Phil.

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

* Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
  2018-11-11 23:06   ` Philippe Mathieu-Daudé
@ 2018-11-12  8:10     ` Richard Henderson
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2018-11-12  8:10 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Richard Henderson
  Cc: Eduardo Habkost, Peter Crosthwaite,
	qemu-devel@nongnu.org Developers, Cleber Rosa, Paolo Bonzini

On 11/12/18 12:06 AM, Philippe Mathieu-Daudé wrote:
>> On 11/11/18 1:02 AM, Philippe Mathieu-Daudé wrote:
>>> Python internal representation is signed, so unsigned values
>>> bigger than 31-bit are interpreted as signed (and printed with
>>> a '-' signed).
>>> Mask out to force unsigned values.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>  scripts/decodetree.py | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Queued, thanks.
> 
> Can you drop this from your queue? I'll send a cleaner approach (as
> RFC, and I also want to log the error I got in the commit msg).

Done.


r~

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

end of thread, other threads:[~2018-11-12  8:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-11  0:02 [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values Philippe Mathieu-Daudé
2018-11-11 11:27 ` Richard Henderson
2018-11-11 23:06   ` Philippe Mathieu-Daudé
2018-11-12  8:10     ` Richard Henderson

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.