MCPcopy Create free account
hub / github.com/qilingframework/qiling / __init__

Method __init__

qiling/os/memory.py:46–89  ·  view source on GitHub ↗
(self, ql: Qiling, pagesize: int = 0x1000)

Source from the content-addressed store, hash-verified

44 """
45
46 def __init__(self, ql: Qiling, pagesize: int = 0x1000):
47 self.ql = ql
48 self.map_info: List[MapInfoEntry] = []
49
50 bit_stuff = {
51 64: (1 << 64) - 1,
52 32: (1 << 32) - 1,
53 16: (1 << 20) - 1 # 20bit address line
54 }
55
56 if ql.arch.bits not in bit_stuff:
57 raise QlErrorStructConversion("Unsupported Qiling architecture for memory manager")
58
59 self.max_mem_addr = bit_stuff[ql.arch.bits]
60
61 # memory page size
62 self.pagesize = pagesize
63
64 # make sure pagesize is a power of 2
65 assert self.pagesize & (self.pagesize - 1) == 0, 'pagesize has to be a power of 2'
66
67 self._packers = {
68 (1, True): ql.pack8s,
69 (2, True): ql.pack16s,
70 (4, True): ql.pack32s,
71 (8, True): ql.pack64s,
72
73 (1, False): ql.pack8,
74 (2, False): ql.pack16,
75 (4, False): ql.pack32,
76 (8, False): ql.pack64
77 }
78
79 self._unpackers = {
80 (1, True): ql.unpack8s,
81 (2, True): ql.unpack16s,
82 (4, True): ql.unpack32s,
83 (8, True): ql.unpack64s,
84
85 (1, False): ql.unpack8,
86 (2, False): ql.unpack16,
87 (4, False): ql.unpack32,
88 (8, False): ql.unpack64
89 }
90
91
92 def __read_string(self, addr: int) -> str:

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected