]> begriffs open source - freertos/blob - portable/Renesas/SH2A_FPU/portasm.src
Update SMP branch readme for port migration (#999)
[freertos] / portable / Renesas / SH2A_FPU / portasm.src
1 ;/*
2 ; * FreeRTOS SMP Kernel V202110.00
3 ; * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4 ; *
5 ; * Permission is hereby granted, free of charge, to any person obtaining a copy of
6 ; * this software and associated documentation files (the "Software"), to deal in
7 ; * the Software without restriction, including without limitation the rights to
8 ; * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 ; * the Software, and to permit persons to whom the Software is furnished to do so,
10 ; * subject to the following conditions:
11 ; *
12 ; * The above copyright notice and this permission notice shall be included in all
13 ; * copies or substantial portions of the Software.
14 ; *
15 ; * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 ; * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 ; * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 ; * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 ; * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 ; * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ; *
22 ; * https://www.FreeRTOS.org
23 ; * https://github.com/FreeRTOS
24 ; *
25 ; * 1 tab == 4 spaces!
26 ; */
27
28         .import _pxCurrentTCB
29         .import _vTaskSwitchContext
30         .import _xTaskIncrementTick
31
32         .export _vPortStartFirstTask
33         .export _ulPortGetGBR
34         .export _vPortYieldHandler
35         .export _vPortPreemptiveTick
36         .export _vPortCooperativeTick
37         .export _vPortSaveFlopRegisters
38         .export _vPortRestoreFlopRegisters
39
40     .section    P
41
42         .INCLUDE "ISR_Support.inc"
43
44 _vPortStartFirstTask:
45
46         portRESTORE_CONTEXT
47
48 ;-----------------------------------------------------------
49
50 _vPortYieldHandler:
51
52         portSAVE_CONTEXT
53
54         mov.l   #_vTaskSwitchContext, r0
55         jsr             @r0
56         nop
57
58         portRESTORE_CONTEXT
59
60 ;-----------------------------------------------------------
61
62 _vPortPreemptiveTick
63
64         portSAVE_CONTEXT
65
66         mov.l   #_xTaskIncrementTick, r0
67         jsr             @r0
68         nop
69
70         mov.l   #_vTaskSwitchContext, r0
71         jsr             @r0
72         nop
73
74         portRESTORE_CONTEXT
75
76 ;-----------------------------------------------------------
77
78 _vPortCooperativeTick
79
80         portSAVE_CONTEXT
81
82         mov.l   #_xTaskIncrementTick, r0
83         jsr             @r0
84         nop
85
86         portRESTORE_CONTEXT
87
88 ;-----------------------------------------------------------
89
90 _ulPortGetGBR:
91
92         stc.l   gbr, r0
93         rts
94         nop
95
96 ;-----------------------------------------------------------
97
98 _vPortSaveFlopRegisters:
99
100         fmov.s  fr0, @-r4
101         fmov.s  fr1, @-r4
102         fmov.s  fr2, @-r4
103         fmov.s  fr3, @-r4
104         fmov.s  fr4, @-r4
105         fmov.s  fr5, @-r4
106         fmov.s  fr6, @-r4
107         fmov.s  fr7, @-r4
108         fmov.s  fr8, @-r4
109         fmov.s  fr9, @-r4
110         fmov.s  fr10, @-r4
111         fmov.s  fr11, @-r4
112         fmov.s  fr12, @-r4
113         fmov.s  fr13, @-r4
114         fmov.s  fr14, @-r4
115         fmov.s  fr15, @-r4
116         sts.l   fpul, @-r4
117         sts.l   fpscr, @-r4
118
119         rts
120         nop
121
122 ;-----------------------------------------------------------
123
124 _vPortRestoreFlopRegisters:
125
126         add.l  #-72, r4
127         lds.l  @r4+, fpscr
128         lds.l  @r4+, fpul
129         fmov.s @r4+, fr15
130         fmov.s @r4+, fr14
131         fmov.s @r4+, fr13
132         fmov.s @r4+, fr12
133         fmov.s @r4+, fr11
134         fmov.s @r4+, fr10
135         fmov.s @r4+, fr9
136         fmov.s @r4+, fr8
137         fmov.s @r4+, fr7
138         fmov.s @r4+, fr6
139         fmov.s @r4+, fr5
140         fmov.s @r4+, fr4
141         fmov.s @r4+, fr3
142         fmov.s @r4+, fr2
143         fmov.s @r4+, fr1
144         fmov.s @r4+, fr0
145
146         rts
147         nop
148
149         .end
150