test cache

This commit is contained in:
TXuian
2024-03-18 11:17:55 +08:00
parent c60f29277a
commit 50dab7b553
13 changed files with 85 additions and 49 deletions
@@ -95,7 +95,9 @@ void handle_undefined_instruction(struct trapframe* tf)
extern void context_switch(struct context**, struct context*);
void dabort_handler(struct trapframe* r)
{
spinlock_lock(&whole_kernel_lock);
if (!is_spinlock_locked(&whole_kernel_lock)) {
spinlock_lock(&whole_kernel_lock);
}
uint32_t dfs, dfa;
__asm__ __volatile__("mrc p15, 0, %0, c5, c0, 0" : "=r"(dfs)::);
@@ -120,7 +122,9 @@ void dabort_handler(struct trapframe* r)
void iabort_handler(struct trapframe* r)
{
spinlock_lock(&whole_kernel_lock);
if (!is_spinlock_locked(&whole_kernel_lock)) {
spinlock_lock(&whole_kernel_lock);
}
uint32_t ifs, ifa;
__asm__ __volatile__("mrc p15, 0, %0, c5, c0, 1" : "=r"(ifs)::);
@@ -20,7 +20,9 @@
#include <string.h>
#include "assert.h"
#include "multicores.h"
#include "spinlock.h"
#include "task.h"
#include "trap_common.h"
bool module_spinlock_use_intr_init(void)
@@ -55,4 +57,9 @@ void _spinlock_unlock(struct spinlock* lock);
void spinlock_unlock(struct spinlock* lock)
{
_spinlock_unlock(lock);
}
bool is_spinlock_locked(struct spinlock* lock)
{
return lock->owner_cpu != SPINLOCK_STATE_UNLOCK;
}
@@ -41,4 +41,5 @@ struct spinlock { // Mutex.
bool module_spinlock_use_intr_init(void);
void spinlock_init(struct spinlock* lock, char* name);
void spinlock_lock(struct spinlock* lock);
void spinlock_unlock(struct spinlock* lock);
void spinlock_unlock(struct spinlock* lock);
bool is_spinlock_locked(struct spinlock* lock);