Package rekall :: Package plugins :: Package addrspaces :: Module accelerated
[frames] | no frames]

Source Code for Module rekall.plugins.addrspaces.accelerated

 1  # Copyright 2013 Google Inc. All Rights Reserved. 
 2  # 
 3  # This program is free software; you can redistribute it and/or modify 
 4  # it under the terms of the GNU General Public License as published by 
 5  # the Free Software Foundation; either version 2 of the License, or (at 
 6  # your option) any later version. 
 7  # 
 8  # This program is distributed in the hope that it will be useful, but 
 9  # WITHOUT ANY WARRANTY; without even the implied warranty of 
10  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
11  # General Public License for more details. 
12  # 
13  # You should have received a copy of the GNU General Public License 
14  # along with this program; if not, write to the Free Software 
15  # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
16  # 
17   
18  """The module provides alternate implementations utilizing C extension modules. 
19  """ 
20   
21  __author__ = "scudette@google.com (Michael Cohen)" 
22  import logging 
23  import os 
24   
25  from rekall import support 
26  from rekall.plugins.addrspaces import amd64 
27   
28 -class AcceleratedAMD64PagedMemory(amd64.AMD64PagedMemory):
29 """An accelerated AMD64 address space.""" 30
31 - def __init__(self, **kwargs):
32 super(AcceleratedAMD64PagedMemory, self).__init__(**kwargs) 33 self._delegate = support.AMD64PagedMemory(self.base, int(self.dtb))
34
35 - def read(self, offset, length):
36 return self._delegate.read(int(offset), int(length))
37
38 - def vtop(self, address):
39 return self._delegate.vtop(int(address))
40
41 - def get_available_addresses(self):
42 for virt, offset, _ in self._delegate.get_available_addresses(): 43 yield virt, offset
44 45 46 if os.environ.get("FAST"): 47 logging.info("Installing accelerated address spaces.") 48 # Replace the original implementation with the accelerated one. 49 AcceleratedAMD64PagedMemory.classes[ 50 "AMD64PagedMemory"] = AcceleratedAMD64PagedMemory 51