]> Zhao Yanbai Git Server - minix.git/commitdiff
kernel: invlpg facility
authorBen Gras <ben@minix3.org>
Mon, 1 Aug 2011 13:35:34 +0000 (15:35 +0200)
committerBen Gras <ben@minix3.org>
Fri, 12 Aug 2011 13:08:27 +0000 (13:08 +0000)
. only use for single-page invalidations initially
. shows tiny but statistically significant performance
  improvement; will be more helpful in certain VM debug
  modes

kernel/arch/i386/arch_do_vmctl.c
kernel/arch/i386/include/arch_proto.h
kernel/arch/i386/klib.S
servers/vm/arch/i386/pagetable.c

index 28461d8446db57ec38e85ef9a3bef7801ac160ab..242bf01cde0feabfef404a6dd5c0bc99dfd71e66 100644 (file)
@@ -61,6 +61,12 @@ struct proc *p;
                reload_cr3();
                return OK;
        }
+       case VMCTL_I386_INVLPG:
+       {
+               i386_invlpg(m_ptr->SVMCTL_VALUE);
+               return OK;
+       }
+
   }
 
 
index af605c6ed2e7ed0df0143eade6eb3084e542887e..145a3d79e19cb5dc06d351ce515271ee67448f09 100644 (file)
@@ -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)    );
index 561c7e5eacf8e115dcb938525ca99b1b05fc0be6..5f7bcfbb32089397268779a012209957f83135b6 100644 (file)
@@ -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                                    */
 /*===========================================================================*/
index bbd2183e98ead4fc784ff0446e09d75129c08aee..6bb893b349eb111505286fe35aed29b3ff1ee428 100644 (file)
@@ -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;