在ARMV8中,只有CTR_EL0,没有CTR_EL1/2/3

1、CTR_EL0寄存器介绍

(1)、DminLine/IminLine

Log2 of the number of words in the smallest cache line of all the data caches and unified caches that are controlled by the PE.x

cache line的大小,cache_line_size = 4 * (2x2^x2x), x=[19:16], [3:0]

获取d-cache cache-line的示例代码:

        .macro  dcache_line_size, reg, tmpmrs     \tmp, ctr_el0                   // read CTRubfm    \tmp, \tmp, #16, #19            // cache line size encodingmov     \reg, #4                        // bytes per wordlsl     \reg, \reg, \tmp                // actual cache line size.endm

其算法就是:
a. 读取ctr_el0比特16到19的数值 : tmp = ctr_el0[19:16]
b. 计算cache line大小 : reg = (4 << tmp) = 4 * (2^tmp)

(2)、TminLine

Tag minimum Line. Log2 of the number of words covered by Allocation Tags in the smallest cache
line of all caches which can contain Allocation tags that are controlled by the PE

cache line的大小,tag_size = 4 * (2x2^x2x), x=[37:32]

(3)、DIC

Instruction cache invalidation requirements for data to instruction coherence

0b0 Instruction cache invalidation to the Point of Unification is required for data to instruction coherence.
0b1 Instruction cache invalidation to the Point of Unification is not required for data to instruction coherence.

(4)、IDC

Data cache clean requirements for instruction to data coherence

0b0 Data cache clean to the Point of Unification is required for instruction to data coherence,
unless CLIDR_EL1.LoC == 0b000 or (CLIDR_EL1.LoUIS == 0b000 &&
CLIDR_EL1.LoUU == 0b000).
0b1 Data cache clean to the Point of Unification is not required for instruction to data
coherence.

(5)、CWG

Cache writeback granule. Log2 of the number of words of the maximum size of memory

(6)、ERG

Exclusives reservation granule. Log2 of the number of words of the maximum size of the reservation granule

(7)、L1Ip

Level 1 instruction cache policy

0b00 VMID aware Physical Index, Physical tag (VPIPT)
0b01 ASID-tagged Virtual Index, Virtual Tag (AIVIVT)
0b10 Virtual Index, Physical Tag (VIPT)
0b11 Physical Index, Physical Tag (PIPT)

2、代码示例

在Linux Kernel代码中,读取CTR_EL0的地方只有三处,分别是:

  • raw_icache_line_size
  • raw_dcache_line_size
  • read_ctr
(**arch/arm64/include/asm/assembler.h**)
/** raw_icache_line_size - get the minimum I-cache line size on this CPU* from the CTR register.*/.macro    raw_icache_line_size, reg, tmpmrs   \tmp, ctr_el0           // read CTRand  \tmp, \tmp, #0xf        // cache line size encodingmov  \reg, #4            // bytes per wordlsl    \reg, \reg, \tmp        // actual cache line size.endm/*/** raw_dcache_line_size - get the minimum D-cache line size on this CPU* from the CTR register.*/.macro    raw_dcache_line_size, reg, tmpmrs   \tmp, ctr_el0           // read CTRubfm \tmp, \tmp, #16, #19        // cache line size encodingmov  \reg, #4            // bytes per wordlsl    \reg, \reg, \tmp        // actual cache line size.endm.macro    read_ctr, reg
alternative_if_not ARM64_MISMATCHED_CACHE_LINE_SIZEmrs  \reg, ctr_el0           // read CTRnop
alternative_elseldr_l   \reg, arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL
alternative_endif.endm

而raw_icache_line_size和raw_dcache_line_size并没有人直接调用;
read_ctr被 dcache_line_size 和 icache_line_size调用

/** dcache_line_size - get the safe D-cache line size across all CPUs*/.macro    dcache_line_size, reg, tmpread_ctr  \tmpubfm        \tmp, \tmp, #16, #19    // cache line size encodingmov      \reg, #4        // bytes per wordlsl        \reg, \reg, \tmp    // actual cache line size.endm/** raw_icache_line_size - get the minimum I-cache line size on this CPU* from the CTR register.*/.macro  raw_icache_line_size, reg, tmpmrs   \tmp, ctr_el0           // read CTRand  \tmp, \tmp, #0xf        // cache line size encodingmov  \reg, #4            // bytes per wordlsl    \reg, \reg, \tmp        // actual cache line size.endm

[mmu/cache]-Cache Type Register(CTR)寄存器介绍-InProgress相关推荐

  1. ARM架构中MMU/TLB/Cache的一些概念和寄存器

    ★★★ 个人博客导读首页-点击此处 ★★★ 相关文章 1.ARMV8-aarch64的MMU学习笔记 2.aarch64的TCR寄存器介绍 文章目录 1.MMU/Cache相关的一些基本概念 (1). ...

  2. ARM协处理器CP15(设置MMU,cache等)学习

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 作者:w ...

  3. ARM处理器之MMU和Cache

    ARM处理器之MMU和Cache ARM920T的MMU和Cache都集成在CP15协处理器中,MMU和Cache的联系非常密切,以下是CP15协处理器的寄存器列表(摘自[S3C2410用户手册]), ...

  4. [国嵌笔记][036][关闭MMU和CACHE]

    关闭MMU和CACHE 1.Cache是一种容量小,但存取速度非常快的存储器,它保存最近用到的存储器中数据的拷贝.按功能分为ICache(指令Cache)和DCache(数据Cache) 2.虚拟地址 ...

  5. ARMv8-A寄存器介绍

    4.ARMv8寄存器 AArch64执行状态提供了31个64位通用寄存器,可以在所有异常级别中随时使用.每个寄存器的位宽都为64 bits,当使用全部64 bits时,称为X0-X30,当使用低32 ...

  6. aarch64的TCR寄存器介绍

    文章目录 一.TCR寄存器 (1).T1SZ.T0SZ (2).ORGN1.IRGN1.ORGN0.IRGN0 (3).SH1.SH0 (4).TG0/TG1 - Granule size (5).I ...

  7. PPC 调用约定 r0-r31寄存器介绍

    最近在做kernel从ARM到一款PPC处理器的移植,需要学下下PPC的通用寄存器,找到的文档整理如下: Register Classification Notes r0 local commonly ...

  8. PPC r0-r31寄存器介绍

    最近在做kernel从ARM到一款PPC处理器的移植,需要学下下PPC的通用寄存器,找到的文档整理如下: Register Classification Notes r0 local commonly ...

  9. ARM体系结构与编程(篇二):ARM体系架构与寄存器介绍

    文章目录 前言 一.ARM内核与架构 1.1 ARM芯片的组成 1.2 ARM指令集与架构 二.ARM处理器模式与寄存器 2.1 ARM处理器模式 2.2 ARM寄存器 前言 该文章是通过学习< ...

最新文章

  1. AI给老照片上色,真的准吗?技术圈和历史圈吵了1000帖
  2. csgo国服文件转国际服务器,csgo国际服怎么转国服 csgo国际服转到国服方法介绍...
  3. 深度学习85—[深度学习] 感知器
  4. python 节气计算_python 生成 1900-2100 的二十四节气文件
  5. oracle 安装oui 15038,SuSE Linux上的Oracle11g-x64-ent安装有许多检查错误
  6. 你能体会那种写 Python 时不用 import 的幸福吗?
  7. MAC地址进行验证的方法
  8. 华为交换机命令 端口速率_华为交换机限速配置命令2016
  9. python工资一般多少西安-干货|python人工智能工程师工资多少钱
  10. 手机蓝牙如何减少延时_JEET ONE真无线耳机测评-高颜值低延时的集合
  11. Java网络编程总结
  12. 计算激光雷达各点的仰角并分析其线数——根据lidar文档垂直角公式计算自己的激光雷达参数/以aloam为例子
  13. Typora下载及使用
  14. 只用最适合的!全面对比主流 .NET 报表控件
  15. 常用的电脑快捷键,常用快捷键大全,提高办公工作效率
  16. JAVA数据聚合服务_Spring Cloud 跨服务数据聚合小框架
  17. gb2312中的英文字母占几个字节?
  18. java-net-php-python-java作业批改系统的设计PPT计算机毕业设计程序
  19. 在Angular6中使用primeNG UI框架
  20. Android 仪表盘 图片 中心 旋转

热门文章

  1. 数据中心或许会成为未来5G最强大的技术支撑
  2. 数据中心设计的六个关键考虑因素
  3. 7000更换控制器电源步骤_恒温恒湿试验箱几大故障的检查步骤及解决方法说明...
  4. 成功解决RuntimeError: Selected KDE bandwidth is 0. Cannot estiamte density
  5. 成功解决NameError: name ‘norm‘ is not defined
  6. Paper:《Adam: A Method for Stochastic Optimization》的翻译与解读
  7. Interview:算法岗位面试—2019秋招校园招聘—算法工程师【机器学习、深度学习(偏图像)】秋招感悟:初期阶段的傲娇→中期阶段的紧张→后期阶段的蜕变
  8. ML之回归预测:利用13种机器学习算法对Boston(波士顿房价)数据集【13+1,506】进行回归预测(房价预测)来比较各模型性能
  9. NLP之TEA:基于SnowNLP实现自然语言处理之对输入文本进行情感分析(分词→词性标注→拼音简繁转换→情感分析→测试)
  10. 成功解决 SyntaxError: invalid token