1 /* 2 * Copyright (c) 2014, STMicroelectronics International N.V. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 */ 27 #ifndef TEE_SVC_H 28 #define TEE_SVC_H 29 30 #include <stdint.h> 31 #include <kernel/tee_common_unpg.h> /* tee_uaddr_t */ 32 #include <tee_api_types.h> 33 #include <tee/abi.h> 34 #include <utee_types.h> 35 36 struct tee_ta_session; 37 38 void syscall_sys_return(uint32_t ret, uint32_t param_types, void *params); 39 40 void syscall_log(const void *buf, size_t len); 41 42 void syscall_panic(uint32_t code); 43 44 TEE_Result syscall_reserved(void); 45 46 TEE_Result syscall_not_supported(void); 47 48 uint32_t syscall_dummy(uint32_t *a); 49 uint32_t syscall_dummy_7args(uint32_t a1, uint32_t a2, uint32_t a3, 50 uint32_t a4, uint32_t a5, uint32_t a6, 51 uint32_t a7); 52 53 uint32_t syscall_nocall(void); 54 55 TEE_Result syscall_get_property(uint32_t prop, tee_uaddr_t buf, size_t blen); 56 57 TEE_Result syscall_open_ta_session(const TEE_UUID *dest, 58 uint32_t cancel_req_to, uint32_t param_types, 59 struct abi_user32_param *usr_params, 60 TEE_TASessionHandle *sess, 61 uint32_t *ret_orig); 62 63 TEE_Result syscall_close_ta_session(TEE_TASessionHandle sess); 64 65 TEE_Result syscall_invoke_ta_command(TEE_TASessionHandle sess, 66 uint32_t cancel_req_to, uint32_t cmd_id, 67 uint32_t param_types, 68 struct abi_user32_param *usr_params, 69 uint32_t *ret_orig); 70 71 TEE_Result syscall_check_access_rights(uint32_t flags, const void *buf, 72 size_t len); 73 74 TEE_Result tee_svc_copy_from_user(struct tee_ta_session *sess, void *kaddr, 75 const void *uaddr, size_t len); 76 TEE_Result tee_svc_copy_to_user(struct tee_ta_session *sess, void *uaddr, 77 const void *kaddr, size_t len); 78 TEE_Result tee_svc_copy_kaddr_to_user32(struct tee_ta_session *sess, 79 uint32_t *uaddr, const void *kaddr); 80 81 TEE_Result syscall_get_cancellation_flag(bool *cancel); 82 83 TEE_Result syscall_unmask_cancellation(bool *old_mask); 84 85 TEE_Result syscall_mask_cancellation(bool *old_mask); 86 87 TEE_Result syscall_wait(uint32_t timeout); 88 89 TEE_Result syscall_get_time(enum utee_time_category cat, TEE_Time *time); 90 TEE_Result syscall_set_ta_time(const TEE_Time *time); 91 92 #ifdef CFG_CACHE_API 93 TEE_Result syscall_cache_operation(void *va, size_t len, 94 enum utee_cache_operation op); 95 #else 96 #define syscall_cache_operation syscall_not_supported 97 #endif 98 99 void tee_svc_trace_syscall(int num); 100 101 102 #endif /* TEE_SVC_H */ 103