0

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

2 Answers 2

0

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.

1
  • it is about a 32-bit Intel Architecture and i guess it should be a 4kB page size.
    – Al Bert
    Sep 18, 2015 at 12:54
0

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

3
  • it is about an INTEL IA32 and the structure is given like below: 0 (P)---Present ; 1 (R/W)---- Read/Write ; 2 (U/S)--- user/supervisor ; 3 (PWT)---- Pagelevel write-through ; 4 (PCD)--- Pagelevel cache disable ; 5 (A)---- Accessed ; 6 (D)----- Dirty ; 7 (PAT)-----; 8 (G)----- ; 11:9 () ---- Ignored ; 31:12 () ---- Phy add. of the 4-kByte page referenced by this entry <br/> And my decimal Values of them should be like below: page directory offset = 0x3CD page table offset = 0x157 page offset = 0x100 or am i wrong ?
    – Al Bert
    Sep 18, 2015 at 13:49
  • in this calculation no need to know the values of status and proctection bits but your understanding is now right Sep 18, 2015 at 13:51
  • and from Offset of the PTE through PTE structure can i find out: for Example if the Page is in Memory, through first bit of 12 (0000 0101 0011 =053). the first bit is 1 that mean the Page is Present in memory
    – Al Bert
    Sep 18, 2015 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.