linux read_cpuid
#define read_cpuid(reg) ({ \u64 __val; \asm("mrs %0, " #reg : "=r" (__val)); \__val; \
})
主要读取一些只读寄存器,封装如下
#ifndef __ASSEMBLY__/** The CPU ID never changes at run time, so we might as well tell the* compiler that it's constant. Use this function to read the CPU ID* rather than directly reading processor_id or read_cpuid() directly.*/
static inline u32 __attribute_const__ read_cpuid_id(void)
{return read_cpuid(MIDR_EL1);
}static inline u64 __attribute_const__ read_cpuid_mpidr(void)-----------经常使用
{return read_cpuid(MPIDR_EL1);
}static inline unsigned int __attribute_const__ read_cpuid_implementor(void)
{return MIDR_IMPLEMENTOR(read_cpuid_id());
}static inline unsigned int __attribute_const__ read_cpuid_part_number(void)
{return MIDR_PARTNUM(read_cpuid_id());
}static inline u32 __attribute_const__ read_cpuid_cachetype(void)
{return read_cpuid(CTR_EL0);
}static inline bool id_aa64mmfr0_mixed_endian_el0(u64 mmfr0)
{return (ID_AA64MMFR0_BIGEND(mmfr0) == 0x1) ||(ID_AA64MMFR0_BIGENDEL0(mmfr0) == 0x1);
}
#endif /* __ASSEMBLY__ */
封装后的函数使用如下
void __init smp_setup_processor_id(void)
{u64 mpidr = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;cpu_logical_map(0) = mpidr;/** clear __my_cpu_offset on boot CPU to avoid hang caused by* using percpu variable early, for example, lockdep will* access percpu variable inside lock_release*/set_my_cpu_offset(0);pr_info("Booting Linux on physical CPU 0x%lx\n", (unsigned long)mpidr);
}
linux read_cpuid相关推荐
- Linux SMP启动流程学习(二)
Linux SMP启动流程学习(二) 3 SMP系统启动流程 3.1 SMP启动判断 源码:/arch/arm/kernel/setup.c 调用:start_kernel() -> smp_s ...
- linux kernel setup_arch
在 linux kernel booting 阶段, asmlinkage void __init start_kernel(void) 中很重要的一个步骤是 setup arch, setup_ar ...
- 从ARM VIVT看linux的cache 处理
转载地址:http://blog.chinaunix.net/uid-10701701-id-91726.html 从 ARM VIVT 看 cache 请访问google 文档. http://d ...
- 从ARM VIVT看linux的cache处理
do_wp_page 的VIVT 考虑 在下面的函数中(write protect detected), 为什么需要 flush_cache_page,和 update_mmu_cache? 原 因 ...
- linux内核 noreturn,读《ARM Linux 内核源代码剖析》.......第13章 setup_processor()
setup_processor首先是查找保存相应处理器信息的结构体,然后根据结构体里的值,对处理器相关的各种变量进行设置. setup_processor static void __init set ...
- 过滤Linux下不同大小的文件,linux查找当前目录下 M/G 大小的文件,删除Linux下指定大小的文件
过滤Linux下不同大小的文件,linux查找当前目录下 M/G 大小的文件,删除Linux下指定大小的文件 find ./ -type f -size +1G| xargs rm 在清理系统日志文件 ...
- linux环境下nacos的安装+启动,阿里云服务器安装nacos
nacos安装+启动(linux环境): 基础:安装java环境 官网下载压缩包:如 nacos-server-1.2.1.tar.gz 放在自定义目录下 # 解压 tar -xvf nacos-se ...
- Alibaba Cloud Linux 2.1903 LTS 64位服务器yum源下载404,Alibaba Cloud Linux 2实例中使用docker-ce、epel等YUM源安装软件失败
[Alibaba Cloud Linux 2.1903 LTS 64位]服务器yum源下载404 failure: repodata/repomd.xml from docker-ce-stable: ...
- Linux下创建硬链接,文件访问为空,提示:xxxx: 符号连接的层数过多
Linux下创建软链接|硬链接,文件访问为空,提示:x x x: 符号连接的层数过多. 原因:创建符号链接的时候未使用绝对路径,无论是源文件路径还是目标路径,都需要使用绝对路径. 如: ln -s / ...
最新文章
- java python算法_用Python,Java和C ++示例解释的排序算法
- PYTHON黑帽编程1.5 使用WIRESHARK练习网络协议分析
- 《1---关于解决MySQL在控制台插入中文乱码问题》
- PKI/CA (5)X.509公钥证书
- 机器学习(三):支持向量机SVM(含代码和注释)
- ByteBuffer的使用
- JAVA 简单综合题目 小型公司职工对象
- NSX产品许可介绍( 适用于vSphere 6.2.x,6.3.x和6.4.x的VMware NSX的产品产品(2145269))
- 7820X+RTX2080Ti(Ubuntu 18.04)新机配置记录
- JPDA 架构研究19 - JDI的连接模块
- 如何使用JLINK调试和固件下载
- 把Android源码导入Android Studio进行调试
- iOS 手势UIGestureRecognizer
- 三种算法求两个正整数的最大公约数和最小公倍数;求三个数的最大公约数和最小公倍数
- vue-cli · Failed to download repo vuejs-templates/webpack-simple: tunneling socket could not be esta
- android lcm,MTK Android Driver :lcm
- 佩珀代因大学计算机科学专业,【精选】佩珀代因大学计算机科学与数学本科专业.pdf...
- pyaudio安装失败的解决方法
- 期初余额、期后事项审计与审计报告案例
- CentOS 安装软件 下载rpm安装包
热门文章
- .xfp文件参数解析(持续更新)
- 史蒂夫·鲍尔默也用Firefox和Google
- Result Maps collection already contains value for com.hry.igoods.mapper.TbAreaMapper.BaseResultMap
- 智慧城管解决方案和建设内容
- vue three.js3d效果
- Python+Vue计算机毕业设计食品质量安全追溯平台yoh8h(源码+程序+LW+部署)
- 小米平板刷机shell怎么退_小米平板1刷lineageOS 16.0 教程
- 搞网络最强的其实不是互联网公司,而是印度的电工!
- 含有外部电路设置的电磁炮Maxwell瞬态仿真
- 软件测试面试桌子,软件测试面试题:如何测试电梯/伞/桌子/笔?