diff options
author | rsc <rsc> | 2007-08-28 12:48:33 +0000 |
---|---|---|
committer | rsc <rsc> | 2007-08-28 12:48:33 +0000 |
commit | 818fc0125e7d73fdf4f1a94f178254e5d05c9831 (patch) | |
tree | 2aefee5aad4478bc570d772a73ee1999d6066b54 /proc.h | |
parent | b52dea08bc1252bd842bf86f34d912c9ab7a02df (diff) | |
download | xv6-labs-818fc0125e7d73fdf4f1a94f178254e5d05c9831.tar.gz xv6-labs-818fc0125e7d73fdf4f1a94f178254e5d05c9831.tar.bz2 xv6-labs-818fc0125e7d73fdf4f1a94f178254e5d05c9831.zip |
replace setjmp/longjmp with swtch
Diffstat (limited to 'proc.h')
-rw-r--r-- | proc.h | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -10,18 +10,18 @@ // Don't need to save all the %fs etc. segment registers, // because they are constant across kernel contexts. // Save all the regular registers so we don't need to care -// which are caller save. -// Don't save %eax, because that's the return register. -// The layout of jmpbuf must match code in setjmp.S. -struct jmpbuf { +// which are caller save, but not the return register %eax. +// (Not saving %eax just simplifies the switching code.) +// The layout of context must match code in swtch.S. +struct context { + int eip; + int esp; int ebx; int ecx; int edx; int esi; int edi; - int esp; int ebp; - int eip; }; enum proc_state { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; @@ -38,7 +38,7 @@ struct proc { int killed; // If non-zero, have been killed struct file *ofile[NOFILE]; // Open files struct inode *cwd; // Current directory - struct jmpbuf jmpbuf; // Jump here to run process + struct context context; // Switch here to run process struct trapframe *tf; // Trap frame for current interrupt char name[16]; // Process name (debugging) }; @@ -61,7 +61,7 @@ extern struct proc *curproc[NCPU]; // Current (running) process per CPU // Per-CPU state struct cpu { uchar apicid; // Local APIC ID - struct jmpbuf jmpbuf; // Jump here to enter scheduler + struct context context; // Switch here to enter scheduler struct taskstate ts; // Used by x86 to find stack for interrupt struct segdesc gdt[NSEGS]; // x86 global descriptor table char mpstack[MPSTACK]; // Per-CPU startup stack |