Paging: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
m Reverted edits by Uzytkownik (Talk); changed back to last version by Tantrikwizard
Combuster (talk | contribs)
m Reverted edits by Combuster (Talk); changed back to last version by Uzytkownik
Line 22: Line 22:
The page table address field represents the physical address of the page table that managers the four megabytes at that point. Please note that it is very important that this address be 4 KiB aligned. This is needed, due to the fact that the last bits of the dword are overwritten by access bits and such.
The page table address field represents the physical address of the page table that managers the four megabytes at that point. Please note that it is very important that this address be 4 KiB aligned. This is needed, due to the fact that the last bits of the dword are overwritten by access bits and such.


* S, or 'Page '''S'''ize' stores the page size for that specific entry. If the bit is set, then pages are 4 MiB in size. Otherwise, they are 4 KiB.
* S, or 'Page '''S'''ize' stores the page size for that specific entry. If the bit is set, then pages are 4 MiB in size. Otherwise, they are 4 KiB. Please note that for 4 MiB pages PSE have to be enabled.
* A, or ''''A'''ccessed' is used to discover whether a page has been read or written to. If it has, then the bit is set, otherwise, it is not. Note that, this bit will not be cleared by the CPU, so that burden falls on the OS (if it needs this bit at all).
* A, or ''''A'''ccessed' is used to discover whether a page has been read or written to. If it has, then the bit is set, otherwise, it is not. Note that, this bit will not be cleared by the CPU, so that burden falls on the OS (if it needs this bit at all).
* D, is the 'Cache '''D'''isable' bit. If the bit is set, the page will not be cached. Otherwise, it will be.
* D, is the 'Cache '''D'''isable' bit. If the bit is set, the page will not be cached. Otherwise, it will be.
Line 69: Line 69:
mov eax, cr0
mov eax, cr0
or eax, 0x80000000
bts eax, 31
mov cr0, eax
mov cr0, eax

To enable PSE (4 MiB pages) the following code is required.

mov eax, cr4
bts eax, 4
mov cr4, eax


==Usage==
==Usage==