All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Arnd Bergmann <arnd@arndb.de>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c in UAL
Date: Thu, 28 Jan 2021 16:21:55 -0800	[thread overview]
Message-ID: <CAKwvOdneTwx8LwKyAA+iMELEBWBxu2nkr9dVuQ=+hgsZROu-tw@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXE5uw4+zV3JVpfA2drOD5TZVMs5a_E5wrrnzjEYc=E_fA@mail.gmail.com>

> On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> wrote:
> > +       TEST_RX("tbh    [pc, r",7, (9f-(1f+4))>>1,", lsl #1]",
> >
> On Thu, Jan 28, 2021 at 1:03 PM Ard Biesheuvel <ardb@kernel.org> wrote:
> Why is this change needed? Are the resulting opcodes equivalent? Does
> GAS infer the lsl #1 but Clang doesn't?

Yes; it seems if you serialize/deserialize this using GNU `as` and
objdump, that's the canonical form (GNU objdump seems to print in UAL
form, IIUC).  I didn't see anything specifically about `tbh` in
https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/assembly-language-changes-after-rvctv2-1?lang=en
but it's what GNU objdump produces and what clang's integrated
assembler accepts.

> >
> >  #define _DATA_PROCESSING32_DNM(op,s,val)                                       \
> > -       TEST_RR(op s".w r0,  r",1, VAL1,", r",2, val, "")                       \
> > +       TEST_RR(op s"   r0,  r",1, VAL1,", r",2, val, "")                       \
>
> What is wrong with these .w suffixes? Shouldn't the assembler accept
> these even on instructions that only exist in a wide encoding?

Yeah, I'm not sure these have anything to do with UAL.  Looking at
LLVM's sources and IIRC, LLVM has "InstAlias"es it uses for .w
suffixes. I think I need to fix those in LLVM for a couple
instructions, rather than modify these in kernel sources.  I'll split
off the arm-test.c and thumb-test.c into separate patches, fix LLVM,
and drop the .w suffix changes to thumb-test.c.

-- 
Thanks,
~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: Nick Desaulniers <ndesaulniers@google.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Russell King <linux@armlinux.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	Nathan Chancellor <natechancellor@gmail.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c in UAL
Date: Thu, 28 Jan 2021 16:21:55 -0800	[thread overview]
Message-ID: <CAKwvOdneTwx8LwKyAA+iMELEBWBxu2nkr9dVuQ=+hgsZROu-tw@mail.gmail.com> (raw)
In-Reply-To: <CAMj1kXE5uw4+zV3JVpfA2drOD5TZVMs5a_E5wrrnzjEYc=E_fA@mail.gmail.com>

> On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> wrote:
> > +       TEST_RX("tbh    [pc, r",7, (9f-(1f+4))>>1,", lsl #1]",
> >
> On Thu, Jan 28, 2021 at 1:03 PM Ard Biesheuvel <ardb@kernel.org> wrote:
> Why is this change needed? Are the resulting opcodes equivalent? Does
> GAS infer the lsl #1 but Clang doesn't?

Yes; it seems if you serialize/deserialize this using GNU `as` and
objdump, that's the canonical form (GNU objdump seems to print in UAL
form, IIUC).  I didn't see anything specifically about `tbh` in
https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/assembly-language-changes-after-rvctv2-1?lang=en
but it's what GNU objdump produces and what clang's integrated
assembler accepts.

> >
> >  #define _DATA_PROCESSING32_DNM(op,s,val)                                       \
> > -       TEST_RR(op s".w r0,  r",1, VAL1,", r",2, val, "")                       \
> > +       TEST_RR(op s"   r0,  r",1, VAL1,", r",2, val, "")                       \
>
> What is wrong with these .w suffixes? Shouldn't the assembler accept
> these even on instructions that only exist in a wide encoding?

Yeah, I'm not sure these have anything to do with UAL.  Looking at
LLVM's sources and IIRC, LLVM has "InstAlias"es it uses for .w
suffixes. I think I need to fix those in LLVM for a couple
instructions, rather than modify these in kernel sources.  I'll split
off the arm-test.c and thumb-test.c into separate patches, fix LLVM,
and drop the .w suffix changes to thumb-test.c.

-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-01-29  0:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-28  4:43 [PATCH] ARM: kprobes: rewrite in UAL Nick Desaulniers
2021-01-28  4:43 ` Nick Desaulniers
2021-01-28 16:15 ` Arnd Bergmann
2021-01-28 16:15   ` Arnd Bergmann
2021-01-28 18:59   ` Nick Desaulniers
2021-01-28 21:23     ` Arnd Bergmann
2021-01-28 21:23       ` Arnd Bergmann
2021-01-28 19:34   ` [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c " Nick Desaulniers
2021-01-28 21:03     ` Ard Biesheuvel
2021-01-28 21:03       ` Ard Biesheuvel
2021-01-28 22:28       ` Arnd Bergmann
2021-01-28 22:28         ` Arnd Bergmann
2021-01-28 23:30         ` Ard Biesheuvel
2021-01-28 23:30           ` Ard Biesheuvel
2021-02-13 11:01           ` Ard Biesheuvel
2021-02-13 11:01             ` Ard Biesheuvel
2021-01-29  0:21       ` Nick Desaulniers [this message]
2021-01-29  0:21         ` Nick Desaulniers
2021-01-29  9:40         ` Ard Biesheuvel
2021-01-29 18:54           ` [PATCH v3] ARM: kprobes: rewrite test-arm.c " Nick Desaulniers
2021-01-29 18:54             ` Nick Desaulniers
2021-03-29 22:08           ` [PATCH v2] ARM: kprobes: rewrite test-[arm|thumb].c " Nick Desaulniers
2021-03-29 22:08             ` Nick Desaulniers

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='CAKwvOdneTwx8LwKyAA+iMELEBWBxu2nkr9dVuQ=+hgsZROu-tw@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=natechancellor@gmail.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.