Save entire memory content.
(self)
| 306 | return (value + alignment - 1) & ~(alignment - 1) |
| 307 | |
| 308 | def save(self): |
| 309 | """Save entire memory content. |
| 310 | """ |
| 311 | |
| 312 | mem_dict = { |
| 313 | "ram" : [], |
| 314 | "mmio" : [] |
| 315 | } |
| 316 | |
| 317 | for lbound, ubound, perm, label, mmio_ctx in self.map_info: |
| 318 | if mmio_ctx is None: |
| 319 | key, data = 'ram', bytes(self.read(lbound, ubound - lbound)) |
| 320 | else: |
| 321 | key, data = 'mmio', mmio_ctx |
| 322 | |
| 323 | mem_dict[key].append((lbound, ubound, perm, label, data)) |
| 324 | |
| 325 | return mem_dict |
| 326 | |
| 327 | def restore(self, mem_dict): |
| 328 | """Restore saved memory content. |