arm: mpu: Add user context API placeholder

This patch adds a configure_mpu_user_context API and implements
the required function placeholders in the NXP and ARM MPU files.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
This commit is contained in:
Andy Gross 2017-12-08 12:13:43 -06:00 committed by Andrew Boie
commit 9ccdcb9be6
5 changed files with 45 additions and 0 deletions

View file

@ -32,6 +32,22 @@ void configure_mpu_stack_guard(struct k_thread *thread)
#endif
#if defined(CONFIG_USERSPACE)
/*
* @brief Configure MPU user context
*
* This function configures the thread's user context.
* The functionality is meant to be used during context switch.
*
* @param thread thread info data structure.
*/
void configure_mpu_user_context(struct k_thread *thread)
{
SYS_LOG_DBG("configure user thread %p's context", thread);
arm_core_mpu_disable();
arm_core_mpu_configure_user_context(thread);
arm_core_mpu_enable();
}
/*
* @brief Configure MPU memory domain
*

View file

@ -240,6 +240,11 @@ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size)
}
#if defined(CONFIG_USERSPACE)
void arm_core_mpu_configure_user_context(struct k_thread *thread)
{
return 0;
}
/**
* @brief configure MPU regions for the memory partitions of the memory domain
*

View file

@ -249,6 +249,11 @@ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size)
}
#if defined(CONFIG_USERSPACE)
void arm_core_mpu_configure_user_context(struct k_thread *thread)
{
return 0;
}
/**
* @brief configure MPU regions for the memory partitions of the memory domain
*

View file

@ -42,6 +42,17 @@ void configure_mpu_stack_guard(struct k_thread *thread);
* @param thread thread info data structure.
*/
void configure_mpu_mem_domain(struct k_thread *thread);
/*
* @brief Configure MPU user context
*
* This function configures the stack and application data regions
* for user mode threads
*
* @param thread thread info data structure.
*/
void configure_mpu_user_context(struct k_thread *thread);
#endif
#ifdef __cplusplus

View file

@ -37,6 +37,7 @@ extern "C" {
#if defined(CONFIG_ARM_CORE_MPU)
struct k_mem_domain;
struct k_mem_partition;
struct k_thread;
/* ARM Core MPU Driver API */
@ -71,6 +72,13 @@ void arm_core_mpu_configure(u8_t type, u32_t base, u32_t size);
*/
void arm_core_mpu_configure_mem_domain(struct k_mem_domain *mem_domain);
/**
* @brief configure MPU regions for a user thread's context
*
* @param thread thread to configure
*/
void arm_core_mpu_configure_user_context(struct k_thread *thread);
/**
* @brief configure MPU region for a single memory partition
*