summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2018-07-05 13:07:52 +0200
committerMikhail Kashkarov <m.kashkarov@partner.samsung.com>2019-12-19 14:59:32 +0300
commit8e3aeac4190432bbf5c9e90ddd82a869921f04bf (patch)
treefebb12fae4514c220a44a1425d124d2ec8bca481
parentbc6d8809261480cbb1b474eb18db2855762d1182 (diff)
downloadtef-optee_os-sandbox/mkashkarov/tizen_6.0_build.tar.gz
tef-optee_os-sandbox/mkashkarov/tizen_6.0_build.tar.bz2
tef-optee_os-sandbox/mkashkarov/tizen_6.0_build.zip
core: define syscall_t as void (*)(void)sandbox/mkashkarov/tizen_6.0_build
syscall_t is currently typedef'ed as TEE_Result (*)(void). It is used to represent a pointer to any system call, in the syscall table for instance. As such, the exact type behind syscall_t cannot reflect all the syscalls since they have different prototypes. The current declaration with a TEE_Result return type was probably chosen because it was a common characteristic of all syscalls to return a TEE_Result. However, this type causes compilation warnings with GCC 8.1: core/arch/arm/tee/arch_svc.c:43:36: warning: cast between incompatible function types from ‘void (*)(long unsigned int)’ to ‘TEE_Result (*)(void)’ {aka ‘unsigned int (*)(void)’} [-Wcast-function-type] #define SYSCALL_ENTRY(_fn) { .fn = (syscall_t)_fn } ^ core/arch/arm/tee/arch_svc.c:50:2: note: in expansion of macro ‘SYSCALL_ENTRY’ SYSCALL_ENTRY(syscall_sys_return), ^~~~~~~~~~~~~ The solution is to use 'void (*)(void)' instead, as explained in the GCC documentation: -Wcast-function-type Warn when a function pointer is cast to an incompatible function pointer. [...] The function type void (*) (void) is special and matches everything, which can be used to suppress this warning. [...] Link: [1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> (cherry picked from commit f6d17e33e7b95c90a2521cfd37cd5cb511909fc4)
-rw-r--r--core/arch/arm/tee/arch_svc.c2
-rw-r--r--core/arch/arm/tee/arch_svc_private.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/core/arch/arm/tee/arch_svc.c b/core/arch/arm/tee/arch_svc.c
index f6767d7..c4a2213 100644
--- a/core/arch/arm/tee/arch_svc.c
+++ b/core/arch/arm/tee/arch_svc.c
@@ -215,7 +215,7 @@ void tee_svc_handler(struct thread_svc_regs *regs)
}
if (scn > TEE_SCN_MAX)
- scf = syscall_not_supported;
+ scf = (syscall_t)syscall_not_supported;
else
scf = tee_svc_syscall_table[scn].fn;
diff --git a/core/arch/arm/tee/arch_svc_private.h b/core/arch/arm/tee/arch_svc_private.h
index 7b2ea94..f2d0de1 100644
--- a/core/arch/arm/tee/arch_svc_private.h
+++ b/core/arch/arm/tee/arch_svc_private.h
@@ -29,8 +29,11 @@
#include <tee_api_types.h>
-/* void argument but in reality it can be any number of arguments */
-typedef TEE_Result (*syscall_t)(void);
+/*
+ * Generic "pointer to function" type. Actual syscalls take zero or more
+ * arguments and return TEE_Result.
+ */
+typedef void (*syscall_t)(void);
/* Helper function for tee_svc_handler() */
uint32_t tee_svc_do_call(struct thread_svc_regs *regs, syscall_t func);