1 /* 2 * Copyright (c) 2017 Synopsys. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <zephyr/device.h> 8 #include <zephyr/init.h> 9 #include <zephyr/kernel.h> 10 #include <zephyr/arch/arc/v2/mpu/arc_core_mpu.h> 11 #include <zephyr/kernel_structs.h> 12 13 /* 14 * @brief Configure MPU for the thread 15 * 16 * This function configures per thread memory map reprogramming the MPU. 17 * 18 * @param thread thread info data structure. 19 */ configure_mpu_thread(struct k_thread * thread)20void configure_mpu_thread(struct k_thread *thread) 21 { 22 arc_core_mpu_disable(); 23 arc_core_mpu_configure_thread(thread); 24 arc_core_mpu_enable(); 25 } 26 27 #if defined(CONFIG_USERSPACE) 28 arch_mem_domain_max_partitions_get(void)29int arch_mem_domain_max_partitions_get(void) 30 { 31 return arc_core_mpu_get_max_domain_partition_regions(); 32 } 33 34 /* 35 * Validate the given buffer is user accessible or not 36 */ arch_buffer_validate(const void * addr,size_t size,int write)37int arch_buffer_validate(const void *addr, size_t size, int write) 38 { 39 return arc_core_mpu_buffer_validate(addr, size, write); 40 } 41 42 #endif 43