"Translate" "Linux device Driver" Linux address type

Source: Internet
Author: User

List of address types used in Linux:

User virtual address (addresses)

The normal address that is visible to the user space program. The length of the user virtual address is 32-bit or 64-bit and relies on the underlying hardware architecture, with each process having its own virtual address space.

Physical address (physical addresses)

The address used between the processor and the system memory. The physical address is either 32-bit or 64-bit, and sometimes a physical address (PAE) greater than 32 bits can be used on 32-bit operating systems

Bus addresses (bus addresses)

The address used between the external bus and the system memory. Usually the bus address and physical address are equivalent, but not necessarily. Some architectures have a IOMMU (IO Memory management unit) that remap the bus address to a physical address. Iommu is helpful in many scenarios, such as remapping scattered physical memory to a continuous bus address, and the device looks like the bus address is contiguous. However, this also brings additional workload, such as the need to iommu additional programming (fill in the mapping entries) for the DMA operation. Of course, the bus address is highly relevant to the architecture.

Kernel logical address (Kernel logical addresses)

The kernel logical address consists of the normal address space of the kernel. These addresses map some or all of the main memory addresses, and are often considered to be physical addresses. On most architectures, there is only a fixed offset between the logical address and the associated physical address. The type of logical address is the hardware local pointer size, so on a 32-bit overloaded system, all physical addresses may not be accessible. The type of logical address is usually unsigned long or void *. The memory allocated through KMALLOC, the address type is a logical address.

Kernel virtual address (Kernel Vsan addresses)

Kernel virtual addresses are similar to kernel logical addresses because they are the mappings of kernel-space addresses to physical memory. Unlike a kernel logical address, a kernel virtual address is mapped without having to map to a physical address either linearly or one-to-one. All kernel logical addresses are kernel virtual addresses, but many kernel virtual addresses are not kernel logical addresses. For example, the memory allocated by Vmalloc is a kernel virtual address (but not directly mapped to a physical address). The Kmap function also returns the kernel virtual address. Kernel virtual addresses are usually stored in pointer variables.

Macro __PA () (defined in <asm/page.h>) translates the kernel logical address into a physical address. Macro __va () translates the physical address back into the kernel logical address, but only for the low address.

"Translate" "Linux device Driver" Linux address type

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.