linux aarch64 head.S set_cpu_boot_mode_flag
2022/3/7 7:20:00
本文主要是介绍linux aarch64 head.S set_cpu_boot_mode_flag,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
set_cpu_boot_mode_flag
使用 el2_setup 的返回值,填充 __boot_cpu_mode 这个全局数组 ,
1、__boot_cpu_mode 也在 head.S 里面定义的。初始值如下:
/* * We need to find out the CPU boot mode long after boot, so we need to * store it in a writable variable. * * This is not in .bss, because we set it sufficiently early that the boot-time * zeroing of .bss would clobber it. */ SYM_DATA_START(__boot_cpu_mode) .long BOOT_CPU_MODE_EL2 .long BOOT_CPU_MODE_EL1 SYM_DATA_END(__boot_cpu_mode)
2、set_cpu_boot_mode_flag 代码
/* * Sets the __boot_cpu_mode flag depending on the CPU boot mode passed * in w0. See arch/arm64/include/asm/virt.h for more info. */ SYM_FUNC_START_LOCAL(set_cpu_boot_mode_flag) adr_l x1, __boot_cpu_mode cmp w0, #BOOT_CPU_MODE_EL2 b.ne 1f add x1, x1, #4 1: str w0, [x1] // This CPU has booted in EL1 dmb sy dc ivac, x1 // Invalidate potentially stale cache line ret SYM_FUNC_END(set_cpu_boot_mode_flag)
3、set_cpu_boot_mode_flag 代码逻辑
1 running_mode = el2_setup(); 2 3 set_cpu_boot_mode_flag(running_mode){ 4 5 if(running_mode == #BOOT_CPU_MODE_EL2){ 6 __boot_cpu_mode.field2 = #BOOT_CPU_MODE_EL2 7 }else{ 8 __boot_cpu_mode.field1 = #BOOT_CPU_MODE_EL1 9 } 10 }
如果running_mode 为EL2, 则 __boot_cpu_mode 的两个field 都为 #BOOT_CPU_MODE_EL2
如果 running_mode 为EL1, 则 __boot_cpu_mode 的两个field 都为 #BOOT_CPU_MODE_EL1
这篇关于linux aarch64 head.S set_cpu_boot_mode_flag的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南
- 2024-08-21【Linux】分区向左扩容的方法
- 2024-08-21【Linux】gnome桌面环境切换KDE Plasma
- 2024-08-19如何安装 VMware Tools (macOS, Linux, Windows)
- 2024-08-15Linux部署Scrapy教程:入门级指南
- 2024-07-29linux命令行下好用的性能监控工具atop
- 2024-07-04Linux系统上离线升级SSH服务的具体操作步骤-icode9专业技术文章分享
- 2024-06-0600-macOS和Linux安装和管理多个Python版本
- 2024-03-30[译]漫画SELinux概念