Page Table Entries

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
HOS

Page Table Entries

Post by HOS »

if i have two consecutive page table entries (covering linear addresses 0x00000000-0x00001fff) which are mapped to two non-consecutive pages in physical memory, how are values stored at the break? for example, if i store a 32bit dword at 0x00000ffe will the first two bytes of the dword be at the end of one page and the next two bytes be at the beginning of the next page? is this automatically handled so i do not need to worry about it, or do stored values need to not cross the boundary?

thanks
common

RE:Page Table Entries

Post by common »

They will be stored on two separate pages and it will automatically be virtual to the program.  As far as the program is concerned, it's a linear memory address, so it flows virtually as it would.  Logically, it's broken up on those two pages.  
CarbonBased

RE:Page Table Entries

Post by CarbonBased »

As 'common' has mentioned, the dword will be mapped without any knowledge from the OS or any applications.

This situation should still be avoided, however, for performance reasons.  Writting such a dword would constitude an unaligned memory write, and will slow down your system.  IIRC, the processor will actually divide this dword into two words (which will then be word aligned), and write each one individually (ie, two writes, instead of one).

Cheers,
Jeff
Post Reply