source: rtems/c/src/lib/libcpu/i386/registers.h @ ab0df696

4.104.114.84.95
Last change on this file since ab0df696 was ab0df696, checked in by Joel Sherrill <joel.sherrill@…>, on 08/05/98 at 15:15:46

Automatic CPU type detection code from Eric Valette <valette@…>.
Enabled on the pc386.

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[ab0df696]1/* registers.h
2 * 
3 *  This file contains definition and constants related to Intel Cpu
4 *
5 *  COPYRIGHT (c) 1998 valette@crf.canon.fr
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id$
12 */
13
14#ifndef _LIBCPU_i386_REGISTERS_H
15#define _LIBCPU_i386_REGISTERS_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#ifndef ASM
62
63/*
64 * definition of eflags registers has a bit field structure
65 */
66typedef struct {
67  /*
68   * fist byte : bits 0->7
69   */
70  unsigned int carry                    : 1;
71  unsigned int                          : 1;
72  unsigned int parity                   : 1;
73  unsigned int                          : 1;
74
75  unsigned int auxiliary_carry          : 1;
76  unsigned int                          : 1;
77  unsigned int zero                     : 1;    /* result is zero */
78  unsigned int sign                     : 1;    /* result is less than zero */
79  /*
80   * Second byte : bits 7->15
81   */
82  unsigned int trap                     : 1;
83  unsigned int intr_enable              : 1;    /* set => intr on */
84  unsigned int direction                : 1;    /* set => autodecrement */
85  unsigned int overflow                 : 1;
86
87  unsigned int IO_privilege             : 2;
88  unsigned int nested_task              : 1;
89  unsigned int                          : 1;
90  /*
91   * Third byte : bits 15->23
92   */
93  unsigned int resume                   : 1;
94  unsigned int virtual_mode             : 1;
95  unsigned int aligment_check           : 1;
96  unsigned int virtual_intr             : 1;
97
98  unsigned int virtual_intr_pending     : 1;
99  unsigned int id                       : 1;
100  unsigned int                          : 2;
101 
102  /*
103   * fourth byte : bits 24->31 : UNUSED
104   */
105  unsigned int                          : 8;
106}eflags_bits;
107
108typedef union {
109  eflags_bits   eflags;
110  unsigned int  i;
111}eflags;
112/*
113 * definition of eflags registers has a bit field structure
114 */
115typedef struct {
116  /*
117   * fist byte : bits 0->7
118   */
119  unsigned int protection_enable        : 1;
120  unsigned int monitor_coproc           : 1;
121  unsigned int coproc_soft_emul         : 1;
122  unsigned int floating_instr_except    : 1;
123 
124  unsigned int extension_type           : 1;
125  unsigned int numeric_error            : 1;
126  unsigned int                          : 2;
127  /*
128   * second byte 8->15 : UNUSED
129   */
130  unsigned int                          : 8;
131  /*
132   * third byte 16->23
133   */
134  unsigned int write_protect            : 1;
135  unsigned int                          : 1;
136  unsigned int aligment_mask            : 1;
137  unsigned int                          : 1;
138
139  unsigned int                          : 4;
140  /*
141   * fourth byte 24->31
142   */
143  unsigned int                          : 4;
144 
145  unsigned int                          : 1;
146  unsigned int no_write_through         : 1;
147  unsigned int page_level_cache_disable : 1;
148  unsigned int paging   : 1;
149}cr0_bits;
150
151typedef union {
152  cr0_bits      cr0;
153  unsigned int  i;
154}cr0;
155
156#endif
157
158#endif
159
Note: See TracBrowser for help on using the repository browser.