> "In any case, the OS needs to know which address generated the Page Fault to be able to deal with the problem. This is why the nice IA32 developers set the value of cr2 to that address whenever a Page Fault occurs. The exception handler can then just look into cr2 to get the address."
The CR3 register holds address of the page table for the currently executing process and CR3 gets updated on every context switch.
Did they mean CR3? If not what is CR2? I am not familiar with the CR2 register and its significance in demand paging systems.
CR2 holds the address that the access was attempted on that faulted. So for example, if you attempt to access 0x23456789 and that faults because there is no page, CR2 contains that 0x23456789. But that might not be an "invalid" address - the OS may simply not have mapped the page in yet (Which is what happens with dynamic paging). So the OS checks the CR2, and if it is valid address the OS maps the correct page in and then returns back to the code that the program attempted to execute (Which now works).
https://news.ycombinator.com/item?id=13775321