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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [MicroBlaze/] [portasm.s] - Blame information for rev 593

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

Line No. Rev Author Line
1 572 jeremybenn
        .extern pxCurrentTCB
2
        .extern vTaskISRHandler
3
        .extern vTaskSwitchContext
4
        .extern uxCriticalNesting
5
        .extern pulISRStack
6
 
7
        .global __FreeRTOS_interrupt_handler
8
        .global VPortYieldASM
9
        .global vStartFirstTask
10
 
11
 
12
.macro portSAVE_CONTEXT
13
        /* Make room for the context on the stack. */
14
        addik r1, r1, -132
15
        /* Save r31 so it can then be used. */
16
        swi r31, r1, 4
17
        /* Copy the msr into r31 - this is stacked later. */
18
        mfs r31, rmsr
19
        /* Stack general registers. */
20
        swi r30, r1, 12
21
        swi r29, r1, 16
22
        swi r28, r1, 20
23
        swi r27, r1, 24
24
        swi r26, r1, 28
25
        swi r25, r1, 32
26
        swi r24, r1, 36
27
        swi r23, r1, 40
28
        swi r22, r1, 44
29
        swi r21, r1, 48
30
        swi r20, r1, 52
31
        swi r19, r1, 56
32
        swi r18, r1, 60
33
        swi r17, r1, 64
34
        swi r16, r1, 68
35
        swi r15, r1, 72
36
        swi r13, r1, 80
37
        swi r12, r1, 84
38
        swi r11, r1, 88
39
        swi r10, r1, 92
40
        swi r9, r1, 96
41
        swi r8, r1, 100
42
        swi r7, r1, 104
43
        swi r6, r1, 108
44
        swi r5, r1, 112
45
        swi r4, r1, 116
46
        swi r3, r1, 120
47
        swi r2, r1, 124
48
        /* Stack the critical section nesting value. */
49
        lwi r3, r0, uxCriticalNesting
50
        swi r3, r1, 128
51
        /* Save the top of stack value to the TCB. */
52
        lwi r3, r0, pxCurrentTCB
53
        sw      r1, r0, r3
54
 
55
        .endm
56
 
57
.macro portRESTORE_CONTEXT
58
        /* Load the top of stack value from the TCB. */
59
        lwi r3, r0, pxCurrentTCB
60
        lw      r1, r0, r3
61
        /* Restore the general registers. */
62
        lwi r31, r1, 4
63
        lwi r30, r1, 12
64
        lwi r29, r1, 16
65
        lwi r28, r1, 20
66
        lwi r27, r1, 24
67
        lwi r26, r1, 28
68
        lwi r25, r1, 32
69
        lwi r24, r1, 36
70
        lwi r23, r1, 40
71
        lwi r22, r1, 44
72
        lwi r21, r1, 48
73
        lwi r20, r1, 52
74
        lwi r19, r1, 56
75
        lwi r18, r1, 60
76
        lwi r17, r1, 64
77
        lwi r16, r1, 68
78
        lwi r15, r1, 72
79
        lwi r14, r1, 76
80
        lwi r13, r1, 80
81
        lwi r12, r1, 84
82
        lwi r11, r1, 88
83
        lwi r10, r1, 92
84
        lwi r9, r1, 96
85
        lwi r8, r1, 100
86
        lwi r7, r1, 104
87
        lwi r6, r1, 108
88
        lwi r5, r1, 112
89
        lwi r4, r1, 116
90
        lwi r2, r1, 124
91
 
92
        /* Load the critical nesting value. */
93
        lwi r3, r1, 128
94
        swi r3, r0, uxCriticalNesting
95
 
96
        /* Obtain the MSR value from the stack. */
97
        lwi r3, r1, 8
98
 
99
        /* Are interrupts enabled in the MSR?  If so return using an return from
100
        interrupt instruction to ensure interrupts are enabled only once the task
101
        is running again. */
102
        andi r3, r3, 2
103
        beqid r3, 36
104
        or r0, r0, r0
105
 
106
        /* Reload the rmsr from the stack, clear the enable interrupt bit in the
107
        value before saving back to rmsr register, then return enabling interrupts
108
        as we return. */
109
        lwi r3, r1, 8
110
        andi r3, r3, ~2
111
        mts rmsr, r3
112
        lwi r3, r1, 120
113
        addik r1, r1, 132
114
        rtid r14, 0
115
        or r0, r0, r0
116
 
117
        /* Reload the rmsr from the stack, place it in the rmsr register, and
118
        return without enabling interrupts. */
119
        lwi r3, r1, 8
120
        mts rmsr, r3
121
        lwi r3, r1, 120
122
        addik r1, r1, 132
123
        rtsd r14, 0
124
        or r0, r0, r0
125
 
126
        .endm
127
 
128
        .text
129
        .align  2
130
 
131
 
132
__FreeRTOS_interrupt_handler:
133
        portSAVE_CONTEXT
134
        /* Entered via an interrupt so interrupts must be enabled in msr. */
135
        ori r31, r31, 2
136
        /* Stack msr. */
137
        swi r31, r1, 8
138
        /* Stack the return address.  As we entered via an interrupt we do
139
        not need to modify the return address prior to stacking. */
140
        swi r14, r1, 76
141
        /* Now switch to use the ISR stack. */
142
        lwi r3, r0, pulISRStack
143
        add r1, r3, r0
144
        bralid r15, vTaskISRHandler
145
        or r0, r0, r0
146
        portRESTORE_CONTEXT
147
 
148
 
149
VPortYieldASM:
150
        portSAVE_CONTEXT
151
        /* Stack msr. */
152
        swi r31, r1, 8
153
        /* Modify the return address so we return to the instruction after the
154
        exception. */
155
        addi r14, r14, 8
156
        swi r14, r1, 76
157
        /* Now switch to use the ISR stack. */
158
        lwi r3, r0, pulISRStack
159
        add r1, r3, r0
160
        bralid r15, vTaskSwitchContext
161
        or r0, r0, r0
162
        portRESTORE_CONTEXT
163
 
164
vStartFirstTask:
165
        portRESTORE_CONTEXT
166
 
167
 
168
 
169
 
170
 
171
 

powered by: WebSVN 2.1.0

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