RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
score
cpu
i386
include
rtems
asm.h
Go to the documentation of this file.
1
16
17
/*
18
* COPYRIGHT:
19
*
20
* This file is based on similar code found in newlib available
21
* from ftp.cygnus.com. The file which was used had no copyright
22
* notice. This file is freely distributable as long as the source
23
* of the file is noted. This file is:
24
*
25
* COPYRIGHT (c) 1994-1997.
26
* On-Line Applications Research Corporation (OAR).
27
*/
28
29
#ifndef _RTEMS_ASM_H
30
#define _RTEMS_ASM_H
31
32
/*
33
* Indicate we are in an assembly file and get the basic CPU definitions.
34
*/
35
36
#ifndef ASM
37
#define ASM
38
#endif
39
#include <rtems/score/cpuopts.h>
40
#include <
rtems/score/i386.h
>
41
#include <
rtems/score/percpu.h
>
42
51
52
/*
53
* Recent versions of GNU cpp define variables which indicate the
54
* need for underscores and percents. If not using GNU cpp or
55
* the version does not support this, then you will obviously
56
* have to define these as appropriate.
57
*/
58
59
#ifndef __USER_LABEL_PREFIX__
60
#define __USER_LABEL_PREFIX__
61
#endif
62
63
/*
64
* Looks like there is a bug in gcc 2.6.2 where this is not
65
* defined correctly when configured as i386-coff and
66
* i386-aout.
67
*/
68
69
#undef __REGISTER_PREFIX__
70
#define __REGISTER_PREFIX__ %
71
72
/*
73
#ifndef __REGISTER_PREFIX__
74
#define __REGISTER_PREFIX__
75
#endif
76
*/
77
78
#include <
rtems/concat.h
>
79
80
/* Use the right prefix for global labels. */
81
82
#define SYM(x) CONCAT0 (__USER_LABEL_PREFIX__, x)
83
84
/* Use the right prefix for registers. */
85
86
#define REG(x) CONCAT0 (__REGISTER_PREFIX__, x)
87
88
#define eax REG (eax)
89
#define ebx REG (ebx)
90
#define ecx REG (ecx)
91
#define edx REG (edx)
92
#define esi REG (esi)
93
#define edi REG (edi)
94
#define esp REG (esp)
95
#define ebp REG (ebp)
96
#define cr0 REG (cr0)
97
#define cr4 REG (cr4)
98
99
#define ax REG (ax)
100
#define bx REG (bx)
101
#define cx REG (cx)
102
#define dx REG (dx)
103
#define si REG (si)
104
#define di REG (di)
105
#define sp REG (sp)
106
#define bp REG (bp)
107
108
#define ah REG (ah)
109
#define bh REG (bh)
110
#define ch REG (ch)
111
#define dh REG (dh)
112
113
#define al REG (al)
114
#define bl REG (bl)
115
#define cl REG (cl)
116
#define dl REG (dl)
117
118
#define cs REG (cs)
119
#define ds REG (ds)
120
#define es REG (es)
121
#define fs REG (fs)
122
#define gs REG (gs)
123
#define ss REG (ss)
124
125
/*
126
* Define macros to handle section beginning and ends.
127
*/
128
129
130
#define BEGIN_CODE_DCL .text
131
#define END_CODE_DCL
132
#define BEGIN_DATA_DCL .data
133
#define END_DATA_DCL
134
#define BEGIN_CODE .text
135
#define END_CODE
136
#define BEGIN_DATA .data
137
#define END_DATA
138
#define BEGIN_BSS .bss
139
#define END_BSS
140
#define END
141
142
/*
143
* Following must be tailor for a particular flavor of the C compiler.
144
* They may need to put underscores in front of the symbols.
145
*/
146
147
#define PUBLIC(sym) .globl SYM (sym)
148
#define EXTERN(sym) .globl SYM (sym)
149
150
#ifdef RTEMS_SMP
151
.macro GET_CPU_ID REG
152
.set LAPIC_ID, 0x20
153
.set LAPIC_ID_SHIFT, 0x18L
154
movl
imps_lapic_addr
,\REG
155
movl LAPIC_ID(\REG),\REG
156
shrl $LAPIC_ID_SHIFT,\REG
/* LAPIC_ID in REG */
157
movzbl imps_apic_cpu_map(\REG),\REG
/* CPU ID in REG */
158
.endm
159
160
.macro GET_SELF_CPU_CONTROL REG
161
GET_CPU_ID \REG
162
shll $PER_CPU_CONTROL_SIZE_LOG2,\REG
/* Calculate offset for CPU structure */
163
leal
_Per_CPU_Information
(\REG),\REG
/* Address of info for current CPU in REG */
164
.endm
165
#else
166
.macro GET_CPU_ID REG
167
movl $0,\REG
168
.endm
169
170
.macro GET_SELF_CPU_CONTROL REG
171
leal
_Per_CPU_Information
, \REG
172
.endm
173
#endif
174
176
177
#endif
concat.h
_Per_CPU_Information
CPU_STRUCTURE_ALIGNMENT Per_CPU_Control_envelope _Per_CPU_Information[]
Set of Per CPU Core Information.
Definition
asm.h:171
i386.h
Intel I386 CPU Dependent Source.
percpu.h
This header file provides the interfaces of the Per-CPU Information.
imps_lapic_addr
unsigned imps_lapic_addr
base address of the local apic. Usually 0xFEE00000
Definition
smp-imps.c:202
Generated by
1.18.0