qemu/tests/migration/ppc64/a-b-kernel.S
Nicholas Piggin 34cc54fb35 tests/qtest/migration-test: Use custom asm bios for ppc64
Similar to other archs, build a custom bios memory updater. Running the
test with OF code is a cool trick, but SLOF takes a long time to boot.
This reduces test time by around 3x (150s to 50s).

Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14 14:01:23 -03:00

67 lines
1.2 KiB
ArmAsm

#
# Copyright (c) 2024 IBM, Inc
#
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
#include "../migration-test.h"
.section .text
.macro print ch
li %r3,PPC_H_PUT_TERM_CHAR
li %r4,0
li %r5,1
li %r6,\ch
sldi %r6,%r6,56
sc 1
.endm
.globl _start
_start:
. = 0x100
/*
* Enter 64-bit mode. Not necessary because the test uses 32-bit
* addresses, but those constants could easily be changed and break
* in 32-bit mode.
*/
mfmsr %r9
li %r10,-1
rldimi %r9,%r10,63,0
mtmsrd %r9
/*
* Set up test memory region. Non-volatiles are used because the
* hcall can clobber regs.
* r20 - start address
* r21 - number of pages
*/
lis %r20,PPC_TEST_MEM_START@h
ori %r20,%r20,PPC_TEST_MEM_START@l
lis %r9,PPC_TEST_MEM_END@h
ori %r9,%r9,PPC_TEST_MEM_END@l
subf %r21,%r20,%r9
li %r10,TEST_MEM_PAGE_SIZE
divd %r21,%r21,%r10
print 'A'
li %r3,0
mr %r9,%r20
mtctr %r21
1: stb %r3,0(%r9)
addi %r9,%r9,TEST_MEM_PAGE_SIZE
bdnz 1b
loop:
mr %r9,%r20
mtctr %r21
1: lbz %r3,0(%r9)
addi %r3,%r3,1
stb %r3,0(%r9)
addi %r9,%r9,TEST_MEM_PAGE_SIZE
bdnz 1b
print 'B'
b loop