]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/RegTest.S
Update version number in readiness for V10.2.0 release.
[freertos] / FreeRTOS / Demo / IA32_flat_GCC_Galileo_Gen_2 / Full_Demo / RegTest.S
1 /*\r
2  * FreeRTOS Kernel V10.2.0\r
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://www.FreeRTOS.org\r
23  * http://aws.amazon.com/freertos\r
24  *\r
25  * 1 tab == 4 spaces!\r
26  */\r
27 \r
28 .file "RegTest.S"\r
29 #include "FreeRTOSConfig.h"\r
30 #include "ISR_Support.h"\r
31 \r
32         .extern ulRegTest1Counter\r
33         .extern ulRegTest2Counter\r
34         .extern dRegTest1_st7\r
35         .extern dRegTest1_st6\r
36         .extern dRegTest1_st5\r
37         .extern dRegTest1_st4\r
38         .extern dRegTest1_st3\r
39         .extern dRegTest1_st2\r
40         .extern dRegTest1_st1\r
41         .extern dRegTest2_st7\r
42         .extern dRegTest2_st6\r
43         .extern dRegTest2_st5\r
44         .extern dRegTest2_st4\r
45         .extern dRegTest2_st3\r
46         .extern dRegTest2_st2\r
47         .extern dRegTest2_st1\r
48         .extern vGenerateYieldInterrupt\r
49         .extern vHPETIRQHandler1\r
50         \r
51         .global vRegTest1\r
52         .global vRegTest2\r
53         .global vApplicationHPETTimer1Wrapper\r
54 \r
55         .section .text.last /* Push up the memory to check executing from higher memory addresses. */\r
56         .align 4\r
57 \r
58 .func vRegTest1\r
59 vRegTest1:\r
60 \r
61         /* Set initial values into the general purpose registers. */\r
62         movl    $0x11111111, %eax\r
63         movl    $0x22222222, %ebx\r
64         movl    $0x33333333, %ecx\r
65         movl    $0x44444444, %edx\r
66         movl    $0x55555555, %esi\r
67         movl    $0x66666666, %edi\r
68 \r
69         /* Set initial values into the floating point registers. */\r
70         .if configSUPPORT_FPU == 1\r
71                 fldl    dRegTest1_st7\r
72                 fldl    dRegTest1_st6\r
73                 fldl    dRegTest1_st5\r
74                 fldl    dRegTest1_st4\r
75                 fldl    dRegTest1_st3\r
76                 fldl    dRegTest1_st2\r
77                 fldl    dRegTest1_st1\r
78         .endif /* configSUPPORT_FPU */\r
79 \r
80 _RegTest1Loop:\r
81 \r
82         /* Loop checking the values originally loaded into the general purpose\r
83         registers remain through the life of the task. */\r
84         cmp     $0x11111111, %eax\r
85         jne     _RegTest1Error\r
86         cmp     $0x22222222, %ebx\r
87         jne     _RegTest1Error\r
88         cmp     $0x33333333, %ecx\r
89         jne     _RegTest1Error\r
90         cmp     $0x44444444, %edx\r
91         jne     _RegTest1Error\r
92         cmp     $0x55555555, %esi\r
93         jne     _RegTest1Error\r
94         cmp     $0x66666666, %edi\r
95         jne     _RegTest1Error\r
96 \r
97 \r
98         .if configSUPPORT_FPU == 1\r
99                 /* Loop checking the values originally loaded into the floating point\r
100                 registers remain through the life of the task. */\r
101                 push    %eax                    /* push clobbered register. */\r
102                 fldl    dRegTest1_st7   /* st( 0 ) set to st( 7 ) value. */\r
103                 fucomp  %st( 7 )                /* Compare st( 0 ) with st( 7 ) and pop. */\r
104                 fnstsw  %ax                             /* Copy status word to ax. */\r
105                 and     $0x45, %ah              /* Mask bits. */\r
106                 xor     $0x40, %ah              /* test bits. */\r
107                 jne     _RegTest1Error\r
108                 fldl    dRegTest1_st6\r
109                 fucomp  %st( 6 )\r
110                 fnstsw  %ax\r
111                 and     $0x45, %ah\r
112                 xor     $0x40, %ah\r
113                 jne     _RegTest1Error\r
114                 fldl    dRegTest1_st5\r
115                 fucomp  %st( 5 )\r
116                 fnstsw  %ax\r
117                 and     $0x45, %ah\r
118                 xor     $0x40, %ah\r
119                 jne     _RegTest1Error\r
120                 fldl    dRegTest1_st4\r
121                 fucomp  %st( 4 )\r
122                 fnstsw  %ax\r
123                 and     $0x45, %ah\r
124                 xor     $0x40, %ah\r
125                 jne     _RegTest1Error\r
126                 fldl    dRegTest1_st3\r
127                 fucomp  %st( 3 )\r
128                 fnstsw  %ax\r
129                 and     $0x45, %ah\r
130                 xor     $0x40, %ah\r
131                 jne     _RegTest1Error\r
132                 fldl    dRegTest1_st2\r
133                 fucomp  %st( 2 )\r
134                 fnstsw  %ax\r
135                 and     $0x45, %ah\r
136                 xor     $0x40, %ah\r
137                 jne     _RegTest1Error\r
138                 fldl    dRegTest1_st1\r
139                 fucomp  %st( 1 )\r
140                 fnstsw  %ax\r
141                 and     $0x45, %ah\r
142                 xor     $0x40, %ah\r
143                 jne     _RegTest1Error\r
144 \r
145                 /* Restore clobbered register. */\r
146                 pop     %eax\r
147         .endif /* configSUPPORT_FPU */\r
148 \r
149         /* Incrememnt the loop counter to prove this task has not gone into the\r
150         error null loop. */\r
151         add     $1, ulRegTest1Counter\r
152 \r
153         /* Loop again. */\r
154         jmp     _RegTest1Loop\r
155 \r
156 _RegTest1Error:\r
157         jmp             .\r
158 .endfunc\r
159 /*-----------------------------------------------------------*/\r
160 \r
161 .func vRegTest2\r
162 vRegTest2:\r
163 \r
164         /* Set initial values into the general purpose registers. */\r
165         movl    $0x10101010, %eax\r
166         movl    $0x20202020, %ebx\r
167         movl    $0x30303030, %ecx\r
168         movl    $0x40404040, %edx\r
169         movl    $0x50505050, %esi\r
170         movl    $0x60606060, %edi\r
171 \r
172         /* Set initial values into the floating point registers. */\r
173         .if configSUPPORT_FPU == 1\r
174                 fldl    dRegTest2_st7\r
175                 fldl    dRegTest2_st6\r
176                 fldl    dRegTest2_st5\r
177                 fldl    dRegTest2_st4\r
178                 fldl    dRegTest2_st3\r
179                 fldl    dRegTest2_st2\r
180                 fldl    dRegTest2_st1\r
181         .endif\r
182 \r
183 _RegTest2Loop:\r
184 \r
185         /* Loop checking the values originally loaded into the general purpose\r
186         registers remain through the life of the task. */\r
187         cmp     $0x10101010, %eax\r
188         jne     _RegTest2Error\r
189         cmp     $0x20202020, %ebx\r
190         jne     _RegTest2Error\r
191         cmp     $0x30303030, %ecx\r
192         jne     _RegTest2Error\r
193         cmp     $0x40404040, %edx\r
194         jne     _RegTest2Error\r
195         cmp     $0x50505050, %esi\r
196         jne     _RegTest2Error\r
197         cmp     $0x60606060, %edi\r
198         jne     _RegTest1Error\r
199 \r
200         .if configSUPPORT_FPU == 1\r
201                 /* Loop checking the values originally loaded into the floating point\r
202                 registers remain through the life of the task. */\r
203                 /* Loop checking the values originally loaded into the floating point\r
204                 registers remain through the life of the task. */\r
205                 push    %eax                    /* push clobbered register. */\r
206                 fldl    dRegTest2_st7                   /* st( 0 ) set to st( 7 ) value. */\r
207                 fucomp  %st( 7 )                /* Compare st( 0 ) with st( 7 ) and pop. */\r
208                 fnstsw  %ax                             /* Copy status word to ax. */\r
209                 and     $0x45, %ah              /* Mask bits. */\r
210                 xor     $0x40, %ah              /* test bits. */\r
211                 jne     _RegTest1Error\r
212                 fldl    dRegTest2_st6\r
213                 fucomp  %st( 6 )\r
214                 fnstsw  %ax\r
215                 and     $0x45, %ah\r
216                 xor     $0x40, %ah\r
217                 jne     _RegTest1Error\r
218                 fldl    dRegTest2_st5\r
219                 fucomp  %st( 5 )\r
220                 fnstsw  %ax\r
221                 and     $0x45, %ah\r
222                 xor     $0x40, %ah\r
223                 jne     _RegTest1Error\r
224                 fldl    dRegTest2_st4\r
225                 fucomp  %st( 4 )\r
226                 fnstsw  %ax\r
227                 and     $0x45, %ah\r
228                 xor     $0x40, %ah\r
229                 jne     _RegTest1Error\r
230                 fldl    dRegTest2_st3\r
231                 fucomp  %st( 3 )\r
232                 fnstsw  %ax\r
233                 and     $0x45, %ah\r
234                 xor     $0x40, %ah\r
235                 jne     _RegTest1Error\r
236                 fldl    dRegTest2_st2\r
237                 fucomp  %st( 2 )\r
238                 fnstsw  %ax\r
239                 and     $0x45, %ah\r
240                 xor     $0x40, %ah\r
241                 jne     _RegTest1Error\r
242                 fldl    dRegTest2_st1\r
243                 fucomp  %st( 1 )\r
244                 fnstsw  %ax\r
245                 and     $0x45, %ah\r
246                 xor     $0x40, %ah\r
247                 jne     _RegTest1Error\r
248 \r
249                 /* Restore clobbered register. */\r
250                 pop     %eax\r
251 \r
252         .endif /* configSUPPORT_FPU */\r
253 \r
254         /* Force a yield from one of the reg test tasks to increase coverage. */\r
255         call vGenerateYieldInterrupt\r
256 \r
257         /* Increment the loop counter to prove this task has not entered the error\r
258         null loop. */\r
259         add     $1, ulRegTest2Counter\r
260         jmp     _RegTest2Loop\r
261 \r
262 _RegTest2Error:\r
263         jmp     .\r
264 \r
265 .endfunc\r
266 \r
267 /*-----------------------------------------------------------*/\r
268 \r
269 /* Purely for demonstration purposes, two of the HPET timers used by the\r
270 IntQueue test use the central interrupt handler, and timer 1 uses its own\r
271 assembly wrapper - which is defined below.  See\r
272 http://www.freertos.org/RTOS_Intel_Quark_Galileo_GCC.html#interrupts for more\r
273 information. */\r
274 .func vApplicationHPETTimer1Wrapper\r
275 vApplicationHPETTimer1Wrapper:\r
276 \r
277         portFREERTOS_INTERRUPT_ENTRY\r
278         call vHPETIRQHandler1\r
279         portFREERTOS_INTERRUPT_EXIT\r
280 \r
281 .endfunc\r
282 \r
283 .end\r