Removes __proc_set_allcores()
[akaros.git] / kern / src / resource.c
index 522dabe..fdbffe6 100644 (file)
@@ -57,7 +57,7 @@ ssize_t core_request(struct proc *p)
                disable_irqsave(&state);        /* protect cur_tf */
                assert(current_tf);
                p->env_tf = *current_tf;
-               current_tf = 0;                 /* Make sure it isn't used in the future */
+               clear_owning_proc(core_id());   /* so we don't restart */
                enable_irqsave(&state);
                env_push_ancillary_state(p); // TODO: (HSS)
                /* sending death, since it's not our job to save contexts or anything in
@@ -127,14 +127,17 @@ ssize_t core_request(struct proc *p)
                                /* Note this won't play well with concurrent proc kmsgs, but
                                 * since we're _S and locked, we shouldn't have any. */
                                assert(current_tf);
-                               vcpd->preempt_tf = *current_tf;
-                               current_tf = 0;                         /* so we don't restart */
+                               /* Copy uthread0's context to the notif slot */
+                               vcpd->notif_tf = *current_tf;
+                               clear_owning_proc(core_id());   /* so we don't restart */
                                save_fp_state(&vcpd->preempt_anc);
                                enable_irqsave(&state);
-                               __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);
+                               /* Userspace needs to not fuck with notif_disabled before
+                                * transitioning to _M. */
+                               if (vcpd->notif_disabled) {
+                                       printk("[kernel] user bug: notifs disabled for vcore 0\n");
+                                       vcpd->notif_disabled = FALSE;
+                               }
                                /* 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). */
@@ -149,7 +152,7 @@ ssize_t core_request(struct proc *p)
                                need_to_idle = TRUE;
                                // change to runnable_m (it's TF is already saved)
                                __proc_set_state(p, PROC_RUNNABLE_M);
-                               p->is_mcp = TRUE;
+                               p->procinfo->is_mcp = TRUE;
                                break;
                        case (PROC_RUNNABLE_S):
                                /* Issues: being on the runnable_list, proc_set_state not liking