ZystemOS/pluto

Converting between physical and virtual addresses must take VMM allocations into account

Closed this issue · 0 comments

Using mem.virtToPhys and mem.physToVirt is fine if the address is known to be KERNEL_ADDR_OFFSET bytes away from its corresponding address, but this may not be the case for addresses allocated by the VMM, since it will assign an aribitrary virtual address to an arbitrary free physical address. We should either make mem.virtToPhys and mem.physToVirt take a VMM and compute the proper corresponding address or create a function in VirtualMemoryManager to do so. I'm in favour of the second option because there are many cases where mem.physToVirt and mem.virtToPhys are used before the kernel VMM is set up.