Lines Matching full:self

24     def __init__(self):  argument
28 self.ops = aarch64_page_ops()
33 def __init__(self): argument
34 self.SUBSECTION_SHIFT = 21
35 self.SEBSECTION_SIZE = 1 << self.SUBSECTION_SHIFT
36 self.MODULES_VSIZE = 2 * 1024 * 1024 * 1024
39 self.SECTION_SIZE_BITS = 29
41 self.SECTION_SIZE_BITS = 27
42 self.MAX_PHYSMEM_BITS = constants.LX_CONFIG_ARM64_VA_BITS
44 self.PAGE_SHIFT = constants.LX_CONFIG_PAGE_SHIFT
45 self.PAGE_SIZE = 1 << self.PAGE_SHIFT
46 self.PAGE_MASK = (~(self.PAGE_SIZE - 1)) & ((1 << 64) - 1)
48 self.VA_BITS = constants.LX_CONFIG_ARM64_VA_BITS
49 if self.VA_BITS > 48:
51 self.VA_BITS_MIN = 47
53 self.VA_BITS_MIN = 48
56 self.vabits_actual = 64 - ((tcr_el1 >> 16) & 63)
58 self.VA_BITS_MIN = self.VA_BITS
59 self.vabits_actual = self.VA_BITS
60 self.kimage_voffset = gdb.parse_and_eval('kimage_voffset') & ((1 << 64) - 1)
62 self.SECTIONS_SHIFT = self.MAX_PHYSMEM_BITS - self.SECTION_SIZE_BITS
65 self.MAX_ORDER = constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER
67 self.MAX_ORDER = 10
69 self.MAX_ORDER_NR_PAGES = 1 << (self.MAX_ORDER)
70 self.PFN_SECTION_SHIFT = self.SECTION_SIZE_BITS - self.PAGE_SHIFT
71 self.NR_MEM_SECTIONS = 1 << self.SECTIONS_SHIFT
72 self.PAGES_PER_SECTION = 1 << self.PFN_SECTION_SHIFT
73 self.PAGE_SECTION_MASK = (~(self.PAGES_PER_SECTION - 1)) & ((1 << 64) - 1)
76 self.SECTIONS_PER_ROOT = self.PAGE_SIZE // gdb.lookup_type("struct mem_section").sizeof
78 self.SECTIONS_PER_ROOT = 1
80 self.NR_SECTION_ROOTS = DIV_ROUND_UP(self.NR_MEM_SECTIONS, self.SECTIONS_PER_ROOT)
81 self.SECTION_ROOT_MASK = self.SECTIONS_PER_ROOT - 1
82 self.SUBSECTION_SHIFT = 21
83 self.SEBSECTION_SIZE = 1 << self.SUBSECTION_SHIFT
84 self.PFN_SUBSECTION_SHIFT = self.SUBSECTION_SHIFT - self.PAGE_SHIFT
85 self.PAGES_PER_SUBSECTION = 1 << self.PFN_SUBSECTION_SHIFT
87 self.SECTION_HAS_MEM_MAP = 1 << int(gdb.parse_and_eval('SECTION_HAS_MEM_MAP_BIT'))
88 self.SECTION_IS_EARLY = 1 << int(gdb.parse_and_eval('SECTION_IS_EARLY_BIT'))
90 self.struct_page_size = utils.get_page_type().sizeof
91 self.STRUCT_PAGE_MAX_SHIFT = (int)(math.log(self.struct_page_size, 2))
93 self.PAGE_OFFSET = self._PAGE_OFFSET(self.VA_BITS)
94 self.MODULES_VADDR = self._PAGE_END(self.VA_BITS_MIN)
95 self.MODULES_END = self.MODULES_VADDR + self.MODULES_VSIZE
97 self.VMEMMAP_RANGE = self._PAGE_END(self.VA_BITS_MIN) - self.PAGE_OFFSET
98 self.VMEMMAP_SIZE = (self.VMEMMAP_RANGE >> self.PAGE_SHIFT) * self.struct_page_size
99 self.VMEMMAP_END = (-(1 * 1024 * 1024 * 1024)) & 0xffffffffffffffff
100 self.VMEMMAP_START = self.VMEMMAP_END - self.VMEMMAP_SIZE
102 self.VMALLOC_START = self.MODULES_END
103 self.VMALLOC_END = self.VMEMMAP_START - 256 * 1024 * 1024
105 self.memstart_addr = gdb.parse_and_eval("memstart_addr")
106 self.PHYS_OFFSET = self.memstart_addr
107self.vmemmap = gdb.Value(self.VMEMMAP_START).cast(utils.get_page_type().pointer()) - (self.memstar…
109 self.KERNEL_START = gdb.parse_and_eval("_text")
110 self.KERNEL_END = gdb.parse_and_eval("_end")
114 self.KASAN_SHADOW_SCALE_SHIFT = 3
116 self.KASAN_SHADOW_SCALE_SHIFT = 4
117 self.KASAN_SHADOW_OFFSET = constants.LX_CONFIG_KASAN_SHADOW_OFFSET
118self.KASAN_SHADOW_END = (1 << (64 - self.KASAN_SHADOW_SCALE_SHIFT)) + self.KASAN_SHADOW_OFFSET
119self.PAGE_END = self.KASAN_SHADOW_END - (1 << (self.vabits_actual - self.KASAN_SHADOW_SCALE_SHIFT))
121 self.PAGE_END = self._PAGE_END(self.VA_BITS_MIN)
124 self.NODE_SHIFT = constants.LX_CONFIG_NODES_SHIFT
126 self.NODE_SHIFT = 0
128 self.MAX_NUMNODES = 1 << self.NODE_SHIFT
130 def SECTION_NR_TO_ROOT(self, sec): argument
131 return sec // self.SECTIONS_PER_ROOT
133 def __nr_to_section(self, nr): argument
134 root = self.SECTION_NR_TO_ROOT(nr)
136 return mem_section[root][nr & self.SECTION_ROOT_MASK]
138 def pfn_to_section_nr(self, pfn): argument
139 return pfn >> self.PFN_SECTION_SHIFT
141 def section_nr_to_pfn(self, sec): argument
142 return sec << self.PFN_SECTION_SHIFT
144 def __pfn_to_section(self, pfn): argument
145 return self.__nr_to_section(self.pfn_to_section_nr(pfn))
147 def pfn_to_section(self, pfn): argument
148 return self.__pfn_to_section(pfn)
150 def subsection_map_index(self, pfn): argument
151 return (pfn & ~(self.PAGE_SECTION_MASK)) // self.PAGES_PER_SUBSECTION
153 def pfn_section_valid(self, ms, pfn): argument
155 idx = self.subsection_map_index(pfn)
160 def valid_section(self, mem_section): argument
161 if mem_section != None and (mem_section['section_mem_map'] & self.SECTION_HAS_MEM_MAP):
165 def early_section(self, mem_section): argument
166 if mem_section != None and (mem_section['section_mem_map'] & self.SECTION_IS_EARLY):
170 def pfn_valid(self, pfn): argument
172 if self.PHYS_PFN(self.PFN_PHYS(pfn)) != pfn:
174 if self.pfn_to_section_nr(pfn) >= self.NR_MEM_SECTIONS:
176 ms = self.__pfn_to_section(pfn)
178 if not self.valid_section(ms):
180 return self.early_section(ms) or self.pfn_section_valid(ms, pfn)
182 def _PAGE_OFFSET(self, va): argument
185 def _PAGE_END(self, va): argument
188 def kasan_reset_tag(self, addr): argument
194 def __is_lm_address(self, addr): argument
195 if (addr - self.PAGE_OFFSET) < (self.PAGE_END - self.PAGE_OFFSET):
199 def __lm_to_phys(self, addr): argument
200 return addr - self.PAGE_OFFSET + self.PHYS_OFFSET
202 def __kimg_to_phys(self, addr): argument
203 return addr - self.kimage_voffset
205 def __virt_to_phys_nodebug(self, va): argument
206 untagged_va = self.kasan_reset_tag(va)
207 if self.__is_lm_address(untagged_va):
208 return self.__lm_to_phys(untagged_va)
210 return self.__kimg_to_phys(untagged_va)
212 def __virt_to_phys(self, va): argument
214 if not self.__is_lm_address(self.kasan_reset_tag(va)):
216 return self.__virt_to_phys_nodebug(va)
218 def virt_to_phys(self, va): argument
219 return self.__virt_to_phys(va)
221 def PFN_PHYS(self, pfn): argument
222 return pfn << self.PAGE_SHIFT
224 def PHYS_PFN(self, phys): argument
225 return phys >> self.PAGE_SHIFT
227 def __phys_to_virt(self, pa): argument
228 return (pa - self.PHYS_OFFSET) | self.PAGE_OFFSET
230 def __phys_to_pfn(self, pa): argument
231 return self.PHYS_PFN(pa)
233 def __pfn_to_phys(self, pfn): argument
234 return self.PFN_PHYS(pfn)
236 def __pa_symbol_nodebug(self, x): argument
237 return self.__kimg_to_phys(x)
239 def __phys_addr_symbol(self, x): argument
241 if x < self.KERNEL_START or x > self.KERNEL_END:
243 return self.__pa_symbol_nodebug(x)
245 def __pa_symbol(self, x): argument
246 return self.__phys_addr_symbol(x)
248 def __va(self, pa): argument
249 return self.__phys_to_virt(pa)
251 def pfn_to_kaddr(self, pfn): argument
252 return self.__va(pfn << self.PAGE_SHIFT)
254 def virt_to_pfn(self, va): argument
255 return self.__phys_to_pfn(self.__virt_to_phys(va))
257 def sym_to_pfn(self, x): argument
258 return self.__phys_to_pfn(self.__pa_symbol(x))
260 def page_to_pfn(self, page): argument
261 …return int(page.cast(utils.get_page_type().pointer()) - self.vmemmap.cast(utils.get_page_type().po…
263 def page_to_phys(self, page): argument
264 return self.__pfn_to_phys(self.page_to_pfn(page))
266 def pfn_to_page(self, pfn): argument
267 return (self.vmemmap + pfn).cast(utils.get_page_type().pointer())
269 def page_to_virt(self, page): argument
271 return self.__va(self.page_to_phys(page))
273 …((page.cast(gdb.lookup_type("unsigned long")) - self.VMEMMAP_START).cast(utils.get_ulong_type())) …
274 return self.PAGE_OFFSET + (__idx * self.PAGE_SIZE)
276 def virt_to_page(self, va): argument
278 return self.pfn_to_page(self.virt_to_pfn(va))
280 __idx = int(self.kasan_reset_tag(va) - self.PAGE_OFFSET) // self.PAGE_SIZE
281 addr = self.VMEMMAP_START + (__idx * self.struct_page_size)
284 def page_address(self, page): argument
285 return self.page_to_virt(page)
287 def folio_address(self, folio): argument
288 return self.page_address(folio['page'].address)
293 def __init__(self): argument
294 super(LxPFN2Page, self).__init__("lx-pfn_to_page", gdb.COMMAND_USER)
296 def invoke(self, arg, from_tty): argument
307 def __init__(self): argument
308 super(LxPage2PFN, self).__init__("lx-page_to_pfn", gdb.COMMAND_USER)
310 def invoke(self, arg, from_tty): argument
322 def __init__(self): argument
323 super(LxPageAddress, self).__init__("lx-page_address", gdb.COMMAND_USER)
325 def invoke(self, arg, from_tty): argument
337 def __init__(self): argument
338 super(LxPage2Phys, self).__init__("lx-page_to_phys", gdb.COMMAND_USER)
340 def invoke(self, arg, from_tty): argument
352 def __init__(self): argument
353 super(LxVirt2Phys, self).__init__("lx-virt_to_phys", gdb.COMMAND_USER)
355 def invoke(self, arg, from_tty): argument
366 def __init__(self): argument
367 super(LxVirt2Page, self).__init__("lx-virt_to_page", gdb.COMMAND_USER)
369 def invoke(self, arg, from_tty): argument
380 def __init__(self): argument
381 super(LxSym2PFN, self).__init__("lx-sym_to_pfn", gdb.COMMAND_USER)
383 def invoke(self, arg, from_tty): argument
394 def __init__(self): argument
395 super(LxPFN2Kaddr, self).__init__("lx-pfn_to_kaddr", gdb.COMMAND_USER)
397 def invoke(self, arg, from_tty): argument