4 ms·
x86 Paging Tutorial
- TempleOS 10y agoTempleOS has two main features. Ring-0-only and no paging. (It's identity mapped because long mode requires it.) Linux and Windows have ring 3 and paging.
- Retr0spectrum 10y agoThat's great, but I think it's mainly because TempleOS has different target use cases to other modern OSs.
- aanm1988 10y ago> It's identity mapped because long mode requires it How can long mode require identity mapping? Do you mean for ring 0 code? For some reason I always thought templeOS was real mode.
- fsaintjacques 10y agoCiro, your work is amazing.
- cirosantilli 10y agoThanks :-) Or maybe, thank my unemployment at the time :-)
- deleted 10y ago[deleted]
- bogomipz 10y agoThe author mentions: > "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.
- munificent 10y agoI read it as cr2 holds the logical address that you were looking up when the page fault occurred.
- DSMan195276 10y agoCR2 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).
- sigjuice 10y agoAccording to "Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3A:", http://www.intel.com/Assets/en_US/PDF/manual/253668.pdf http://www.intel.com/Assets/en_US/PDF/manual/253668.pdf CR2 — Contains the page-fault linear address (the linear address that caused a page fault)
- kruhft 10y agoRelevant: "Ask HN: Would you design a modern CPU with virtual memory support?" https://news.ycombinator.com/item?id=13775321 https://news.ycombinator.com/item?id=13775321
- Drisc0 10y agoThis would have been useful when I was still in school