]> Zhao Yanbai Git Server - minix.git/commitdiff
kernel: separate state for trace-deferred syscalls
authorBen Gras <ben@minix3.org>
Fri, 4 Jan 2013 17:14:31 +0000 (17:14 +0000)
committerBen Gras <ben@minix3.org>
Tue, 8 Jan 2013 15:47:37 +0000 (15:47 +0000)
state is usually not in p_reg any more with sysenter/syscall trap entries,
so when saving/restarting do_ipc invocations the state has to be remembered
explicitly.

kernel/arch/i386/arch_system.c
kernel/proc.c
kernel/proc.h

index 376586cd60c01b485ac5c59958f30e1dba1eac43..15ffa5cd55524600a3f655fa7a1b43d8e4825572 100644 (file)
@@ -491,8 +491,9 @@ void arch_do_syscall(struct proc *proc)
   /* do_ipc assumes that it's running because of the current process */
   assert(proc == get_cpulocal_var(proc_ptr));
   /* Make the system call, for real this time. */
+  assert(proc->p_misc_flags & MF_SC_DEFER);
   proc->p_reg.retreg =
-         do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx);
+         do_ipc(proc->p_defer.r1, proc->p_defer.r2, proc->p_defer.r3);
 }
 
 struct proc * arch_finish_switch_to_user(void)
index 0518551e12a6305954d0263c62caf4eb85acfab6..3bdabd25ffd7f8936fa092a463224c3dd540dbdb 100644 (file)
@@ -546,7 +546,11 @@ int do_ipc(reg_t r1, reg_t r2, reg_t r3)
                 * input message. Postpone the entire system call.
                 */
                caller_ptr->p_misc_flags &= ~MF_SC_TRACE;
+               assert(!(caller_ptr->p_misc_flags & MF_SC_DEFER));
                caller_ptr->p_misc_flags |= MF_SC_DEFER;
+               caller_ptr->p_defer.r1 = r1;
+               caller_ptr->p_defer.r2 = r2;
+               caller_ptr->p_defer.r3 = r3;
 
                /* Signal the "enter system call" event. Block the process. */
                cause_sig(proc_nr(caller_ptr), SIGTRAP);
index 0d2d9148e26acd316635fe9fd1725b84b898d1b7..f645d3ea56853a953cb48011c692814a178b1e1b 100644 (file)
@@ -121,6 +121,11 @@ struct proc {
   int p_found; /* consistency checking variables */
   int p_magic;         /* check validity of proc pointers */
 
+  /* if MF_SC_DEFER is set, this struct is valid and contains the
+   * do_ipc() arguments that are still to be executed
+   */
+  struct { reg_t r1, r2, r3; } p_defer;
+
 #if DEBUG_TRACE
   int p_schedules;
 #endif