]> Zhao Yanbai Git Server - minix.git/commitdiff
kernel: use MF_KCALL_RESUME instead of RTS_VMREQUEST for memcopy retry.
authorBen Gras <ben@minix3.org>
Sun, 4 Jul 2010 23:09:24 +0000 (23:09 +0000)
committerBen Gras <ben@minix3.org>
Sun, 4 Jul 2010 23:09:24 +0000 (23:09 +0000)
solves tracker item 499, submitted by Roman Ignatov.

kernel/arch/i386/memory.c
kernel/system.c

index cdff159813ec3c7ec8738184e72f15228263b991..b5e9f4add598529bb196933ad2a5956b23a1dc12 100644 (file)
@@ -570,6 +570,8 @@ PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
         */                                                             
        assert(!RTS_ISSET(caller, RTS_VMREQUEST));
        assert(!RTS_ISSET(target, RTS_VMREQUEST));
+       assert(!(caller->p_misc_flags & MF_KCALL_RESUME));
+       assert(!(target->p_misc_flags & MF_KCALL_RESUME));
 
        RTS_SET(caller, RTS_VMREQUEST);
 
@@ -819,9 +821,8 @@ int vmcheck;                        /* if nonzero, can return VMSUSPEND */
   if(vm_running) {
        int r;
 
-       if(caller && RTS_ISSET(caller, RTS_VMREQUEST)) {
+       if(caller && (caller->p_misc_flags & MF_KCALL_RESUME)) {
                assert(caller->p_vmrequest.vmresult != VMSUSPEND);
-               RTS_UNSET(caller, RTS_VMREQUEST);
                if(caller->p_vmrequest.vmresult != OK) {
                        return caller->p_vmrequest.vmresult;
                }
index ac89638cd1dfa1da4d5646d6d2c61e0407c0bdf4..e3a1b769a61313c79fa4b96b6b9eb73b9f4defc5 100644 (file)
@@ -591,11 +591,14 @@ PUBLIC void kernel_call_resume(struct proc *caller)
                        caller->p_rts_flags, caller->p_misc_flags);
         */
 
+       /* re-execute the kernel call, with MF_KCALL_RESUME still set so
+        * the call knows this is a retry.
+        */
+       result = kernel_call_dispatch(caller, &caller->p_vmrequest.saved.reqmsg);
        /*
         * we are resuming the kernel call so we have to remove this flag so it
         * can be set again
         */
        caller->p_misc_flags &= ~MF_KCALL_RESUME;
-       result = kernel_call_dispatch(caller, &caller->p_vmrequest.saved.reqmsg);
        kernel_call_finish(caller, &caller->p_vmrequest.saved.reqmsg, result);
 }