Arm-Trusted-Firmware代码分析
ATF
BL1
bl1_entrypoint
bl1/bl1.ld.S
ENTRY(bl1_entrypoint)
el3_entrypoint_common
_exception_vectors设置el3异常向量, MVBAR
bl1_exceptions
SynchronousExceptionA64
smc_handler64
BL1_SMC_RUN_IMAGE
smc_handler
bl1_smc_handler
- bl1_fwu_smc_handler
bl1_setup
- bl1_early_platform_setup
- bl1_plat_arch_setup
pauth_init_enable_el3
if ENABLE_PAUTH
PACbl1_main
bl1_arch_setup
auth_mod_init
if TRUSTED_BOARD_BOOT
- crypto_mod_init
- img_parser_init
bl1_platform_setup
- arm_bl1_platform_setup
- soc_css_security_setup
bl1_plat_get_next_image_id
- NS_BL2U_IMAGE_ID
- BL2_IMAGE_ID
bl1_load_bl2
image_id == BL2_IMAGE_ID
bl1_plat_get_image_desc
bl1_plat_handle_pre_image_load
load_auth_image
load_auth_image_internal
load_auth_image_recursive
load_image
auth_mod_verify_img
- img_parser_check_integrity
- auth_hash
- auth_signature
- auth_nvctr
load_image_flush
- load_image
bl1_prepare_next_image
bl1_plat_get_image_desc
next_bl_ep->spsr
bl1_plat_set_ep_info
Allow platform to make change
cm_init_my_context
cm_get_context
cm_setup_context
- write_ctx_reg(state, CTX_SCR_EL3, scr_el3);
- write_ctx_reg(state, CTX_ELR_EL3, ep->pc);
- write_ctx_reg(state, CTX_SPSR_EL3, ep->spsr);
cm_prepare_el3_exit
- cm_el1_sysregs_context_restore
- cm_set_next_eret_context
desc->state = IMAGE_STATE_EXECUTED;
el3_exit
BL2
bl2_entrypoint(BL2_AT_EL3)
bl2/bl2_el3.ld.S
ENTRY(bl2_entrypoint)
bl2/aarch64/bl2_el3_entrypoint.S
el3_entrypoint_common
- bl2_el3_exceptions
bl2_el3_setup
- bl2_el3_early_platform_setup
- bl2_el3_plat_arch_setup
pauth_init_enable_el3
bl2_main
bl2_arch_setup
auth_mod_init
- crypto_mod_init
- img_parser_init
bl2_plat_preload_setup
Fix PIE
bl2_load_images
pauth_disable_el1
bl2_run_next_image
bl2_entrypoint(!BL2_AT_EL3)
bl2/bl2.ld.S
ENTRY(bl2_entrypoint)
bl2/aarch32/bl2_entrypoint.S
msr vbar_el1, x0 #early_exceptions
RW memory
BSS
inv_dcache_range
禁止数据cache
plat_set_my_stack
update_stack_protector_canary
bl2_setup
- bl2_early_platform_setup2
- bl2_plat_arch_setup
pauth_init_enable_el1
bl2_main
bl2_arch_setup
auth_mod_init
if TRUSTED_BOARD_BOOT
- crypto_mod_init
- img_parser_init
bl2_plat_preload_setup
Fix PIE
bl2_load_images
- plat_get_bl_image_load_info
- bl2_plat_handle_pre_image_load
- load_auth_image
- bl2_plat_handle_post_image_load
- plat_flush_next_bl_params
disable_mmu_icache_secure
pauth_disable_el1
smc(BL1_SMC_RUN_IMAGE, (unsigned long)next_bl_ep_info, 0, 0, 0, 0, 0, 0);
BL3
BL31
bl31/bl31.ld.S
ENTRY(bl31_entrypoint)
bl31_entrypoint
el3_entrypoint_common
runtime_exceptions
sync_exception_aarch64
handle_sync_exception
- smc_handler64
- smc_handler32
sync_exception_aarch32
- handle_sync_exception
bl31_setup
- bl31_early_platform_setup2
- bl31_plat_arch_setup
pauth_init_enable_el3
bl31_main
bl31_platform_setup
bl31_lib_init
runtime_svc_init
service = &RT_SVC_DESCS_START[index]
service->init()
rt_svc_descs_indices[start_idx] = index;
根据service的call type和start oen确定唯一的index,并将所有call type映射到同一个index
start_idx = (uint8_t)get_unique_oen(service->start_oen, service->call_type);
end_idx = (uint8_t)get_unique_oen(service->end_oen, service->call_type);
(*bl32_init)()
if (bl32_init != NULL)
bl31_prepare_next_image_entry
cm_init_my_context
cm_get_context
cm_setup_context
- write_ctx_reg(state, CTX_SCR_EL3, scr_el3);
- write_ctx_reg(state, CTX_ELR_EL3, ep->pc);
- write_ctx_reg(state, CTX_SPSR_EL3, ep->spsr);
cm_prepare_el3_exit
- cm_el1_sysregs_context_restore
- cm_set_next_eret_context
bl31_plat_runtime_setup
el3_exit
BL32
BL33
RT_SVC_DESCS_START
DECLARE_RT_SVC
static const rt_svc_desc_t _svc_desc ## _name
__section(“rt_svc_descs”) __used = {
.start_oen = (_start),
.end_oen = (_end),
.call_type = (_type),
.name = #_name,
.init = (_setup),
.handle = (_smch)
}
tspd
tspd_setup
bl31_register_bl32_init
bl32_init = &tspd_init
- tspd_synchronous_sp_entry
tspd_smc_handler
optee
opteed_setup
bl31_plat_get_next_image_ep_info
opteed_init_optee_ep_state
bl31_register_bl32_init
bl32_init = &opteed_init
- opteed_synchronous_sp_entry
opteed_smc_handler
…
Arm-Trusted-Firmware代码分析相关推荐
- ATF(Arm Trusted Firmware)/TF-A Chapter 02 BL1-ROMCode
第二章目录: Chapter 02.TF-A(Arm Trusted Firmware, ATF ) BL1-ROMCode(本文) Chapter 02.TF-A(Arm Trusted Firmw ...
- ATF(Arm Trusted Firmware)/TF-A Chapter 01. 介绍
1.TF-A 介绍 TF-A是一套通用的软件架构+特定于平台的实现代码. TF-A满足大多数SoC厂商的CPU设计:单核启动,多核启动,自定义reset vector,可裁剪的启动阶段,bootrom ...
- ARM GICv3 GIC代码分析
前言 在前一篇博文(ARM GICv3中断控制器)中, 介绍了GIC的一些基本概念,本文主要分析了linux kernel中GIC v3中断控制器的代码(drivers/irqchip/irq-gic ...
- ATF(Arm Trusted Firmware)/TF-A Chapter 04 Authentication Framework
4.1. 代码分析 首先,重新分析之前忽略掉的 TRUSTED_BOARD_BOOT =1 的情况,bl1_platform_setup->arm_bl1_platform_setup-> ...
- 【ARM】Uboot代码分析
一.摘要 这篇文章主要对BootLoader(UBoot)的源码进行了分析,并对UBoot的移植略作提及. BootLoader的总目标是正确调用内核的执行,由于大部分的BoorLoader都依赖于 ...
- [ATF] ARM Trusted firmware 构建选项
TF-A 构建系统支持以下构建选项.除非另有说明,这些选项应在构建命令行中指定,并且不会在任何组件生成文件中修改.请注意,构建系统不会跟踪构建选项的依赖性.因此,如果任何构建选项从先前的构建中发生更改 ...
- ARM裸机篇---启动代码分析
ARM裸机篇---启动代码分析 先搞清楚启动代码和Bootloader的区别,启动代码是指CPU复位后到进入C语言的main函数之前需要执行的那段汇编代码. 下面的代码先暂且这样吧,没啥注释的,时间关 ...
- ARM GICv3 ITS介绍及代码分析
前言: 在ARM gicv3中断控制器,有提到过ITS的作用,本篇就ITS进行更详细的介绍以及分析linux 内核中ITS代码的实现. 本文基于linux 4.19,介绍DT方式初始化的ITS代码. ...
- arm linux kernel 从入口到start_kernel 的代码分析
Linux系统启动过程分析(主要是加载内核前的动作) 经过对Linux系统有了一定了解和熟悉后,想对其更深层次的东西做进一步探究.这当中就包括系统的启动流程.文件系统的组成结构.基于动态库和静态库的程 ...
- ARM generic timer驱动代码分析
转自 蜗窝科技 http://www.wowotech.net/linux_kenrel/arm-generic-timer.html 一.前言 关注ARM平台上timer driver(clo ...
最新文章
- Endnote技巧:解决中英参考文献混排问题,附国标文件
- 1045 快速排序 (25 分)
- iOS开发笔记[16/50]:Views
- zxing二维码的生成与解码(C#)
- 组件是全局怎么修改样式_用一个落地项目,帮你掌握Sketch组件的制作思路
- int long long 的范围
- [译] Bulma: 2018年你应该关注的CSS框架
- img atl和a title
- unittest 测试
- 主流强化学习算法论文综述:DQN、DDPG、TRPO、A3C、PPO、SAC、TD3
- 采集屏幕编码H264
- word2007如何删除尾注分隔符
- ewebeditor漏洞大全
- 字体反爬案例解析:大众点评
- 2022.11.22 英语背诵
- python 制作 gif 动态图
- 坐标转换源代码,C++/C, 极为精确地大地坐标系转地心坐标系,地心坐标系转站心坐标系
- 简单电脑版微信双开方法多开bat分身代码教程
- Linux开发学习笔记(二)
- 学生可以租的便宜云GPU-滴滴云