Reputation: 21
What would happen if you have a page table entry which maps a page to a PPN which is beyond the available RAM on the machine. Would it page fault or would it just ignore the MSB's of the calculated address? Or something else?
Upvotes: 2
Views: 102
Reputation: 1337
I did something similar before when I was playing with the Linux kernel, unintentionally of course. Anyway, trying to access a physical page that is beyond your maximum address causes the kernel to panic.
More specifically, A page fault arises if your virtual page is not available in main memory and needs to be fetched (swapped in) from your hard disk. Or if it is available in main memory but with different access rights (available in main memory for read, and your request needs to write). In either cases the OS handles this request by swapping in the page, giving you access or killing the requesting process with a segmentation fault (the notorious Segmentation fault (core dumped)
). At startup the kernel creates a start and end PFN (Page Frame Number) and populates the page table so basically it is not possible for such things to happen.
If for some reason (which shouldn't happen unless you've manipulated the kernel) your page table contains an invalid PFN or PPN, it will cause the kernel to panic and produce something like this:
BUG: unable to handle kernel paging request at ffffea0df0668018
I don't know about other OSes but I guess it is the same. But again this shouldn't happen unless there is something wrong with the kernel.
Upvotes: 1