summaryrefslogtreecommitdiff
path: root/libcpu/arm/cortex-a
diff options
context:
space:
mode:
authorwangxiaoyao <[email protected]>2023-02-20 13:48:00 +0800
committerguo <[email protected]>2023-02-21 08:48:49 +0800
commit484a0d602e8b571a9d8186d38c8b136abc4ccfc9 (patch)
tree399ef1a1718bffed545a7354bbf2a8f8133e9c23 /libcpu/arm/cortex-a
parentf84d89b0ca9c8982d436aa12be75554722462090 (diff)
[fixup] add cache maintenance ops;
fix bugs on cache maintenance when starting user app
Diffstat (limited to 'libcpu/arm/cortex-a')
-rw-r--r--libcpu/arm/cortex-a/cache.h19
-rw-r--r--libcpu/arm/cortex-a/mmu.c2
-rw-r--r--libcpu/arm/cortex-a/mmu.h13
3 files changed, 20 insertions, 14 deletions
diff --git a/libcpu/arm/cortex-a/cache.h b/libcpu/arm/cortex-a/cache.h
new file mode 100644
index 0000000000..c3e096ba0c
--- /dev/null
+++ b/libcpu/arm/cortex-a/cache.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2019-03-29 quanzhao the first version
+ */
+
+#ifndef __CACHE_H__
+#define __CACHE_H__
+
+static inline void rt_hw_icache_invalidate_all(void)
+{
+ __asm__ volatile("mcr p15, 0, %0, c7, c5, 0"::"r"(0ul));
+}
+
+#endif /* __CACHE_H__ */
diff --git a/libcpu/arm/cortex-a/mmu.c b/libcpu/arm/cortex-a/mmu.c
index 12d441d8e9..ed96e96d18 100644
--- a/libcpu/arm/cortex-a/mmu.c
+++ b/libcpu/arm/cortex-a/mmu.c
@@ -337,7 +337,7 @@ void rt_hw_aspace_switch(rt_aspace_t aspace)
if (aspace != &rt_kernel_space)
{
void *pgtbl = aspace->page_table;
- pgtbl = _rt_kmem_v2p(pgtbl);
+ pgtbl = rt_kmem_v2p(pgtbl);
rt_hw_mmu_switch(pgtbl);
diff --git a/libcpu/arm/cortex-a/mmu.h b/libcpu/arm/cortex-a/mmu.h
index 04b4f485b0..2d09c1281d 100644
--- a/libcpu/arm/cortex-a/mmu.h
+++ b/libcpu/arm/cortex-a/mmu.h
@@ -112,19 +112,6 @@ void *rt_hw_mmu_v2p(struct rt_aspace *aspace, void *vaddr);
void rt_hw_mmu_kernel_map_init(struct rt_aspace *aspace, size_t vaddr_start, size_t size);
void *rt_hw_mmu_tbl_get();
-static inline void *_rt_kmem_v2p(void *vaddr)
-{
- return rt_hw_mmu_v2p(&rt_kernel_space, vaddr);
-}
-
-static inline void *rt_kmem_v2p(void *vaddr)
-{
- MM_PGTBL_LOCK(&rt_kernel_space);
- void *paddr = _rt_kmem_v2p(vaddr);
- MM_PGTBL_UNLOCK(&rt_kernel_space);
- return paddr;
-}
-
int rt_hw_mmu_control(struct rt_aspace *aspace, void *vaddr, size_t size, enum rt_mmu_cntl cmd);
#endif