Use of prefetch command pld in ARM

Publisher:智慧启迪Latest update time:2016-03-01 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Kernel version:2.6.14

CPU architecture:ARM920T

Recently, I was analyzing copy_from_user of ARM Linux. The main function is implemented by __arch_copy_from_user. This function is defined in the linux/arch/arm/lib/uaccess.S file and is implemented using assembly. Some source codes are as follows:

 

[plain] view plain copy
 
 print?
  1. ENTRY(__arch_copy_from_user)  
  2.         stmfd sp!, {r0, r2, r4 - r7, lr}  
  3.         cmp r2, #4  
  4.         blt .cfu_not_enough  
  5.     PLD( pld [r1, #0] ) //Because r0 and r1 will be used later, pre-read to speed up memory access  
  6.     PLD(    pld [r0, #0]        )  
  7.         ands    ip, r0, #3  
  8.         bne .cfu_dest_not_aligned  
  9. .cfu_dest_aligned:  
  10.         ands    ip, r1, #3  
  11.         bne .cfu_src_not_aligned  
  12. ...  
This code uses the preload instruction pld (preload). The capital PLD is a macro, which is defined as follows (linux/include/asm-arm/assembler.h):

 

[plain] view plain copy
 
 print?
  1. #if __LINUX_ARM_ARCH__ >= 5  
  2. #define PLD(code...)    code  
  3. #else  
  4. #define PLD(code...)  
  5. #endif  
pld, that is, preload instruction, pld instruction is only valid in armv5 and above. Using pld instruction can prompt ARM to fill cache line in advance. The offset in pld instruction is very particular. It is usually a multiple of 64-byte.
Function: cache preload (PLD, PreLoad), use pld to instruct the storage system to read from the memory address specified by the following instructions. The storage system can use this method to speed up future memory access.
Format: pld[Rn,{offset}]
Where:
  • Rn The base address register of the memory.
  • Offset The offset added to Rn.
Reference address:Use of prefetch command pld in ARM

Previous article:Illustrated ARM Linux boot process
Next article:Detailed explanation of send and recv functions in the Linux kernel

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号