1 #ifndef THREADS_SWITCH_H
2 #define THREADS_SWITCH_H
5 /* switch_thread()'s stack frame. */
6 struct switch_threads_frame
8 uint32_t edi; /* 0: Saved %edi. */
9 uint32_t esi; /* 4: Saved %esi. */
10 uint32_t ebp; /* 8: Saved %ebp. */
11 uint32_t ebx; /* 12: Saved %ebx. */
12 void (*eip) (void); /* 16: Return address. */
13 struct thread *cur; /* 20: switch_threads()'s CUR argument. */
14 struct thread *next; /* 24: switch_threads()'s NEXT argument. */
17 /* Switches from CUR, which must be the running thread, to NEXT,
18 which must also be running switch_threads(), returning CUR in
20 struct thread *switch_threads (struct thread *cur, struct thread *next);
22 /* Stack frame for switch_entry(). */
23 struct switch_entry_frame
28 void switch_entry (void);
30 /* Pops the CUR and NEXT arguments off the stack, for use in
31 initializing threads. */
32 void switch_thunk (void);
35 /* Offsets used by switch.S. */
37 #define SWITCH_NEXT 24
39 #endif /* threads/switch.h */