if i have a Virtual Address: 0xF3557100 , how do i convert it to Physical Address and what are the Values of Offset, Page Directory and Page Table ?
The PTE (page table entry) for that address has the value 0x87124053
thnx
Sadly, what you are asking is system dependent. You would need to know the size of the page to begin with.
In the simplest case, the lowest order bits corresponding to the page size are the offset and the remaining high order bits specify the page table entry.
You say that you have the value of he page table entry. You then need to know the structure of the page table entry. Some part of that will indicate the physical address. Other parts will define page attributes.
In short, we'd need to know a whole lot more information.
In general from this info you can not translate a VA to PA. Each architecture has some constant value for PAGE_SHIFT. as your address is 32 bit, most of such architecture has 12 bit PAGE_SHIFT value. this value determines the offset value so your offset value is 12 bits.that also means your page size is 4096 bytes. even though a architecture can support more than one value for PAGE_SHIFT, we take case of 12 bits offset which is usually default value in most systems making page of 4096
PTE contains address of the page frame/number along with other status and protection information.Lower 12 bits in PTE are used for status and protection while other 20 bits are used for PPN. as a principle virtual frame number is mapped to physical frame number and offset is same in both. so exclude lower most 12 bits from PTE and append 12 lower most bits from va.
so offset from va is 0x100 so physical address is 0x87124100 according to 10-10-12 rule (there is no general rule for this division)
offset = 12 bits
page table = page directory=10 bits
now you CAN easily calculate relevant bits value from given address.
1111001101 0101010111 000100000000
page directory offset = 1111001101
page table offset = 0101010111
page offset = 000100000000