arch: arm: userspace: minor refactor in z_arch_is_user_context

Refactor z_arch_is_user_context() for ARM, so it uses
the CMSIS CONTROL_nPRIV_Msk instead of hard-coded 0x1.
Fixing also some typos in include/arch/arm/syscall.h.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2019-07-01 11:40:25 +02:00 committed by Andrew Boie
parent 66a2ed2360
commit 48fa076a56
1 changed files with 4 additions and 3 deletions

View File

@ -6,9 +6,9 @@
/**
* @file
* @brief ARM specific sycall header
* @brief ARM specific syscall header
*
* This header contains the ARM specific sycall interface. It is
* This header contains the ARM specific syscall interface. It is
* included by the syscall interface architecture-abstraction header
* (include/arch/syscall.h)
*/
@ -26,6 +26,7 @@
#include <zephyr/types.h>
#include <stdbool.h>
#include <arch/arm/cortex_m/cmsis.h>
#ifdef __cplusplus
extern "C" {
@ -167,7 +168,7 @@ static inline bool z_arch_is_user_context(void)
/* if not handler mode, return mode information */
__asm__ volatile("mrs %0, CONTROL\n\t" : "=r"(value));
return (value & 0x1) ? true : false;
return (value & CONTROL_nPRIV_Msk) ? true : false;
}
#ifdef __cplusplus