root / lab4 / .minix-src / include / i386 / stackframe.h @ 14
History | View | Annotate | Download (1.67 KB)
1 |
#ifndef STACK_FRAME_H
|
---|---|
2 |
#define STACK_FRAME_H
|
3 |
|
4 |
#include <sys/types.h> |
5 |
|
6 |
typedef unsigned reg_t; /* machine register */ |
7 |
typedef reg_t segdesc_t;
|
8 |
|
9 |
/* The stack frame layout is determined by the software, but for efficiency
|
10 |
* it is laid out so the assembly code to use it is as simple as possible.
|
11 |
* 80286 protected mode and all real modes use the same frame, built with
|
12 |
* 16-bit registers. Real mode lacks an automatic stack switch, so little
|
13 |
* is lost by using the 286 frame for it. The 386 frame differs only in
|
14 |
* having 32-bit registers and more segment registers. The same names are
|
15 |
* used for the larger registers to avoid differences in the code.
|
16 |
*/
|
17 |
struct stackframe_s {
|
18 |
u16_t gs; /* last item pushed by save */
|
19 |
u16_t fs; /* ^ */
|
20 |
u16_t es; /* | */
|
21 |
u16_t ds; /* | */
|
22 |
reg_t di; /* di through cx are not accessed in C */
|
23 |
reg_t si; /* order is to match pusha/popa */
|
24 |
reg_t fp; /* bp */
|
25 |
/* reg_t st; */ /* hole for another copy of sp */ |
26 |
reg_t bx; /* | */
|
27 |
reg_t dx; /* | */
|
28 |
reg_t cx; /* | */
|
29 |
reg_t retreg; /* ax and above are all pushed by save */
|
30 |
/* reg_t retadr; */ /* return address for assembly code save() */ |
31 |
reg_t pc; /* ^ last item pushed by interrupt */
|
32 |
reg_t cs; /* | */
|
33 |
reg_t psw; /* | */
|
34 |
reg_t sp; /* | */
|
35 |
reg_t ss; /* these are pushed by CPU during interrupt */
|
36 |
}; |
37 |
|
38 |
#endif /* #ifndef STACK_FRAME_H */ |