osdep: protect qemu/osdep.h with extern "C"
[qemu/ar7.git] / tests / migration / aarch64 / a-b-kernel.S
blob02259453483b4be9240c00bed34fb7a763dcc56d
2 # Copyright (c) 2018 Red Hat, Inc. and/or its affiliates
4 # Author:
5 #   Wei Huang <wei@redhat.com>
7 # This work is licensed under the terms of the GNU GPL, version 2 or later.
8 # See the COPYING file in the top-level directory.
10 # Note: Please make sure the compiler compiles the assembly code below with
11 # pc-relative address. Also the branch instructions should use relative
12 # addresses only.
14 #include "../migration-test.h"
16 .section .text
18         .globl  _start
20 _start:
21         /* disable MMU to use phys mem address */
22         mrs     x0, sctlr_el1
23         bic     x0, x0, #(1<<0)
24         msr     sctlr_el1, x0
25         isb
27         /* traverse test memory region */
28         mov     x0, #ARM_TEST_MEM_START
29         mov     x1, #ARM_TEST_MEM_END
31         /* output char 'A' to PL011 */
32         mov     w3, 'A'
33         mov     x2, #ARM_MACH_VIRT_UART
34         strb    w3, [x2]
36         /* clean up memory */
37         mov     w3, #0
38         mov     x4, x0
39 clean:
40         strb    w3, [x4]
41         add     x4, x4, #TEST_MEM_PAGE_SIZE
42         cmp     x4, x1
43         ble     clean
45         /* w5 keeps a counter so we can limit the output speed */
46         mov     w5, #0
48         /* main body */
49 mainloop:
50         mov     x4, x0
52 innerloop:
53         /* increment the first byte of each page by 1 */
54         ldrb    w3, [x4]
55         add     w3, w3, #1
56         and     w3, w3, #0xff
57         strb    w3, [x4]
59         /* make sure QEMU user space can see consistent data as MMU is off */
60         dc      civac, x4
62         add     x4, x4, #TEST_MEM_PAGE_SIZE
63         cmp     x4, x1
64         blt     innerloop
66         add     w5, w5, #1
67         and     w5, w5, #0xff
68         cmp     w5, #0
69         bne     mainloop
71         /* output char 'B' to PL011 */
72         mov     w3, 'B'
73         strb    w3, [x2]
75         b       mainloop