Skip to content

Commit 48fa076

Browse files
ioannisgandrewboie
authored andcommitted
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 <[email protected]>
1 parent 66a2ed2 commit 48fa076

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/arch/arm/syscall.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
/**
88
* @file
9-
* @brief ARM specific sycall header
9+
* @brief ARM specific syscall header
1010
*
11-
* This header contains the ARM specific sycall interface. It is
11+
* This header contains the ARM specific syscall interface. It is
1212
* included by the syscall interface architecture-abstraction header
1313
* (include/arch/syscall.h)
1414
*/
@@ -26,6 +26,7 @@
2626

2727
#include <zephyr/types.h>
2828
#include <stdbool.h>
29+
#include <arch/arm/cortex_m/cmsis.h>
2930

3031
#ifdef __cplusplus
3132
extern "C" {
@@ -167,7 +168,7 @@ static inline bool z_arch_is_user_context(void)
167168

168169
/* if not handler mode, return mode information */
169170
__asm__ volatile("mrs %0, CONTROL\n\t" : "=r"(value));
170-
return (value & 0x1) ? true : false;
171+
return (value & CONTROL_nPRIV_Msk) ? true : false;
171172
}
172173

173174
#ifdef __cplusplus

0 commit comments

Comments
 (0)