mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-27 07:46:53 +00:00
board_inspector: fix an inappropriate call to ord
The stream tracks the AML binary to be parsed as a list of bytes, not characters. It makes no sense to call `ord` with a byte as the input parameter. This patch also adjust the format of the dump and print the formatted using the logging module. Tracked-On: #6504 Signed-off-by: Junjie Mao <junjie.mao@intel.com> Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
parent
75884af9ac
commit
a7e06cec2f
@ -3,15 +3,17 @@
|
|||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from .exception import *
|
from .exception import *
|
||||||
from .grammar import AML_EXT_OP_PREFIX
|
from .grammar import AML_EXT_OP_PREFIX
|
||||||
|
|
||||||
class Stream:
|
class Stream:
|
||||||
def print_binary(self, base):
|
def print_binary(self, base):
|
||||||
acc = f"[{hex(base)}/{hex(len(self.data))}]"
|
acc = f"[{hex(base):>8s}/{hex(len(self.data)):>8s}]"
|
||||||
converted = ""
|
converted = ""
|
||||||
for i in range(base, base + 16):
|
for i in range(base, base + 16):
|
||||||
code = ord(self.data[i])
|
code = self.data[i]
|
||||||
acc += " %02x" % code
|
acc += " %02x" % code
|
||||||
if code >= 0x20 and code <= 0x7E:
|
if code >= 0x20 and code <= 0x7E:
|
||||||
converted += chr(code)
|
converted += chr(code)
|
||||||
@ -21,7 +23,7 @@ class Stream:
|
|||||||
acc += " "
|
acc += " "
|
||||||
converted += " "
|
converted += " "
|
||||||
acc += f" '{converted}'"
|
acc += f" '{converted}'"
|
||||||
print(acc)
|
logging.debug(acc)
|
||||||
|
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.data = data
|
self.data = data
|
||||||
|
Loading…
Reference in New Issue
Block a user