blob: c73691953d7cc3f6512bd1ebf2c140c04af00075 [file] [log] [blame]
Marc Bonnici758bd242021-12-19 21:37:50 +00001/*
Nishant Sharma96107d72022-04-28 00:13:50 +01002 * Copyright (c) 2017-2023, ARM Limited and Contributors. All rights reserved.
Marc Bonnici758bd242021-12-19 21:37:50 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SPM_COMMON_H
8#define SPM_COMMON_H
9
10#include <context.h>
11
12/*******************************************************************************
13 * Constants that allow assembler code to preserve callee-saved registers of the
14 * C runtime context while performing a security state switch.
15 ******************************************************************************/
16#define SP_C_RT_CTX_X19 0x0
17#define SP_C_RT_CTX_X20 0x8
18#define SP_C_RT_CTX_X21 0x10
19#define SP_C_RT_CTX_X22 0x18
20#define SP_C_RT_CTX_X23 0x20
21#define SP_C_RT_CTX_X24 0x28
22#define SP_C_RT_CTX_X25 0x30
23#define SP_C_RT_CTX_X26 0x38
24#define SP_C_RT_CTX_X27 0x40
25#define SP_C_RT_CTX_X28 0x48
26#define SP_C_RT_CTX_X29 0x50
27#define SP_C_RT_CTX_X30 0x58
28
29#define SP_C_RT_CTX_SIZE 0x60
30#define SP_C_RT_CTX_ENTRIES (SP_C_RT_CTX_SIZE >> DWORD_SHIFT)
31
32#ifndef __ASSEMBLER__
33
34#include <stdint.h>
Nishant Sharma96107d72022-04-28 00:13:50 +010035#include <lib/xlat_tables/xlat_tables_v2.h>
Marc Bonnici758bd242021-12-19 21:37:50 +000036
37/* Assembly helpers */
38uint64_t spm_secure_partition_enter(uint64_t *c_rt_ctx);
39void __dead2 spm_secure_partition_exit(uint64_t c_rt_ctx, uint64_t ret);
40
Nishant Sharma96107d72022-04-28 00:13:50 +010041/* Helper to obtain a reference to the SP's translation table context */
42xlat_ctx_t *spm_get_sp_xlat_context(void);
43
Marc Bonnici758bd242021-12-19 21:37:50 +000044#endif /* __ASSEMBLER__ */
45
46#endif /* SPM_COMMON_H */