1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 __author__ = ("Andrew Case <atcuno@gmail.com>",
21 "Michael Cohen <scudette@google.com>")
22
23
24 from rekall.plugins.linux import common
25
26
27 -class IOmem(common.LinuxPlugin):
28 '''mimics /proc/iomem.'''
29
30 __name = "iomem"
31
32 table_header = [
33 dict(name="resource", style="address"),
34 dict(name="start", style="address"),
35 dict(name="end", style="address"),
36 dict(name="name", type="TreeNode"),
37 ]
38
40
41 resource_tree_root = self.profile.get_constant_object(
42 "iomem_resource", target="resource")
43
44 seen = set()
45
46 return self._GetResources(resource_tree_root, seen)
47
49 """Traverse the resource tree depth first."""
50 if not node or node in seen:
51 return
52
53 seen.add(node)
54
55 yield node, depth
56
57 if node.child:
58 for x in self._GetResources(node.child.deref(), seen, depth+1):
59 yield x
60
61 for sibling in node.walk_list("sibling"):
62 for x in self._GetResources(sibling, seen, depth):
63 yield x
64
65
74