Trusted Firmware-A · source analysis

SMC runtime service 등록과 dispatch

OEN 범위와 fast/yielding call type으로 runtime service descriptor를 찾고 handler에 x1-x4와 handle을 전달하는 코드를 읽습니다.

표의 버전은 소스 분석 기준이며 최신 보안 버전 권고가 아닙니다. TF-A LTS 2.14.3 이후에는 보안 수정이 있습니다. 제품 적용 시 공식 변경 기록과 사용 플랫폼의 errata를 확인하세요.

Series
08 / 12
Baseline
LTS 2.14.3
Commit
f5e765a3443f
Source
common/runtime_svc.c:8-96 (발췌 범위)

서비스 등록과 SMC dispatch는 언제 갈라지는가?

TF-A LTS 2.14.3의 runtime_svc_init()는 공통 cold 초기화에서 linker descriptor를 검사하고 OEN+call type별 index를 채운다. 이 글에 발췌한 C 함수 handle_runtime_svc()는 원문 주석이 AArch32 모드용으로 명시한 경로다. AArch64 BL31은 이 C 함수를 호출하지 않고 어셈블리에서 index를 조회해 handler로 분기한다. 펌웨어 실행 모드와 호출자의 SMC32/SMC64 convention도 서로 다른 구분이다.

invalid descriptor는 panic(), 개별 init 실패는 그 descriptor의 index 기록을 건너뛰는 continue다. 조회 index가 유효하지 않으면 SMC_UNK, 유효하면 handler를 호출한다. 겹친 OEN 범위를 자동 거절하는 검사는 이 고정 코드에 없다.

C dispatch와 AArch64 BL31의 실제 진입 경로

아래 그림의 handle_runtime_svc()와 index >= RT_SVC_DECS_NUM 조건은 C 구현에 한정한다. AArch64 BL31의 runtime_exceptions.S는 같은 등록 index 배열을 사용하지만 별도 명령열을 실행한다. AArch64 펌웨어에 들어온 AArch32 호출자도 곧바로 이 C 함수로 간다고 해석하지 않는다.

구간C 구현AArch64 BL31
index 검사descriptor 수 이상이면 SMC_UNKindex의 bit 7이 1이면 smc_unknown으로 분기
handler 포인터유효 index의 .handle을 직접 호출DEBUG일 때 NULL 포인터를 critical error로 분기한 뒤 BLR
FID 처리type+OEN으로 slot 선택fast-call reserved bits 검사, SVE hint를 flags에 복사하고 FID에서 제거한 뒤 type+OEN 선택
AArch32 호출자펌웨어의 AArch32 모드 경로와 구분smc_handler32에서 SMC64 convention을 거부한 뒤 공통 어셈블리 경로로 합류

근거: C dispatch · AArch64 BL31 진입과 조회. 본문의 init 실패·중복 OEN 설명은 공통 등록 루프의 조건이고, 런타임 검사 방식은 위 두 경로를 구분한다.

같은 배열을 사이에 둔 서로 다른 시점

그림 1. cold 등록이 만든 index를 나중의 SMC가 읽는다 (조회 부분은 C 구현 기준)
공통 cold 초기화
초기화
.rt_svc_descsbuild/linker의 정적 descriptor
validate형식 오류는 panic
optional init실패하면 그 descriptor의 기록 생략
rt_svc_descs_indices[128]성공 범위의 index 기록
이후의
SMC
smc_fidbit31 type + bits29:24 OEN
index keyOEN과 type 결합
index 조회invalid → SMC_UNK
descriptor handler유효하면 x1–x4 등 전달

위 레인의 오른쪽 배열이 아래 레인의 조회 대상이다. SMC function ID는 매 호출 입력이지 rt_svc_desc_t와 함께 생성되는 객체가 아니다.

cold 등록: 형식 오류, init 실패, index 기록의 세 갈래

그림 2. runtime_svc_init()의 반복문
  1. 1
    descriptor 수 확인개수가 0이면 바로 반환한다. 그 외에는 index 배열 전체를 0xff invalid 값으로 초기화한다.
  2. 2
    linker 순서대로 한 descriptor씩 검사start_oen ≤ end_oen, OEN 상한, fast/yield type, init/handle 중 적어도 하나가 있는지를 검사한다.
  3. 3
    결과가 갈린다
    invalid오류 로그 뒤 panic()
    init 반환 비0오류 로그 뒤 continue; 이 descriptor의 기록 생략
    통과/성공OEN+type 범위 slot에 현재 index 기록
  4. 4
    반복 종료중복 slot을 별도로 검사하지 않는다. 같은 type·OEN slot이 겹치면 나중에 순회한 성공 descriptor가 앞선 값을 덮을 수 있다.

언제 무엇을 만들고 읽는가

좁은 화면에서는 표를 가로로 밀어 오른쪽 열까지 읽는다.

시점함수/자료입력상태 변화 또는 결과한계
build/linkDECLARE_RT_SVCservice 선언.rt_svc_descs에 정적 descriptor 배치등록 순서는 실제 linker 산출물로 확인
공통 cold 초기화runtime_svc_init()descriptor 배열형식 검사·optional init·index 기록init 실패는 자신의 기록만 skip
SMC 호출get_unique_oen_from_smc_fid()smc_fidbit31 type + bits29:24 OEN으로 slot 결정bit30과 function number는 slot을 고르지 않음
SMC 호출handle_runtime_svc()slot의 descriptor indexindex ≥ descriptor 수면 SMC_UNK별도의 overlap 거절 검사 없음
SMC 호출service handlersmc_fid, x1–x4, cookie, handle, flagsservice별 function/인자 처리common dispatch는 서비스별 검증을 대신하지 않음

조회 분기와 SMC function ID의 역할

그림 3. 조회한 index에서 unknown과 handler가 갈린다 (조회 부분은 C 구현 기준)
smc_fid → unique OENtype+OEN slot → rt_svc_descs_indices[idx]
index ≥ RT_SVC_DECS_NUMSMC_RET1(handle, SMC_UNK)
유효한 descriptor indexcontext에서 x1–x4를 읽어 rt_svc_descs[index].handle(smc_fid, x1…x4, cookie, handle, flags) 호출

공통 함수는 bit30 convention과 function number로 descriptor를 추가 선택하지 않는다. handler가 필요한 service별 검증을 수행한다. dispatch 원문

그림 4. 32-bit SMC function ID의 네 필드와 index key (조회 부분은 C 구현 기준)
bit 31fast/yielding type
bit 30SMC32/SMC64 convention
bits 29:24OEN
나머지 function ID 비트function number 등, handler가 해석
공통 index key = bit31 call type + bits29:24 OEN

같은 OEN·type이면 다른 function number도 같은 descriptor index에 도달한다. bit30과 나머지 필드를 어떻게 다룰지는 service handler의 계약이다. runtime_svc.h:96–113

원본 코드

아래 코드는 Trusted Firmware-A LTS 2.14.3의 common/runtime_svc.c에서 8-96줄을 그대로 가져온 것이다.

commitf5e765a3443fe21154aa908228e75ee2600085f6anchor · L32uintptr_t handle_runtime_svc(uint32_t smc_fid
8#include <errno.h>
9#include <string.h>
10
11#include <common/debug.h>
12#include <common/runtime_svc.h>
13
14/*******************************************************************************
15 * The 'rt_svc_descs' array holds the runtime service descriptors exported by
16 * services by placing them in the 'rt_svc_descs' linker section.
17 * The 'rt_svc_descs_indices' array holds the index of a descriptor in the
18 * 'rt_svc_descs' array. When an SMC arrives, the OEN[29:24] bits and the call
19 * type[31] bit in the function id are combined to get an index into the
20 * 'rt_svc_descs_indices' array. This gives the index of the descriptor in the
21 * 'rt_svc_descs' array which contains the SMC handler.
22 ******************************************************************************/
23uint8_t rt_svc_descs_indices[MAX_RT_SVCS];
24
25#define RT_SVC_DECS_NUM		((RT_SVC_DESCS_END - RT_SVC_DESCS_START)\
26					/ sizeof(rt_svc_desc_t))
27
28/*******************************************************************************
29 * Function to invoke the registered `handle` corresponding to the smc_fid in
30 * AArch32 mode.
31 ******************************************************************************/
32uintptr_t handle_runtime_svc(uint32_t smc_fid,
33			     void *cookie,
34			     void *handle,
35			     unsigned int flags)
36{
37	u_register_t x1, x2, x3, x4;
38	unsigned int index;
39	unsigned int idx;
40	const rt_svc_desc_t *rt_svc_descs;
41
42	assert(handle != NULL);
43	idx = get_unique_oen_from_smc_fid(smc_fid);
44	assert(idx < MAX_RT_SVCS);
45
46	index = rt_svc_descs_indices[idx];
47	if (index >= RT_SVC_DECS_NUM)
48		SMC_RET1(handle, SMC_UNK);
49
50	rt_svc_descs = (rt_svc_desc_t *) RT_SVC_DESCS_START;
51
52	get_smc_params_from_ctx(handle, x1, x2, x3, x4);
53
54	return rt_svc_descs[index].handle(smc_fid, x1, x2, x3, x4, cookie,
55						handle, flags);
56}
57
58/*******************************************************************************
59 * Simple routine to sanity check a runtime service descriptor before using it
60 ******************************************************************************/
61static int32_t validate_rt_svc_desc(const rt_svc_desc_t *desc)
62{
63	if (desc == NULL) {
64		return -EINVAL;
65	}
66	if (desc->start_oen > desc->end_oen) {
67		return -EINVAL;
68	}
69	if (desc->end_oen >= OEN_LIMIT) {
70		return -EINVAL;
71	}
72	if ((desc->call_type != SMC_TYPE_FAST) &&
73	    (desc->call_type != SMC_TYPE_YIELD)) {
74		return -EINVAL;
75	}
76	/* A runtime service having no init or handle function doesn't make sense */
77	if ((desc->init == NULL) && (desc->handle == NULL)) {
78		return -EINVAL;
79	}
80	return 0;
81}
82
83/*******************************************************************************
84 * This function calls the initialisation routine in the descriptor exported by
85 * a runtime service. Once a descriptor has been validated, its start & end
86 * owning entity numbers and the call type are combined to form a unique oen.
87 * The unique oen is used as an index into the 'rt_svc_descs_indices' array.
88 * The index of the runtime service descriptor is stored at this index.
89 ******************************************************************************/
90void __init runtime_svc_init(void)
91{
92	int rc = 0;
93	uint8_t index, start_idx, end_idx;
94	rt_svc_desc_t *rt_svc_descs;
95
96	/* Assert the number of descriptors detected are less than maximum indices */

세 발췌를 시간 순서대로 연결하기

첫 발췌 common/runtime_svc.c:8–96에는 index 배열 선언, handle_runtime_svc(), descriptor 검사가 보인다. 둘째 common/runtime_svc.c:80–155에는 cold 등록 루프가 보이며 두 발췌는 80–96행에서 겹친다. 셋째 runtime_svc.h:51–113은 descriptor 선언과 OEN/type 결합 helper의 계약이다.

소스 파일에서 dispatch 함수가 init 함수보다 앞에 놓여 있어도 실행 시점은 반대다. 공통 runtime_svc_init()가 cold setup에서 먼저 index를 채운다. 이후 AArch32 펌웨어는 handle_runtime_svc()에서, AArch64 BL31은 어셈블리 SMC 경로에서 그 값을 읽는다. BL31 cold entry와 이어 읽기.

함께 읽어야 하는 원본 코드

첫 코드 조각만으로 동작이 완성되지 않는 경우 호출 매크로, 객체 정의와 실제 실행 목록을 같은 페이지에 묶었다. 각 조각은 같은 기준 commit에서 가져왔다.

01. runtime service descriptor table 구성

common/runtime_svc.c 80-155줄이다.

filecommon/runtime_svc.canchor · L90void __init runtime_svc_init(void)
80	return 0;
81}
82
83/*******************************************************************************
84 * This function calls the initialisation routine in the descriptor exported by
85 * a runtime service. Once a descriptor has been validated, its start & end
86 * owning entity numbers and the call type are combined to form a unique oen.
87 * The unique oen is used as an index into the 'rt_svc_descs_indices' array.
88 * The index of the runtime service descriptor is stored at this index.
89 ******************************************************************************/
90void __init runtime_svc_init(void)
91{
92	int rc = 0;
93	uint8_t index, start_idx, end_idx;
94	rt_svc_desc_t *rt_svc_descs;
95
96	/* Assert the number of descriptors detected are less than maximum indices */
97	assert((RT_SVC_DESCS_END >= RT_SVC_DESCS_START) &&
98			(RT_SVC_DECS_NUM < MAX_RT_SVCS));
99
100	/* If no runtime services are implemented then simply bail out */
101	if (RT_SVC_DECS_NUM == 0U) {
102		return;
103	}
104	/* Initialise internal variables to invalid state */
105	(void)memset(rt_svc_descs_indices, -1, sizeof(rt_svc_descs_indices));
106
107	rt_svc_descs = (rt_svc_desc_t *) RT_SVC_DESCS_START;
108	for (index = 0U; index < RT_SVC_DECS_NUM; index++) {
109		rt_svc_desc_t *service = &rt_svc_descs[index];
110
111		/*
112		 * An invalid descriptor is an error condition since it is
113		 * difficult to predict the system behaviour in the absence
114		 * of this service.
115		 */
116		rc = validate_rt_svc_desc(service);
117		if (rc != 0) {
118			ERROR("Invalid runtime service descriptor %p\n",
119				(void *) service);
120			panic();
121		}
122
123		/*
124		 * The runtime service may have separate rt_svc_desc_t
125		 * for its fast smc and yielding smc. Since the service itself
126		 * need to be initialized only once, only one of them will have
127		 * an initialisation routine defined. Call the initialisation
128		 * routine for this runtime service, if it is defined.
129		 */
130		if (service->init != NULL) {
131			rc = service->init();
132			if (rc != 0) {
133				ERROR("Error initializing runtime service %s\n",
134						service->name);
135				continue;
136			}
137		}
138
139		/*
140		 * Fill the indices corresponding to the start and end
141		 * owning entity numbers with the index of the
142		 * descriptor which will handle the SMCs for this owning
143		 * entity range.
144		 */
145		start_idx = (uint8_t)get_unique_oen(service->start_oen,
146						    service->call_type);
147		end_idx = (uint8_t)get_unique_oen(service->end_oen,
148						  service->call_type);
149		assert(start_idx <= end_idx);
150		assert(end_idx < MAX_RT_SVCS);
151		for (; start_idx <= end_idx; start_idx++) {
152			rt_svc_descs_indices[start_idx] = index;
153		}
154	}
155}

02. OEN 범위와 handler를 보존하는 runtime service descriptor

include/common/runtime_svc.h 51-113줄이다.

fileinclude/common/runtime_svc.hanchor · L61typedef struct rt_svc_desc {
51 * for future use
52 */
53typedef uintptr_t (*rt_svc_handle_t)(uint32_t smc_fid,
54				  u_register_t x1,
55				  u_register_t x2,
56				  u_register_t x3,
57				  u_register_t x4,
58				  void *cookie,
59				  void *handle,
60				  u_register_t flags);
61typedef struct rt_svc_desc {
62	uint8_t start_oen;
63	uint8_t end_oen;
64	uint8_t call_type;
65	const char *name;
66	rt_svc_init_t init;
67	rt_svc_handle_t handle;
68} rt_svc_desc_t;
69
70/*
71 * Convenience macros to declare a service descriptor
72 */
73#define DECLARE_RT_SVC(_name, _start, _end, _type, _setup, _smch)	\
74	static const rt_svc_desc_t __svc_desc_ ## _name			\
75		__section(".rt_svc_descs") __used = {			\
76			.start_oen = (_start),				\
77			.end_oen = (_end),				\
78			.call_type = (_type),				\
79			.name = #_name,					\
80			.init = (_setup),				\
81			.handle = (_smch)				\
82		}
83
84/*
85 * Compile time assertions related to the 'rt_svc_desc' structure to:
86 * 1. ensure that the assembler and the compiler view of the size
87 *    of the structure are the same.
88 * 2. ensure that the assembler and the compiler see the initialisation
89 *    routine at the same offset.
90 * 3. ensure that the assembler and the compiler see the handler
91 *    routine at the same offset.
92 */
93CASSERT((sizeof(rt_svc_desc_t) == SIZEOF_RT_SVC_DESC),
94	assert_sizeof_rt_svc_desc_mismatch);
95CASSERT(RT_SVC_DESC_INIT == __builtin_offsetof(rt_svc_desc_t, init),
96	assert_rt_svc_desc_init_offset_mismatch);
97CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle),
98	assert_rt_svc_desc_handle_offset_mismatch);
99
100
101/*
102 * This function combines the call type and the owning entity number
103 * corresponding to a runtime service to generate a unique owning entity number.
104 * This unique oen is used to access an entry in the 'rt_svc_descs_indices'
105 * array. The entry contains the index of the service descriptor in the
106 * 'rt_svc_descs' array.
107 */
108static inline uint32_t get_unique_oen(uint32_t oen, uint32_t call_type)
109{
110	return ((call_type & FUNCID_TYPE_MASK) << FUNCID_OEN_WIDTH) |
111		(oen & FUNCID_OEN_MASK);
112}
113

공통 프레임워크가 보장하는 것과 넘기는 것

01

descriptor는 정적 선언이다

DECLARE_RT_SVC가 rt_svc_desc_t를 .rt_svc_descs section에 둔다. smc_fid는 나중 호출의 레지스터 입력이며 descriptor와 함께 할당되거나 list에 삽입되는 객체가 아니다. runtime_svc.h:53–86

02

유효성 검사는 중복 검사와 다르다

validate_rt_svc_desc()는 OEN 순서·상한, call type, init/handle 양쪽 NULL 여부를 검사한다. 같은 type·OEN 범위가 이미 쓰였는지는 확인하지 않는다. 형식 오류는 init 루프에서 panic()으로 이어진다. runtime_svc.c:62–88

03

init 실패는 국소적으로 skip된다

descriptor의 init가 있으면 호출한다. 반환이 0이 아니면 오류를 기록하고 continue하므로 그 descriptor의 range는 이번 순회에서 기록하지 않는다. slot이 반드시 비어 있게 된다는 뜻은 아니다. 앞서 쓴 값이 남거나 뒤 descriptor가 다시 쓸 수 있다.

04

조회에는 type과 OEN만 쓴다

get_unique_oen_from_smc_fid()의 결과로 128개 slot 중 하나를 고른다. bit30 convention과 function number는 이 slot을 고르는 입력이 아니다. 해당 필드와 x1–x4, flags, handle의 사용·권한 검사는 service handler 구현을 따로 보아야 한다.

05

unknown은 범위를 벗어난 descriptor index다

slot 값이 RT_SVC_DECS_NUM 이상이면 SMC_UNK를 반환한다. 그렇지 않으면 context에서 x1–x4를 가져와 선택한 handler에 넘긴다. 이 함수는 그 자리에서 descriptor의 OEN 범위를 재검사하거나 handler pointer를 검증하지 않는다. dispatch 원문

겹침, 32/64-bit convention, handler 책임

01

겹친 OEN/type slot은 나중 기록이 이긴다

등록 루프는 각 descriptor가 통과하면 시작·끝 unique OEN 사이에 현재 index를 대입한다. 기존 값과 비교하지 않으므로 동일 type의 범위가 겹치면 나중에 순회한 descriptor가 겹친 slot을 덮는다. 빌드에서 어떤 선언이 나중인지까지 포함해 linker 산출물을 조사해야 한다. 다른 call type이면 unique OEN slot 자체가 분리된다.

02

공통 validation은 handler 존재까지 강제하지 않는다

형식 검사는 init와 handle이 둘 다 NULL인 경우만 거절한다. 따라서 init만 있는 descriptor가 통과할 수 있다. 그러나 handle_runtime_svc()는 유효 index에 도달하면 .handle을 곧바로 호출한다. 실제 service 선언과 접근 가능한 OEN을 함께 확인해야 한다.

03

SMC32/64와 function number는 service가 다룬다

공통 index는 type+OEN이 같으면 같은 slot을 가리킨다. service는 받은 smc_fid, x1–x4, handle/flags를 해석해 허용된 함수·호출자·인자 범위를 판정한다. 공통 dispatch의 선택만으로 32-bit pointer 처리나 caller 보안 정책이 검증됐다고 볼 수 없다.

index 충돌을 코드와 빌드에서 판정하기

그림 5. 같은 type·OEN slot을 두 descriptor가 쓰는 가상 예
A 먼저 순회FAST · OEN 4–6 → FAST/4, FAST/5, FAST/6 slot에 A 기록
B 나중 순회FAST · OEN 6–7 → FAST/6, FAST/7 slot에 B 기록
최종 FAST/6 = B중복 거절이 없으므로 같은 slot은 나중 대입으로 덮인다. 실제 선언·순서는 빌드별로 확인.

표기는 call type/OEN 조합이지 배열의 숫자 첨자가 아니다. 이 예는 동작 설명을 위한 가상 범위이며 실제 LTS service 선언 목록을 뜻하지 않는다. B의 init가 실패해 continue하면 B는 기록하지 않아 앞선 A가 남을 수 있다. index 쓰기 루프

관찰한 조건common 코드의 처리slot의 가능한 상태검증 지점
descriptor 형식 invalidERROR → panic()이후 정상 등록 완료를 가정할 수 없음validate_rt_svc_desc
init 반환 비0ERROR → continue이 descriptor는 미기록; 기존/이후 기록 가능runtime_svc_init loop
겹친 OEN + 같은 type기존 slot 비교 없이 대입뒤에 순회한 성공 descriptor로 overwrite 가능linker 순서 + index loop
겹친 OEN + 다른 typetype bit가 slot 구획을 분리서로 다른 slotget_unique_oen
조회 index ≥ descriptor 수SMC_UNKhandler 호출 없음handle_runtime_svc

서로 다른 객체와 수명

객체제공/생성 시점읽거나 쓰는 곳수명·주의점
rt_svc_desc_t 배열build/link, .rt_svc_descscold 등록과 dispatch정적 descriptor; list cleanup 대상 아님
rt_svc_descs_indices[128]BL31 image 전역 배열cold init가 쓰고 SMC dispatch가 읽음코드상 writable 배열; 성공 등록된 slot만 descriptor index
smc_fid매 SMC 호출자index key와 handler 인자descriptor와 별도인 32-bit function ID 값
x1–x4SMC context선택된 service handler호출별 인자; service가 해석·검증
handle·flagsEL3 exception pathSMC_RET1/handler호출 context와 메타데이터; cookie는 interface상 future use 예약

같은 SMC 실패라도 경계가 다르다

증상이 파일에서 확인되는 경계다음 확인
공통 cold 초기화에서 panicdescriptor 형식 invalidOEN 순서·상한, type, init/handle NULL
service init 오류 뒤 진행그 descriptor의 index 쓰기 skip이전/나중 descriptor의 겹친 slot 기록 여부
SMC_UNK조회 index가 descriptor 수 이상FID의 bit31/OEN, 빌드 포함 여부, init 결과
예상과 다른 handler같은 type·OEN slot overwrite 가능실제 linker descriptor 순서와 slot 최종값
handler 내부 거절/오류공통 index는 유효했음bit30, function number, x1–x4, caller 정책 등 service별 코드

아래 C 함수 symbol 조회는 해당 함수를 포함하는 빌드에만 적용한다. AArch64 BL31에서는 runtime_svc_init, sync_exception_handler와 어셈블리의 index 조회·blr를 대조한다. BL31 ELF에 handle_runtime_svc가 없다는 사실만으로 서비스 누락이라고 판정하지 않는다.

읽기 중심의 ELF·코드·보드 증거

실제 플랫폼 산출물이 있을 때 아래를 대조한다. 이 작업은 TF-A를 빌드하거나 보드에서 SMC를 실행하지 않았다. 경로의 <platform>과 툴체인 접두사는 대상 환경에 맞춘다.

자료예시 명령·관찰확인 범위
대상 펌웨어 ELF symbol${CROSS_COMPILE}nm -n <firmware.elf> | grep -E ' (runtime_svc_init|handle_runtime_svc|sync_exception_handler)$'C 선언문 대신 심볼 이름·주소 확인
section/map${CROSS_COMPILE}readelf -SW build/<platform>/debug/bl31/bl31.elf와 해당 bl31.map.rt_svc_descs 배치·service 선언 순서 확인
disassembly${CROSS_COMPILE}objdump -dr build/<platform>/debug/bl31/bl31.elfindex 기록·조회·handler 분기 확인
cold debug loginvalid descriptor와 init callback 오류 로그panic과 skip 구분; 무오류 로그만으로 중복 부재 증명 불가
보드 SMC 관찰허용된 시험 FID 응답과 필요 시 계측한 indexSMC_UNK와 실제 handler 선택 구분

재현 가능한 세 가지 대조

  1. 01
    descriptor와 slot의 관계

    대상 ELF/map에서 .rt_svc_descs 배열과 선언 순서를 찾는다. 각 descriptor의 OEN 범위·type을 펼쳐 같은 slot의 중복을 계산한다. 빌드에 없는 service까지 있다고 가정하지 않는다.

  2. 02
    cold 등록 결과

    descriptor 형식 오류와 init callback 비0을 별도로 기록한다. init 실패가 자신만 skip한다는 코드 경계, 겹친 slot의 이전·이후 기록 가능성을 함께 판단한다.

  3. 03
    dispatch 결과

    승인된 보드 시험 환경에서 type/OEN이 다른 FID의 SMC_UNK와 handler 응답을 비교한다. bit30·function number가 달라도 같은 index key에 갈 수 있으므로 service별 handler 분기를 함께 확인한다.

원문과 다음 글