Watt-32 tcp/ip  2.2 dev-rel.10
register.h
Go to the documentation of this file.
1 
14 #ifndef _w32_REGISTER_H
15 #define _w32_REGISTER_H
16 
17 /*
18  * Definition related to EFLAGS.
19  */
20 #define EFLAGS_CARRY 0x1
21 #define EFLAGS_PARITY 0x4
22 
23 #define EFLAGS_AUX_CARRY 0x10
24 #define EFLAGS_ZERO 0x40
25 #define EFLAGS_SIGN 0x80
26 
27 #define EFLAGS_TRAP 0x100
28 #define EFLAGS_INTR_ENABLE 0x200
29 #define EFLAGS_DIRECTION 0x400
30 #define EFLAGS_OVERFLOW 0x800
31 
32 #define EFLAGS_IOPL_MASK 0x3000
33 #define EFLAGS_NESTED_TASK 0x8000
34 
35 #define EFLAGS_RESUME 0x10000
36 #define EFLAGS_VIRTUAL_MODE 0x20000
37 #define EFLAGS_ALIGN_CHECK 0x40000
38 #define EFLAGS_VIRTUAL_INTR 0x80000
39 
40 #define EFLAGS_VIRTUAL_INTR_PEND 0x100000
41 #define EFLAGS_ID 0x200000
42 
43 /*
44  * Definitions related to CR0.
45  */
46 #define CR0_PROTECTION_ENABLE 0x1
47 #define CR0_MONITOR_COPROC 0x2
48 #define CR0_COPROC_SOFT_EMUL 0x4
49 #define CR0_FLOATING_INSTR_EXCEPTION 0x8
50 
51 #define CR0_EXTENSION_TYPE 0x10
52 #define CR0_NUMERIC_ERROR 0x20
53 
54 #define CR0_WRITE_PROTECT 0x10000
55 #define CR0_ALIGMENT_MASK 0x40000
56 
57 #define CR0_NO_WRITE_THROUGH 0x20000000
58 #define CR0_PAGE_LEVEL_CACHE_DISABLE 0x40000000
59 #define CR0_PAGING 0x80000000
60 
61 #if defined(IN_ASM_FILE)
62  #if defined(__DJGPP__)
63  #include <machine/asm.h>
64  /* Use only after ".data" */
65  #define DATA(x,type) .align 2; .globl _##x; _##x: type
66  #else
67  #define ENTRY(f) .text; .p2align 4,,15; .globl _##f; _##f:
68  #define DATA(x,type) .align 4; .globl _##x; _##x: type
69  #define _C_LABEL(x) _##x
70  #endif
71 
72 #else
73 
74 /*
75  * Definition of eflags registers has a bit field structure.
76  */
77 typedef struct {
78  /*
79  * first byte : bits 0->7
80  */
81  unsigned int carry : 1;
82  unsigned int : 1;
83  unsigned int parity : 1;
84  unsigned int : 1;
85 
86  unsigned int auxiliary_carry : 1;
87  unsigned int : 1;
88  unsigned int zero : 1; /* result is zero */
89  unsigned int sign : 1; /* result is less than zero */
90  /*
91  * Second byte : bits 7->15
92  */
93  unsigned int trap : 1;
94  unsigned int intr_enable : 1; /* set => intr on */
95  unsigned int direction : 1; /* set => autodecrement */
96  unsigned int overflow : 1;
97 
98  unsigned int IO_privilege : 2;
99  unsigned int nested_task : 1;
100  unsigned int : 1;
101  /*
102  * Third byte : bits 15->23
103  */
104  unsigned int resume : 1;
105  unsigned int virtual_mode : 1;
106  unsigned int aligment_check : 1;
107  unsigned int virtual_intr : 1;
108  unsigned int virtual_intr_pending : 1;
109  unsigned int id : 1;
110  unsigned int : 2;
111  /*
112  * fourth byte : bits 24->31 : UNUSED
113  */
114  unsigned int : 8;
115 } eflags_bits;
116 
117 typedef union {
119  unsigned int i;
120  } eflags;
121 
122 /*
123  * Definition of CR registers has a bit field structure.
124  */
125 typedef struct {
126  /*
127  * first byte : bits 0->7
128  */
129  unsigned int protection_enable : 1;
130  unsigned int monitor_coproc : 1;
131  unsigned int coproc_soft_emul : 1;
132  unsigned int floating_instr_except : 1;
133 
134  unsigned int extension_type : 1;
135  unsigned int numeric_error : 1;
136  unsigned int : 2;
137  /*
138  * second byte 8->15 : UNUSED
139  */
140  unsigned int : 8;
141  /*
142  * third byte 16->23
143  */
144  unsigned int write_protect : 1;
145  unsigned int : 1;
146  unsigned int aligment_mask : 1;
147  unsigned int : 1;
148 
149  unsigned int : 4;
150  /*
151  * fourth byte 24->31
152  */
153  unsigned int : 4;
154  unsigned int : 1;
155  unsigned int no_write_through : 1;
156  unsigned int page_level_cache_disable : 1;
157  unsigned int paging : 1;
158 } cr0_bits;
159 
160 typedef union {
161  cr0_bits cr0;
162  unsigned long i;
163  } cr0;
164 
165 #endif /* IN_ASM_FILE */
166 
167 #endif
168 
Definition: register.h:160