1 /* 2 * Copyright (c) 2020 Intel Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_SYS_MEM_MANAGE_H 8 #define ZEPHYR_INCLUDE_SYS_MEM_MANAGE_H 9 10 /** 11 * @brief Memory Management 12 * @defgroup memory_management Memory Management 13 * @ingroup os_services 14 * @{ 15 */ 16 17 #ifndef _ASMLANGUAGE 18 #include <stdbool.h> 19 #include <stdint.h> 20 21 /** 22 * @brief Check if a physical address is within range of physical memory. 23 * 24 * This checks if the physical address (@p virt) is within 25 * permissible range, e.g. between 26 * :kconfig:option:`CONFIG_SRAM_BASE_ADDRESS` and 27 * (:kconfig:option:`CONFIG_SRAM_BASE_ADDRESS` + 28 * :kconfig:option:`CONFIG_SRAM_SIZE`). 29 * 30 * @note Only used if 31 * :kconfig:option:`CONFIG_KERNEL_VM_USE_CUSTOM_MEM_RANGE_CHECK` 32 * is enabled. 33 * 34 * @param phys Physical address to be checked. 35 * 36 * @return True if physical address is within range, false if not. 37 */ 38 bool sys_mm_is_phys_addr_in_range(uintptr_t phys); 39 40 /** 41 * @brief Check if a virtual address is within range of virtual memory. 42 * 43 * This checks if the virtual address (@p virt) is within 44 * permissible range, e.g. between 45 * :kconfig:option:`CONFIG_KERNEL_VM_BASE` and 46 * (:kconfig:option:`CONFIG_KERNEL_VM_BASE` + 47 * :kconfig:option:`CONFIG_KERNEL_VM_SIZE`). 48 * 49 * @note Only used if 50 * :kconfig:option:`CONFIG_KERNEL_VM_USE_CUSTOM_MEM_RANGE_CHECK` 51 * is enabled. 52 * 53 * @param virt Virtual address to be checked. 54 * 55 * @return True if virtual address is within range, false if not. 56 */ 57 bool sys_mm_is_virt_addr_in_range(void *virt); 58 59 /** @} */ 60 61 #endif /* !_ASMLANGUAGE */ 62 #endif /* ZEPHYR_INCLUDE_SYS_MEM_MANAGE_H */ 63