User stackpointers moved to the vcpd structs
authorBarret Rhoden <brho@cs.berkeley.edu>
Sat, 10 Apr 2010 01:14:50 +0000 (18:14 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:42 +0000 (17:35 -0700)
They are per-core, and contain all the procdata settings the kernel and
userspace use for vcore mamangement.

Update your kernel headers.

kern/arch/i686/mptables.c
kern/include/ros/notification.h
kern/include/ros/procdata.h
kern/src/process.c
user/parlib/hart.c

index 4cc6a62..74faff4 100644 (file)
@@ -172,7 +172,7 @@ void mptables_parse() {
                panic("MPTABLES Not found. IOAPIC and interrupts will not function properly. <Insert whale held up by smaller birds here>");
        }
        
-       mptables_info("-->MPTables Floating Pointer Structure found @ KVA 0x%p.\n", mpfps);
+       mptables_info("-->MPTables Floating Pointer Structure found @ KVA %08p.\n", mpfps);
        
        mptables_info("-->Current Interrupt Mode: ");
        // Identify our interrupt mode
index 3aa2c7e..be6ef8d 100644 (file)
@@ -63,7 +63,7 @@ struct preempt_data {
        struct user_trapframe   preempt_tf;
        struct ancillary_state  preempt_anc;
        struct user_trapframe   notif_tf;
-       void                                    *transition_stack;      /* advertised by the user */
+       uintptr_t                               transition_stack;       /* advertised by the user */
        bool                                    notif_enabled;          /* vcore is willing to receive*/
        bool                                    notif_pending;          /* notif k_msg on the way */
        seq_ctr_t                               preempt_tf_valid;
index d2e5703..e56f3a4 100644 (file)
@@ -19,8 +19,6 @@ typedef struct procdata {
 #ifdef __i386__
        segdesc_t                               *ldt; // TODO: bug with this. (TLSV)
 #endif
-       // TODO: will replace these in a later commit
-       uintptr_t stack_pointers[MAX_NUM_CPUS];
        /* glibc relies on stuff above this point.  if you change it, you need to
         * rebuild glibc. */
        struct notif_method             notif_methods[MAX_NR_NOTIF];
index 2e1f6b4..088eeab 100644 (file)
@@ -1068,13 +1068,13 @@ void __startcore(trapframe_t *tf, uint32_t srcid, void *a0, void *a1, void *a2)
 
        assert(p_to_run);
        vcoreid = get_vcoreid(p_to_run, pcoreid);
+       vcpd = &p_to_run->procdata->vcore_preempt_data[vcoreid];
        printd("[kernel] startcore on physical core %d for process %d's vcore %d\n",
               pcoreid, p_to_run->pid, vcoreid);
        memset(&local_tf, 0, sizeof(local_tf));
        proc_init_trapframe(&local_tf, vcoreid, p_to_run->env_entry,
-                           p_to_run->procdata->stack_pointers[vcoreid]);
+                           vcpd->transition_stack);
        /* Disable/mask active notifications for fresh vcores */
-       vcpd = &p_to_run->procdata->vcore_preempt_data[vcoreid];
        vcpd->notif_enabled = FALSE;
        /* the sender of the amsg increfed, thinking we weren't running current. */
        if (p_to_run == current)
@@ -1113,7 +1113,7 @@ void __notify(trapframe_t *tf, uint32_t srcid, void *a0, void *a1, void *a2)
        vcpd->notif_tf = *tf;
        memset(&local_tf, 0, sizeof(local_tf));
        proc_init_trapframe(&local_tf, vcoreid, p->env_entry,
-                           p->procdata->stack_pointers[vcoreid]);
+                           vcpd->transition_stack);
        __proc_startcore(p, &local_tf);
 }
 
index b14f813..ec9e074 100644 (file)
@@ -56,7 +56,8 @@ static void hart_free_stack(int id)
 
 static int hart_allocate_stack(int id)
 {
-       if(__procdata.stack_pointers[id])
+       struct preempt_data *vcpd = &__procdata.vcore_preempt_data[id];
+       if (vcpd->transition_stack)
                return 0; // reuse old stack
 
        void* stackbot = mmap(0, HART_STACK_SIZE,
@@ -66,7 +67,7 @@ static int hart_allocate_stack(int id)
        if(stackbot == MAP_FAILED)
                return -1; // errno set by mmap
 
-       __procdata.stack_pointers[id] = (uintptr_t)stackbot + HART_STACK_SIZE;
+       vcpd->transition_stack = (uintptr_t)stackbot + HART_STACK_SIZE;
 
        return 0;
 }