]> Zhao Yanbai Git Server - minix.git/commitdiff
allow empty senda
authorBen Gras <ben@minix3.org>
Mon, 8 Jun 2009 04:39:26 +0000 (04:39 +0000)
committerBen Gras <ben@minix3.org>
Mon, 8 Jun 2009 04:39:26 +0000 (04:39 +0000)
kernel/arch/i386/exception.c
kernel/proc.c

index 28593a19ae682426b73dda1d1445f2a5bac0640b..1a68a243fe0f988ea42c9abfbc1434ff733aa06f 100755 (executable)
@@ -44,7 +44,11 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
                vmassert(pr->p_seg.p_cr3 == read_cr3());
        } else {
                u32_t cr3;
-               lock;
+               int u = 0;
+               if(!intr_disabled()) {
+                       lock;
+                       u = 1;
+               }
                cr3 = read_cr3();
                vmassert(ptproc);
                if(ptproc->p_seg.p_cr3 != cr3) {
@@ -58,7 +62,9 @@ void pagefault(vir_bytes old_eip, struct proc *pr, int trap_errno,
                        vm_print(cr3);
                        vm_print(ptproc->p_seg.p_cr3);
                }
-               unlock;
+               if(u) {
+                       unlock;
+               }
        }
 
        test_eip = k_reenter ? old_eip : pr->p_reg.pc;
index 789965d22baadbd42af1ecfb44cf46b86d51d300..2bf4cb7a0af672b57097acd563c8c153ead2a453 100755 (executable)
@@ -732,13 +732,6 @@ size_t size;
        vir_bytes table_v = (vir_bytes) table;
        vir_bytes linaddr;
 
-       if(!(linaddr = umap_local(caller_ptr, D, (vir_bytes) table,
-               size * sizeof(*table)))) {
-               printf("mini_senda: umap_local failed; 0x%lx len 0x%lx\n",
-                       table, size * sizeof(*table));
-               return EFAULT;
-       }
-
        privp= priv(caller_ptr);
        if (!(privp->s_flags & SYS_PROC))
        {
@@ -757,6 +750,13 @@ size_t size;
                return OK;
        }
 
+       if(!(linaddr = umap_local(caller_ptr, D, (vir_bytes) table,
+               size * sizeof(*table)))) {
+               printf("mini_senda: umap_local failed; 0x%lx len 0x%lx\n",
+                       table, size * sizeof(*table));
+               return EFAULT;
+       }
+
        /* Limit size to something reasonable. An arbitrary choice is 16
         * times the number of process table entries.
         *