def __setattr__(self, name, newvalue): if name not in self._regs: raise AttributeError msb, lsb = self._regs[name] val = self.value & (~bitops.bm(msb, lsb)) val |= newvalue << lsb # can't access self.value directly since that would cause # infinite recursion to __setattr__ object.__setattr__(self, "value", val)
def page_table_walk(self, virt): global_offset = bvalsel(31, 20, virt) l1_pte = self.global_page_table[global_offset] bit18 = (l1_pte & 0x40000) >> 18 if (bvalsel(1, 0, l1_pte) == 1): l2_offset = bvalsel(19, 12, virt) l2_pte = self.secondary_page_tables[global_offset][l2_offset] if l2_pte is None: return None if (bvalsel(1, 0, l2_pte) == 2) or (bvalsel(1, 0, l2_pte) == 3): entry4kb = (l2_pte & bm(31, 12)) + bvalsel(11, 0, virt) return entry4kb elif (bvalsel(1, 0, l2_pte) == 1): entry64kb = (l2_pte & bm(31, 16)) + bvalsel(15, 0, virt) return entry64kb if (bvalsel(1, 0, l1_pte) == 2): onemb_entry = bm(31, 20) & l1_pte onemb_entry += bvalsel(19, 0, virt) return onemb_entry return 0
def page_table_walk(self, virt): global_offset = bvalsel(31, 20, virt) l1_pte = self.global_page_table[global_offset] bit18 = (l1_pte & 0x40000) >> 18 if (bvalsel(1, 0, l1_pte) == 1) : l2_offset = bvalsel(19, 12, virt) l2_pte = self.secondary_page_tables[global_offset][l2_offset] if l2_pte is None : return None if (bvalsel(1, 0, l2_pte) == 2) or (bvalsel(1, 0, l2_pte) == 3) : entry4kb = (l2_pte & bm(31, 12)) + bvalsel(11, 0, virt) return entry4kb elif (bvalsel(1, 0, l2_pte) == 1) : entry64kb = (l2_pte & bm(31, 16)) + bvalsel(15, 0, virt) return entry64kb if (bvalsel(1, 0, l1_pte) == 2) : onemb_entry = bm(31, 20) & l1_pte onemb_entry += bvalsel(19, 0, virt) return onemb_entry return 0