forked from xuos/xiuos
Fix one dabort and iabort lock bug.
This commit is contained in:
parent
08c8f0b952
commit
620965dc2c
|
@ -95,7 +95,7 @@ void handle_undefined_instruction(struct trapframe* tf)
|
||||||
extern void context_switch(struct context**, struct context*);
|
extern void context_switch(struct context**, struct context*);
|
||||||
void dabort_handler(struct trapframe* r)
|
void dabort_handler(struct trapframe* r)
|
||||||
{
|
{
|
||||||
if (!is_spinlock_locked(&whole_kernel_lock)) {
|
if (!is_spinlock_locked(&whole_kernel_lock) || whole_kernel_lock.owner_cpu != cur_cpuid()) {
|
||||||
spinlock_lock(&whole_kernel_lock);
|
spinlock_lock(&whole_kernel_lock);
|
||||||
}
|
}
|
||||||
uint32_t dfs, dfa;
|
uint32_t dfs, dfa;
|
||||||
|
@ -122,7 +122,7 @@ void dabort_handler(struct trapframe* r)
|
||||||
|
|
||||||
void iabort_handler(struct trapframe* r)
|
void iabort_handler(struct trapframe* r)
|
||||||
{
|
{
|
||||||
if (!is_spinlock_locked(&whole_kernel_lock)) {
|
if (!is_spinlock_locked(&whole_kernel_lock) || whole_kernel_lock.owner_cpu != cur_cpuid()) {
|
||||||
spinlock_lock(&whole_kernel_lock);
|
spinlock_lock(&whole_kernel_lock);
|
||||||
}
|
}
|
||||||
uint32_t ifs, ifa;
|
uint32_t ifs, ifa;
|
||||||
|
|
|
@ -68,22 +68,22 @@ void spinlock_lock(struct spinlock* lock)
|
||||||
ERROR("spinlock %s lock double locked by core %d\n", lock->name, lock->owner_cpu);
|
ERROR("spinlock %s lock double locked by core %d\n", lock->name, lock->owner_cpu);
|
||||||
panic("");
|
panic("");
|
||||||
}
|
}
|
||||||
// _spinlock_lock(&request_lock, SPINLOCK_LOCK_WAITFOREVER);
|
_spinlock_lock(&request_lock, SPINLOCK_LOCK_WAITFOREVER);
|
||||||
// doubleListAddOnBack(&core_lock_request[cur_cpuid()].node, &lock_request_guard);
|
doubleListAddOnBack(&core_lock_request[cur_cpuid()].node, &lock_request_guard);
|
||||||
// _spinlock_unlock(&request_lock);
|
_spinlock_unlock(&request_lock);
|
||||||
|
|
||||||
// while (lock_request_guard.next != &core_lock_request[cur_cpuid()].node)
|
while (lock_request_guard.next != &core_lock_request[cur_cpuid()].node)
|
||||||
// ;
|
;
|
||||||
|
|
||||||
_spinlock_lock(lock, SPINLOCK_LOCK_WAITFOREVER);
|
_spinlock_lock(lock, SPINLOCK_LOCK_WAITFOREVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spinlock_unlock(struct spinlock* lock)
|
void spinlock_unlock(struct spinlock* lock)
|
||||||
{
|
{
|
||||||
// assert(lock_request_guard.next == &core_lock_request[cur_cpuid()].node);
|
assert(lock_request_guard.next == &core_lock_request[cur_cpuid()].node);
|
||||||
// _spinlock_lock(&request_lock, SPINLOCK_LOCK_WAITFOREVER);
|
_spinlock_lock(&request_lock, SPINLOCK_LOCK_WAITFOREVER);
|
||||||
// _double_list_del(core_lock_request[cur_cpuid()].node.prev, core_lock_request[cur_cpuid()].node.next);
|
_double_list_del(core_lock_request[cur_cpuid()].node.prev, core_lock_request[cur_cpuid()].node.next);
|
||||||
// _spinlock_unlock(&request_lock);
|
_spinlock_unlock(&request_lock);
|
||||||
|
|
||||||
_spinlock_unlock(lock);
|
_spinlock_unlock(lock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue