diff options
author | Brandon Potter <brandon.potter@amd.com> | 2015-07-24 12:25:22 -0700 |
---|---|---|
committer | Brandon Potter <brandon.potter@amd.com> | 2015-07-24 12:25:22 -0700 |
commit | b90711ea53f51d85890dd6e1bed0ca852adb8074 (patch) | |
tree | eded5a2ba8f4b283271f1ee4c7deb508f3b42cac /util | |
parent | ef08046af413e2dc19cf7e8e1a3a329cc3c05bec (diff) | |
download | gem5-b90711ea53f51d85890dd6e1bed0ca852adb8074.tar.xz |
base: refactor process class (specifically FdMap and friends)
This patch extends the previous patch's alterations around fd_map. It cleans
up some of the uglier code in the process file and replaces it with a more
concise C++11 version. As part of the changes, the FdMap class is pulled out
of the Process class and receives its own file.
Diffstat (limited to 'util')
-rwxr-xr-x | util/cpt_upgrader.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/util/cpt_upgrader.py b/util/cpt_upgrader.py index 5d836a23d..a0d1b94cb 100755 --- a/util/cpt_upgrader.py +++ b/util/cpt_upgrader.py @@ -614,6 +614,29 @@ def from_D(cpt): miscRegs[599:599] = [0xFC001] cpt.set(sec, 'miscRegs', ' '.join(str(x) for x in miscRegs)) +# Checkpoint version F renames an internal member of Process class. +def from_E(cpt): + import re + for sec in cpt.sections(): + fdm = 'FdMap' + fde = 'FDEntry' + if re.match('.*\.%s.*' % fdm, sec): + rename = re.sub(fdm, fde, sec) + split = re.split(fde, rename) + + # rename the section and add the 'mode' field + rename_section(cpt, sec, rename) + cpt.set(rename, 'mode', "0") # no proper value to set :( + + # add in entries 257 to 1023 + if split[1] == "0": + for x in range(257, 1024): + seq = (split[0], fde, "%s" % x) + section = "".join(seq) + cpt.add_section(section) + cpt.set(section, 'fd', '-1') + + migrations = [] migrations.append(from_0) migrations.append(from_1) @@ -629,6 +652,16 @@ migrations.append(from_A) migrations.append(from_B) migrations.append(from_C) migrations.append(from_D) +migrations.append(from_E) + +# http://stackoverflow.com/questions/15069127/python-configparser-module-\ +# rename-a-section +def rename_section(cp, section_from, section_to): + items = cp.items(section_from) + cp.add_section(section_to) + for item in items: + cp.set(section_to, item[0], item[1]) + cp.remove_section(section_from) verbose_print = False |