xv6/proc.c File Reference

#include "types.h"
#include "defs.h"
#include "param.h"
#include "mmu.h"
#include "x86.h"
#include "proc.h"
#include "spinlock.h"

Go to the source code of this file.

Functions

void forkret (void)
void trapret (void)
void pinit (void)
void procdump (void)
void ksegment (void)
void usegment (void)
static struct procallocproc (void)
void userinit (void)
int growproc (int n)
int fork (void)
void scheduler (void)
void sched (void)
void yield (void)
void sleep (void *chan, struct spinlock *lk)
static void wakeup1 (void *chan)
void wakeup (void *chan)
int kill (int pid)
void exit (void)
int wait (void)

Variables

struct {
   struct spinlock   lock
   struct proc   proc [NPROC]
ptable
static struct procinitproc
int nextpid = 1


Function Documentation

static struct proc* allocproc ( void   )  [static, read]

void exit ( void   ) 

int fork ( void   ) 

void forkret ( void   ) 

Definition at line 302 of file proc.c.

References ptable, and release().

Referenced by allocproc().

int growproc ( int  n  ) 

Definition at line 174 of file proc.c.

References kalloc(), kfree(), memmove(), memset(), and usegment().

Referenced by sys_sbrk().

int kill ( int  pid  ) 

Definition at line 372 of file proc.c.

References acquire(), proc::killed, NPROC, proc::pid, ptable, release(), RUNNABLE, SLEEPING, and proc::state.

Referenced by main(), preempt(), and sys_kill().

void ksegment ( void   ) 

Definition at line 65 of file proc.c.

References cpu::cpu, cpunum(), cpus, cpu::gdt, lgdt(), loadgs(), SEG, SEG_KCODE, SEG_KCPU, SEG_KDATA, STA_R, STA_W, and STA_X.

Referenced by mpmain().

void pinit ( void   ) 

Definition at line 21 of file proc.c.

References initlock(), and ptable.

Referenced by mpmain().

void procdump ( void   ) 

void sched ( void   ) 

Definition at line 271 of file proc.c.

References FL_IF, holding(), panic(), ptable, readeflags(), RUNNING, and swtch().

Referenced by exit(), sleep(), and yield().

void scheduler ( void   ) 

Definition at line 237 of file proc.c.

References acquire(), NPROC, ptable, release(), RUNNABLE, RUNNING, proc::state, sti(), swtch(), and usegment().

void sleep ( void *  chan,
struct spinlock lk 
)

Definition at line 313 of file proc.c.

References acquire(), panic(), ptable, release(), sched(), and SLEEPING.

Referenced by bget(), consoleread(), iderw(), ilock(), main(), piperead(), pipewrite(), sys_sleep(), and wait().

void trapret ( void   ) 

Referenced by allocproc().

void usegment ( void   ) 

Definition at line 83 of file proc.c.

References DPL_USER, KSTACKSIZE, ltr(), popcli(), pushcli(), SEG, SEG16, SEG_KDATA, SEG_TSS, SEG_UCODE, SEG_UDATA, STA_R, STA_W, STA_X, and STS_T32A.

Referenced by exec(), growproc(), and scheduler().

void userinit ( void   ) 

int wait ( void   ) 

void wakeup ( void *  chan  ) 

Definition at line 361 of file proc.c.

References acquire(), ptable, release(), and wakeup1().

Referenced by brelse(), consoleintr(), ideintr(), iput(), iunlock(), pipeclose(), piperead(), pipewrite(), and trap().

static void wakeup1 ( void *  chan  )  [static]

Definition at line 350 of file proc.c.

References proc::chan, NPROC, ptable, RUNNABLE, SLEEPING, and proc::state.

Referenced by exit(), and wakeup().

void yield ( void   ) 

Definition at line 291 of file proc.c.

References acquire(), ptable, release(), RUNNABLE, and sched().

Referenced by trap().


Variable Documentation

struct proc* initproc [static]

Definition at line 14 of file proc.c.

struct spinlock lock

Definition at line 10 of file proc.c.

int nextpid = 1

Definition at line 16 of file proc.c.

Referenced by allocproc().

struct proc proc[NPROC]

Definition at line 11 of file proc.c.

struct { ... } ptable


Generated on Fri Jan 7 12:25:49 2011 for xv6 by  doxygen 1.5.6