pc64: avoid getcr3() in mmuflushtlb()
it turns out that calculating physical address of pml4 is faster than reading the machine register, so pass it explicitely.
This commit is contained in:
parent
18b3847aef
commit
15b903c4e1
3 changed files with 4 additions and 4 deletions
|
@ -96,7 +96,7 @@ void meminit(void);
|
||||||
void meminit0(void);
|
void meminit0(void);
|
||||||
void memreserve(uintptr, uintptr);
|
void memreserve(uintptr, uintptr);
|
||||||
void mfence(void);
|
void mfence(void);
|
||||||
#define mmuflushtlb() putcr3(getcr3())
|
#define mmuflushtlb(pml4) putcr3(pml4)
|
||||||
void mmuinit(void);
|
void mmuinit(void);
|
||||||
uintptr *mmuwalk(uintptr*, uintptr, int, int);
|
uintptr *mmuwalk(uintptr*, uintptr, int, int);
|
||||||
char* mtrr(uvlong, uvlong, char *);
|
char* mtrr(uvlong, uvlong, char *);
|
||||||
|
|
|
@ -239,7 +239,7 @@ rebootjump(uintptr entry, uintptr code, ulong size)
|
||||||
if((pte = mmuwalk(m->pml4, REBOOTADDR, 0, 0)) != nil)
|
if((pte = mmuwalk(m->pml4, REBOOTADDR, 0, 0)) != nil)
|
||||||
*pte &= ~PTENOEXEC;
|
*pte &= ~PTENOEXEC;
|
||||||
|
|
||||||
mmuflushtlb();
|
mmuflushtlb(PADDR(m->pml4));
|
||||||
|
|
||||||
/* setup reboot trampoline function */
|
/* setup reboot trampoline function */
|
||||||
f = (void*)REBOOTADDR;
|
f = (void*)REBOOTADDR;
|
||||||
|
@ -350,5 +350,5 @@ procsave(Proc *p)
|
||||||
* You might think it would be a win not to do this in that case,
|
* You might think it would be a win not to do this in that case,
|
||||||
* especially on VMware, but it turns out not to matter.
|
* especially on VMware, but it turns out not to matter.
|
||||||
*/
|
*/
|
||||||
mmuflushtlb();
|
mmuflushtlb(PADDR(m->pml4));
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ taskswitch(uintptr stack)
|
||||||
tss->rsp1[1] = stack >> 32;
|
tss->rsp1[1] = stack >> 32;
|
||||||
tss->rsp2[0] = (u32int)stack;
|
tss->rsp2[0] = (u32int)stack;
|
||||||
tss->rsp2[1] = stack >> 32;
|
tss->rsp2[1] = stack >> 32;
|
||||||
mmuflushtlb();
|
mmuflushtlb(PADDR(m->pml4));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kernelro(void);
|
static void kernelro(void);
|
||||||
|
|
Loading…
Reference in a new issue