pc: replace duplicated and broken mmu flush code in vunmap()

comparing m with MACHP() is wrong as m is a constant on 386.

add procflushothers(), which flushes all processes except up
using common procflushmmu() routine.
This commit is contained in:
cinap_lenrek 2019-12-07 02:19:14 +01:00
parent 28836f3ff5
commit 13785bbbef
3 changed files with 13 additions and 21 deletions

View file

@ -643,10 +643,7 @@ vmapalloc(ulong size)
void
vunmap(void *v, int size)
{
int i;
ulong va, o;
Mach *nm;
Proc *p;
/*
* might not be aligned
@ -675,25 +672,8 @@ vunmap(void *v, int size)
putcr3(PADDR(MACHP(0)->pdb));
return;
}
for(i=0; i<conf.nproc; i++){
p = proctab(i);
if(p->state == Dead)
continue;
if(p != up)
p->newtlb = 1;
}
for(i=0; i<conf.nmach; i++){
nm = MACHP(i);
if(nm != m)
nm->flushmmu = 1;
}
procflushothers();
flushmmu();
for(i=0; i<conf.nmach; i++){
nm = MACHP(i);
if(nm != m)
while(active.machs[nm->machno] && nm->flushmmu)
;
}
}
/*

View file

@ -229,6 +229,7 @@ void procdump(void);
int procfdprint(Chan*, int, char*, int);
void procflushseg(Segment*);
void procflushpseg(Physseg*);
void procflushothers(void);
int procindex(ulong);
void procinit0(void);
ulong procpagecount(Proc*);

View file

@ -1412,6 +1412,17 @@ procflushpseg(Physseg *ps)
procflushmmu(matchpseg, ps);
}
static int
matchother(Proc *p, void *a)
{
return p != a;
}
void
procflushothers(void)
{
procflushmmu(matchother, up);
}
void
scheddump(void)
{