diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:42 -0500 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-01-07 13:05:42 -0500 |
commit | 17b47d35e1d0dedca7a3336f1193b1a502bcd78b (patch) | |
tree | 3b37175b174a2cdad1020ff6dd917f32c1c10907 /util | |
parent | 7eb0fb8b6ebffcb39b61964d4c7387455c262aae (diff) | |
download | gem5-17b47d35e1d0dedca7a3336f1193b1a502bcd78b.tar.xz |
arch: Move the ISA object to a separate section
After making the ISA an independent SimObject, it is serialized
automatically by the Python world. Previously, this just resulted in
an empty ISA section. This patch moves the contents of the ISA to that
section and removes the explicit ISA serialization from the thread
contexts, which makes it behave like a normal SimObject during
serialization.
Note: This patch breaks checkpoint backwards compatibility! Use the
cpt_upgrader.py utility to upgrade old checkpoints to the new format.
Diffstat (limited to 'util')
-rwxr-xr-x | util/cpt_upgrader.py | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/util/cpt_upgrader.py b/util/cpt_upgrader.py index ead3d9cbb..4dbca3fcb 100755 --- a/util/cpt_upgrader.py +++ b/util/cpt_upgrader.py @@ -116,11 +116,77 @@ def from_2(cpt): except ConfigParser.NoOptionError: pass +# The ISA is now a separate SimObject, which means that we serialize +# it in a separate section instead of as a part of the ThreadContext. +def from_3(cpt): + isa = cpt.get('root','isa') + isa_fields = { + "alpha" : ( "fpcr", "uniq", "lock_flag", "lock_addr", "ipr" ), + "arm" : ( "miscRegs" ), + "sparc" : ( "asi", "tick", "fprs", "gsr", "softint", "tick_cmpr", + "stick", "stick_cmpr", "tpc", "tnpc", "tstate", "tt", + "tba", "pstate", "tl", "pil", "cwp", "gl", "hpstate", + "htstate", "hintp", "htba", "hstick_cmpr", + "strandStatusReg", "fsr", "priContext", "secContext", + "partId", "lsuCtrlReg", "scratchPad", + "cpu_mondo_head", "cpu_mondo_tail", + "dev_mondo_head", "dev_mondo_tail", + "res_error_head", "res_error_tail", + "nres_error_head", "nres_error_tail", + "tick_intr_sched", + "cpu", "tc_num", "tick_cmp", "stick_cmp", "hstick_cmp"), + "x86" : ( "regVal" ), + } + + isa_fields = isa_fields.get(isa, []) + isa_sections = [] + for sec in cpt.sections(): + import re + + re_cpu_match = re.match('^(.*sys.*\.cpu[^.]*)\.xc\.(.+)$', sec) + # Search for all the execution contexts + if not re_cpu_match: + continue + + if re_cpu_match.group(2) != "0": + # This shouldn't happen as we didn't support checkpointing + # of in-order and O3 CPUs. + raise ValueError("Don't know how to migrate multi-threaded CPUs " + "from version 1") + + isa_section = [] + for fspec in isa_fields: + for (key, value) in cpt.items(sec, raw=True): + if key in isa_fields: + isa_section.append((key, value)) + + name = "%s.isa" % re_cpu_match.group(1) + isa_sections.append((name, isa_section)) + + for (key, value) in isa_section: + cpt.remove_option(sec, key) + + for (sec, options) in isa_sections: + # Some intermediate versions of gem5 have empty ISA sections + # (after we made the ISA a SimObject, but before we started to + # serialize into a separate ISA section). + if not cpt.has_section(sec): + cpt.add_section(sec) + else: + if cpt.items(sec): + raise ValueError("Unexpected populated ISA section in old " + "checkpoint") + + for (key, value) in options: + cpt.set(sec, key, value) + + migrations = [] migrations.append(from_0) migrations.append(from_1) migrations.append(from_2) +migrations.append(from_3) verbose_print = False |