OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [powerpc/] [arch/] [v2_0/] [include/] [arch.inc] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
##=============================================================================
2
##
3
##      arch.inc
4
##
5
##      PowerPC architecture assembler header file
6
##
7
##=============================================================================
8
#####ECOSGPLCOPYRIGHTBEGIN####
9
## -------------------------------------------
10
## This file is part of eCos, the Embedded Configurable Operating System.
11
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
##
13
## eCos is free software; you can redistribute it and/or modify it under
14
## the terms of the GNU General Public License as published by the Free
15
## Software Foundation; either version 2 or (at your option) any later version.
16
##
17
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
## for more details.
21
##
22
## You should have received a copy of the GNU General Public License along
23
## with eCos; if not, write to the Free Software Foundation, Inc.,
24
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
##
26
## As a special exception, if other files instantiate templates or use macros
27
## or inline functions from this file, or you compile this file and link it
28
## with other works to produce a work based on this file, this file does not
29
## by itself cause the resulting work to be covered by the GNU General Public
30
## License. However the source code for this file must still be made available
31
## in accordance with section (3) of the GNU General Public License.
32
##
33
## This exception does not invalidate any other reasons why a work based on
34
## this file might be covered by the GNU General Public License.
35
##
36
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
## at http://sources.redhat.com/ecos/ecos-license/
38
## -------------------------------------------
39
#####ECOSGPLCOPYRIGHTEND####
40
##=============================================================================
41
#######DESCRIPTIONBEGIN####
42
##
43
## Author(s):   nickg
44
## Contributors:nickg
45
## Date:        1997-10-16
46
## Purpose:     PowerPC definitions.
47
## Description: This file contains various definitions and macros that are
48
##              useful for writing assembly code for the PowerPC
49
##              It also includes the variant assembly header file.
50
## Usage:
51
##              #include 
52
##              ...
53
##
54
##
55
######DESCRIPTIONEND####
56
##
57
##=============================================================================
58
 
59
#include 
60
#include 
61
 
62
#------------------------------------------------------------------------------
63
# Easier to read names for the registers
64
 
65
        .equ    r0, 0
66
        .equ    r1, 1
67
        .equ    r2, 2
68
        .equ    r3, 3
69
        .equ    r4, 4
70
        .equ    r5, 5
71
        .equ    r6, 6
72
        .equ    r7, 7
73
        .equ    r8, 8
74
        .equ    r9, 9
75
        .equ    r10, 10
76
        .equ    r11, 11
77
        .equ    r12, 12
78
        .equ    r13, 13
79
        .equ    r14, 14
80
        .equ    r15, 15
81
        .equ    r16, 16
82
        .equ    r17, 17
83
        .equ    r18, 18
84
        .equ    r19, 19
85
        .equ    r20, 20
86
        .equ    r21, 21
87
        .equ    r22, 22
88
        .equ    r23, 23
89
        .equ    r24, 24
90
        .equ    r25, 25
91
        .equ    r26, 26
92
        .equ    r27, 27
93
        .equ    r28, 28
94
        .equ    r29, 29
95
        .equ    r30, 30
96
        .equ    r31, 31
97
 
98
        .equ    sp, r1
99
 
100
#ifdef CYGHWR_HAL_POWERPC_FPU
101
        .equ    f0, 0
102
        .equ    f1, 1
103
        .equ    f2, 2
104
        .equ    f3, 3
105
        .equ    f4, 4
106
        .equ    f5, 5
107
        .equ    f6, 6
108
        .equ    f7, 7
109
        .equ    f8, 8
110
        .equ    f9, 9
111
        .equ    f10, 10
112
        .equ    f11, 11
113
        .equ    f12, 12
114
        .equ    f13, 13
115
        .equ    f14, 14
116
        .equ    f15, 15
117
        .equ    f16, 16
118
        .equ    f17, 17
119
        .equ    f18, 18
120
        .equ    f19, 19
121
        .equ    f20, 20
122
        .equ    f21, 21
123
        .equ    f22, 22
124
        .equ    f23, 23
125
        .equ    f24, 24
126
        .equ    f25, 25
127
        .equ    f26, 26
128
        .equ    f27, 27
129
        .equ    f28, 28
130
        .equ    f29, 29
131
        .equ    f30, 30
132
        .equ    f31, 31
133
#endif
134
 
135
 
136
#------------------------------------------------------------------------------
137
# Some useful coding macros
138
 
139
        # Load immediate word, has to be done with 2 instructions
140
        .macro  lwi     reg,val
141
        lis     \reg,\val@H
142
        ori     \reg,\reg,\val@L
143
        .endm
144
 
145
#ifdef CYGPKG_HAL_POWERPC_PPC603
146
        # Move from HID0 hw control register
147
        .macro  mfhid0 reg
148
        mfspr   \reg,HID0
149
        .endm
150
#endif
151
 
152
#define FUNC_START(name)        \
153
        .type name,@function;   \
154
        .globl name;            \
155
name:
156
 
157
#define FUNC_END(name)          \
158
        /* nothing for now */
159
 
160
##-----------------------------------------------------------------------------
161
## PowerPC FPU state handling
162
## The PowerPC ABI defines f14-f31 as callee saved. There is thus no need to
163
## save them when calling C functions
164
 
165
#ifdef CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT
166
# define MAX_SAVE_FREG    13
167
#else
168
# define MAX_SAVE_FREG    31
169
#endif
170
 
171
        .macro  hal_fpu_save regs
172
#ifdef CYGHWR_HAL_POWERPC_FPU
173
        .set _freg, 0
174
        .rept MAX_SAVE_FREG+1
175
        stfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(\regs)
176
        .set _freg, _freg+1
177
        .endr
178
#endif
179
        .endm
180
 
181
        .macro  hal_fpu_load regs
182
#ifdef CYGHWR_HAL_POWERPC_FPU
183
        .set _freg, 0
184
        .rept MAX_SAVE_FREG+1
185
        lfd _freg,(CYGARC_PPCREG_FREGS+_freg*8)(\regs)
186
        .set _freg, _freg+1
187
        .endr
188
#endif
189
        .endm
190
 
191
##-----------------------------------------------------------------------------
192
## CPU specific macros. These provide a common assembler interface to
193
## operations that may have CPU specific implementations on different
194
## variants of the architecture.
195
 
196
        # Enable interrupts
197
        .macro hal_cpu_int_enable
198
        mfmsr   r0
199
        ori     r3,r3,0x8000
200
        rlwimi  r0,r3,0,16,16
201
        sync
202
        mtmsr   r0
203
        sync
204
        .endm
205
 
206
        # Disable interrupts
207
        .macro hal_cpu_int_disable
208
        mfmsr   r0
209
        li      r3,0
210
        rlwimi  r0,r3,0,16,16
211
        sync
212
        mtmsr   r0
213
        sync
214
        .endm
215
 
216
        # Merge the interrupt enable state of the status register in
217
        # \sr with the current sr.
218
        .macro  hal_cpu_int_merge sr
219
        mfmsr   r0
220
        rlwimi  r0,\sr,0,16,16
221
        sync
222
        mtmsr   r0
223
        sync
224
        .endm
225
 
226
#------------------------------------------------------------------------------
227
# end of arch.inc

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.