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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [or32/] [kernel/] [misc.S] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1624 jcastillo
#include 
2
#include 
3
 
4
        .text
5
/*
6
 * Enable interrupts
7
 *      sti()
8
 */
9
        .global _sti
10
_sti:
11
        l.mfspr r3,r0,SPR_SR
12
        l.ori r3,r3,(SPR_SR_IEE | SPR_SR_TEE)
13
        l.mtspr r0,r3,SPR_SR
14
        l.jr    r9
15
        l.nop
16
 
17
/*
18
 * Disable interrupts
19
 *      cli()
20
 */
21
        .global _cli
22
_cli:
23
        l.addi r4,r0,-1
24
        l.xori r4,r4,(SPR_SR_IEE | SPR_SR_TEE)
25
        l.mfspr r3,r0,SPR_SR
26
        l.and r3,r3,r4
27
        l.mtspr r0,r3,SPR_SR
28
        l.jr    r9
29
        l.nop
30
 
31
/*
32
 * Get 'flags' (aka status register)
33
 *      __save_flags(long *ptr)
34
 */
35
        .global ___save_flags
36
___save_flags:
37
        l.mfspr r4,r0,SPR_SR
38
        l.sw    0(r3),r4
39
        l.jr    r9
40
        l.nop
41
 
42
/*
43
 * Restore 'flags'
44
 *      __restore_flags(long val)
45
 */
46
        .global ___restore_flags
47
___restore_flags:
48
        l.mtspr r0,r3,SPR_SR
49
        l.jr    r9
50
        l.nop
51
 
52
/*
53
 * SPR write
54
 *      mtspr(long add, long val)
55
 */
56
        .global _mtspr
57
_mtspr:
58
        l.mtspr r3,r4,0
59
        l.jr    r9
60
        l.nop
61
 
62
/*
63
 * SPR read
64
 *      mtspr(long add)
65
 */
66
        .global _mfspr
67
_mfspr:
68
        l.mfspr r11,r3,0
69
        l.jr    r9
70
        l.nop
71
 
72
/*
73
 * Instruction cache enable
74
 *      ic_enable()
75
 */
76
        .global _ic_enable
77
_ic_enable:
78
  /* Disable IC */
79
  l.mfspr r13,r0,SPR_SR
80
  l.addi  r11,r0,-1
81
  l.xori  r11,r11,SPR_SR_ICE
82
  l.and   r11,r13,r11
83
  l.mtspr r0,r11,SPR_SR
84
 
85
  /* Invalidate IC */
86
  l.addi  r13,r0,0
87
  l.addi  r11,r0,IC_SIZE
88
1:
89
  l.mtspr r0,r13,SPR_ICBIR
90
  l.sfne  r13,r11
91
  l.bf    1b
92
  l.addi  r13,r13,IC_LINE
93
 
94
  /* Enable IC */
95
  l.mfspr r13,r0,SPR_SR
96
  l.ori   r13,r13,SPR_SR_ICE
97
  l.mtspr r0,r13,SPR_SR
98
  l.nop
99
  l.nop
100
  l.nop
101
  l.nop
102
  l.nop
103
 
104
  l.jr    r9
105
  l.nop
106
 
107
/*
108
 * Instruction cache disable
109
 *      ic_disable()
110
 */
111
        .global _ic_disable
112
_ic_disable:
113
  /* Disable IC */
114
  l.mfspr r13,r0,SPR_SR
115
  l.addi  r11,r0,-1
116
  l.xori  r11,r11,SPR_SR_ICE
117
  l.and   r11,r13,r11
118
  l.mtspr r0,r11,SPR_SR
119
 
120
  l.jr    r9
121
  l.nop
122
 
123
/*
124
 * Instruction cache invalidate
125
 *      ic_flush()
126
 */
127
        .global _ic_invalidate
128
_ic_invalidate:
129
  /* Disable IC */
130
  l.mfspr r13,r0,SPR_SR
131
  l.addi  r11,r0,-1
132
  l.xori  r11,r11,SPR_SR_ICE
133
  l.and   r11,r13,r11
134
  l.mtspr r0,r11,SPR_SR
135
 
136
  /* Invalidate IC */
137
  l.addi  r13,r0,0
138
  l.addi  r11,r0,IC_SIZE
139
1:
140
  l.mtspr r0,r13,SPR_ICBIR
141
  l.sfne  r13,r11
142
  l.bf    1b
143
  l.addi  r13,r13,IC_LINE
144
 
145
  /* Enable IC */
146
  l.mfspr r13,r0,SPR_SR
147
  l.ori   r13,r13,SPR_SR_ICE
148
  l.mtspr r0,r13,SPR_SR
149
  l.nop
150
  l.nop
151
  l.nop
152
  l.nop
153
  l.nop
154
 
155
  l.jr    r9
156
  l.nop
157
 
158
/*
159
 * Data cache enable
160
 *      dc_enable()
161
 */
162
        .global _dc_enable
163
_dc_enable:
164
  /* Disable DC */
165
  l.mfspr r13,r0,SPR_SR
166
  l.addi  r11,r0,-1
167
  l.xori  r11,r11,SPR_SR_DCE
168
  l.and   r11,r13,r11
169
  l.mtspr r0,r11,SPR_SR
170
 
171
  /* Flush DC */
172
  l.addi  r13,r0,0
173
  l.addi  r11,r0,DC_SIZE
174
1:
175
  l.mtspr r0,r13,SPR_DCBIR
176
  l.sfne  r13,r11
177
  l.bf    1b
178
  l.addi  r13,r13,DC_LINE
179
 
180
  /* Enable DC */
181
  l.mfspr r13,r0,SPR_SR
182
  l.ori   r13,r13,SPR_SR_DCE
183
  l.mtspr r0,r13,SPR_SR
184
 
185
  l.jr    r9
186
  l.nop
187
 
188
/*
189
 * Data cache disable
190
 *      dc_disable()
191
 */
192
        .global _dc_disable
193
_dc_disable:
194
  /* Disable DC */
195
  l.mfspr r13,r0,SPR_SR
196
  l.addi  r11,r0,-1
197
  l.xori  r11,r11,SPR_SR_DCE
198
  l.and   r11,r13,r11
199
  l.mtspr r0,r11,SPR_SR
200
 
201
  l.jr    r9
202
  l.nop
203
 
204
/*
205
 * Invalidate data cache line
206
 *      dc_line_invalidate(long ph_add)
207
 */
208
        .global _dc_line_invalidate
209
_dc_line_invalidate:
210
  l.mfspr r4,r0,SPR_SR
211
  l.addi  r5,r0,-1
212
  l.xori  r5,r5,SPR_SR_DCE
213
  l.and   r5,r4,r5
214
  l.mtspr r0,r5,SPR_SR
215
  l.mtspr r0,r3,SPR_DCBIR
216
  l.mtspr r0,r4,SPR_SR
217
  l.jr    r9
218
  l.nop
219
 
220
/*
221
 * Data MMU enable
222
 *      dmmu_enable()
223
 */
224
        .global _dmmu_enable
225
_dmmu_enable:
226
  /* Invalidate all sets */
227
  l.addi  r11,r0,DMMU_SET_NB
228
  l.addi  r13,r0,0
229
1:
230
  l.mtspr r13,r0,SPR_DTLBMR_BASE(0)
231
  l.addi  r11,r11,-1
232
  l.sfeqi r11,0
233
  l.bnf   1b
234
  l.addi  r13,r13,1
235
  l.mfspr r11,r0,SPR_SR
236
  l.ori   r11,r11,SPR_SR_DME
237
  l.mtspr r0,r11,SPR_SR
238
  l.jr    r9
239
  l.nop
240
 
241
/*
242
 * Instruction MMU enable
243
 *      immu_enable()
244
 */
245
        .global _immu_enable
246
_immu_enable:
247
  /* Invalidate all sets */
248
  l.addi  r11,r0,IMMU_SET_NB
249
  l.addi  r13,r0,0
250
1:
251
  l.mtspr r13,r0,SPR_ITLBMR_BASE(0)
252
  l.addi  r11,r11,-1
253
  l.sfeqi r11,0
254
  l.bnf   1b
255
  l.addi  r13,r13,1
256
  l.mfspr r11,r0,SPR_SR
257
  l.ori   r11,r11,SPR_SR_IME
258
  l.mtspr r0,r11,SPR_SR
259
  l.nop
260
  l.nop
261
  l.nop
262
  l.nop
263
  l.jr    r9
264
  l.nop
265
 
266
 /*
267
 * Print utility
268
 *      __print(const char *fmt, ...)
269
 */
270
        .global __print
271
__print:
272
        l.lwz   r3,0(r1)
273
        l.addi  r4,r1,4
274
#       l.sys   202
275
  l.nop 3
276
        l.jr    r9
277
        l.nop
278
 

powered by: WebSVN 2.1.0

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