LDD understands:
Linux is a virtual memory system, which means thatProgramThe address you see does not directly correspond to the physical address used by the hardware. the Virtual Memory introduces an indirect layer that allows many good things. with the virtual memory, the system re-runs the program to get much more space than the physical memory. Indeed, even if a single process can have a virtual address space larger than the system's physical memory, the virtual memory allows the program to run the address space of the process, including the memory of the ing member to the device memory.
So far, we have discussed virtual and physical addresses, but many details have been covered up. The Linux system processes several types of addresses, each of which has its own meaning. Unfortunately, the kernelCodeIt is not always very clear exactly what type of address is used in each case, so the programmer must be careful.
The address type used in Linux shows how the address type is associated with physical memory.
User Virtual addresses
This is the regular address seen by the user program. The user address is 32-bit or 64-bit in length and depends on the underlying hardware structure, and each process has its own virtual address space.
Physical addresses
The address used between the processor and the system memory. The physical address is 32-or 64-bit; or even 32-bit systems can use a larger physical address in some cases.
Bus addresses
The address used between the peripherals and the memory. often, they are the same as the physical addresses used by the processor, but this is not necessary. some systems provide an I/O Memory Management Unit (iommu), which remaps the address between the bus and the main memory. an iommu can be used in multiple ways to make things simple (for example, to make the buffer distributed in the memory appear continuous to the device, for example ), however, iommu programming is an additional step when the DMA Operation is set. the bus address is highly characteristic dependent, of course.
Kernel logical addresses
These constitute a normal kernel address space. These addresses map some (maybe all) primary memory and are often treated as physical memory.In most systems, there is only one constant offset between the logical address and their physical addresses (the constant offset on 80 x86 is called linear address/virtual address, which is not the same as Intel's logical address definition.).The logical address uses the local pointer size of the hardware. Therefore, it may not be able to address all the physical memory on the heavily equipped 32-bit system. logical addresses are often stored in unsigned long or void * type variables. the memory returned from kmalloc has the kernel logic address.
Kernel virtual addresses
Kernel virtual addresses are similar to logical addresses. They are all ing from kernel space addresses to physical addresses. kernel virtual addresses do not have to have a linear logical address space, one-to-one ing to physical addresses,However, all logical addresses are kernel virtual addresses, but many kernel virtual addresses are not logical addresses.For example, the memory allocated by vmalloc has a virtual address (but there is no direct physical ing). The kmap function (described later in this chapter) also returns a virtual address. The virtual address is often stored in Pointer variables.