This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Page Table Indexing using Virtual Address bits

Hello Experts,

In section G5.5.1 " Overview of VMSAv8-32 address translation using Long-descriptor translation tables" of ARM ARM and also in the code which I got from repository, I can see bits [31:30] of VA are used to index level 1 table.

Code:

//Traverse the virtual-address in 1st level pagetable
//Only bit 31:30 use for 1st level addressing
addr_1stLevel = (virtualAddress & 0xC0000000);

//Get the index from virtual address
addr_1stLevel = (addr_1stLevel >> 30);

//Get the address on the address
addr_1stLevel = (addr_1stLevel << 3) + baseAddress;

ARM ARM:

I am trying to understand why VA[31:30] are used to index level 1 table ? And bits 29:21 are used to index level 2 table ? 

I was considering ARM ARM as a general example. But I could see the same is implemented in code. 

Can anyone explain the logic behind indexing tables with these specific bits of VA ?

Regards,

Amitra