Fix for EXPER_TRADPROC and vcore0
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 30 Apr 2010 19:31:34 +0000 (12:31 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:46 +0000 (17:35 -0700)
Needed to do some ugliness to get the vcore0 fake proc to start up the
right way.  For those curious, this looked like a mystery page fault in
glibc (locale shit).  Git pointed to the culprit commit.

kern/src/resource.c

index da703c3..b169c3b 100644 (file)
@@ -177,15 +177,20 @@ ssize_t core_request(struct proc *p)
                                struct preempt_data *vcpd = &p->procdata->vcore_preempt_data[0];
                                vcpd->preempt_tf = *current_tf;
                                save_fp_state(&vcpd->preempt_anc);
+                               __seq_start_write(&vcpd->preempt_tf_valid);
+                               /* If we remove this, vcore0 will start where the _S left off */
+                               vcpd->notif_pending = TRUE;
+                               assert(vcpd->notif_enabled);
 #ifdef __CONFIG_EXPER_TRADPROC__
+                               /* the proc that represents vcore0 will start at the entry
+                                * point, as if it was a notification handler, so we'll mimic
+                                * what __startcore would have done for a vcore0 restart. */
                                vcpd->notif_tf = *current_tf;
                                proc_init_trapframe(&p->env_tf, 0, p->env_entry,
                                                    vcpd->transition_stack);
+                               vcpd->notif_pending = FALSE;
+                               vcpd->notif_enabled = FALSE;
 #endif /* __CONFIG_EXPER_TRADPROC__ */
-                               __seq_start_write(&vcpd->preempt_tf_valid);
-                               /* If we remove this, vcore0 will start where the _S left off */
-                               vcpd->notif_pending = TRUE;
-                               assert(vcpd->notif_enabled);
                                /* in the async case, we'll need to remotely stop and bundle
                                 * vcore0's TF.  this is already done for the sync case (local
                                 * syscall). */