Skip to content

arch: arm: userspace: minor refactor in z_arch_is_user_context #17189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion drivers/serial/uart_mcux_lpuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <device.h>
#include <drivers/uart.h>
#include <drivers/clock_control.h>
#include <fsl_lpuart.h>
#include <soc.h>
#include <fsl_lpuart.h>

struct mcux_lpuart_config {
LPUART_Type *base;
Expand Down
7 changes: 4 additions & 3 deletions include/arch/arm/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand All @@ -26,6 +26,7 @@

#include <zephyr/types.h>
#include <stdbool.h>
#include <arch/arm/cortex_m/cmsis.h>

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions soc/arm/nxp_imx/rt/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@

#include <fsl_common.h>

/* ARM CMSIS definitions must be included before kernel_includes.h.
* Therefore, it is essential to include kernel_includes.h after including
* core SOC-specific headers.
*/
#include <kernel_includes.h>
/* Add include for DTS generated information */
#include <generated_dts_board.h>

#ifdef __cplusplus
extern "C" {
Expand Down
6 changes: 3 additions & 3 deletions soc/arm/nxp_kinetis/k6x/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
#ifndef _ASMLANGUAGE

#include <fsl_common.h>
#include <device.h>
#include <sys/util.h>
#include <random/rand32.h>

/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

Expand Down
2 changes: 1 addition & 1 deletion soc/arm/nxp_kinetis/k8x/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ config WDOG_INIT
requires that the watchdog be configured during reset
handling.

endif # SOC_SERIES_KINETIS_KV5X
endif # SOC_SERIES_KINETIS_K8X
9 changes: 3 additions & 6 deletions soc/arm/nxp_kinetis/k8x/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifndef _SOC__H_
#define _SOC__H_

#include <misc/util.h>
#include <sys/util.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -17,11 +17,8 @@ extern "C" {

#include <fsl_common.h>

/* ARM CMSIS definitions must be included before kernel_includes.h.
* Therefore, it is essential to include kernel_includes.h after including
* core SOC-specific headers.
*/
#include <kernel_includes.h>
/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

Expand Down
9 changes: 9 additions & 0 deletions soc/arm/nxp_kinetis/ke1xf/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,13 @@

#include <sys/util.h>

#ifndef _ASMLANGUAGE

#include <fsl_common.h>

/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

#endif /* _SOC__H_ */
6 changes: 3 additions & 3 deletions soc/arm/nxp_kinetis/kl2x/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#ifndef _ASMLANGUAGE

#include <fsl_common.h>
#include <device.h>
#include <sys/util.h>
#include <random/rand32.h>

/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

Expand Down
6 changes: 3 additions & 3 deletions soc/arm/nxp_kinetis/kwx/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#ifndef _ASMLANGUAGE

#include <fsl_common.h>
#include <device.h>
#include <sys/util.h>
#include <random/rand32.h>

/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

Expand Down
8 changes: 3 additions & 5 deletions soc/arm/nxp_lpc/lpc54xxx/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
#include <sys/util.h>
#include <fsl_common.h>

/* ARM CMSIS definitions must be included before kernel_includes.h.
* Therefore, it is essential to include kernel_includes.h after including
* core SOC-specific headers.
*/
#include <kernel_includes.h>
/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

#define IOCON_PIO_DIGITAL_EN 0x80u
Expand Down
5 changes: 4 additions & 1 deletion soc/arm/nxp_lpc/lpc55xxx/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
#define _SOC__H_

#ifndef _ASMLANGUAGE
#include <device.h>
#include <sys/util.h>
#include <fsl_common.h>

/* Add include for DTS generated information */
#include <generated_dts_board.h>

#endif /* !_ASMLANGUAGE */

#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
Expand Down