00001 #ifndef THREADS_SWITCH_H 00002 //3272679800878 00003 #define THREADS_SWITCH_H 00004 00005 #ifndef __ASSEMBLER__ 00006 /* switch_thread()'s stack frame. */ 00007 struct switch_threads_frame 00008 { 00009 uint32_t edi; /* 0: Saved %edi. */ 00010 uint32_t esi; /* 4: Saved %esi. */ 00011 uint32_t ebp; /* 8: Saved %ebp. */ 00012 uint32_t ebx; /* 12: Saved %ebx. */ 00013 void (*eip) (void); /* 16: Return address. */ 00014 struct thread *cur; /* 20: switch_threads()'s CUR argument. */ 00015 struct thread *next; /* 24: switch_threads()'s NEXT argument. */ 00016 }; 00017 00018 /* Switches from CUR, which must be the running thread, to NEXT, 00019 which must also be running switch_threads(), returning CUR in 00020 NEXT's context. */ 00021 struct thread *switch_threads (struct thread *cur, struct thread *next); 00022 00023 /* Stack frame for switch_entry(). */ 00024 struct switch_entry_frame 00025 { 00026 void (*eip) (void); 00027 }; 00028 00029 void switch_entry (void); 00030 00031 /* Pops the CUR and NEXT arguments off the stack, for use in 00032 initializing threads. */ 00033 void switch_thunk (void); 00034 #endif 00035 00036 /* Offsets used by switch.S. */ 00037 #define SWITCH_CUR 20 00038 #define SWITCH_NEXT 24 00039 00040 #endif /* threads/switch.h */