To my understanding the page tables entries that point to the next page table need to be absolute addresses, so from 0x0.
Now I would like to generate my page tables before runtime and cannot know the absolute address because I don’t know at which address they end up exactly… so is it somehow possible to do that with relative (to table base address e.g.) addresses?
Greets from Germany
Grüße aus GroßbritannienNot really. The MMU expects the L2 table pointers in L1 table entries to be absolute PAs (or IPAs). There isn't (AFAIK) a way to tell it to treat them as relative addresses.
Are you dynamically allocating the memory that holds the tables? Is that why you don't know the addresses? Or is it that the addresses come from the linker?
So I'm working with Zig (upcoming system programming lang and self proclaimed C competitor) which has a comptime feature. Sadly hard linked label addresses are not accessible during compile time. So there's probably some hack in C but I'm trying to solve that elegantly in zig, so I either have relative addressing or I have to do it at runtime