[Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values

Philippe Mathieu-Daudé posted 1 patch 5 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181111000259.7665-1-f4bug@amsat.org
Test docker-clang@ubuntu passed
Test checkpatch passed
Test asan passed
Test docker-mingw@fedora passed
Test docker-quick@centos7 passed
scripts/decodetree.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
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


Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
Posted by Richard Henderson 5 years, 5 months ago
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~

Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
Posted by Philippe Mathieu-Daudé 5 years, 5 months ago
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.

Re: [Qemu-devel] [PATCH] decodetree: Force Python to print unsigned values
Posted by Richard Henderson 5 years, 5 months ago
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~