All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>
Subject: [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly
Date: Tue, 22 Jun 2021 15:55:16 +0200	[thread overview]
Message-ID: <20210622135517.234801-4-thuth@redhat.com> (raw)
In-Reply-To: <20210622135517.234801-1-thuth@redhat.com>

According to the Principles of Operation, the epsw instruction
does not touch the second register if it is r0. With GCC we were
lucky so far that it never tried to use r0 here, but when compiling
the kvm-unit-tests with Clang, this indeed happens and leads to
very weird crashes. Thus let's make sure to never use r0 for the
second operand of the epsw instruction.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/s390x/asm/arch_def.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h
index 3aa5da9..15cf7d4 100644
--- a/lib/s390x/asm/arch_def.h
+++ b/lib/s390x/asm/arch_def.h
@@ -265,7 +265,7 @@ static inline uint64_t extract_psw_mask(void)
 
 	asm volatile(
 		"	epsw	%0,%1\n"
-		: "+r" (mask_upper), "+r" (mask_lower) : : );
+		: "=r" (mask_upper), "=a" (mask_lower));
 
 	return (uint64_t) mask_upper << 32 | mask_lower;
 }
-- 
2.27.0


  parent reply	other threads:[~2021-06-22 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22 13:55 [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 1/4] configure: Add the possibility to specify additional cflags Thomas Huth
2021-06-22 13:55 ` [kvm-unit-tests PATCH 2/4] powerpc: Probe whether the compiler understands -mabi=no-altivec Thomas Huth
2021-06-22 13:55 ` Thomas Huth [this message]
2021-06-22 14:12   ` [kvm-unit-tests PATCH 3/4] lib/s390x: Fix the epsw inline assembly Claudio Imbrenda
2021-06-22 16:40     ` Thomas Huth
2021-06-23  7:33   ` Janosch Frank
2021-06-22 13:55 ` [kvm-unit-tests PATCH 4/4] Test compilation with Clang on aarch64, ppc64le and s390x in Travis-CI Thomas Huth
2021-06-22 16:25 ` [kvm-unit-tests PATCH 0/4] Test compiling with Clang in the Travis-CI Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210622135517.234801-4-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.