]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_A53_64-bit_UltraScale_MPSoC/RTOSDemo_A53/src/Full_Demo/reg_test.S
4461147c24512dd182bee58e034d3bdddcc64e46
[freertos] / FreeRTOS / Demo / CORTEX_A53_64-bit_UltraScale_MPSoC / RTOSDemo_A53 / src / Full_Demo / reg_test.S
1 /*\r
2  * FreeRTOS Kernel V10.0.0\r
3  * Copyright (C) 2017 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. If you wish to use our Amazon\r
14  * FreeRTOS name, please do so in a fair use way that does not cause confusion.\r
15  *\r
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
22  *\r
23  * http://www.FreeRTOS.org\r
24  * http://aws.amazon.com/freertos\r
25  *\r
26  * 1 tab == 4 spaces!\r
27  */\r
28 \r
29         .global vRegTest1Implementation\r
30         .global vRegTest2Implementation\r
31         .extern ullRegTest1LoopCounter\r
32         .extern ullRegTest2LoopCounter\r
33 \r
34         .text\r
35 \r
36         /* This function is explained in the comments at the top of main-full.c. */\r
37 .type vRegTest1Implementation, %function\r
38 vRegTest1Implementation:\r
39 \r
40         /* Fill each general purpose register with a known value. */\r
41         mov             x0, #0xff\r
42         mov             x1, #0x01\r
43         mov             x2, #0x02\r
44         mov             x3, #0x03\r
45         mov             x4, #0x04\r
46         mov             x5, #0x05\r
47         mov             x6, #0x06\r
48         mov             x7, #0x07\r
49         mov             x8, #0x08\r
50         mov             x9, #0x09\r
51         mov             x10, #0x10\r
52         mov             x11, #0x11\r
53         mov             x12, #0x12\r
54         mov             x13, #0x13\r
55         mov             x14, #0x14\r
56         mov             x15, #0x15\r
57         mov             x16, #0x16\r
58         mov             x17, #0x17\r
59         mov             x18, #0x18\r
60         mov             x19, #0x19\r
61         mov             x20, #0x20\r
62         mov             x21, #0x21\r
63         mov             x22, #0x22\r
64         mov             x23, #0x23\r
65         mov             x24, #0x24\r
66         mov             x25, #0x25\r
67         mov             x26, #0x26\r
68         mov             x27, #0x27\r
69         mov             x28, #0x28\r
70         mov             x29, #0x29\r
71         mov             x30, #0x30\r
72 \r
73         /* Fill each FPU register with a known value. */\r
74         fmov    v0.d[1], x0\r
75         fmov    d1, x1\r
76         fmov    d2, x2\r
77         fmov    d3, x3\r
78         fmov    d4, x4\r
79         fmov    d5, x5\r
80         fmov    d6, x6\r
81         fmov    d7, x7\r
82         fmov    d8, x8\r
83         fmov    d9, x9\r
84         fmov    d10, x10\r
85         fmov    d11, x11\r
86         fmov    d12, x12\r
87         fmov    d13, x13\r
88         fmov    d14, x14\r
89         fmov    d15, x15\r
90         fmov    d16, x16\r
91         fmov    d17, x17\r
92         fmov    d18, x18\r
93         fmov    d19, x19\r
94         fmov    d20, x20\r
95         fmov    d21, x21\r
96         fmov    d22, x22\r
97         fmov    d23, x23\r
98         fmov    d24, x24\r
99         fmov    d25, x25\r
100         fmov    d26, x26\r
101         fmov    d27, x27\r
102         fmov    d28, x28\r
103         fmov    d29, x29\r
104         fmov    v30.d[1], x30\r
105         fmov    d31, xzr\r
106 \r
107         /* Loop, checking each itteration that each register still contains the\r
108         expected value. */\r
109 reg1_loop:\r
110         /* Yield to increase test coverage */\r
111         SMC 0\r
112 \r
113         /* Test each general purpose register to check that it still contains the\r
114         expected known value, jumping to reg1_error_loop if any register contains\r
115         an unexpected value. */\r
116         cmp             x0, #0xFF\r
117         bne             reg1_error_loop\r
118         cmp             x1, #0x01\r
119         bne             reg1_error_loop\r
120         cmp             x2, #0x02\r
121         bne             reg1_error_loop\r
122         cmp             x3, #0x03\r
123         bne             reg1_error_loop\r
124         cmp             x4, #0x04\r
125         bne             reg1_error_loop\r
126         cmp             x5, #0x05\r
127         bne             reg1_error_loop\r
128         cmp             x6, #0x06\r
129         bne             reg1_error_loop\r
130         cmp             x7, #0x07\r
131         bne             reg1_error_loop\r
132         cmp             x8, #0x08\r
133         bne             reg1_error_loop\r
134         cmp             x9, #0x09\r
135         bne             reg1_error_loop\r
136         cmp             x10, #0x10\r
137         bne             reg1_error_loop\r
138         cmp             x11, #0x11\r
139         bne             reg1_error_loop\r
140         cmp             x12, #0x12\r
141         bne             reg1_error_loop\r
142         cmp             x13, #0x13\r
143         bne             reg1_error_loop\r
144         cmp             x14, #0x14\r
145         bne             reg1_error_loop\r
146         cmp             x15, #0x15\r
147         bne             reg1_error_loop\r
148         cmp             x16, #0x16\r
149         bne             reg1_error_loop\r
150         cmp             x17, #0x17\r
151         bne             reg1_error_loop\r
152         cmp             x18, #0x18\r
153         bne             reg1_error_loop\r
154         cmp             x19, #0x19\r
155         bne             reg1_error_loop\r
156         cmp             x20, #0x20\r
157         bne             reg1_error_loop\r
158         cmp             x21, #0x21\r
159         bne             reg1_error_loop\r
160         cmp             x22, #0x22\r
161         bne             reg1_error_loop\r
162         cmp             x23, #0x23\r
163         bne             reg1_error_loop\r
164         cmp             x24, #0x24\r
165         bne             reg1_error_loop\r
166         cmp             x25, #0x25\r
167         bne             reg1_error_loop\r
168         cmp             x26, #0x26\r
169         bne             reg1_error_loop\r
170         cmp             x27, #0x27\r
171         bne             reg1_error_loop\r
172         cmp             x28, #0x28\r
173         bne             reg1_error_loop\r
174         cmp             x29, #0x29\r
175         bne             reg1_error_loop\r
176         cmp             x30, #0x30\r
177         bne             reg1_error_loop\r
178 \r
179         /* Check every floating point register to ensure it contains the expected\r
180         value.  First save the registers clobbered by the test. */\r
181         stp     x0, x1, [sp,#-0x10]!\r
182 \r
183         fmov    x0, v0.d[1]\r
184         cmp             x0, 0xff\r
185         bne             reg1_error_loop\r
186         fmov    x0, d1\r
187         cmp             x0, 0x01\r
188         bne             reg1_error_loop\r
189         fmov    x0, d2\r
190         cmp             x0, 0x02\r
191         bne             reg1_error_loop\r
192         fmov    x0, d3\r
193         cmp             x0, 0x03\r
194         bne             reg1_error_loop\r
195         fmov    x0, d4\r
196         cmp             x0, 0x04\r
197         bne             reg1_error_loop\r
198         fmov    x0, d5\r
199         cmp             x0, 0x05\r
200         bne             reg1_error_loop\r
201         fmov    x0, d6\r
202         cmp             x0, 0x06\r
203         bne             reg1_error_loop\r
204         fmov    x0, d7\r
205         cmp             x0, 0x07\r
206         bne             reg1_error_loop\r
207         fmov    x0, d8\r
208         cmp             x0, 0x08\r
209         bne             reg1_error_loop\r
210         fmov    x0, d9\r
211         cmp             x0, 0x09\r
212         bne             reg1_error_loop\r
213         fmov    x0, d10\r
214         cmp             x0, 0x10\r
215         bne             reg1_error_loop\r
216         fmov    x0, d11\r
217         cmp             x0, 0x11\r
218         bne             reg1_error_loop\r
219         fmov    x0, d12\r
220         cmp             x0, 0x12\r
221         bne             reg1_error_loop\r
222         fmov    x0, d13\r
223         cmp             x0, 0x13\r
224         bne             reg1_error_loop\r
225         fmov    x0, d14\r
226         cmp             x0, 0x14\r
227         bne             reg1_error_loop\r
228         fmov    x0, d15\r
229         cmp             x0, 0x15\r
230         bne             reg1_error_loop\r
231         fmov    x0, d16\r
232         cmp             x0, 0x16\r
233         bne             reg1_error_loop\r
234         fmov    x0, d17\r
235         cmp             x0, 0x17\r
236         bne             reg1_error_loop\r
237         fmov    x0, d18\r
238         cmp             x0, 0x18\r
239         bne             reg1_error_loop\r
240         fmov    x0, d19\r
241         cmp             x0, 0x19\r
242         bne             reg1_error_loop\r
243         fmov    x0, d20\r
244         cmp             x0, 0x20\r
245         bne             reg1_error_loop\r
246         fmov    x0, d21\r
247         cmp             x0, 0x21\r
248         bne             reg1_error_loop\r
249         fmov    x0, d22\r
250         cmp             x0, 0x22\r
251         bne             reg1_error_loop\r
252         fmov    x0, d23\r
253         cmp             x0, 0x23\r
254         bne             reg1_error_loop\r
255         fmov    x0, d24\r
256         cmp             x0, 0x24\r
257         bne             reg1_error_loop\r
258         fmov    x0, d25\r
259         cmp             x0, 0x25\r
260         bne             reg1_error_loop\r
261         fmov    x0, d26\r
262         cmp             x0, 0x26\r
263         bne             reg1_error_loop\r
264         fmov    x0, d27\r
265         cmp             x0, 0x27\r
266         bne             reg1_error_loop\r
267         fmov    x0, d28\r
268         cmp             x0, 0x28\r
269         bne             reg1_error_loop\r
270         fmov    x0, d29\r
271         cmp             x0, 0x29\r
272         bne             reg1_error_loop\r
273         fmov    x0, v30.d[1]\r
274         cmp             x0, 0x30\r
275         bne             reg1_error_loop\r
276         fmov    x0, d31\r
277         cmp             x0, 0x00\r
278         bne             reg1_error_loop\r
279 \r
280         /* Restore the registers clobbered by the test. */\r
281         ldp     x0, x1, [sp], #0x10\r
282 \r
283         /* Everything passed, increment the loop counter. */\r
284         stp     x0, x1, [sp,#-0x10]!\r
285         ldr             x0, =ullRegTest1LoopCounter\r
286         ldr     x1, [x0]\r
287         adds    x1, x1, #1\r
288         str     x1, [x0]\r
289         ldp     x0, x1, [sp], #0x10\r
290 \r
291         /* Start again. */\r
292         b reg1_loop\r
293 \r
294 reg1_error_loop:\r
295         /* If this line is hit then there was an error in a core register value.\r
296         The loop ensures the loop counter stops incrementing. */\r
297         b reg1_error_loop\r
298         nop\r
299 \r
300 /*-----------------------------------------------------------*/\r
301 \r
302 .type vRegTest2Implementation, %function\r
303 vRegTest2Implementation:\r
304 \r
305         /* Fill each general purpose register with a known value. */\r
306         mov             x0, #0xff0\r
307         mov             x1, #0x010\r
308         mov             x2, #0x020\r
309         mov             x3, #0x030\r
310         mov             x4, #0x040\r
311         mov             x5, #0x050\r
312         mov             x6, #0x060\r
313         mov             x7, #0x070\r
314         mov             x8, #0x080\r
315         mov             x9, #0x090\r
316         mov             x10, #0x100\r
317         mov             x11, #0x110\r
318         mov             x12, #0x120\r
319         mov             x13, #0x130\r
320         mov             x14, #0x140\r
321         mov             x15, #0x150\r
322         mov             x16, #0x160\r
323         mov             x17, #0x170\r
324         mov             x18, #0x180\r
325         mov             x19, #0x190\r
326         mov             x20, #0x200\r
327         mov             x21, #0x210\r
328         mov             x22, #0x220\r
329         mov             x23, #0x230\r
330         mov             x24, #0x240\r
331         mov             x25, #0x250\r
332         mov             x26, #0x260\r
333         mov             x27, #0x270\r
334         mov             x28, #0x280\r
335         mov             x29, #0x290\r
336         mov             x30, #0x300\r
337 \r
338         /* Fill each FPU register with a known value. */\r
339         fmov    d0, x0\r
340         fmov    d1, x1\r
341         fmov    d2, x2\r
342         fmov    d3, x3\r
343         fmov    d4, x4\r
344         fmov    d5, x5\r
345         fmov    d6, x6\r
346         fmov    d7, x7\r
347         fmov    d8, x8\r
348         fmov    d9, x9\r
349         fmov    v10.d[1], x10\r
350         fmov    d11, x11\r
351         fmov    d12, x12\r
352         fmov    d13, x13\r
353         fmov    d14, x14\r
354         fmov    d15, x15\r
355         fmov    d16, x16\r
356         fmov    d17, x17\r
357         fmov    d18, x18\r
358         fmov    d19, x19\r
359         fmov    d20, x20\r
360         fmov    d21, x21\r
361         fmov    d22, x22\r
362         fmov    d23, x23\r
363         fmov    d24, x24\r
364         fmov    d25, x25\r
365         fmov    d26, x26\r
366         fmov    v27.d[1], x27\r
367         fmov    d28, x28\r
368         fmov    d29, x29\r
369         fmov    d30, x30\r
370         fmov    d31, x0\r
371 \r
372         /* Loop, checking each itteration that each register still contains the\r
373         expected value. */\r
374 reg2_loop:\r
375 \r
376         /* Test each general purpose register to check that it still contains the\r
377         expected known value, jumping to reg2_error_loop if any register contains\r
378         an unexpected value. */\r
379         cmp             x0, #0xFF0\r
380         bne             reg2_error_loop\r
381         cmp             x1, #0x010\r
382         bne             reg2_error_loop\r
383         cmp             x2, #0x020\r
384         bne             reg2_error_loop\r
385         cmp             x3, #0x030\r
386         bne             reg2_error_loop\r
387         cmp             x4, #0x040\r
388         bne             reg2_error_loop\r
389         cmp             x5, #0x050\r
390         bne             reg2_error_loop\r
391         cmp             x6, #0x060\r
392         bne             reg2_error_loop\r
393         cmp             x7, #0x070\r
394         bne             reg2_error_loop\r
395         cmp             x8, #0x080\r
396         bne             reg2_error_loop\r
397         cmp             x9, #0x090\r
398         bne             reg2_error_loop\r
399         cmp             x10, #0x100\r
400         bne             reg2_error_loop\r
401         cmp             x11, #0x110\r
402         bne             reg2_error_loop\r
403         cmp             x12, #0x120\r
404         bne             reg2_error_loop\r
405         cmp             x13, #0x130\r
406         bne             reg2_error_loop\r
407         cmp             x14, #0x140\r
408         bne             reg2_error_loop\r
409         cmp             x15, #0x150\r
410         bne             reg2_error_loop\r
411         cmp             x16, #0x160\r
412         bne             reg2_error_loop\r
413         cmp             x17, #0x170\r
414         bne             reg2_error_loop\r
415         cmp             x18, #0x180\r
416         bne             reg2_error_loop\r
417         cmp             x19, #0x190\r
418         bne             reg2_error_loop\r
419         cmp             x20, #0x200\r
420         bne             reg2_error_loop\r
421         cmp             x21, #0x210\r
422         bne             reg2_error_loop\r
423         cmp             x22, #0x220\r
424         bne             reg2_error_loop\r
425         cmp             x23, #0x230\r
426         bne             reg2_error_loop\r
427         cmp             x24, #0x240\r
428         bne             reg2_error_loop\r
429         cmp             x25, #0x250\r
430         bne             reg2_error_loop\r
431         cmp             x26, #0x260\r
432         bne             reg2_error_loop\r
433         cmp             x27, #0x270\r
434         bne             reg2_error_loop\r
435         cmp             x28, #0x280\r
436         bne             reg2_error_loop\r
437         cmp             x29, #0x290\r
438         bne             reg2_error_loop\r
439         cmp             x30, #0x300\r
440         bne             reg2_error_loop\r
441 \r
442         /* Check every floating point register to ensure it contains the expected\r
443         value.  First save the registers clobbered by the test. */\r
444         stp     x0, x1, [sp,#-0x10]!\r
445 \r
446         fmov    x0, d0\r
447         cmp             x0, 0xff0\r
448         bne             reg1_error_loop\r
449         fmov    x0, d1\r
450         cmp             x0, 0x010\r
451         bne             reg1_error_loop\r
452         fmov    x0, d2\r
453         cmp             x0, 0x020\r
454         bne             reg1_error_loop\r
455         fmov    x0, d3\r
456         cmp             x0, 0x030\r
457         bne             reg1_error_loop\r
458         fmov    x0, d4\r
459         cmp             x0, 0x040\r
460         bne             reg1_error_loop\r
461         fmov    x0, d5\r
462         cmp             x0, 0x050\r
463         bne             reg1_error_loop\r
464         fmov    x0, d6\r
465         cmp             x0, 0x060\r
466         bne             reg1_error_loop\r
467         fmov    x0, d7\r
468         cmp             x0, 0x070\r
469         bne             reg1_error_loop\r
470         fmov    x0, d8\r
471         cmp             x0, 0x080\r
472         bne             reg1_error_loop\r
473         fmov    x0, d9\r
474         cmp             x0, 0x090\r
475         bne             reg1_error_loop\r
476         fmov    x0, v10.d[1]\r
477         cmp             x0, 0x100\r
478         bne             reg1_error_loop\r
479         fmov    x0, d11\r
480         cmp             x0, 0x110\r
481         bne             reg1_error_loop\r
482         fmov    x0, d12\r
483         cmp             x0, 0x120\r
484         bne             reg1_error_loop\r
485         fmov    x0, d13\r
486         cmp             x0, 0x130\r
487         bne             reg1_error_loop\r
488         fmov    x0, d14\r
489         cmp             x0, 0x140\r
490         bne             reg1_error_loop\r
491         fmov    x0, d15\r
492         cmp             x0, 0x150\r
493         bne             reg1_error_loop\r
494         fmov    x0, d16\r
495         cmp             x0, 0x160\r
496         bne             reg1_error_loop\r
497         fmov    x0, d17\r
498         cmp             x0, 0x170\r
499         bne             reg1_error_loop\r
500         fmov    x0, d18\r
501         cmp             x0, 0x180\r
502         bne             reg1_error_loop\r
503         fmov    x0, d19\r
504         cmp             x0, 0x190\r
505         bne             reg1_error_loop\r
506         fmov    x0, d20\r
507         cmp             x0, 0x200\r
508         bne             reg1_error_loop\r
509         fmov    x0, d21\r
510         cmp             x0, 0x210\r
511         bne             reg1_error_loop\r
512         fmov    x0, d22\r
513         cmp             x0, 0x220\r
514         bne             reg1_error_loop\r
515         fmov    x0, d23\r
516         cmp             x0, 0x230\r
517         bne             reg1_error_loop\r
518         fmov    x0, d24\r
519         cmp             x0, 0x240\r
520         bne             reg1_error_loop\r
521         fmov    x0, d25\r
522         cmp             x0, 0x250\r
523         bne             reg1_error_loop\r
524         fmov    x0, d26\r
525         cmp             x0, 0x260\r
526         bne             reg1_error_loop\r
527         fmov    x0, v27.d[1]\r
528         cmp             x0, 0x270\r
529         bne             reg1_error_loop\r
530         fmov    x0, d28\r
531         cmp             x0, 0x280\r
532         bne             reg1_error_loop\r
533         fmov    x0, d29\r
534         cmp             x0, 0x290\r
535         bne             reg1_error_loop\r
536         fmov    x0, d30\r
537         cmp             x0, 0x300\r
538         bne             reg1_error_loop\r
539         fmov    x0, d31\r
540         cmp             x0, 0xff0\r
541         bne             reg1_error_loop\r
542 \r
543         /* Restore the registers clobbered by the test. */\r
544         ldp     x0, x1, [sp], #0x10\r
545 \r
546         /* Everything passed, increment the loop counter. */\r
547         stp     x0, x1, [sp,#-0x10]!\r
548         ldr             x0, =ullRegTest2LoopCounter\r
549         ldr     x1, [x0]\r
550         adds    x1, x1, #1\r
551         str     x1, [x0]\r
552         ldp     x0, x1, [sp], #0x10\r
553 \r
554         /* Start again. */\r
555         b reg2_loop\r
556 \r
557 reg2_error_loop:\r
558         /* If this line is hit then there was an error in a core register value.\r
559         The loop ensures the loop counter stops incrementing. */\r
560         b reg2_error_loop\r
561         nop\r
562 \r
563         .end\r
564 \r