If I process the following map using commit hash fdc0fb0 (current HEAD of master):
0xA4000000, 512K, CODE, PROGRAM_TEXT
0xA4080000, 255M, RW_DATA, Non-Trusted-DRAM
0xB3FE0000, 128K, RW_DATA, NT-DRAM(MMU_TABLE)
using this command:
python3.9 generate.py -vv -i mmu_map_virt.txt -ttb 0xB3FE0000 -el 1 -tg 16K -tsz 32 -o mmu_map.S
I generate the expected map
<cut out for brevity>
[DEBUG] mapping complete chunk at index 2014
[DEBUG] mapping complete chunk at index 2015
[DEBUG] mapping complete chunk at index 83
[DEBUG] mapping complete chunk at index 84
[DEBUG] mapping complete chunk at index 85
[DEBUG] mapping complete chunk at index 86
[DEBUG] mapping complete chunk at index 87
[DEBUG] mapping complete chunk at index 88
[DEBUG]
[DEBUG] mapping region 0xb3fe0000 in level 2 table
[DEBUG] Region(lineno=3, label='NT-DRAM(MMU_TABLE)', addr=0xb3fe0000, length=0x20000, memory_type=MEMORY_TYPE.rw_data
[DEBUG] floating region, dispatching to next-level table
[DEBUG]
[DEBUG] mapping region 0xb3fe0000 in level 3 table
[DEBUG] Region(lineno=3, label='NT-DRAM(MMU_TABLE)', addr=0xb3fe0000, length=0x20000, memory_type=MEMORY_TYPE.rw_data
[DEBUG] mapping complete chunk at index 2040
[DEBUG] mapping complete chunk at index 2041
[DEBUG] mapping complete chunk at index 2042
[DEBUG] mapping complete chunk at index 2043
[DEBUG] mapping complete chunk at index 2044
[DEBUG] mapping complete chunk at index 2045
[DEBUG] mapping complete chunk at index 2046
[DEBUG] mapping complete chunk at index 2047
<runs to completion and generates mmu_map.S>
If I process the following map using a slight offset:
0xA4000000, 512K, CODE, PROGRAM_TEXT
0xA40C0000, 255M, RW_DATA, Non-Trusted-DRAM
0xB3FE0000, 128K, RW_DATA, NT-DRAM(MMU_TABLE)
using the same command:
python3.9 generate.py -vv -i mmu_map_virt.txt -ttb 0xB3FE0000 -el 1 -tg 16K -tsz 32 -o mmu_map.S
I receive the following error:
<cut out for brevity>
[DEBUG] mapping complete chunk at index 2007
[DEBUG] mapping complete chunk at index 2008
[DEBUG] mapping complete chunk at index 2009
[DEBUG] mapping complete chunk at index 2010
[DEBUG] mapping complete chunk at index 2011
[DEBUG] mapping complete chunk at index 2012
[DEBUG] mapping complete chunk at index 2013
[DEBUG] mapping complete chunk at index 2014
[DEBUG] mapping complete chunk at index 2015
[DEBUG] mapping complete chunk at index 2016
[DEBUG] mapping complete chunk at index 2017
[DEBUG] mapping complete chunk at index 2018
[DEBUG] mapping complete chunk at index 2019
[DEBUG] mapping complete chunk at index 2020
[DEBUG] mapping complete chunk at index 2021
[DEBUG] mapping complete chunk at index 2022
[DEBUG] mapping complete chunk at index 2023
[DEBUG] mapping complete chunk at index 2024
[DEBUG] mapping complete chunk at index 2025
[DEBUG] mapping complete chunk at index 2026
[DEBUG] mapping complete chunk at index 2027
[DEBUG] mapping complete chunk at index 2028
[DEBUG] mapping complete chunk at index 2029
[DEBUG] mapping complete chunk at index 2030
[DEBUG] mapping complete chunk at index 2031
[DEBUG] mapping complete chunk at index 83
[DEBUG] mapping complete chunk at index 84
[DEBUG] mapping complete chunk at index 85
[DEBUG] mapping complete chunk at index 86
[DEBUG] mapping complete chunk at index 87
[DEBUG] mapping complete chunk at index 88
[DEBUG] mapping complete chunk at index 89
[DEBUG]
[DEBUG] mapping region 0xb3fe0000 in level 2 table
[DEBUG] Region(lineno=3, label='NT-DRAM(MMU_TABLE)', addr=0xb3fe0000, length=0x20000, memory_type=MEMORY_TYPE.rw_data
[DEBUG] floating region, dispatching to next-level table
Traceback (most recent call last):
File "/home/goldfish/Downloads/arm64-pgtable-tool/generate.py", line 20, in <module>
import pgtt
File "/home/goldfish/Downloads/arm64-pgtable-tool/pgtt/__init__.py", line 27, in <module>
from . import table
File "/home/goldfish/Downloads/arm64-pgtable-tool/pgtt/table.py", line 202, in <module>
[root.map(r) for r in mmap.regions]
File "/home/goldfish/Downloads/arm64-pgtable-tool/pgtt/table.py", line 202, in <listcomp>
[root.map(r) for r in mmap.regions]
File "/home/goldfish/Downloads/arm64-pgtable-tool/pgtt/table.py", line 92, in map
self.entries[start_idx].map(region)
<Errors here and exits>
Did I overlook a boundary/range condition or is this a bug? The same behavior exists in python3.8.
Thank you