optee系统服务/service的实现方式
生活随笔
收集整理的這篇文章主要介紹了
optee系统服务/service的实现方式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
快速鏈接:
.
👉👉👉 個人博客筆記導讀目錄(全部) 👈👈👈
文章目錄
- 1、四種service的使用
- 2、四種service的宏實現
- 3、在optee啟動是調用這四種service
1、四種service的使用
在optee中定義了如下四種service
- service_init
- service_init_late
- driver_init
- driver_init_late
2、四種service的宏實現
在initcall.h中實現了這4個service的宏
它們執行順序為: service_init --> service_init_late --> driver_init --> driver_init_late
#define service_init(fn) __define_initcall(1, fn) #define service_init_late(fn) __define_initcall(2, fn) #define driver_init(fn) __define_initcall(3, fn) #define driver_init_late(fn) __define_initcall(4, fn)__define_initcall的具體實現,起始就是在section段中定義的結構體.
#define __define_initcall(level, fn) \SCATTERED_ARRAY_DEFINE_PG_ITEM_ORDERED(initcall, level, initcall_t) = \(fn)#define SCATTERED_ARRAY_DEFINE_PG_ITEM_ORDERED(array_name, order, \element_type) \__SCT_ARRAY_DEF_PG_ITEM1(array_name, order, __COUNTER__, element_type)#define __SCT_ARRAY_DEF_PG_ITEM1(array_name, order, id, element_type) \__SCT_ARRAY_DEF_PG_ITEM2(array_name, order, id, element_type)#define __SCT_ARRAY_DEF_PG_ITEM2(array_name, order, id, element_type) \__SCT_ARRAY_DEF_PG_ITEM3(element_type, \__scattered_array_ ## id ## array_name, \".scattered_array_" #array_name "_1_" #order)#define __SCT_ARRAY_DEF_PG_ITEM3(element_type, element_name, section_name) \static const element_type element_name __used \__section(section_name __SECTION_FLAGS_RODATA)#define __SECTION_FLAGS_RODATA3、在optee啟動是調用這四種service
在call_initcalls()中,遍歷section段中的數組,依次執行這些service函數(.call函數).
_start --> generic_boot_init_primary()–>init_primary_helper()–>init_tee_runtime()–>init_teecore()–>call_initcalls()
(core/arch/arm/tee/init.c) static void call_initcalls(void) {const initcall_t *call;for (call = initcall_begin; call < initcall_end; call++) {TEE_Result ret;ret = (*call)();if (ret != TEE_SUCCESS) {EMSG("Initial call 0x%08" PRIxVA " failed",(vaddr_t)call);}} }#define initcall_begin SCATTERED_ARRAY_BEGIN(initcall, initcall_t) #define initcall_end SCATTERED_ARRAY_END(initcall, initcall_t)總結
以上是生活随笔為你收集整理的optee系统服务/service的实现方式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: optee的启动过程
- 下一篇: 汽车开放系统架构(AUTOSAR)简介