]> Zhao Yanbai Git Server - minix.git/commitdiff
only switch pagetable if necessary and it's different for copying messages
authorBen Gras <ben@minix3.org>
Wed, 3 Jun 2009 15:28:13 +0000 (15:28 +0000)
committerBen Gras <ben@minix3.org>
Wed, 3 Jun 2009 15:28:13 +0000 (15:28 +0000)
kernel/arch/i386/memory.c

index 44896b90f6cea0f404cac4a363b569eacfb58ad3..1c3f6d6c6b10fdc3191fc8691ea5baffd588ac77 100644 (file)
@@ -704,11 +704,14 @@ u32_t read_cr3(void)
 phys_bytes arch_switch_copymsg(struct proc *rp, message *m, phys_bytes lin)
 {
        phys_bytes r;
-       if(rp->p_seg.p_cr3) {
+       int u = 0;
+       if(!intr_disabled()) { lock; u = 1; }
+       if(rp->p_seg.p_cr3 && ptproc != rp) {
                vm_set_cr3(rp->p_seg.p_cr3);
                ptproc = rp;
        }
        r = phys_copy(vir2phys(m), lin, sizeof(message));
+       if(u) { unlock; }
 }
 
 /*===========================================================================*