Colors of Ray+Hue'

Original Source: http://www.on-time.com/rtos-32-docs/rttarget-32/programming-manual/x86-cpu/protected-mode/virtual-linear-and-physical-addresses.htm


Virtual, Linear, and Physical Addresses

The 386 memory management can become quite confusing. Here is a summary of the different types of addresses and how one type is translated to another:

Virtual addresses are used by an application program. They consist of a 16-bit selector and a 32-bit offset. In the flat memory model, the selectors are preloaded into segment registers CS, DS, SS, and ES, which all refer to the same linear address. They need not be considered by the application. Addresses are simply 32-bit near pointers.

Linear addresses are calculated from virtual addresses by segment translation. The base of the segment referred to by the selector is added to the virtual offset, giving a 32-bit linear address. Under RTTarget-32, virtual offsets are equal to linear addresses since the base of all code and data segments is 0.

Physical addresses are calculated from linear addresses through paging. The linear address is used as an index into the Page Table where the CPU locates the corresponding physical address. If paging is not enabled, linear addresses are always equal to physical addresses. Under RTTarget-32, linear addresses are equal to physical addresses except for remapped RAM regions (see section RTLoc: Locating a Program, sections Virtual Command and FillRAM Command) and for memory allocated using the virtual memory manager.

Linear address is generated after page table mapping. Physical address is generated before page table mapping(ie paging).

Linear Adress,created by adding logical address to the base of segment, CS,DS,ES,SS,FSor GS. When Paging is enabled, the page tables are used to translate linear address to physical address.

On the Other Hand, Physical Address is nothing but, the address value that appears on pins of processor during a memory read/memory write operations.

In Short, we can say if paging is disabled linear address = physical address


'Linux Kernel' 카테고리의 다른 글

System Memory  (0) 2016.08.13
Radix Tree  (0) 2016.08.12
Block I/O Operation  (0) 2016.08.06
What is wmb() in linux driver  (0) 2016.08.05
What is the return address of kmalloc() ? Physical or Virtual?  (0) 2016.07.29