]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/IA32_flat_GCC_Galileo_Gen_2/Full_Demo/RegTest.S
Update version number to 9.0.0rc2.
[freertos] / FreeRTOS / Demo / IA32_flat_GCC_Galileo_Gen_2 / Full_Demo / RegTest.S
1 /*\r
2     FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
12 \r
13     ***************************************************************************\r
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
16     >>!   obliged to provide the source code for proprietary components     !<<\r
17     >>!   outside of the FreeRTOS kernel.                                   !<<\r
18     ***************************************************************************\r
19 \r
20     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
21     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
22     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
23     link: http://www.freertos.org/a00114.html\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    FreeRTOS provides completely free yet professionally developed,    *\r
28      *    robust, strictly quality controlled, supported, and cross          *\r
29      *    platform software that is more than just the market leader, it     *\r
30      *    is the industry's de facto standard.                               *\r
31      *                                                                       *\r
32      *    Help yourself get started quickly while simultaneously helping     *\r
33      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
34      *    tutorial book, reference manual, or both:                          *\r
35      *    http://www.FreeRTOS.org/Documentation                              *\r
36      *                                                                       *\r
37     ***************************************************************************\r
38 \r
39     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
40     the FAQ page "My application does not run, what could be wrong?".  Have you\r
41     defined configASSERT()?\r
42 \r
43     http://www.FreeRTOS.org/support - In return for receiving this top quality\r
44     embedded software for free we request you assist our global community by\r
45     participating in the support forum.\r
46 \r
47     http://www.FreeRTOS.org/training - Investing in training allows your team to\r
48     be as productive as possible as early as possible.  Now you can receive\r
49     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
50     Ltd, and the world's leading authority on the world's leading RTOS.\r
51 \r
52     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
53     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
54     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
55 \r
56     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
57     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
58 \r
59     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
60     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
61     licenses offer ticketed support, indemnification and commercial middleware.\r
62 \r
63     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
64     engineered and independently SIL3 certified version for use in safety and\r
65     mission critical applications that require provable dependability.\r
66 \r
67     1 tab == 4 spaces!\r
68 */\r
69 \r
70 .file "RegTest.S"\r
71 #include "FreeRTOSConfig.h"\r
72 #include "ISR_Support.h"\r
73 \r
74         .extern ulRegTest1Counter\r
75         .extern ulRegTest2Counter\r
76         .extern dRegTest1_st7\r
77         .extern dRegTest1_st6\r
78         .extern dRegTest1_st5\r
79         .extern dRegTest1_st4\r
80         .extern dRegTest1_st3\r
81         .extern dRegTest1_st2\r
82         .extern dRegTest1_st1\r
83         .extern dRegTest2_st7\r
84         .extern dRegTest2_st6\r
85         .extern dRegTest2_st5\r
86         .extern dRegTest2_st4\r
87         .extern dRegTest2_st3\r
88         .extern dRegTest2_st2\r
89         .extern dRegTest2_st1\r
90         .extern vGenerateYieldInterrupt\r
91         .extern vHPETIRQHandler1\r
92         \r
93         .global vRegTest1\r
94         .global vRegTest2\r
95         .global vApplicationHPETTimer1Wrapper\r
96 \r
97         .section .text.last /* Push up the memory to check executing from higher memory addresses. */\r
98         .align 4\r
99 \r
100 .func vRegTest1\r
101 vRegTest1:\r
102 \r
103         /* Set initial values into the general purpose registers. */\r
104         movl    $0x11111111, %eax\r
105         movl    $0x22222222, %ebx\r
106         movl    $0x33333333, %ecx\r
107         movl    $0x44444444, %edx\r
108         movl    $0x55555555, %esi\r
109         movl    $0x66666666, %edi\r
110 \r
111         /* Set initial values into the floating point registers. */\r
112         .if configSUPPORT_FPU == 1\r
113                 fldl    dRegTest1_st7\r
114                 fldl    dRegTest1_st6\r
115                 fldl    dRegTest1_st5\r
116                 fldl    dRegTest1_st4\r
117                 fldl    dRegTest1_st3\r
118                 fldl    dRegTest1_st2\r
119                 fldl    dRegTest1_st1\r
120         .endif /* configSUPPORT_FPU */\r
121 \r
122 _RegTest1Loop:\r
123 \r
124         /* Loop checking the values originally loaded into the general purpose\r
125         registers remain through the life of the task. */\r
126         cmp     $0x11111111, %eax\r
127         jne     _RegTest1Error\r
128         cmp     $0x22222222, %ebx\r
129         jne     _RegTest1Error\r
130         cmp     $0x33333333, %ecx\r
131         jne     _RegTest1Error\r
132         cmp     $0x44444444, %edx\r
133         jne     _RegTest1Error\r
134         cmp     $0x55555555, %esi\r
135         jne     _RegTest1Error\r
136         cmp     $0x66666666, %edi\r
137         jne     _RegTest1Error\r
138 \r
139 \r
140         .if configSUPPORT_FPU == 1\r
141                 /* Loop checking the values originally loaded into the floating point\r
142                 registers remain through the life of the task. */\r
143                 push    %eax                    /* push clobbered register. */\r
144                 fldl    dRegTest1_st7   /* st( 0 ) set to st( 7 ) value. */\r
145                 fucomp  %st( 7 )                /* Compare st( 0 ) with st( 7 ) and pop. */\r
146                 fnstsw  %ax                             /* Copy status word to ax. */\r
147                 and     $0x45, %ah              /* Mask bits. */\r
148                 xor     $0x40, %ah              /* test bits. */\r
149                 jne     _RegTest1Error\r
150                 fldl    dRegTest1_st6\r
151                 fucomp  %st( 6 )\r
152                 fnstsw  %ax\r
153                 and     $0x45, %ah\r
154                 xor     $0x40, %ah\r
155                 jne     _RegTest1Error\r
156                 fldl    dRegTest1_st5\r
157                 fucomp  %st( 5 )\r
158                 fnstsw  %ax\r
159                 and     $0x45, %ah\r
160                 xor     $0x40, %ah\r
161                 jne     _RegTest1Error\r
162                 fldl    dRegTest1_st4\r
163                 fucomp  %st( 4 )\r
164                 fnstsw  %ax\r
165                 and     $0x45, %ah\r
166                 xor     $0x40, %ah\r
167                 jne     _RegTest1Error\r
168                 fldl    dRegTest1_st3\r
169                 fucomp  %st( 3 )\r
170                 fnstsw  %ax\r
171                 and     $0x45, %ah\r
172                 xor     $0x40, %ah\r
173                 jne     _RegTest1Error\r
174                 fldl    dRegTest1_st2\r
175                 fucomp  %st( 2 )\r
176                 fnstsw  %ax\r
177                 and     $0x45, %ah\r
178                 xor     $0x40, %ah\r
179                 jne     _RegTest1Error\r
180                 fldl    dRegTest1_st1\r
181                 fucomp  %st( 1 )\r
182                 fnstsw  %ax\r
183                 and     $0x45, %ah\r
184                 xor     $0x40, %ah\r
185                 jne     _RegTest1Error\r
186 \r
187                 /* Restore clobbered register. */\r
188                 pop     %eax\r
189         .endif /* configSUPPORT_FPU */\r
190 \r
191         /* Incrememnt the loop counter to prove this task has not gone into the\r
192         error null loop. */\r
193         add     $1, ulRegTest1Counter\r
194 \r
195         /* Loop again. */\r
196         jmp     _RegTest1Loop\r
197 \r
198 _RegTest1Error:\r
199         jmp             .\r
200 .endfunc\r
201 /*-----------------------------------------------------------*/\r
202 \r
203 .func vRegTest2\r
204 vRegTest2:\r
205 \r
206         /* Set initial values into the general purpose registers. */\r
207         movl    $0x10101010, %eax\r
208         movl    $0x20202020, %ebx\r
209         movl    $0x30303030, %ecx\r
210         movl    $0x40404040, %edx\r
211         movl    $0x50505050, %esi\r
212         movl    $0x60606060, %edi\r
213 \r
214         /* Set initial values into the floating point registers. */\r
215         .if configSUPPORT_FPU == 1\r
216                 fldl    dRegTest2_st7\r
217                 fldl    dRegTest2_st6\r
218                 fldl    dRegTest2_st5\r
219                 fldl    dRegTest2_st4\r
220                 fldl    dRegTest2_st3\r
221                 fldl    dRegTest2_st2\r
222                 fldl    dRegTest2_st1\r
223         .endif\r
224 \r
225 _RegTest2Loop:\r
226 \r
227         /* Loop checking the values originally loaded into the general purpose\r
228         registers remain through the life of the task. */\r
229         cmp     $0x10101010, %eax\r
230         jne     _RegTest2Error\r
231         cmp     $0x20202020, %ebx\r
232         jne     _RegTest2Error\r
233         cmp     $0x30303030, %ecx\r
234         jne     _RegTest2Error\r
235         cmp     $0x40404040, %edx\r
236         jne     _RegTest2Error\r
237         cmp     $0x50505050, %esi\r
238         jne     _RegTest2Error\r
239         cmp     $0x60606060, %edi\r
240         jne     _RegTest1Error\r
241 \r
242         .if configSUPPORT_FPU == 1\r
243                 /* Loop checking the values originally loaded into the floating point\r
244                 registers remain through the life of the task. */\r
245                 /* Loop checking the values originally loaded into the floating point\r
246                 registers remain through the life of the task. */\r
247                 push    %eax                    /* push clobbered register. */\r
248                 fldl    dRegTest2_st7                   /* st( 0 ) set to st( 7 ) value. */\r
249                 fucomp  %st( 7 )                /* Compare st( 0 ) with st( 7 ) and pop. */\r
250                 fnstsw  %ax                             /* Copy status word to ax. */\r
251                 and     $0x45, %ah              /* Mask bits. */\r
252                 xor     $0x40, %ah              /* test bits. */\r
253                 jne     _RegTest1Error\r
254                 fldl    dRegTest2_st6\r
255                 fucomp  %st( 6 )\r
256                 fnstsw  %ax\r
257                 and     $0x45, %ah\r
258                 xor     $0x40, %ah\r
259                 jne     _RegTest1Error\r
260                 fldl    dRegTest2_st5\r
261                 fucomp  %st( 5 )\r
262                 fnstsw  %ax\r
263                 and     $0x45, %ah\r
264                 xor     $0x40, %ah\r
265                 jne     _RegTest1Error\r
266                 fldl    dRegTest2_st4\r
267                 fucomp  %st( 4 )\r
268                 fnstsw  %ax\r
269                 and     $0x45, %ah\r
270                 xor     $0x40, %ah\r
271                 jne     _RegTest1Error\r
272                 fldl    dRegTest2_st3\r
273                 fucomp  %st( 3 )\r
274                 fnstsw  %ax\r
275                 and     $0x45, %ah\r
276                 xor     $0x40, %ah\r
277                 jne     _RegTest1Error\r
278                 fldl    dRegTest2_st2\r
279                 fucomp  %st( 2 )\r
280                 fnstsw  %ax\r
281                 and     $0x45, %ah\r
282                 xor     $0x40, %ah\r
283                 jne     _RegTest1Error\r
284                 fldl    dRegTest2_st1\r
285                 fucomp  %st( 1 )\r
286                 fnstsw  %ax\r
287                 and     $0x45, %ah\r
288                 xor     $0x40, %ah\r
289                 jne     _RegTest1Error\r
290 \r
291                 /* Restore clobbered register. */\r
292                 pop     %eax\r
293 \r
294         .endif /* configSUPPORT_FPU */\r
295 \r
296         /* Force a yield from one of the reg test tasks to increase coverage. */\r
297         call vGenerateYieldInterrupt\r
298 \r
299         /* Increment the loop counter to prove this task has not entered the error\r
300         null loop. */\r
301         add     $1, ulRegTest2Counter\r
302         jmp     _RegTest2Loop\r
303 \r
304 _RegTest2Error:\r
305         jmp     .\r
306 \r
307 .endfunc\r
308 \r
309 /*-----------------------------------------------------------*/\r
310 \r
311 /* Purely for demonstration purposes, two of the HPET timers used by the\r
312 IntQueue test use the central interrupt handler, and timer 1 uses its own\r
313 assembly wrapper - which is defined below.  See\r
314 http://www.freertos.org/RTOS_Intel_Quark_Galileo_GCC.html#interrupts for more\r
315 information. */\r
316 .func vApplicationHPETTimer1Wrapper\r
317 vApplicationHPETTimer1Wrapper:\r
318 \r
319         portFREERTOS_INTERRUPT_ENTRY\r
320         call vHPETIRQHandler1\r
321         portFREERTOS_INTERRUPT_EXIT\r
322 \r
323 .endfunc\r
324 \r
325 .end\r