Signed-off-by: Andrej Utz <andrej....@st.oth-regensburg.de> --- pyjailhouse/sysfs_parser.py | 11 +++++++++++ tools/root-cell-config.c.tmpl | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/pyjailhouse/sysfs_parser.py b/pyjailhouse/sysfs_parser.py index 0f91d928..0dcc7475 100644 --- a/pyjailhouse/sysfs_parser.py +++ b/pyjailhouse/sysfs_parser.py @@ -791,6 +791,17 @@ class IORegion: def size(self): return int(self.stop - self.start) + def start_str(self): + # This method is used in root-cell-config.c.tmpl + + # Python 2 appends a 'L' to hexadecimal format of large integers, + # therefore .strip('L') is necessary. + return hex(self.start).strip('L') + + def size_str(self): + # Comments from start_str() apply here as well. + return hex(self.size()).strip('L') + class MemRegion(IORegion): def __init__(self, start, stop, typestr, comments=None): diff --git a/tools/root-cell-config.c.tmpl b/tools/root-cell-config.c.tmpl index b6522ce1..d884089a 100644 --- a/tools/root-cell-config.c.tmpl +++ b/tools/root-cell-config.c.tmpl @@ -132,9 +132,9 @@ struct { /* ${c} */ % endfor { - .phys_start = ${hex(r.start).strip('L')}, - .virt_start = ${hex(r.start).strip('L')}, - .size = ${hex(r.size()).strip('L')}, + .phys_start = ${r.start_str()}, + .virt_start = ${r.start_str()}, + .size = ${r.size_str()}, .flags = ${r.flagstr('\t\t')}, }, % endfor -- 2.23.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/20190930193857.2866-5-andrej.utz%40st.oth-regensburg.de.