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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [OpenRISC/] [portasm.S] - Blame information for rev 665

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

Line No. Rev Author Line
1 572 jeremybenn
#include "port_spr_defs.h"
2
 
3
        .file           "portasm.S"
4
        .section        .text
5
 
6 621 filepang
.macro portSAVE_REGISTER
7
        l.addi  r1, r1, -116
8
        l.sw    0x00(r1), r3
9
        l.sw    0x04(r1), r4
10
        l.sw    0x08(r1), r5
11
        l.sw    0x0c(r1), r6
12
        l.sw    0x10(r1), r7
13
        l.sw    0x14(r1), r8
14
        l.sw    0x18(r1), r9
15
        l.sw    0x1c(r1), r10
16
        l.sw    0x20(r1), r11
17
        l.sw    0x24(r1), r12
18
        l.sw    0x28(r1), r13
19
        l.sw    0x2c(r1), r14
20
        l.sw    0x30(r1), r15
21
        l.sw    0x34(r1), r16
22
        l.sw    0x38(r1), r17
23
        l.sw    0x3c(r1), r18
24
        l.sw    0x40(r1), r19
25
        l.sw    0x44(r1), r20
26
        l.sw    0x48(r1), r21
27
        l.sw    0x4c(r1), r22
28
        l.sw    0x50(r1), r23
29
        l.sw    0x54(r1), r24
30
        l.sw    0x58(r1), r25
31
        l.sw    0x5c(r1), r26
32
        l.sw    0x60(r1), r27
33
        l.sw    0x64(r1), r28
34
        l.sw    0x68(r1), r29
35
        l.sw    0x6c(r1), r30
36
        l.sw    0x70(r1), r31
37
.endm
38
 
39
 
40
.macro portRESTORE_REGISTER
41
        l.lwz   r3 , 0x00(r1)
42
        l.lwz   r4 , 0x04(r1)
43
        l.lwz   r5 , 0x08(r1)
44
        l.lwz   r6 , 0x0c(r1)
45
        l.lwz   r7 , 0x10(r1)
46
        l.lwz   r8 , 0x14(r1)
47
        l.lwz   r9 , 0x18(r1)
48
        l.lwz   r10, 0x1c(r1)
49
        l.lwz   r11, 0x20(r1)
50
        l.lwz   r12, 0x24(r1)
51
        l.lwz   r13, 0x28(r1)
52
        l.lwz   r14, 0x2c(r1)
53
        l.lwz   r15, 0x30(r1)
54
        l.lwz   r16, 0x34(r1)
55
        l.lwz   r17, 0x38(r1)
56
        l.lwz   r18, 0x3c(r1)
57
        l.lwz   r19, 0x40(r1)
58
        l.lwz   r20, 0x44(r1)
59
        l.lwz   r21, 0x48(r1)
60
        l.lwz   r22, 0x4c(r1)
61
        l.lwz   r23, 0x50(r1)
62
        l.lwz   r24, 0x54(r1)
63
        l.lwz   r25, 0x58(r1)
64
        l.lwz   r26, 0x5c(r1)
65
        l.lwz   r27, 0x60(r1)
66
        l.lwz   r28, 0x64(r1)
67
        l.lwz   r29, 0x68(r1)
68
        l.lwz   r30, 0x6c(r1)
69
        l.lwz   r31, 0x70(r1)
70
        l.addi  r1, r1, 116
71
.endm
72
 
73
 
74
.macro portSAVE_CONTEXT
75 572 jeremybenn
        .global pxCurrentTCB
76
        # make rooms in stack
77 665 filepang
        l.addi  r1, r1, -132
78 572 jeremybenn
        # early save r3-r5, these are clobber register
79
        l.sw    0x08(r1), r3
80
        l.sw    0x0C(r1), r4
81
        l.sw    0x10(r1), r5
82
        # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
83 621 filepang
        l.mfspr r3, r0, SPR_ESR_BASE
84
        l.mfspr r4, r0, SPR_EPCR_BASE
85 572 jeremybenn
        l.sw    0x78(r1), r3
86
        l.sw    0x7C(r1), r4
87
        l.sw    0x00(r1), r9
88
        # Save Context
89
        l.sw    0x04(r1), r2
90
        l.sw    0x14(r1), r6
91
        l.sw    0x18(r1), r7
92
        l.sw    0x1C(r1), r8
93
        l.sw    0x20(r1), r10
94
        l.sw    0x24(r1), r11
95
        l.sw    0x28(r1), r12
96
        l.sw    0x2C(r1), r13
97
        l.sw    0x30(r1), r14
98
        l.sw    0x34(r1), r15
99
        l.sw    0x38(r1), r16
100
        l.sw    0x3C(r1), r17
101
        l.sw    0x40(r1), r18
102
        l.sw    0x44(r1), r19
103
        l.sw    0x48(r1), r20
104
        l.sw    0x4C(r1), r21
105
        l.sw    0x50(r1), r22
106
        l.sw    0x54(r1), r23
107
        l.sw    0x58(r1), r24
108
        l.sw    0x5C(r1), r25
109
        l.sw    0x60(r1), r26
110
        l.sw    0x64(r1), r27
111
        l.sw    0x68(r1), r28
112
        l.sw    0x6C(r1), r29
113
        l.sw    0x70(r1), r30
114
        l.sw    0x74(r1), r31
115
        # Save the top of stack in TCB
116
        l.movhi r3, hi(pxCurrentTCB)
117
        l.ori   r3, r3, lo(pxCurrentTCB)
118
        l.lwz   r3, 0x0(r3)
119
        l.sw    0x0(r3), r1
120
        # restore clobber register
121
        l.lwz   r3, 0x08(r1)
122
        l.lwz   r4, 0x0C(r1)
123
        l.lwz   r5, 0x10(r1)
124 621 filepang
.endm
125 572 jeremybenn
 
126 621 filepang
 
127
.macro portRESTORE_CONTEXT
128 572 jeremybenn
        l.movhi r3, hi(pxCurrentTCB)
129
        l.ori   r3, r3, lo(pxCurrentTCB)
130
        l.lwz   r3, 0x0(r3)
131
        l.lwz   r1, 0x0(r3)
132
        # restore context
133
        l.lwz   r9, 0x00(r1)
134
        l.lwz   r2, 0x04(r1)
135
        l.lwz   r6, 0x14(r1)
136
        l.lwz   r7, 0x18(r1)
137
        l.lwz   r8, 0x1C(r1)
138
        l.lwz   r10, 0x20(r1)
139
        l.lwz   r11, 0x24(r1)
140
        l.lwz   r12, 0x28(r1)
141
        l.lwz   r13, 0x2C(r1)
142
        l.lwz   r14, 0x30(r1)
143
        l.lwz   r15, 0x34(r1)
144
        l.lwz   r16, 0x38(r1)
145
        l.lwz   r17, 0x3C(r1)
146
        l.lwz   r18, 0x40(r1)
147
        l.lwz   r19, 0x44(r1)
148
        l.lwz   r20, 0x48(r1)
149
        l.lwz   r21, 0x4C(r1)
150
        l.lwz   r22, 0x50(r1)
151
        l.lwz   r23, 0x54(r1)
152
        l.lwz   r24, 0x58(r1)
153
        l.lwz   r25, 0x5C(r1)
154
        l.lwz   r26, 0x60(r1)
155
        l.lwz   r27, 0x64(r1)
156
        l.lwz   r28, 0x68(r1)
157
        l.lwz   r29, 0x6C(r1)
158
        l.lwz   r30, 0x70(r1)
159
        l.lwz   r31, 0x74(r1)
160
        # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
161
        l.lwz   r3, 0x78(r1)
162
        l.lwz   r4, 0x7C(r1)
163 621 filepang
        l.mtspr r0, r3, SPR_ESR_BASE
164
        l.mtspr r0, r4, SPR_EPCR_BASE
165 572 jeremybenn
        # restore clobber register
166
        l.lwz   r3, 0x08(r1)
167
        l.lwz   r4, 0x0C(r1)
168
        l.lwz   r5, 0x10(r1)
169 665 filepang
        l.addi  r1, r1, 132
170 572 jeremybenn
        l.rfe
171
        l.nop
172 621 filepang
.endm
173 572 jeremybenn
 
174
 
175 621 filepang
.text
176
.global vPortTickHandler
177
.type   vPortTickHandler, %function
178
vPortTickHandler:
179
        portSAVE_CONTEXT
180
 
181
        l.mfspr r3, r0, SPR_TTMR
182
        l.movhi r4, hi(SPR_TTMR_IP)
183
        l.ori   r4, r4, lo(SPR_TTMR_IP)
184
        l.xori  r4, r4, 0xffffffff
185
        l.and   r3, r3, r4                              # clear tick timer interrupt
186
        l.mtspr r0, r3, SPR_TTMR
187 572 jeremybenn
 
188 621 filepang
        l.jal   vTaskIncrementTick
189
        l.nop
190
.if configUSE_PREEMPTION == 0
191
        # do nothing
192
.else
193
        l.jal   vTaskSwitchContext
194
        l.nop
195
.endif
196
 
197
        portRESTORE_CONTEXT
198
.size   vPortTickHandler, .-vPortTickHandler
199
 
200
 
201 572 jeremybenn
.text
202 621 filepang
.global vPortSystemCall
203
.type   vPortSystemCall, %function
204
vPortSystemCall:
205 664 filepang
        portSAVE_CONTEXT
206 621 filepang
 
207 664 filepang
        l.jal   vTaskSwitchContext
208 572 jeremybenn
        l.nop
209 621 filepang
 
210
        portRESTORE_CONTEXT
211
.size   vPortSystemCall, .-vPortSystemCall
212
 
213
 
214
.text
215
.global vPortExtIntHandler
216
.type   vPortExtIntHandler, %function
217
vPortExtIntHandler:
218
        portSAVE_CONTEXT
219
 
220
    l.jal       int_main
221
        l.nop
222
 
223
.if configUSE_PREEMPTION == 0
224
        # do nothing
225
.else
226 572 jeremybenn
        l.jal   vTaskSwitchContext
227
        l.nop
228 621 filepang
.endif
229 572 jeremybenn
 
230 621 filepang
        portRESTORE_CONTEXT
231
.size   vPortExtIntHandler, .-vPortExtIntHandler
232 572 jeremybenn
 
233 621 filepang
 
234
.text
235
.global vPortMiscIntHandler
236
.type   vPortMiscIntHandler, %function
237
vPortMiscIntHandler:
238
        portSAVE_CONTEXT
239
 
240
    l.jal       misc_int_handler
241
        l.lwz   r3, -4(r1)
242
 
243
.if configUSE_PREEMPTION == 0
244
        # do nothing
245
.else
246
        l.jal   vTaskSwitchContext
247
        l.nop
248
.endif
249
 
250
        portRESTORE_CONTEXT
251
.size   vPortMiscIntHandler, .-vPortMiscIntHandler

powered by: WebSVN 2.1.0

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