pgtt/codegen.py
def _mk_next_level_table( n:int, index:int, next_t:table.Table ) -> str:
    """
    args
    ====

        n
                    parent table number in sequential order from ttbr0_eln

        index
                    index of the next level table pointer

        next_t
                    the next level translation table
    """
#/* program_table_{n}_entry_{index} */
    return f"""
    MOV64   x11, {hex(next_t.addr)} // next-level table address
    add     x11, x11, x20               // add base address
    orr     x11, x11, #0x3              // next-level table descriptor
    str     x11, [x21, #{index}*8]     // write entry[{index}] into table"""

    args
    ====

        n
                    parent table number in sequential order from ttbr0_eln

        index
                    index of the next level table pointer

        next_t
                    the next level translation table
    
args
n
parent table number in sequential order from ttbr0_eln

index
index of the next level table pointer

next_t
the next level translation table
args n parent table number in sequential order from ttbr0_eln index index of the next level table pointer next_t the next level translation table
def _mk_next_level_table( n:int, index:int, next_t:table.Table ) -> str:
    return f"""
    MOV64   x11, {hex(next_t.addr)} // next-level table address
    add     x11, x11, x20               // add base address
    orr     x11, x11, #0x3              // next-level table descriptor
    str     x11, [x21, #{index}*8]     // write entry[{index}] into table"""
def _mk_next_level_table ( n : int , index : int , next_t : table . Table ) -> str : return f"""
    MOV64   x11, {hex(next_t.addr)} // next-level table address
    add     x11, x11, x20               // add base address
    orr     x11, x11, #0x3              // next-level table descriptor
    str     x11, [x21, #{index}*8]     // write entry[{index}] into table"""
args
n
parent table number in sequential order from ttbr0_eln
args n parent table number in sequential order from ttbr0_eln
"""
    args
    ====

        n
                    parent table number in sequential order from ttbr0_eln

        index
                    index of the next level table pointer

        next_t
                    the next level translation table
    """ #/* program_table_{n}_entry_{index} */
n
int
index
int
next_t
table.Table