Skip to content
Advertisement

Manual Virtual Address Translation

I’ve looked at a few different articles related to this already but none of them explain the solution in a way that I can understand and replicate. I need to know how to translate a physical address to a virtual address in memory based on the following:

A simple virtual memory system has 32KB physical memory with 16-bit virtual address, of which 12 bits are used as offset. The following is the current content of the page table of one of the processes:

enter image description here

So basically I think the page size of this virtual memory system is 1024KB. I need a process to find the corresponding PA of VA B2A0. If you can give me the process I can go from there, you don’t have to give me the final solution 🙂

Thanks in advance guys. Also, if you know of an article that does this already and I’ve just missed it, feel free to just link me to that.

Cheers.

Advertisement

Answer

32 KB is 2^15. so there are 15 bits for every physical address, lower 12 of them are used as offset, higher 3 as a number of pageframe.

What virtual page does 0xb2a0 resides in? To determine this, we need to take bits of the address, higher than 2^12. The size of a page is 2^12, that is 4096 or 0x1000, so it is a virtual page number 0xb = 11 (floor of 0xb2a0 / 0x1000). Offset inside the page is 0xb2a0 modulo 0x1000, it’s 0x2a0.

Then use the table to translate the virtual page number 11 to a physical pageframe. The virtual page is present (1), and it corresponds to the physical frame number with higher bits 111, that is 111 + twelve 0 in binary, => 0x7000 – it is the address of the start of the physical frame.

Our physical address resides at offset 0x2a0, so, the sought physical address is 0x7000 + 0x2a0 = 0x72a0.

Please, follow this flow and make it clear for you. If you have questions, read the Wikipedia first and if something is still not clear, ask 🙂

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement