Commit efec8d21 authored by Christian Borntraeger's avatar Christian Borntraeger
Browse files

selftests: kvm: make syncregs more reliable on s390



similar to commit 2c57da356800 ("selftests: kvm: fix sync_regs_test with
newer gccs") and commit 204c91ef ("KVM: selftests: do not blindly
clobber registers in guest asm") we better do not rely on gcc leaving
r11 untouched.  We can write the simple ucall inline and have the guest
code completely as small assembler function.

Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Suggested-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
parent f76f6371
Loading
Loading
Loading
Loading
+9 −6
Original line number Original line Diff line number Diff line
@@ -25,12 +25,15 @@


static void guest_code(void)
static void guest_code(void)
{
{
	register u64 stage asm("11") = 0;
	/*

	 * We embed diag 501 here instead of doing a ucall to avoid that
	for (;;) {
	 * the compiler has messed with r11 at the time of the ucall.
		GUEST_SYNC(0);
	 */
		asm volatile ("ahi %0,1" : : "r"(stage));
	asm volatile (
	}
		"0:	diag 0,0,0x501\n"
		"	ahi 11,1\n"
		"	j 0b\n"
	);
}
}


#define REG_COMPARE(reg) \
#define REG_COMPARE(reg) \