forked from yuwumichcn223/pintos
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathswitch.h
39 lines (32 loc) · 1.14 KB
/
switch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef THREADS_SWITCH_H
#define THREADS_SWITCH_H
#ifndef __ASSEMBLER__
/* switch_thread()'s stack frame. */
struct switch_threads_frame
{
uint32_t edi; /* 0: Saved %edi. */
uint32_t esi; /* 4: Saved %esi. */
uint32_t ebp; /* 8: Saved %ebp. */
uint32_t ebx; /* 12: Saved %ebx. */
void (*eip) (void); /* 16: Return address. */
struct thread *cur; /* 20: switch_threads()'s CUR argument. */
struct thread *next; /* 24: switch_threads()'s NEXT argument. */
};
/* Switches from CUR, which must be the running thread, to NEXT,
which must also be running switch_threads(), returning CUR in
NEXT's context. */
struct thread *switch_threads (struct thread *cur, struct thread *next);
/* Stack frame for switch_entry(). */
struct switch_entry_frame
{
void (*eip) (void);
};
void switch_entry (void);
/* Pops the CUR and NEXT arguments off the stack, for use in
initializing threads. */
void switch_thunk (void);
#endif
/* Offsets used by switch.S. */
#define SWITCH_CUR 20
#define SWITCH_NEXT 24
#endif /* threads/switch.h */