kern

changeset 53:23abbeea4d5f

llalallalala
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 08 Aug 2011 09:53:10 +0300
parents fa65b4f45366
children 4eaecb14fe31
files src/proc.c src/proc.h src/sched.c
diffstat 3 files changed, 9 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/src/proc.c	Sun Aug 07 06:42:00 2011 +0300
     1.2 +++ b/src/proc.c	Mon Aug 08 09:53:10 2011 +0300
     1.3 @@ -53,22 +53,20 @@
     1.4  		panic("failed to allocate user stack page\n");
     1.5  	}
     1.6  	proc[1].ctx.stack_ptr = PAGE_TO_ADDR(stack_pg) + PGSIZE;
     1.7 -
     1.8 -	proc[1].stack_end = KMEM_START;
     1.9 -	proc[1].stack_start = KMEM_START - PGSIZE;
    1.10 +	proc[1].stack_start_pg = stack_pg;
    1.11  
    1.12  	/* create the virtual address space for this process */
    1.13 -	proc[1].ctx.pgtbl_paddr = clone_vm();
    1.14 +	/*proc[1].ctx.pgtbl_paddr = clone_vm();*/
    1.15  
    1.16  	/* we don't need the image and the stack in this address space */
    1.17 -	unmap_page_range(img_start_pg, proc_size_pg);
    1.18 +	/*unmap_page_range(img_start_pg, proc_size_pg);
    1.19  	pgfree(img_start_pg, proc_size_pg);
    1.20  
    1.21  	unmap_page(stack_pg);
    1.22 -	pgfree(stack_pg, 1);
    1.23 +	pgfree(stack_pg, 1);*/
    1.24  
    1.25  	/* add it to the scheduler queues */
    1.26 -	add_proc(1, STATE_RUNNING);
    1.27 +	add_proc(1, STATE_RUNNABLE);
    1.28  
    1.29  	/* switch to the initial process, this never returns */
    1.30  	context_switch(1);
     2.1 --- a/src/proc.h	Sun Aug 07 06:42:00 2011 +0300
     2.2 +++ b/src/proc.h	Mon Aug 08 09:53:10 2011 +0300
     2.3 @@ -16,7 +16,7 @@
     2.4  };
     2.5  
     2.6  enum proc_state {
     2.7 -	STATE_RUNNING,
     2.8 +	STATE_RUNNABLE,
     2.9  	STATE_BLOCKED,
    2.10  	STATE_ZOMBIE
    2.11  };
     3.1 --- a/src/sched.c	Sun Aug 07 06:42:00 2011 +0300
     3.2 +++ b/src/sched.c	Mon Aug 08 09:53:10 2011 +0300
     3.3 @@ -62,7 +62,7 @@
     3.4  
     3.5  	proc = get_process(pid);
     3.6  
     3.7 -	q = state == STATE_RUNNING ? &runq : &waitq;
     3.8 +	q = state == STATE_RUNNABLE ? &runq : &waitq;
     3.9  
    3.10  	ins_back(q, proc);
    3.11  	proc->state = state;
    3.12 @@ -76,7 +76,7 @@
    3.13  	int istate;
    3.14  	struct process *proc = get_process(pid);
    3.15  
    3.16 -	if(proc->state != STATE_RUNNING) {
    3.17 +	if(proc->state != STATE_RUNNABLE) {
    3.18  		printf("block_proc: process %d not running\n", pid);
    3.19  		return -1;
    3.20  	}
    3.21 @@ -107,7 +107,7 @@
    3.22  
    3.23  	remove(&waitq, proc);
    3.24  	ins_back(&runq, proc);
    3.25 -	proc->state = STATE_RUNNING;
    3.26 +	proc->state = STATE_RUNNABLE;
    3.27  
    3.28  	set_intr_state(istate);
    3.29  	return 0;