]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/reg_test.S
b251393b2cac86a5a180cec2abde40c244688fdd
[freertos] / FreeRTOS / Demo / CORTEX_A53_64-bit_UltraScale_MPSoC / RTOSDemo_A53 / src / Full_Demo / reg_test.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         .global vRegTest1Implementation\r
71         .global vRegTest2Implementation\r
72         .extern ullRegTest1LoopCounter\r
73         .extern ullRegTest2LoopCounter\r
74 \r
75         .text\r
76 \r
77         /* This function is explained in the comments at the top of main-full.c. */\r
78 .type vRegTest1Implementation, %function\r
79 vRegTest1Implementation:\r
80 \r
81         /* Fill each general purpose register with a known value. */\r
82         mov             x0, #0xff\r
83         mov             x1, #0x01\r
84         mov             x2, #0x02\r
85         mov             x3, #0x03\r
86         mov             x4, #0x04\r
87         mov             x5, #0x05\r
88         mov             x6, #0x06\r
89         mov             x7, #0x07\r
90         mov             x8, #0x08\r
91         mov             x9, #0x09\r
92         mov             x10, #0x10\r
93         mov             x11, #0x11\r
94         mov             x12, #0x12\r
95         mov             x13, #0x13\r
96         mov             x14, #0x14\r
97         mov             x15, #0x15\r
98         mov             x16, #0x16\r
99         mov             x17, #0x17\r
100         mov             x18, #0x18\r
101         mov             x19, #0x19\r
102         mov             x20, #0x20\r
103         mov             x21, #0x21\r
104         mov             x22, #0x22\r
105         mov             x23, #0x23\r
106         mov             x24, #0x24\r
107         mov             x25, #0x25\r
108         mov             x26, #0x26\r
109         mov             x27, #0x27\r
110         mov             x28, #0x28\r
111         mov             x29, #0x29\r
112         mov             x30, #0x30\r
113 \r
114         /* Fill each FPU register with a known value. */\r
115         fmov    v0.d[1], x0\r
116         fmov    d1, x1\r
117         fmov    d2, x2\r
118         fmov    d3, x3\r
119         fmov    d4, x4\r
120         fmov    d5, x5\r
121         fmov    d6, x6\r
122         fmov    d7, x7\r
123         fmov    d8, x8\r
124         fmov    d9, x9\r
125         fmov    d10, x10\r
126         fmov    d11, x11\r
127         fmov    d12, x12\r
128         fmov    d13, x13\r
129         fmov    d14, x14\r
130         fmov    d15, x15\r
131         fmov    d16, x16\r
132         fmov    d17, x17\r
133         fmov    d18, x18\r
134         fmov    d19, x19\r
135         fmov    d20, x20\r
136         fmov    d21, x21\r
137         fmov    d22, x22\r
138         fmov    d23, x23\r
139         fmov    d24, x24\r
140         fmov    d25, x25\r
141         fmov    d26, x26\r
142         fmov    d27, x27\r
143         fmov    d28, x28\r
144         fmov    d29, x29\r
145         fmov    v30.d[1], x30\r
146         fmov    d31, xzr\r
147 \r
148         /* Loop, checking each itteration that each register still contains the\r
149         expected value. */\r
150 reg1_loop:\r
151         /* Yield to increase test coverage */\r
152         SMC 0\r
153 \r
154         /* Test each general purpose register to check that it still contains the\r
155         expected known value, jumping to reg1_error_loop if any register contains\r
156         an unexpected value. */\r
157         cmp             x0, #0xFF\r
158         bne             reg1_error_loop\r
159         cmp             x1, #0x01\r
160         bne             reg1_error_loop\r
161         cmp             x2, #0x02\r
162         bne             reg1_error_loop\r
163         cmp             x3, #0x03\r
164         bne             reg1_error_loop\r
165         cmp             x4, #0x04\r
166         bne             reg1_error_loop\r
167         cmp             x5, #0x05\r
168         bne             reg1_error_loop\r
169         cmp             x6, #0x06\r
170         bne             reg1_error_loop\r
171         cmp             x7, #0x07\r
172         bne             reg1_error_loop\r
173         cmp             x8, #0x08\r
174         bne             reg1_error_loop\r
175         cmp             x9, #0x09\r
176         bne             reg1_error_loop\r
177         cmp             x10, #0x10\r
178         bne             reg1_error_loop\r
179         cmp             x11, #0x11\r
180         bne             reg1_error_loop\r
181         cmp             x12, #0x12\r
182         bne             reg1_error_loop\r
183         cmp             x13, #0x13\r
184         bne             reg1_error_loop\r
185         cmp             x14, #0x14\r
186         bne             reg1_error_loop\r
187         cmp             x15, #0x15\r
188         bne             reg1_error_loop\r
189         cmp             x16, #0x16\r
190         bne             reg1_error_loop\r
191         cmp             x17, #0x17\r
192         bne             reg1_error_loop\r
193         cmp             x18, #0x18\r
194         bne             reg1_error_loop\r
195         cmp             x19, #0x19\r
196         bne             reg1_error_loop\r
197         cmp             x20, #0x20\r
198         bne             reg1_error_loop\r
199         cmp             x21, #0x21\r
200         bne             reg1_error_loop\r
201         cmp             x22, #0x22\r
202         bne             reg1_error_loop\r
203         cmp             x23, #0x23\r
204         bne             reg1_error_loop\r
205         cmp             x24, #0x24\r
206         bne             reg1_error_loop\r
207         cmp             x25, #0x25\r
208         bne             reg1_error_loop\r
209         cmp             x26, #0x26\r
210         bne             reg1_error_loop\r
211         cmp             x27, #0x27\r
212         bne             reg1_error_loop\r
213         cmp             x28, #0x28\r
214         bne             reg1_error_loop\r
215         cmp             x29, #0x29\r
216         bne             reg1_error_loop\r
217         cmp             x30, #0x30\r
218         bne             reg1_error_loop\r
219 \r
220         /* Check every floating point register to ensure it contains the expected\r
221         value.  First save the registers clobbered by the test. */\r
222         stp     x0, x1, [sp,#-0x10]!\r
223 \r
224         fmov    x0, v0.d[1]\r
225         cmp             x0, 0xff\r
226         bne             reg1_error_loop\r
227         fmov    x0, d1\r
228         cmp             x0, 0x01\r
229         bne             reg1_error_loop\r
230         fmov    x0, d2\r
231         cmp             x0, 0x02\r
232         bne             reg1_error_loop\r
233         fmov    x0, d3\r
234         cmp             x0, 0x03\r
235         bne             reg1_error_loop\r
236         fmov    x0, d4\r
237         cmp             x0, 0x04\r
238         bne             reg1_error_loop\r
239         fmov    x0, d5\r
240         cmp             x0, 0x05\r
241         bne             reg1_error_loop\r
242         fmov    x0, d6\r
243         cmp             x0, 0x06\r
244         bne             reg1_error_loop\r
245         fmov    x0, d7\r
246         cmp             x0, 0x07\r
247         bne             reg1_error_loop\r
248         fmov    x0, d8\r
249         cmp             x0, 0x08\r
250         bne             reg1_error_loop\r
251         fmov    x0, d9\r
252         cmp             x0, 0x09\r
253         bne             reg1_error_loop\r
254         fmov    x0, d10\r
255         cmp             x0, 0x10\r
256         bne             reg1_error_loop\r
257         fmov    x0, d11\r
258         cmp             x0, 0x11\r
259         bne             reg1_error_loop\r
260         fmov    x0, d12\r
261         cmp             x0, 0x12\r
262         bne             reg1_error_loop\r
263         fmov    x0, d13\r
264         cmp             x0, 0x13\r
265         bne             reg1_error_loop\r
266         fmov    x0, d14\r
267         cmp             x0, 0x14\r
268         bne             reg1_error_loop\r
269         fmov    x0, d15\r
270         cmp             x0, 0x15\r
271         bne             reg1_error_loop\r
272         fmov    x0, d16\r
273         cmp             x0, 0x16\r
274         bne             reg1_error_loop\r
275         fmov    x0, d17\r
276         cmp             x0, 0x17\r
277         bne             reg1_error_loop\r
278         fmov    x0, d18\r
279         cmp             x0, 0x18\r
280         bne             reg1_error_loop\r
281         fmov    x0, d19\r
282         cmp             x0, 0x19\r
283         bne             reg1_error_loop\r
284         fmov    x0, d20\r
285         cmp             x0, 0x20\r
286         bne             reg1_error_loop\r
287         fmov    x0, d21\r
288         cmp             x0, 0x21\r
289         bne             reg1_error_loop\r
290         fmov    x0, d22\r
291         cmp             x0, 0x22\r
292         bne             reg1_error_loop\r
293         fmov    x0, d23\r
294         cmp             x0, 0x23\r
295         bne             reg1_error_loop\r
296         fmov    x0, d24\r
297         cmp             x0, 0x24\r
298         bne             reg1_error_loop\r
299         fmov    x0, d25\r
300         cmp             x0, 0x25\r
301         bne             reg1_error_loop\r
302         fmov    x0, d26\r
303         cmp             x0, 0x26\r
304         bne             reg1_error_loop\r
305         fmov    x0, d27\r
306         cmp             x0, 0x27\r
307         bne             reg1_error_loop\r
308         fmov    x0, d28\r
309         cmp             x0, 0x28\r
310         bne             reg1_error_loop\r
311         fmov    x0, d29\r
312         cmp             x0, 0x29\r
313         bne             reg1_error_loop\r
314         fmov    x0, v30.d[1]\r
315         cmp             x0, 0x30\r
316         bne             reg1_error_loop\r
317         fmov    x0, d31\r
318         cmp             x0, 0x00\r
319         bne             reg1_error_loop\r
320 \r
321         /* Restore the registers clobbered by the test. */\r
322         ldp     x0, x1, [sp], #0x10\r
323 \r
324         /* Everything passed, increment the loop counter. */\r
325         stp     x0, x1, [sp,#-0x10]!\r
326         ldr             x0, =ullRegTest1LoopCounter\r
327         ldr     x1, [x0]\r
328         adds    x1, x1, #1\r
329         str     x1, [x0]\r
330         ldp     x0, x1, [sp], #0x10\r
331 \r
332         /* Start again. */\r
333         b reg1_loop\r
334 \r
335 reg1_error_loop:\r
336         /* If this line is hit then there was an error in a core register value.\r
337         The loop ensures the loop counter stops incrementing. */\r
338         b reg1_error_loop\r
339         nop\r
340 \r
341 /*-----------------------------------------------------------*/\r
342 \r
343 .type vRegTest2Implementation, %function\r
344 vRegTest2Implementation:\r
345 \r
346         /* Fill each general purpose register with a known value. */\r
347         mov             x0, #0xff0\r
348         mov             x1, #0x010\r
349         mov             x2, #0x020\r
350         mov             x3, #0x030\r
351         mov             x4, #0x040\r
352         mov             x5, #0x050\r
353         mov             x6, #0x060\r
354         mov             x7, #0x070\r
355         mov             x8, #0x080\r
356         mov             x9, #0x090\r
357         mov             x10, #0x100\r
358         mov             x11, #0x110\r
359         mov             x12, #0x120\r
360         mov             x13, #0x130\r
361         mov             x14, #0x140\r
362         mov             x15, #0x150\r
363         mov             x16, #0x160\r
364         mov             x17, #0x170\r
365         mov             x18, #0x180\r
366         mov             x19, #0x190\r
367         mov             x20, #0x200\r
368         mov             x21, #0x210\r
369         mov             x22, #0x220\r
370         mov             x23, #0x230\r
371         mov             x24, #0x240\r
372         mov             x25, #0x250\r
373         mov             x26, #0x260\r
374         mov             x27, #0x270\r
375         mov             x28, #0x280\r
376         mov             x29, #0x290\r
377         mov             x30, #0x300\r
378 \r
379         /* Fill each FPU register with a known value. */\r
380         fmov    d0, x0\r
381         fmov    d1, x1\r
382         fmov    d2, x2\r
383         fmov    d3, x3\r
384         fmov    d4, x4\r
385         fmov    d5, x5\r
386         fmov    d6, x6\r
387         fmov    d7, x7\r
388         fmov    d8, x8\r
389         fmov    d9, x9\r
390         fmov    v10.d[1], x10\r
391         fmov    d11, x11\r
392         fmov    d12, x12\r
393         fmov    d13, x13\r
394         fmov    d14, x14\r
395         fmov    d15, x15\r
396         fmov    d16, x16\r
397         fmov    d17, x17\r
398         fmov    d18, x18\r
399         fmov    d19, x19\r
400         fmov    d20, x20\r
401         fmov    d21, x21\r
402         fmov    d22, x22\r
403         fmov    d23, x23\r
404         fmov    d24, x24\r
405         fmov    d25, x25\r
406         fmov    d26, x26\r
407         fmov    v27.d[1], x27\r
408         fmov    d28, x28\r
409         fmov    d29, x29\r
410         fmov    d30, x30\r
411         fmov    d31, x0\r
412 \r
413         /* Loop, checking each itteration that each register still contains the\r
414         expected value. */\r
415 reg2_loop:\r
416 \r
417         /* Test each general purpose register to check that it still contains the\r
418         expected known value, jumping to reg2_error_loop if any register contains\r
419         an unexpected value. */\r
420         cmp             x0, #0xFF0\r
421         bne             reg2_error_loop\r
422         cmp             x1, #0x010\r
423         bne             reg2_error_loop\r
424         cmp             x2, #0x020\r
425         bne             reg2_error_loop\r
426         cmp             x3, #0x030\r
427         bne             reg2_error_loop\r
428         cmp             x4, #0x040\r
429         bne             reg2_error_loop\r
430         cmp             x5, #0x050\r
431         bne             reg2_error_loop\r
432         cmp             x6, #0x060\r
433         bne             reg2_error_loop\r
434         cmp             x7, #0x070\r
435         bne             reg2_error_loop\r
436         cmp             x8, #0x080\r
437         bne             reg2_error_loop\r
438         cmp             x9, #0x090\r
439         bne             reg2_error_loop\r
440         cmp             x10, #0x100\r
441         bne             reg2_error_loop\r
442         cmp             x11, #0x110\r
443         bne             reg2_error_loop\r
444         cmp             x12, #0x120\r
445         bne             reg2_error_loop\r
446         cmp             x13, #0x130\r
447         bne             reg2_error_loop\r
448         cmp             x14, #0x140\r
449         bne             reg2_error_loop\r
450         cmp             x15, #0x150\r
451         bne             reg2_error_loop\r
452         cmp             x16, #0x160\r
453         bne             reg2_error_loop\r
454         cmp             x17, #0x170\r
455         bne             reg2_error_loop\r
456         cmp             x18, #0x180\r
457         bne             reg2_error_loop\r
458         cmp             x19, #0x190\r
459         bne             reg2_error_loop\r
460         cmp             x20, #0x200\r
461         bne             reg2_error_loop\r
462         cmp             x21, #0x210\r
463         bne             reg2_error_loop\r
464         cmp             x22, #0x220\r
465         bne             reg2_error_loop\r
466         cmp             x23, #0x230\r
467         bne             reg2_error_loop\r
468         cmp             x24, #0x240\r
469         bne             reg2_error_loop\r
470         cmp             x25, #0x250\r
471         bne             reg2_error_loop\r
472         cmp             x26, #0x260\r
473         bne             reg2_error_loop\r
474         cmp             x27, #0x270\r
475         bne             reg2_error_loop\r
476         cmp             x28, #0x280\r
477         bne             reg2_error_loop\r
478         cmp             x29, #0x290\r
479         bne             reg2_error_loop\r
480         cmp             x30, #0x300\r
481         bne             reg2_error_loop\r
482 \r
483         /* Check every floating point register to ensure it contains the expected\r
484         value.  First save the registers clobbered by the test. */\r
485         stp     x0, x1, [sp,#-0x10]!\r
486 \r
487         fmov    x0, d0\r
488         cmp             x0, 0xff0\r
489         bne             reg1_error_loop\r
490         fmov    x0, d1\r
491         cmp             x0, 0x010\r
492         bne             reg1_error_loop\r
493         fmov    x0, d2\r
494         cmp             x0, 0x020\r
495         bne             reg1_error_loop\r
496         fmov    x0, d3\r
497         cmp             x0, 0x030\r
498         bne             reg1_error_loop\r
499         fmov    x0, d4\r
500         cmp             x0, 0x040\r
501         bne             reg1_error_loop\r
502         fmov    x0, d5\r
503         cmp             x0, 0x050\r
504         bne             reg1_error_loop\r
505         fmov    x0, d6\r
506         cmp             x0, 0x060\r
507         bne             reg1_error_loop\r
508         fmov    x0, d7\r
509         cmp             x0, 0x070\r
510         bne             reg1_error_loop\r
511         fmov    x0, d8\r
512         cmp             x0, 0x080\r
513         bne             reg1_error_loop\r
514         fmov    x0, d9\r
515         cmp             x0, 0x090\r
516         bne             reg1_error_loop\r
517         fmov    x0, v10.d[1]\r
518         cmp             x0, 0x100\r
519         bne             reg1_error_loop\r
520         fmov    x0, d11\r
521         cmp             x0, 0x110\r
522         bne             reg1_error_loop\r
523         fmov    x0, d12\r
524         cmp             x0, 0x120\r
525         bne             reg1_error_loop\r
526         fmov    x0, d13\r
527         cmp             x0, 0x130\r
528         bne             reg1_error_loop\r
529         fmov    x0, d14\r
530         cmp             x0, 0x140\r
531         bne             reg1_error_loop\r
532         fmov    x0, d15\r
533         cmp             x0, 0x150\r
534         bne             reg1_error_loop\r
535         fmov    x0, d16\r
536         cmp             x0, 0x160\r
537         bne             reg1_error_loop\r
538         fmov    x0, d17\r
539         cmp             x0, 0x170\r
540         bne             reg1_error_loop\r
541         fmov    x0, d18\r
542         cmp             x0, 0x180\r
543         bne             reg1_error_loop\r
544         fmov    x0, d19\r
545         cmp             x0, 0x190\r
546         bne             reg1_error_loop\r
547         fmov    x0, d20\r
548         cmp             x0, 0x200\r
549         bne             reg1_error_loop\r
550         fmov    x0, d21\r
551         cmp             x0, 0x210\r
552         bne             reg1_error_loop\r
553         fmov    x0, d22\r
554         cmp             x0, 0x220\r
555         bne             reg1_error_loop\r
556         fmov    x0, d23\r
557         cmp             x0, 0x230\r
558         bne             reg1_error_loop\r
559         fmov    x0, d24\r
560         cmp             x0, 0x240\r
561         bne             reg1_error_loop\r
562         fmov    x0, d25\r
563         cmp             x0, 0x250\r
564         bne             reg1_error_loop\r
565         fmov    x0, d26\r
566         cmp             x0, 0x260\r
567         bne             reg1_error_loop\r
568         fmov    x0, v27.d[1]\r
569         cmp             x0, 0x270\r
570         bne             reg1_error_loop\r
571         fmov    x0, d28\r
572         cmp             x0, 0x280\r
573         bne             reg1_error_loop\r
574         fmov    x0, d29\r
575         cmp             x0, 0x290\r
576         bne             reg1_error_loop\r
577         fmov    x0, d30\r
578         cmp             x0, 0x300\r
579         bne             reg1_error_loop\r
580         fmov    x0, d31\r
581         cmp             x0, 0xff0\r
582         bne             reg1_error_loop\r
583 \r
584         /* Restore the registers clobbered by the test. */\r
585         ldp     x0, x1, [sp], #0x10\r
586 \r
587         /* Everything passed, increment the loop counter. */\r
588         stp     x0, x1, [sp,#-0x10]!\r
589         ldr             x0, =ullRegTest2LoopCounter\r
590         ldr     x1, [x0]\r
591         adds    x1, x1, #1\r
592         str     x1, [x0]\r
593         ldp     x0, x1, [sp], #0x10\r
594 \r
595         /* Start again. */\r
596         b reg2_loop\r
597 \r
598 reg2_error_loop:\r
599         /* If this line is hit then there was an error in a core register value.\r
600         The loop ensures the loop counter stops incrementing. */\r
601         b reg2_error_loop\r
602         nop\r
603 \r
604         .end\r
605 \r