FEX icon indicating copy to clipboard operation
FEX copied to clipboard

4k page emulation

Open skmp opened this issue 3 years ago • 0 comments

Splitting from #1221

from @skmp

We now have a fairly clean interface - one would need to add support for this in virtual void GuestMmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) = 0; and GuestMunmap, and maybe introduce a GuestMprotect and then it would all work.

from @marcan

mmap on files can be made to work perfectly fine as long as the vaddr is not requested as fixed. You just align the mapping to 16K and give the app an offset halfway into the page if needed. munmap would then align back before unmapping the 16K aligned block.

mprotect similarly would only fail if the app is trying to do its own page management at page granularity. Many uses of mprotect are used on whatever mmap returned, and since that would be 16K aligned (or the above hack for file maps), it could similarly be made to work.

We are already tracking guest VMAs for mtrack, so adding the few extra things needed should be fairly uneventful.

I'm putting it in the 2212 milestone, hopefully the asahi side is ready by then.

skmp avatar Aug 15 '22 07:08 skmp