[Linux Device Driver] linux address type, linux Device address type

Source: Internet
Author: User

[Linux Device Driver] linux address type, linux Device address type

List of address types used in Linux:

User virtual addresses)

The normal address visible to the user space program. The virtual address length is 32-bit or 64-bit. It depends on the underlying hardware architecture. Each process has its own virtual address space.

Physical address (Physical addresses)

The address used between the processor and the system memory. The physical address length is 32-bit or 64-bit. A 32-bit operating system can also use a physical address (PAE) that is larger than 32-bit)

Bus address)

The address used between the external bus and the system memory. Generally, the BUS address is equivalent to the physical address, but not necessarily. In some architectures, an IOMMU (IO memory management unit) remaps bus addresses to physical addresses. IOMMU is helpful in many scenarios. For example, if the scattered physical memory is remapped to a continuous BUS address, the device looks like the BUS address is continuous. However, this also brings about additional work. For example, when performing DMA operations, You Need To program IOMMU (fill in ing items ). Of course, the BUS address is highly related to the architecture.

Kernel logical address (Kernel logical addresses)

The Logical Address of the kernel constitutes the normal address space of the kernel. These addresses map some or all of the primary addresses, and are often considered as physical addresses. In most architecture, there is only one fixed offset between the logical address and the related physical address. The Logical Address type is the local pointer size of the hardware. Therefore, you may not be able to access all physical addresses on a 32-bit overloaded system. The Logical Address type is usually unsigned long or void *. Memory allocated through kmalloc. The address type is logical address.

Kernel virtual address (Kernel virtual addresses)

The kernel virtual address is similar to the kernel logical address because it is the ing of the kernel space address to the physical memory. Different from the kernel logical address, the kernel virtual address does not need to be linearly or one-to-one mapped to a physical address during ing. All kernel logic addresses are virtual kernel addresses, but many kernel virtual addresses are not. For example, the memory allocated by vmalloc is the kernel virtual address (but not directly mapped to the physical address ). The kmap function returns the kernel virtual address. Kernel virtual addresses are usually stored in Pointer variables.

 

Macro _ pa () (defined in <asm/page. h>) converts the kernel logical address to a physical address. Macro _ va () converts the physical address back to the kernel logical address, but takes effect only for low addresses.

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.