Merged proc_init_trapframe and proc_init_trapframe_vcoreid
authorAndrew Waterman <waterman@ubuntu.(none)>
Sun, 3 Jan 2010 00:49:54 +0000 (16:49 -0800)
committerAndrew Waterman <waterman@ubuntu.(none)>
Sun, 3 Jan 2010 00:49:54 +0000 (16:49 -0800)
kern/arch/i386/process.c
kern/arch/sparc/process.c
kern/include/process.h

index 9750a85..8ee744d 100644 (file)
@@ -23,7 +23,7 @@ void proc_set_program_counter(trapframe_t *tf, uintptr_t pc)
        tf->tf_eip = pc;
 }
 
-void proc_init_trapframe(trapframe_t *tf)
+void proc_init_trapframe(trapframe_t *tf, uint32_t vcoreid)
 {
        /* Set up appropriate initial values for the segment registers.
         * GD_UD is the user data segment selector in the GDT, and
@@ -37,6 +37,8 @@ void proc_init_trapframe(trapframe_t *tf)
        tf->tf_cs = GD_UT | 3;
        /* set the env's EFLAGSs to have interrupts enabled */
        tf->tf_eflags |= 0x00000200; // bit 9 is the interrupts-enabled
+
+       proc_set_tfcoreid(tf,vcoreid);
 }
 
 /* Coupled closely with userland's entry.S.  id is the vcoreid, which entry.S
index a416a7b..04e3951 100644 (file)
@@ -18,7 +18,8 @@ void
 proc_init_arch(struct proc *SAFE p)
 {
        pid_t parent_id = p->ppid, id = p->pid;
-       if(frontend_syscall(parent_id,RAMP_SYSCALL_proc_init,id,0,0))
+       int32_t errno;
+       if(frontend_syscall(parent_id,RAMP_SYSCALL_proc_init,id,0,0,&errno))
                panic("Front-end server couldn't initialize new process!");
 }
 
@@ -26,7 +27,8 @@ proc_init_arch(struct proc *SAFE p)
 void
 proc_free_arch(struct proc *SAFE p)
 {
-       if(frontend_syscall(0,RAMP_SYSCALL_proc_free,p->pid,0,0))
+       int32_t errno;
+       if(frontend_syscall(0,RAMP_SYSCALL_proc_free,p->pid,0,0,&errno))
                panic("Front-end server couldn't free process!");
 }
 
@@ -38,7 +40,7 @@ proc_set_program_counter(trapframe_t *tf, uintptr_t pc)
 }
 
 void
-proc_init_trapframe(trapframe_t *tf)
+proc_init_trapframe(trapframe_t *tf, uint32_t vcoreid)
 {
         extern char trap_table;
 
@@ -46,6 +48,8 @@ proc_init_trapframe(trapframe_t *tf)
         tf->psr = PSR_S; // but PS = 0
         tf->wim = 0;
         tf->tbr = (uint32_t)&trap_table;
+
+       proc_set_tfcoreid(tf,vcoreid);
 }
 
 void proc_set_tfcoreid(trapframe_t *tf, uint32_t id)
index bb54b51..a4c82f1 100644 (file)
 #define PROC_RUNNABLE_M                        0x20
 #define PROC_RUNNING_M                 0x40
 
+#define procstate2str(state) ((state)==PROC_CREATED    ? "CREATED   " : \
+                              (state)==PROC_RUNNABLE_S ? "RUNNABLE_S" : \
+                              (state)==PROC_RUNNING_S  ? "RUNNING_S " : \
+                              (state)==PROC_WAITING    ? "WAITING   " : \
+                              (state)==PROC_DYING      ? "DYING     " : \
+                              (state)==PROC_RUNNABLE_M ? "RUNNABLE_M" : \
+                              (state)==PROC_RUNNING_M  ? "RUNNING_M " : \
+                                                         "UNKNOWN   ")
+
 #include <env.h>
 
 // Till we remove the old struct Env
@@ -139,7 +148,7 @@ void __death(trapframe_t *tf, uint32_t srcid, void * a0, void * a1,
 void proc_init_arch(struct proc *SAFE p);
 void proc_free_arch(struct proc *SAFE p);
 void proc_set_program_counter(trapframe_t *SAFE tf, uintptr_t pc);
-void proc_init_trapframe(trapframe_t *SAFE tf);
+void proc_init_trapframe(trapframe_t *SAFE tf, uint32_t vcoreid);
 void proc_set_tfcoreid(trapframe_t *SAFE tf, uint32_t id);
 void proc_set_syscall_retval(trapframe_t *SAFE tf, intreg_t value);