Removed proc_init_arch; created frontend_proc_init
authorKevin Klues <klueska@ros-dev.(none)>
Wed, 24 Mar 2010 07:28:39 +0000 (00:28 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:37 +0000 (17:35 -0700)
kern/arch/i686/process.c
kern/arch/sparc/process.c
kern/include/frontend.h
kern/include/process.h
kern/src/frontend.c
kern/src/process.c

index 06aa9cd..89b8464 100644 (file)
@@ -8,16 +8,6 @@
 #include <assert.h>
 #include <stdio.h>
 
-// architecture-specific process initialization code
-void proc_init_arch(struct proc *SAFE p)
-{
-}
-
-// architecture-specific process termination code
-void proc_free_arch(struct proc *SAFE p)
-{
-}
-
 void proc_init_trapframe(trapframe_t *tf, uint32_t vcoreid,
                          uint32_t entryp, uint32_t stack_top)
 {
@@ -29,7 +19,7 @@ void proc_init_trapframe(trapframe_t *tf, uint32_t vcoreid,
        tf->tf_ds = GD_UD | 3;
        tf->tf_es = GD_UD | 3;
        tf->tf_ss = GD_UD | 3;
-       tf->tf_esp = stack_top;
+       tf->tf_esp = stack_top-64;
        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
index b37a65d..a97eb9a 100644 (file)
 #pragma nosharc
 #endif
 
-// architecture-specific process initialization code
-void
-proc_init_arch(struct proc *SAFE p)
-{
-       pid_t parent_id = p->ppid, id = p->pid;
-       int32_t errno;
-       if(frontend_syscall(parent_id,APPSERVER_SYSCALL_proc_init,id,0,0,0,&errno))
-               panic("Front-end server couldn't initialize new process!");
-}
-
-// architecture-specific process termination code
-void
-proc_free_arch(struct proc *SAFE p)
-{
-       int32_t errno;
-       if(frontend_syscall(0,APPSERVER_SYSCALL_proc_free,p->pid,0,0,0,&errno))
-               panic("Front-end server couldn't free process!");
-}
-
 void
 proc_init_trapframe(trapframe_t *tf, uint32_t vcoreid,
                     uint32_t entryp, uint32_t stack_top)
index 16761b1..35d1974 100644 (file)
@@ -13,6 +13,9 @@
 #define APPSERVER_ETH_TYPE 0x8888
 #endif
 
+void frontend_proc_init(struct proc* p);
+void frontend_proc_free(struct proc* p);
+
 int32_t frontend_syscall_from_user(env_t* p, int32_t syscall_num, 
                                    uint32_t arg0, uint32_t arg1, 
                                    uint32_t arg2, uint32_t translate_args);
index 9a52fe8..d93877b 100644 (file)
@@ -146,8 +146,6 @@ void __death(trapframe_t *tf, uint32_t srcid, void * a0, void * a1,
 #endif
 
 /* Arch Specific */
-void proc_init_arch(struct proc *SAFE p);
-void proc_free_arch(struct proc *SAFE p);
 void proc_init_trapframe(trapframe_t *SAFE tf, uint32_t vcoreid,
                          uint32_t entryp, uint32_t stack_top);
 void proc_set_syscall_retval(trapframe_t *SAFE tf, intreg_t value);
index 366772e..fd9cf78 100644 (file)
 
 volatile int magic_mem[10];
 
+void
+frontend_proc_init(struct proc *SAFE p)
+{
+       pid_t parent_id = p->ppid, id = p->pid;
+       int32_t errno;
+       if(frontend_syscall(parent_id,APPSERVER_SYSCALL_proc_init,id,0,0,0,&errno))
+               panic("Front-end server couldn't initialize new process!");
+}
+
+void
+frontend_proc_free(struct proc *SAFE p)
+{
+       int32_t errno;
+       if(frontend_syscall(0,APPSERVER_SYSCALL_proc_free,p->pid,0,0,0,&errno))
+               panic("Front-end server couldn't free process!");
+}
+
 void* user_memdup(struct proc* p, const void* va, int len)
 {
        void* kva = NULL;
index d8c0646..e72296d 100644 (file)
@@ -23,6 +23,7 @@
 #include <hashtable.h>
 #include <slab.h>
 #include <sys/queue.h>
+#include <frontend.h>
 
 /* Process Lists */
 struct proc_list proc_runnablelist = TAILQ_HEAD_INITIALIZER(proc_runnablelist);
@@ -270,7 +271,7 @@ static error_t proc_alloc(struct proc *SAFE*SAFE pp, pid_t parent_id)
        *pp = p;
        atomic_inc(&num_envs);
 
-       proc_init_arch(p);
+       frontend_proc_init(p);
 
        printd("[%08x] new process %08x\n", current ? current->pid : 0, p->pid);
        } // INIT_STRUCT
@@ -301,11 +302,11 @@ static void __proc_free(struct proc *p)
 {
        physaddr_t pa;
 
-       printd("[PID %d] freeing proc: %d\n", current ? current->pid : 0, p->pid);
+       printk("[PID %d] freeing proc: %d\n", current ? current->pid : 0, p->pid);
        // All parts of the kernel should have decref'd before __proc_free is called
        assert(p->env_refcnt == 0);
 
-       proc_free_arch(p);
+       frontend_proc_free(p);
 
        // Free any colors allocated to this process
        if(p->cache_colors_map != global_cache_colors_map) {