mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[fixup] add cache maintenance ops;
fix bugs on cache maintenance when starting user app
This commit is contained in:
@@ -59,13 +59,13 @@ void rt_hw_backtrace(rt_uint32_t *ffp, rt_ubase_t sepc)
|
||||
}
|
||||
|
||||
ra = fp - 1;
|
||||
if (!_rt_kmem_v2p(ra) || *ra < vas || *ra > vae)
|
||||
if (!rt_kmem_v2p(ra) || *ra < vas || *ra > vae)
|
||||
break;
|
||||
|
||||
rt_kprintf(" %p", *ra - 0x04);
|
||||
|
||||
fp = fp - 2;
|
||||
if (!_rt_kmem_v2p(fp))
|
||||
if (!rt_kmem_v2p(fp))
|
||||
break;
|
||||
fp = (rt_ubase_t *)(*fp);
|
||||
if (!fp)
|
||||
|
||||
@@ -45,6 +45,8 @@ ALWAYS_INLINE void rt_hw_cpu_icache_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 */
|
||||
void rt_hw_cpu_sync(void);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define DBG_LVL DBG_INFO
|
||||
#include <rtdbg.h>
|
||||
|
||||
#include <board.h>
|
||||
#include <cache.h>
|
||||
#include <mm_aspace.h>
|
||||
#include <mm_page.h>
|
||||
@@ -43,7 +44,7 @@ rt_ubase_t MMUTable[__SIZE(VPN2_BIT)];
|
||||
|
||||
void rt_hw_aspace_switch(rt_aspace_t aspace)
|
||||
{
|
||||
uintptr_t page_table = (uintptr_t)_rt_kmem_v2p(aspace->page_table);
|
||||
uintptr_t page_table = (uintptr_t)rt_kmem_v2p(aspace->page_table);
|
||||
current_mmu_table = aspace->page_table;
|
||||
|
||||
write_csr(satp, (((size_t)SATP_MODE) << SATP_MODE_OFFSET) |
|
||||
@@ -136,7 +137,9 @@ void *rt_hw_mmu_map(struct rt_aspace *aspace, void *v_addr, void *p_addr,
|
||||
// TODO trying with HUGEPAGE here
|
||||
while (npages--)
|
||||
{
|
||||
MM_PGTBL_LOCK(aspace);
|
||||
ret = _map_one_page(aspace, v_addr, p_addr, attr);
|
||||
MM_PGTBL_UNLOCK(aspace);
|
||||
if (ret != 0)
|
||||
{
|
||||
/* error, undo map */
|
||||
@@ -444,7 +447,7 @@ int rt_hw_mmu_control(struct rt_aspace *aspace, void *vaddr, size_t size,
|
||||
* otherwise is a failure and no report will be
|
||||
* returned.
|
||||
*
|
||||
* @param mmu_info
|
||||
* @param aspace
|
||||
* @param mdesc
|
||||
* @param desc_nr
|
||||
*/
|
||||
|
||||
@@ -67,19 +67,6 @@ void rt_hw_mmu_unmap(rt_aspace_t aspace, void *v_addr, size_t size);
|
||||
void rt_hw_aspace_switch(rt_aspace_t aspace);
|
||||
void *rt_hw_mmu_v2p(rt_aspace_t aspace, void *vaddr);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user