[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH 05/11] decodetree: Force Python to print unsigne
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [RFC PATCH 05/11] decodetree: Force Python to print unsigned values |
Date: |
Mon, 12 Nov 2018 00:36:16 +0100 |
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é <address@hidden>
---
TODO: display error encountered:
case 0x-1:
....
---
scripts/decodetree.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 5dea15e7a5..08aa52d544 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -900,12 +900,12 @@ class Tree:
def str_case(b):
return '0x{0:08x}'.format(b)
- output(ind, 'switch (', str_switch(self.thismask), ') {\n')
+ output(ind, 'switch (', str_switch(self.thismask & insnmask), ') {\n')
for b, s in sorted(self.subs):
assert (self.thismask & ~s.fixedmask) == 0
innermask = outermask | self.thismask
innerbits = outerbits | b
- output(ind, 'case ', str_case(b), ':\n')
+ output(ind, 'case ', str_case(b & insnmask), ':\n')
output(ind, ' /* ',
str_match_bits(innerbits, innermask), ' */\n')
s.output_code(i + 4, extracted, innerbits, innermask)
--
2.17.2