-----x86 Family of microprocessor are segmented memory model. It means, operating system will take care to assign segment address when executing programs. For example when compiler compiles a program for x86 family of processor, it will use offset address for generating code. Here offset address is called virtual address. Consider this example
org 0x100
mov ax, 10
mov bx 20
push ax
push bx
-----Consider the above code, it doesn’t mean anything but we can understand how processor finds physical address. When processor executes “push” instruction, It combines SS (Stack Segment) and SP (Stack Pointer) for finding the physical address and it stores the value on that location after it decrements SP by 2. But while writing program we are not at all specifying the segments address because OS will decide where to load this program based on where free space available, according to that it will assign segment address to Segment register.
(http://stalintechnologies.blogspot.com/search/label/Advanced%20C%20presentation) x86 processor register and how to use in Turbo C compiler
ARM:
But In ARM it’s not like that, In ARM, program’s virtual address is divided into three parts
1. Page directory entry
2. Page table
3. Physical block offset
-----MMU has a register called TTBR (Translation Table Base Register). It holds the base address of the Page directory. This is the entry point for all virtual to physical address translation.
-----Whenever processor trying to read data from memory, it goes via MMU (If it is enabled). MMU interprets the virtual address,
how it interprets?
-----First it takes the most significant 12 bit from that virtual address; it uses this for finding the base address of page table. This 12-bit is used to traverse into page directory for finding the correct page table’s base address, then it takes next 8 bit for finding the physical 4kb block’s base address, this 8 bit is used for traverse into page table for finding 4Kb’s physical block’s base address, once it got the base address of 4kb block, it will be pointing the physical base address of actual block but not actual data that we need, so it takes the next 12 bit from virtual address generated by compiler for finding the actual location of the variable. This is how MMU translates the virtual address to physical address. It will make slow down the process execution so recently referred block will be maintained in cache to fast up the execution.
-----consider the below example program
TInt E32main()
{
TInt a;
a = 40;
}
suppose compiler generates the virtual address for that particular variable "a" is 0x03c20046
When a = 40, when executing this statement, what and all MMU will perform for processor executing this statement?...
----Most significant 12 bit's decimal value is 60 this is the offset of page directory, next 8 bit's decimal value is 32, this is the offset value of page table and least 12 bit's decimal value is 70, this is the offset value of actual physical block's offset for storing the value 40.
-----------------------------------------------END------------------------------------------------
No comments:
Post a Comment