CACHE & TLB (三)

本文档详细介绍了ARM926EJ-S处理器中CACHE和TLB的相关定义及操作。主要关注代码实现,如flush_XXX函数,以及在体系结构指针传递中如何初始化CPU的CACHE和TLB。示例代码展示了如cache_flush和tlb_invalidate等关键操作的汇编实现,用于理解内核对缓存和TLB管理的细节。
摘要由CSDN通过智能技术生成

source code

ARM926EJS为例分析,

主要的代码位于arch/arm/mm/cache-arm926.sarch/arm/mm/proc-arm926.s

1. cache和tlb的定义

 

#ifdef MULTI_CACHE

 

ENTRY(\name\()_cache_fns)

            .long    \name\()_flush_icache_all

            .long    \name\()_flush_kern_cache_all

            .long    \name\()_flush_user_cache_all

            .long    \name\()_flush_user_cache_range

            .long    \name\()_coherent_kern_range

            .long    \name\()_coherent_user_range

            .long    \name\()_flush_kern_dcache_area

            .long    \name\()_dma_map_area

            .long    \name\()_dma_unmap_area

            .long    \name\()_dma_inv_range

            .long    \name\()_dma_clean_range

            .long    \name\()_dma_flush_range

            .size     \name\()_cache_fns, . - \name\()_cache_fns

.endm

 

 

/*

 * thecache line size of the I and D cache

 */

#define CACHE_DLINESIZE          32

 

/*

 *         MM Cache Management

 *         ===================

 *

 *         The arch/arm/mm/cache-*.S andarch/arm/mm/proc-*.S files

 *         implement these methods.

 *

 *         Start addresses are inclusive and endaddresses are exclusive;

 *         start addresses should be rounded down,end addresses up.

 *

 *         See Documentation/cachetlb.txt for moreinformation.

 *         Please note that the implementation ofthese, and the required

 *         effects are cache-type (VIVT/VIPT/PIPT)specific.

 *

 *         flush_icache_all()

 *

 *                     Unconditionally clean andinvalidate the entire icache.

 *                     Currently only needed forcache-v6.S and cache-v7.S, see

 *                     __flush_icache_all for thegeneric implementation.

 *

 *         flush_kern_all()

 *

 *                     Unconditionally clean andinvalidate the entire cache.

 *

 *         flush_user_all()

 *

 *                     Clean and invalidate all userspace cache entries

 *                     before a change of pagetables.

 *

 *         flush_user_range(start, end, flags)

 *

 *                     Clean and invalidate arange of cache entries in the

 *                     specified address spacebefore a change of page tables.

 *                     - start - user startaddress (inclusive, page aligned)

 *                     - end   - user end address   (exclusive, page aligned)

 *                     - flags - vma->vm_flagsfield

 *

 *         coherent_kern_range(start, end)

 *

 *                     Ensure coherency betweenthe Icache and the Dcache in the

 *                     region described by start, end.  If you have non-snooping

 *                     Harvard caches, you need toimplement this function.

 *                     - start  - virtual start address

 *                     - end    - virtual end address

 *

 *         coherent_user_range(start, end)

 *

 *                     Ensure coherency betweenthe Icache and the Dcache in the

 *                     region described by start,end.  If you have non-snooping

 *                     Harvard caches, you need toimplement this function.

 *                     - start  - virtual start address

 *                     - end    - virtual end address

 *

 *         flush_kern_dcache_area(kaddr, size)

 *

 *                     Ensure that the data heldin page is written back.

 *                     - kaddr  - page address

 *                     - size   - region size

 *

 *         DMA Cache Coherency

 *         ===================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值