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 669

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_CONTEXT
7 572 jeremybenn
        .global pxCurrentTCB
8
        # make rooms in stack
9 665 filepang
        l.addi  r1, r1, -132
10 572 jeremybenn
        # early save r3-r5, these are clobber register
11
        l.sw    0x08(r1), r3
12
        l.sw    0x0C(r1), r4
13
        l.sw    0x10(r1), r5
14
        # save SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
15 621 filepang
        l.mfspr r3, r0, SPR_ESR_BASE
16
        l.mfspr r4, r0, SPR_EPCR_BASE
17 572 jeremybenn
        l.sw    0x78(r1), r3
18
        l.sw    0x7C(r1), r4
19
        l.sw    0x00(r1), r9
20
        # Save Context
21
        l.sw    0x04(r1), r2
22
        l.sw    0x14(r1), r6
23
        l.sw    0x18(r1), r7
24
        l.sw    0x1C(r1), r8
25
        l.sw    0x20(r1), r10
26
        l.sw    0x24(r1), r11
27
        l.sw    0x28(r1), r12
28
        l.sw    0x2C(r1), r13
29
        l.sw    0x30(r1), r14
30
        l.sw    0x34(r1), r15
31
        l.sw    0x38(r1), r16
32
        l.sw    0x3C(r1), r17
33
        l.sw    0x40(r1), r18
34
        l.sw    0x44(r1), r19
35
        l.sw    0x48(r1), r20
36
        l.sw    0x4C(r1), r21
37
        l.sw    0x50(r1), r22
38
        l.sw    0x54(r1), r23
39
        l.sw    0x58(r1), r24
40
        l.sw    0x5C(r1), r25
41
        l.sw    0x60(r1), r26
42
        l.sw    0x64(r1), r27
43
        l.sw    0x68(r1), r28
44
        l.sw    0x6C(r1), r29
45
        l.sw    0x70(r1), r30
46
        l.sw    0x74(r1), r31
47
        # Save the top of stack in TCB
48
        l.movhi r3, hi(pxCurrentTCB)
49
        l.ori   r3, r3, lo(pxCurrentTCB)
50
        l.lwz   r3, 0x0(r3)
51
        l.sw    0x0(r3), r1
52
        # restore clobber register
53
        l.lwz   r3, 0x08(r1)
54
        l.lwz   r4, 0x0C(r1)
55
        l.lwz   r5, 0x10(r1)
56 621 filepang
.endm
57 572 jeremybenn
 
58 621 filepang
 
59
.macro portRESTORE_CONTEXT
60 572 jeremybenn
        l.movhi r3, hi(pxCurrentTCB)
61
        l.ori   r3, r3, lo(pxCurrentTCB)
62
        l.lwz   r3, 0x0(r3)
63
        l.lwz   r1, 0x0(r3)
64
        # restore context
65
        l.lwz   r9, 0x00(r1)
66
        l.lwz   r2, 0x04(r1)
67
        l.lwz   r6, 0x14(r1)
68
        l.lwz   r7, 0x18(r1)
69
        l.lwz   r8, 0x1C(r1)
70
        l.lwz   r10, 0x20(r1)
71
        l.lwz   r11, 0x24(r1)
72
        l.lwz   r12, 0x28(r1)
73
        l.lwz   r13, 0x2C(r1)
74
        l.lwz   r14, 0x30(r1)
75
        l.lwz   r15, 0x34(r1)
76
        l.lwz   r16, 0x38(r1)
77
        l.lwz   r17, 0x3C(r1)
78
        l.lwz   r18, 0x40(r1)
79
        l.lwz   r19, 0x44(r1)
80
        l.lwz   r20, 0x48(r1)
81
        l.lwz   r21, 0x4C(r1)
82
        l.lwz   r22, 0x50(r1)
83
        l.lwz   r23, 0x54(r1)
84
        l.lwz   r24, 0x58(r1)
85
        l.lwz   r25, 0x5C(r1)
86
        l.lwz   r26, 0x60(r1)
87
        l.lwz   r27, 0x64(r1)
88
        l.lwz   r28, 0x68(r1)
89
        l.lwz   r29, 0x6C(r1)
90
        l.lwz   r30, 0x70(r1)
91
        l.lwz   r31, 0x74(r1)
92
        # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)
93
        l.lwz   r3, 0x78(r1)
94
        l.lwz   r4, 0x7C(r1)
95 621 filepang
        l.mtspr r0, r3, SPR_ESR_BASE
96
        l.mtspr r0, r4, SPR_EPCR_BASE
97 572 jeremybenn
        # restore clobber register
98
        l.lwz   r3, 0x08(r1)
99
        l.lwz   r4, 0x0C(r1)
100
        l.lwz   r5, 0x10(r1)
101 665 filepang
        l.addi  r1, r1, 132
102 572 jeremybenn
        l.rfe
103
        l.nop
104 621 filepang
.endm
105 572 jeremybenn
 
106
 
107 621 filepang
.text
108
.global vPortTickHandler
109
.type   vPortTickHandler, %function
110
vPortTickHandler:
111
        portSAVE_CONTEXT
112
 
113
        l.mfspr r3, r0, SPR_TTMR
114
        l.movhi r4, hi(SPR_TTMR_IP)
115
        l.ori   r4, r4, lo(SPR_TTMR_IP)
116
        l.xori  r4, r4, 0xffffffff
117
        l.and   r3, r3, r4                              # clear tick timer interrupt
118
        l.mtspr r0, r3, SPR_TTMR
119 572 jeremybenn
 
120 621 filepang
        l.jal   vTaskIncrementTick
121
        l.nop
122
.if configUSE_PREEMPTION == 0
123
        # do nothing
124
.else
125
        l.jal   vTaskSwitchContext
126
        l.nop
127
.endif
128
 
129
        portRESTORE_CONTEXT
130
.size   vPortTickHandler, .-vPortTickHandler
131
 
132
 
133 572 jeremybenn
.text
134 621 filepang
.global vPortSystemCall
135
.type   vPortSystemCall, %function
136
vPortSystemCall:
137 664 filepang
        portSAVE_CONTEXT
138 621 filepang
 
139 664 filepang
        l.jal   vTaskSwitchContext
140 572 jeremybenn
        l.nop
141 621 filepang
 
142
        portRESTORE_CONTEXT
143
.size   vPortSystemCall, .-vPortSystemCall
144
 
145
 
146
.text
147
.global vPortExtIntHandler
148
.type   vPortExtIntHandler, %function
149
vPortExtIntHandler:
150
        portSAVE_CONTEXT
151
 
152
    l.jal       int_main
153
        l.nop
154
 
155
.if configUSE_PREEMPTION == 0
156
        # do nothing
157
.else
158 572 jeremybenn
        l.jal   vTaskSwitchContext
159
        l.nop
160 621 filepang
.endif
161 572 jeremybenn
 
162 621 filepang
        portRESTORE_CONTEXT
163
.size   vPortExtIntHandler, .-vPortExtIntHandler
164 572 jeremybenn
 
165 621 filepang
 
166
.text
167
.global vPortMiscIntHandler
168
.type   vPortMiscIntHandler, %function
169
vPortMiscIntHandler:
170
        portSAVE_CONTEXT
171
 
172
    l.jal       misc_int_handler
173
        l.lwz   r3, -4(r1)
174
 
175
.if configUSE_PREEMPTION == 0
176
        # do nothing
177
.else
178
        l.jal   vTaskSwitchContext
179
        l.nop
180
.endif
181
 
182
        portRESTORE_CONTEXT
183
.size   vPortMiscIntHandler, .-vPortMiscIntHandler

powered by: WebSVN 2.1.0

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