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