kernel: invlpg facility
. only use for single-page invalidations initially . shows tiny but statistically significant performance improvement; will be more helpful in certain VM debug modes
This commit is contained in:
parent
55c6f3f507
commit
35cc7fbeb8
4 changed files with 23 additions and 4 deletions
|
@ -61,6 +61,12 @@ struct proc *p;
|
|||
reload_cr3();
|
||||
return OK;
|
||||
}
|
||||
case VMCTL_I386_INVLPG:
|
||||
{
|
||||
i386_invlpg(m_ptr->SVMCTL_VALUE);
|
||||
return OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ _PROTOTYPE( void phys_outsb, (u16_t port, phys_bytes buf, size_t count) );
|
|||
_PROTOTYPE( void phys_outsw, (u16_t port, phys_bytes buf, size_t count) );
|
||||
_PROTOTYPE( u32_t read_cr3, (void) );
|
||||
_PROTOTYPE( void reload_cr3, (void) );
|
||||
_PROTOTYPE( void i386_invlpg, (phys_bytes linaddr) );
|
||||
_PROTOTYPE( void phys_memset, (phys_bytes ph, u32_t c, phys_bytes bytes));
|
||||
_PROTOTYPE( void reload_ds, (void) );
|
||||
_PROTOTYPE( void ia32_msr_read, (u32_t reg, u32_t * hi, u32_t * lo) );
|
||||
|
|
|
@ -714,6 +714,18 @@ ENTRY(write_cr3)
|
|||
pop %ebp
|
||||
ret
|
||||
|
||||
/*===========================================================================*/
|
||||
/* i386_invlpg */
|
||||
/*===========================================================================*/
|
||||
/* PUBLIC void i386_invlpg(unsigned long linaddr); */
|
||||
ENTRY(i386_invlpg)
|
||||
push %ebp
|
||||
mov %esp, %ebp
|
||||
mov 8(%ebp), %eax
|
||||
invlpg (%eax)
|
||||
pop %ebp
|
||||
ret
|
||||
|
||||
/*===========================================================================*/
|
||||
/* getcr3val */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -333,8 +333,8 @@ PUBLIC void *vm_allocpage(phys_bytes *phys, int reason)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) {
|
||||
panic("VMCTL_FLUSHTLB failed: %d", r);
|
||||
if((r=sys_vmctl(SELF, VMCTL_I386_INVLPG, loc)) != OK) {
|
||||
panic("VMCTL_I386_INVLPG failed: %d", r);
|
||||
}
|
||||
|
||||
level--;
|
||||
|
@ -370,8 +370,8 @@ PUBLIC void vm_pagelock(void *vir, int lockflag)
|
|||
panic("vm_lockpage: pt_writemap failed");
|
||||
}
|
||||
|
||||
if((r=sys_vmctl(SELF, VMCTL_FLUSHTLB, 0)) != OK) {
|
||||
panic("VMCTL_FLUSHTLB failed: %d", r);
|
||||
if((r=sys_vmctl(SELF, VMCTL_I386_INVLPG, m)) != OK) {
|
||||
panic("VMCTL_I386_INVLPG failed: %d", r);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue