Reputation: 27
In a 32-bits system with 4KB page size, the page number PN from its address VA is 20 bits long obtained with PN = VA / 4KB.
But if we have a 48-bits system, is still the page number 20 bits long?
Concretely, I have a virtual address of the form 0x5641ba0c7000 and I want to know if the virtual page number is 5641ba0c7 (= 5641ba0c7000 / 4KB) or 5641b (20 bits)
Upvotes: 0
Views: 933
Reputation: 58132
Normally the virtual page number would be everything except the low bits of the address that give the offset within the page. With 4 KB (= 2**12 byte) pages, the offset is the low 12 bits, so the virtual page number is the remaining 48-12=36 bits. That's 0x5641ba0c7 in your example. (This number is likely to be broken up further as indexes into several levels of page tables.)
There's nothing universal about 20 bits; it's just that if you have 32-bit virtual addresses then 32-12=20, so the high 20 bits give the page number in that case.
Upvotes: 1