Disclaimer: The conclusions drawn in this article are all from the "Embedded Linux Complete Development Manual". They are summarized in my own words after trying to understand its meaning, so as to better understand the contents of this section.
VA: virtual address
WVA: converted virtual address
PA: physical address
PID: process identification number, obtained by C13 of CP15.
1. The virtual address gets the converted virtual address
If VA < 32M, then MVA = VA | (PID << 25),
otherwise VA = MVA.
32M = 2^25, so PID needs to be shifted left by 25 bits to get a non-duplicate physical address space.
Tip: VA < 32M, as for why it is 32, I think it may be because the code space of the program will not exceed the virtual address space of the following 32M when it is running. Since this method of obtaining MVA is to simplify the work of preventing different processes with overlapping virtual addresses from being mapped to the same physical address space, and the virtual memory space after 32M stores system components and dynamic link libraries, etc., which can be shared by different processes, there is no need to distinguish the physical address space corresponding to the virtual address space after 32M for each process.
2. Page table classification
2.1. Level 1 page table entries
Identifies the lower 2 bits Entry Type 00 Invalid entry 01 Coarse page table entries 10 Segment Entries 11 Fine page table entries 2.2. Secondary page table entries
Identifies the lower 2 bits Entry Type 00 Invalid entry 01 Huge Page Entries 10 Minipage Entries 11 Minipage entries 3. Relationship between page tables
3.1、Directional relationship
It can be understood that segments, large pages, small pages, and tiny pages belong to the same level, because they can directly obtain physical addresses.
Coarse page tables and fine page tables belong to the second-level page table, and page tables belong to the first-level page table.3.2. Inclusion Relationship
(1) A page table can contain 4096 segment entries (i.e., segment descriptors), and each segment stores 1M of physical address space.(2) The page table can contain 4096 coarse page tables.
1. Each coarse page table contains 256 entries, and each entry can index a 4K physical address.
2. A large page can index a 64K physical address, and every 16 entries in the coarse page table can point to the same large page
. 3. A small page can index a 4K physical address, and each entry in the coarse page table can point to a small page.
4. A tiny page can index a 1K physical address, and the coarse page table cannot point to a tiny page.(3) The page table can contain 4096 fine page tables.
1. Each fine page table contains 1024 entries, and each entry can index a 1K physical address.
2. A large page can index a 64K physical address, and every 64 entries in the fine page table can point to the same large page
. 3. A small page can index a 4K physical address, and every 4 entries in the fine page table can point to a small page.
4. A tiny page can index a 1K physical address, and every 1 entry in the fine page table can point to a tiny page.4. Indexing steps
(1) The segment mode
obtains the physical address of the first-level page table (bits [31:14]) from C2 (page table base address register) of CP15, and uses bits [31:20] of MVA to index the corresponding segment descriptor in the first-level page table. The physical address of the corresponding segment is obtained from bits [31:20] of the segment descriptor, and bits [19:0] of MVA index the physical address to be operated in the segment.(2) Coarse page table mode (large pages are stored):
Get the physical address of the first-level page table (bits [31:14]) from C2 (page table base address register) of CP15, and use bits [31:20] of MVA to index the corresponding coarse page table descriptor in the first-level page table. Use bits [31:10] of the coarse page table descriptor to get the physical address of the corresponding coarse page table. Use bits [19:12] of MVA to index a large page descriptor in the coarse page table. Use bits [31:16] of the large page descriptor to get the physical address of the large page. Use bits [15:0] of MVA to index the physical address to be operated in the large page.
The indexing method of large pages stored in fine page tables is similar.(3) Coarse page table mode (small pages are stored)
obtains the physical address of the first-level page table (bits [31:14]) from C2 (page table base address register) of CP15, and uses bits [31:20] of MVA to index the corresponding coarse page table descriptor in the first-level page table. Use bits [31:10] of the coarse page table descriptor to obtain the physical address of the corresponding coarse page table. Use bits [19:12] of MVA to index a small page descriptor in the coarse page table, take out descriptor [31:12] to obtain the physical address of the small page table, and then use bits [11:0] of MVA to index the physical address stored in the small page table.(4) The fine page table (which stores the tiny page table)
obtains the physical address of the first-level page table (bits [31:14]) from C2 (page table base address register) of CP15, and uses bits [31:20] of MVA to index the corresponding fine page table descriptor in the first-level page table. Bits [31:12] of the fine page table descriptor index into the base address of a tiny page table, and then bits [19:10] of MVA index into a descriptor in the tiny page table. [31:10] of the descriptor is taken out to index into the physical address of the tiny page, and then bits [9:0] of MVA index into the physical address to be operated in the tiny page.Summary:
Segment index:
TTB[31:14] MVA[31:20] Get segment descriptor
DUB[31:20] MVA[19:0] Get physical addressCoarse page table large page:
TTB[31:14] MVA[31:20] Get the coarse page table descriptor
SOB[31:10] MVA[19:12] Get the large page table descriptor
BIB[31:16] MVA[15:0] Get the physical addressFine page table large page:
TTB[31:14] MVA[31:20] Get fine page table descriptor
FIB[31:12] MVA[19:12] Get large page table descriptor
BIB[31:16] MVA[15:0] Get physical addressCoarse page table small page:
TTB[31:14] MVA[31:20] Get the coarse page table descriptor
SOB[31:10] MVA[19:12] Get the small page table descriptor
SMB[31:12] MVA[11:0] Get the physical addressFine page table small page:
TTB[31:14] MVA[31:20] Get fine page table descriptor
FIB[31:12] MVA[19:12] Get small page table descriptor
SMB[31:12] MVA[11:0] Get physical addressFine page table tiny page:
TTB[31:14] MVA[31:20] Get fine page table descriptor
FIB[31:12] MVA[19:10] Get tiny page descriptor
VSB[31:10] MVA[9:0] Get physical addressTip:
SOB: coarse base
FIB: fine base
DUB: section base
SMB: small base
VSB: very small base
BIB: big base
Previous article:ARM address remapping mechanism
Next article:The relationship between the virtual address and physical address of the s3c2440 register based on linux2.6.30.4
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to determine the grounding method for a circuit board built with circuit modules?
- Inventory of mainstream Bluetooth chips, which one is better, Nordic/TI/Broadcom?
- 50% charge in 5 minutes! How powerful is the much-hyped GaN fast charging?
- A comprehensive analysis of the principles of various lightning protection circuits
- Basic circuit design tree for RF microwave circuit engineering
- [Jihai APM32E103VET6S MINI development board review] RTC test
- Oscilloscope helps measure harmonic content calculation
- Common Linux commands in the Corelink SinA33 development board virtual machine
- Tkinter study notes——by Changjianze1
- CircuitPython 6.0.0-alpha.3 released