xref: /optee_os/core/include/kernel/user_mode_ctx.h (revision a1d5c81f8834a9d2c6f4372cce2e59e70e709121)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2019, Linaro Limited
4  */
5 
6 #ifndef __KERNEL_USER_MODE_CTX_H
7 #define __KERNEL_USER_MODE_CTX_H
8 
9 #include <assert.h>
10 #include <kernel/secure_partition.h>
11 #include <kernel/user_mode_ctx_struct.h>
12 #include <kernel/user_ta.h>
13 #include <stdbool.h>
14 
15 static inline bool is_user_mode_ctx(struct tee_ta_ctx *ctx)
16 {
17 	return is_user_ta_ctx(ctx) || is_sp_ctx(ctx);
18 }
19 
20 static inline struct user_mode_ctx *to_user_mode_ctx(struct tee_ta_ctx *ctx)
21 {
22 	assert(is_user_mode_ctx(ctx));
23 	return container_of(ctx, struct user_mode_ctx, ctx);
24 }
25 
26 void user_mode_ctx_print_mappings(struct user_mode_ctx *umctx);
27 
28 #endif /*__KERNEL_USER_MODE_CTX_H*/
29