mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
mmu: fix deadlock
This commit is contained in:
@@ -31,7 +31,7 @@ void arch_mmu_switchcontext(arch_mmu_tableptr context){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* inv = NULL;
|
void* inv = NULL;
|
||||||
|
int invlock;
|
||||||
semaphore_t sem;
|
semaphore_t sem;
|
||||||
|
|
||||||
void arch_mmu_invalidateipi(){
|
void arch_mmu_invalidateipi(){
|
||||||
@@ -40,6 +40,7 @@ void arch_mmu_invalidateipi(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void invalidate(void* addr){
|
static void invalidate(void* addr){
|
||||||
|
spinlock_acquire(&invlock);
|
||||||
asm("invlpg (%%rax)" : : "a"(addr));
|
asm("invlpg (%%rax)" : : "a"(addr));
|
||||||
sem.count = -arch_smp_cpucount();
|
sem.count = -arch_smp_cpucount();
|
||||||
if(!sem.count) return;
|
if(!sem.count) return;
|
||||||
@@ -47,6 +48,7 @@ static void invalidate(void* addr){
|
|||||||
inv = addr;
|
inv = addr;
|
||||||
arch_smp_sendipi(0, VECTOR_MMUINVAL, IPI_CPU_ALLBUTSELF);
|
arch_smp_sendipi(0, VECTOR_MMUINVAL, IPI_CPU_ALLBUTSELF);
|
||||||
while(!sem_tryacquire(&sem)) asm("pause");
|
while(!sem_tryacquire(&sem)) asm("pause");
|
||||||
|
spinlock_release(&invlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user