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/stmm_sp.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 ts_ctx *ctx) 16 { 17 return is_user_ta_ctx(ctx) || is_stmm_ctx(ctx); 18 } 19 20 static inline struct user_mode_ctx *to_user_mode_ctx(struct ts_ctx *ctx) 21 { 22 if (is_user_ta_ctx(ctx)) 23 return &to_user_ta_ctx(ctx)->uctx; 24 else 25 return &to_stmm_ctx(ctx)->uctx; 26 } 27 28 void user_mode_ctx_print_mappings(struct user_mode_ctx *umctx); 29 30 #endif /*__KERNEL_USER_MODE_CTX_H*/ 31