diff --git a/include/arch/arc/syscall.h b/include/arch/arc/syscall.h index a9e6c4d0a38..0ad9da1a053 100644 --- a/include/arch/arc/syscall.h +++ b/include/arch/arc/syscall.h @@ -24,6 +24,7 @@ #ifndef _ASMLANGUAGE #include +#include #ifdef CONFIG_CPU_ARCV2 #include @@ -172,7 +173,7 @@ static inline u32_t _arch_syscall_invoke0(u32_t call_id) return ret; } -static inline int _arch_is_user_context(void) +static inline bool _arch_is_user_context(void) { u32_t status; @@ -182,7 +183,7 @@ static inline int _arch_is_user_context(void) : "=r"(status) : [status32] "i" (_ARC_V2_STATUS32)); - return !(status & _ARC_V2_STATUS32_US); + return !(status & _ARC_V2_STATUS32_US) ? true : false; } #ifdef __cplusplus diff --git a/include/arch/arm/syscall.h b/include/arch/arm/syscall.h index ebb1f6b2e11..c2409626909 100644 --- a/include/arch/arm/syscall.h +++ b/include/arch/arm/syscall.h @@ -24,6 +24,7 @@ #ifndef _ASMLANGUAGE #include +#include #ifdef __cplusplus extern "C" { @@ -153,19 +154,19 @@ static inline u32_t _arch_syscall_invoke0(u32_t call_id) return ret; } -static inline int _arch_is_user_context(void) +static inline bool _arch_is_user_context(void) { u32_t value; /* check for handler mode */ __asm__ volatile("mrs %0, IPSR\n\t" : "=r"(value)); if (value) { - return 0; + return false; } /* if not handler mode, return mode information */ __asm__ volatile("mrs %0, CONTROL\n\t" : "=r"(value)); - return value & 0x1; + return (value & 0x1) ? true : false; } #ifdef __cplusplus diff --git a/include/arch/x86/syscall.h b/include/arch/x86/syscall.h index 6531f98d7e5..3a6f8e28575 100644 --- a/include/arch/x86/syscall.h +++ b/include/arch/x86/syscall.h @@ -23,6 +23,7 @@ #ifndef _ASMLANGUAGE #include +#include #ifdef __cplusplus extern "C" { @@ -151,7 +152,7 @@ static inline u32_t _arch_syscall_invoke0(u32_t call_id) return ret; } -static inline int _arch_is_user_context(void) +static inline bool _arch_is_user_context(void) { int cs; diff --git a/include/syscall.h b/include/syscall.h index bcd5f895444..5e42bf07352 100644 --- a/include/syscall.h +++ b/include/syscall.h @@ -10,6 +10,7 @@ #include #include +#include #ifndef _ASMLANGUAGE #include @@ -117,16 +118,16 @@ typedef u32_t (*_k_syscall_handler_t)(u32_t arg1, u32_t arg2, u32_t arg3, /** * Indicate whether we are currently running in user mode * - * @return nonzero if the CPU is currently running with user permissions + * @return true if the CPU is currently running with user permissions */ -static inline int _arch_is_user_context(void); +static inline bool _arch_is_user_context(void); /** * Indicate whether the CPU is currently in user mode * - * @return nonzero if the CPU is currently running with user permissions + * @return true if the CPU is currently running with user permissions */ -static inline int _is_user_context(void) +static inline bool _is_user_context(void) { return _arch_is_user_context(); }