|
|
|
|
|
by jaen
11 days ago
|
|
The slowest part is always emulating the MMU, as that adds a 2-3× overhead to every memory access. In that sense ARM Sv39 is not a great choice. Usually emulators use a direct-mapped cache (basically a software TLB). In this case though, since you control the kernel, it could use something like the MIPS software-managed TLB of the olden days, with bespoke paging data structures and fast-path page fault handlers, perhaps also using PowerPC Inverted Page Tables as inspiration. (and eg. changing page allocation strategies to constrain pages in the lower address space region to simplify cache look up, and something to prevent cache set conflicts). Given that the working set is small tho in this use case, eg. just a kernel-managed direct-mapped `page_number[MAX_PAGES] → base_address` table is sufficient and fast. (with some trick for page faults; also who needs granular RWX access permissions...) |
|