ep_info.h 1.58 KB
Newer Older
1
/*
2
 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
3
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
5
6
 */

7
8
#ifndef EP_INFO_H
#define EP_INFO_H
9

10
#include <common/param_header.h>
11

12
#ifndef __ASSEMBLER__
13
14
#include <stdint.h>
#include <lib/cassert.h>
15
#endif /* __ASSEMBLER__ */
16
17
18
19
20

#include <export/common/ep_info_exp.h>

#define SECURE		EP_SECURE
#define NON_SECURE	EP_NON_SECURE
21
22
#define sec_state_is_valid(s) (((s) == SECURE) || ((s) == NON_SECURE))

23
#define PARAM_EP_SECURITY_MASK	EP_SECURITY_MASK
24

25
26
#define NON_EXECUTABLE	EP_NON_EXECUTABLE
#define EXECUTABLE	EP_EXECUTABLE
27

28
/* Secure or Non-secure image */
29
#define GET_SECURITY_STATE(x) ((x) & EP_SECURITY_MASK)
30
#define SET_SECURITY_STATE(x, security) \
31
			((x) = ((x) & ~EP_SECURITY_MASK) | (security))
32

33
#ifndef __ASSEMBLER__
34
35
36
37
38
39
40
41
42
43

/*
 * Compile time assertions related to the 'entry_point_info' structure to
 * ensure that the assembler and the compiler view of the offsets of
 * the structure members is the same.
 */
CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
		__builtin_offsetof(entry_point_info_t, pc), \
		assert_BL31_pc_offset_mismatch);

44
#ifndef __aarch64__
45
46
47
48
49
CASSERT(ENTRY_POINT_INFO_LR_SVC_OFFSET ==
		__builtin_offsetof(entry_point_info_t, lr_svc),
		assert_entrypoint_lr_offset_error);
#endif

50
51
52
53
54
55
56
57
58
CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
		__builtin_offsetof(entry_point_info_t, args), \
		assert_BL31_args_offset_mismatch);

CASSERT(sizeof(uintptr_t) ==
		__builtin_offsetof(entry_point_info_t, spsr) - \
		__builtin_offsetof(entry_point_info_t, pc), \
		assert_entrypoint_and_spsr_should_be_adjacent);

59
#endif /*__ASSEMBLER__*/
60

61
#endif /* EP_INFO_H */