This commit is contained in:
kolya 2008-10-15 05:15:32 +00:00
parent c100d9ee2d
commit deca9fef83

38
proc.h
View file

@ -24,19 +24,19 @@ enum proc_state { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE };
// Per-process state // Per-process state
struct proc { struct proc {
char *mem; // Start of process memory (kernel address) char *mem; // Start of process memory (kernel address)
uint sz; // Size of process memory (bytes) uint sz; // Size of process memory (bytes)
char *kstack; // Bottom of kernel stack for this process char *kstack; // Bottom of kernel stack for this process
enum proc_state state; // Process state enum proc_state state; // Process state
int pid; // Process ID int pid; // Process ID
struct proc *parent; // Parent process struct proc *parent; // Parent process
void *chan; // If non-zero, sleeping on chan void *chan; // If non-zero, sleeping on chan
int killed; // If non-zero, have been killed int killed; // If non-zero, have been killed
struct file *ofile[NOFILE]; // Open files struct file *ofile[NOFILE]; // Open files
struct inode *cwd; // Current directory struct inode *cwd; // Current directory
struct context *context; // Switch here to run process struct context *context; // Switch here to run process
struct trapframe *tf; // Trap frame for current syscall struct trapframe *tf; // Trap frame for current syscall
char name[16]; // Process name (debugging) char name[16]; // Process name (debugging)
}; };
// Process memory is laid out contiguously, low addresses first: // Process memory is laid out contiguously, low addresses first:
@ -47,14 +47,14 @@ struct proc {
// Per-CPU state // Per-CPU state
struct cpu { struct cpu {
uchar apicid; // Local APIC ID uchar apicid; // Local APIC ID
struct proc *curproc; // Process currently running. struct proc *curproc; // Process currently running.
struct context *context; // Switch here to enter scheduler struct context *context; // Switch here to enter scheduler
struct taskstate ts; // Used by x86 to find stack for interrupt struct taskstate ts; // Used by x86 to find stack for interrupt
struct segdesc gdt[NSEGS]; // x86 global descriptor table struct segdesc gdt[NSEGS]; // x86 global descriptor table
volatile uint booted; // Has the CPU started? volatile uint booted; // Has the CPU started?
int ncli; // Depth of pushcli nesting. int ncli; // Depth of pushcli nesting.
int intena; // Were interrupts enabled before pushcli? int intena; // Were interrupts enabled before pushcli?
}; };
extern struct cpu cpus[NCPU]; extern struct cpu cpus[NCPU];