Shell eec78d9f5d
[rt-smart] testcase & improvements for memory management (#7099)
* [utest/mm] add testcase for create/init
format codes of create/init in components/mm

* [libcpu/aarch64] fix user stack check routine

* [kservice] export API for utest

* [utest/mm] testcase for aspace_map
format & modify the files under components/mm related with aspace_map

* [lwp/user_mm] add user_map_varea for mmap feature

* [mm] rename rt_mm_fault_try_fix to rt_aspace_fault_try_fix

* [utest/mm] testcase for synchronization

* [mm] modify unmap api to improve throughput

* [utest/mm] testcases for cache and varea map

* [format] remove extra space

* [utest/mm] fix testcase problem in header

* [lwp] extend map_user_varea with a flag

* [utest/mm] testcase for lwp_map_user_varea

* [libcpu/arm/cortex-a] fix kernel space layout

* [utest/mm] adjust for armv7 arch
2023-03-30 08:25:15 +08:00

62 lines
2.0 KiB
C

/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-11-09 RT-Thread The first version
*/
#ifndef __CACHE_H__
#define __CACHE_H__
#ifndef ALWAYS_INLINE
#define ALWAYS_INLINE inline __attribute__((always_inline))
#endif
/**
* @brief These APIs may not be supported by a specified architecture
* But we have to include to all the cases to be 'general purpose'
*/
ALWAYS_INLINE void rt_hw_cpu_dcache_clean_local(void *addr, int size) {}
ALWAYS_INLINE void rt_hw_cpu_dcache_invalidate_local(void *addr, int size) {}
ALWAYS_INLINE void rt_hw_cpu_dcache_clean_and_invalidate_local(void *addr, int size) {}
ALWAYS_INLINE void rt_hw_cpu_dcache_clean_all_local() {}
ALWAYS_INLINE void rt_hw_cpu_dcache_invalidate_all_local(void) {}
ALWAYS_INLINE void rt_hw_cpu_dcache_clean_and_invalidate_all_local(void) {}
ALWAYS_INLINE void rt_hw_cpu_icache_invalidate_local(void *addr, int size) {}
ALWAYS_INLINE void rt_hw_cpu_icache_invalidate_all_local() {}
/**
* @brief Multi-core
*/
#define rt_hw_cpu_dcache_clean rt_hw_cpu_dcache_clean_local
#define rt_hw_cpu_dcache_invalidate rt_hw_cpu_dcache_invalidate_local
#define rt_hw_cpu_dcache_clean_and_invalidate rt_hw_cpu_dcache_clean_and_invalidate_local
#define rt_hw_cpu_dcache_clean_all rt_hw_cpu_dcache_clean_all_local
#define rt_hw_cpu_dcache_invalidate_all rt_hw_cpu_dcache_invalidate_all_local
#define rt_hw_cpu_dcache_clean_and_invalidate_all rt_hw_cpu_dcache_clean_and_invalidate_all_local
#define rt_hw_cpu_icache_invalidate rt_hw_cpu_icache_invalidate_local
#define rt_hw_cpu_icache_invalidate_all rt_hw_cpu_icache_invalidate_all_local
#define rt_hw_icache_invalidate_all rt_hw_cpu_icache_invalidate_all
/** instruction barrier */
static inline void rt_hw_cpu_sync(void) {}
/**
* @brief local cpu icahce & dcache synchronization
*
* @param addr
* @param size
*/
void rt_hw_sync_cache_local(void *addr, int size);
#endif /* __CACHE_H__ */