Just like the array of 4 in the C struct. Signed-off-by: Andrej Utz <andrej....@st.oth-regensburg.de> --- pyjailhouse/config_parser.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/pyjailhouse/config_parser.py b/pyjailhouse/config_parser.py index 3f20bc61..7b4872e0 100644 --- a/pyjailhouse/config_parser.py +++ b/pyjailhouse/config_parser.py @@ -155,20 +155,30 @@ class CacheRegion(CStruct): class Irqchip(CStruct): - __slots__ = 'address', 'id', 'pin_base', 'pin_bitmap_lo', 'pin_bitmap_hi', + __slots__ = 'address', 'id', 'pin_base', _BIN_FIELD_NUM = len(__slots__) - _BIN_FMT = struct.Struct('QIIQQ') + _BIN_FMT = struct.Struct('QII') + _BIN_FMT_PIN_MAP = struct.Struct('4I') + + # constructed fields + __slots__ += 'pin_bitmap', def __init__(self): self.address = 0 self.id = 0 self.pin_base = 0 - self.pin_bitmap_lo = 0 - self.pin_bitmap_hi = 0 + self.pin_bitmap = [0,0,0,0] def is_standard(self): return self.address == 0xfec00000 + @classmethod + def parse(cls, stream): + self = cls.parse_class(cls, stream) + pin_fmt = cls._BIN_FMT_PIN_MAP + self.pin_bitmap = pin_fmt.unpack_from(stream.read(pin_fmt.size)) + return self + class PIORegion(CStruct): __slots__ = 'base', 'length', -- 2.27.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to jailhouse-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20200630064228.4742-5-andrej.utz%40st.oth-regensburg.de.