source: rtems/c/src/exec/score/cpu/i386/rtems/score/i386.h @ a3f5b6b

Last change on this file since a3f5b6b was a3f5b6b, checked in by Joel Sherrill <joel.sherrill@…>, on 05/28/00 at 20:14:45

Added a special CPU model of "rtems_multilib". This is the beginnings
of an experiment to determine what it will take to multilib most of
RTEMS per GNU multilib conventions. It is thought that only
interrupt processing and IO are not multlib-able. This means that
a BSP Kit should include IRQ processing from score/cpu, all peripheral
support (header files from score/cpu, libchip, and libcpu), and the
BSPs themselves. The rest of RTEMS should be multlib-able. But to do
this, all RTEMS CPU model feature flags must be derivable from gcc
cpp predefines. By configuring the bare bsp with the rtems_multilib
CPU model, you can try any combination of CPU CFLAGS and see well how the
logic in that section of the <CPU>.h works. Once all CPU multilib
variations can be built, then RTEMS proper can be multilib'ed and
separated from the BSPs.

  • Property mode set to 100644
File size: 4.2 KB
Line 
1/*  i386.h
2 *
3 *  This include file contains information pertaining to the Intel
4 *  i386 processor.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#ifndef __i386_h
17#define __i386_h
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/*
24 *  This section contains the information required to build
25 *  RTEMS for a particular member of the Intel i386
26 *  family when executing in protected mode.  It does
27 *  this by setting variables to indicate which implementation
28 *  dependent features are present in a particular member
29 *  of the family.
30 *
31 *  Currently recognized:
32 *    i386_fp    (i386 DX or SX w/i387)
33 *    i386_nofp  (i386 DX or SX w/o i387)
34 *    i486dx
35 *    i486sx
36 *    pentium
37 *    pentiumpro
38 *
39 *  CPU Model Feature Flags:
40 *
41 *  I386_HAS_BSWAP:  Defined to "1" if the instruction for endian swapping
42 *                   (bswap) should be used.  This instruction appears to
43 *                   be present in all i486's and above.
44 *
45 *  I386_HAS_FPU:    Defined to "1" if the CPU has an FPU.
46 *
47 */
48
49#if defined(rtems_multilib)
50/*
51 *  Figure out all CPU Model Feature Flags based upon compiler
52 *  predefines.
53 */
54
55#define CPU_MODEL_NAME  "rtems_multilib"
56#define I386_HAS_FPU   0
57#define I386_HAS_BSWAP 0
58
59#elif defined(i386_fp)
60
61#define CPU_MODEL_NAME  "i386 with i387"
62#define I386_HAS_BSWAP 0
63
64#elif defined(i386_nofp)
65
66#define CPU_MODEL_NAME  "i386 w/o i387"
67#define I386_HAS_FPU   0
68#define I386_HAS_BSWAP 0
69
70#elif defined(i486dx)
71
72#define CPU_MODEL_NAME  "i486dx"
73
74#elif defined(i486sx)
75
76#define CPU_MODEL_NAME  "i486sx"
77#define I386_HAS_FPU 0
78
79#elif defined(pentium)
80
81#define CPU_MODEL_NAME  "Pentium"
82
83#elif defined(pentiumpro)
84
85#define CPU_MODEL_NAME  "Pentium Pro"
86
87#else
88
89#error "Unsupported CPU Model"
90
91#endif
92
93/*
94 *  Set default values for CPU model feature flags
95 *
96 *  NOTE: These settings are chosen to reflect most of the family members.
97 */
98
99#ifndef I386_HAS_FPU
100#define I386_HAS_FPU 1
101#endif
102
103#ifndef I386_HAS_BSWAP
104#define I386_HAS_BSWAP 1
105#endif
106
107/*
108 *  Define the name of the CPU family.
109 */
110
111#define CPU_NAME "Intel i386"
112
113#ifndef ASM
114
115/*
116 *  The following routine swaps the endian format of an unsigned int.
117 *  It must be static so it can be referenced indirectly.
118 */
119
120static inline unsigned int i386_swap_U32(
121  unsigned int value
122)
123{
124  unsigned long lout;
125
126#if (I386_HAS_BSWAP == 0)
127  asm volatile( "rorw  $8,%%ax;"
128                "rorl  $16,%0;"
129                "rorw  $8,%%ax" : "=a" (lout) : "0" (value) );
130#else
131    __asm__ volatile( "bswap %0" : "=r"  (lout) : "0"   (value));
132#endif
133  return( lout );
134}
135
136static inline unsigned int i386_swap_U16(
137  unsigned int value
138)
139{
140    unsigned short      sout;
141
142    __asm__ volatile( "rorw $8,%0" : "=r"  (sout) : "0"   (value));
143    return (sout);
144}
145
146
147/* routines */
148
149/*
150 *  i386_Logical_to_physical
151 *
152 *  Converts logical address to physical address.
153 */
154
155void *i386_Logical_to_physical(
156  unsigned short  segment,
157  void           *address
158);
159
160/*
161 *  i386_Physical_to_logical
162 *
163 *  Converts physical address to logical address.
164 */
165
166void *i386_Physical_to_logical(
167  unsigned short  segment,
168  void           *address
169);
170
171
172/*
173 *  "Simpler" names for a lot of the things defined in this file
174 */
175
176/* segment access routines */
177 
178#define get_cs()   i386_get_cs()
179#define get_ds()   i386_get_ds()
180#define get_es()   i386_get_es()
181#define get_ss()   i386_get_ss()
182#define get_fs()   i386_get_fs()
183#define get_gs()   i386_get_gs()
184 
185#define CPU_swap_u32( _value )  i386_swap_U32( _value )
186#define CPU_swap_u16( _value )  i386_swap_U16( _value )
187 
188/* i80x86 I/O instructions */
189 
190#define outport_byte( _port, _value ) i386_outport_byte( _port, _value )
191#define outport_word( _port, _value ) i386_outport_word( _port, _value )
192#define outport_long( _port, _value ) i386_outport_long( _port, _value )
193#define inport_byte( _port, _value )  i386_inport_byte( _port, _value )
194#define inport_word( _port, _value )  i386_inport_word( _port, _value )
195#define inport_long( _port, _value )  i386_inport_long( _port, _value )
196 
197
198#ifdef __cplusplus
199}
200#endif
201
202#endif /* !ASM */
203
204#endif
205/* end of include file */
Note: See TracBrowser for help on using the repository browser.