qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Richard Henderson <richard.henderson@linaro.org>,
	David Hildenbrand <david@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>,
	qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	Michael Tokarev <mjt@tls.msk.ru>
Subject: Re: [PATCH 2/4] tests/tcg/s390x: Test CLC with inaccessible second operand
Date: Mon, 06 Nov 2023 10:20:54 +0100	[thread overview]
Message-ID: <150d34e65cff88b2605e5811f8c583b3adb3275a.camel@linux.ibm.com> (raw)
In-Reply-To: <9963393c-f641-402a-94a1-86e6ef740adf@linaro.org>

On Tue, 2023-10-31 at 15:53 -0700, Richard Henderson wrote:
> On 10/30/23 22:32, Ilya Leoshkevich wrote:
> > +int main(void)
> > +{
> > +    register unsigned long r0 asm("r0");
> > +    unsigned long mem = 42, rhs = 500;
> > +    struct sigaction act;
> > +    int err;
> > +
> > +    memset(&act, 0, sizeof(act));
> > +    act.sa_sigaction = handle_sigsegv;
> > +    act.sa_flags = SA_SIGINFO;
> > +    err = sigaction(SIGSEGV, &act, NULL);
> > +    assert(err == 0);
> > +
> > +    r0 = 100;
> > +    asm("algr %[r0],%[rhs]\n"
> > +        "clc 0(8,%[mem]),0(0)\n"  /* The 2nd operand will cause a
> > SEGV. */
> > +        : [r0] "+r" (r0)
> > +        : [mem] "r" (&mem)
> > +        , [rhs] "r" (rhs)
> > +        : "cc", "memory");
> > +
> 
> You could just as easily set cc based on CHI or something to avoid
> hard-coding r0, or even 
> clobbering an output register at all.

The point of hardcoding r0 is rather to be able to check its value in
handle_sigsegv(). While this was not buggy, I still wanted to make sure
that the updated value is "committed" despite SEGV.

> 
> But I guess there's little point bike shedding this too much...
> 
> r~



  reply	other threads:[~2023-11-06  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31  5:32 [PATCH 0/4] target/s390x: CC fixes Ilya Leoshkevich
2023-10-31  5:32 ` [PATCH 1/4] target/s390x: Fix CLC corrupting cc_src Ilya Leoshkevich
2023-10-31 22:49   ` Richard Henderson
2023-10-31  5:32 ` [PATCH 2/4] tests/tcg/s390x: Test CLC with inaccessible second operand Ilya Leoshkevich
2023-10-31 22:53   ` Richard Henderson
2023-11-06  9:20     ` Ilya Leoshkevich [this message]
2023-10-31  5:32 ` [PATCH 3/4] target/s390x: Fix LAALG not updating cc_src Ilya Leoshkevich
2023-10-31 22:57   ` Richard Henderson
2023-10-31  5:32 ` [PATCH 4/4] tests/tcg/s390x: Test LAALG with negative cc_src Ilya Leoshkevich
2023-10-31  8:38 ` [PATCH 0/4] target/s390x: CC fixes David Hildenbrand
2023-11-03 16:44   ` Ilya Leoshkevich
2023-11-03 17:02     ` David Hildenbrand

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=150d34e65cff88b2605e5811f8c583b3adb3275a.camel@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).