From: Ard Biesheuvel <ardb@kernel.org> To: Nick Desaulniers <ndesaulniers@google.com> 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 22:03:30 +0100 [thread overview] Message-ID: <CAMj1kXE5uw4+zV3JVpfA2drOD5TZVMs5a_E5wrrnzjEYc=E_fA@mail.gmail.com> (raw) In-Reply-To: <20210128193422.241155-1-ndesaulniers@google.com> On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> wrote: > > Clang's integrated assembler only accepts UAL syntax, rewrite the > instructions that were changed by RVCTv2.1. > > The document "Assembly language changes after RVCTv2.1" was very > helpful. > > This exposed a bug in Clang's integrated assembler, which hopefully will > land in clang-12, but is required to test this patch with LLVM_IAS=1. > > Link: https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/assembly-language-changes-after-rvctv2-1 > Link: https://github.com/ClangBuiltLinux/linux/issues/1271 > Link: https://reviews.llvm.org/D95586 > Reported-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > --- > * Fix additonal swpvsb case in test-arm.c when __LINUX_ARM_ARCH__ < 6, > reported by Arnd. > * Fix arch/arm/probes/kprobes/test-thumb.c, reported by Arnd. > * Modify the oneline to note I'm modifying test-*.c. > > arch/arm/probes/kprobes/test-arm.c | 290 +++++++++++++-------------- > arch/arm/probes/kprobes/test-thumb.c | 20 +- > 2 files changed, 155 insertions(+), 155 deletions(-) > ... > diff --git a/arch/arm/probes/kprobes/test-thumb.c b/arch/arm/probes/kprobes/test-thumb.c > index 456c181a7bfe..63277c1006b9 100644 > --- a/arch/arm/probes/kprobes/test-thumb.c > +++ b/arch/arm/probes/kprobes/test-thumb.c > @@ -441,21 +441,21 @@ void kprobe_thumb32_test_cases(void) > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]", > + TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,", lsl #1]", Why is this change needed? Are the resulting opcodes equivalent? Does GAS infer the lsl #1 but Clang doesn't? > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]", > + TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]", > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RRX("tbh [r",1,9f, ", r",14,1,"]", > + TEST_RRX("tbh [r",1,9f, ", r",14,1,", lsl #1]", > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > @@ -468,15 +468,15 @@ void kprobe_thumb32_test_cases(void) > > TEST_UNSUPPORTED("strexb r0, r1, [r2]") > TEST_UNSUPPORTED("strexh r0, r1, [r2]") > - TEST_UNSUPPORTED("strexd r0, r1, [r2]") > + TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") > TEST_UNSUPPORTED("ldrexb r0, [r1]") > TEST_UNSUPPORTED("ldrexh r0, [r1]") > - TEST_UNSUPPORTED("ldrexd r0, [r1]") > + TEST_UNSUPPORTED("ldrexd r0, r1, [r1]") > > TEST_GROUP("Data-processing (shifted register) and (modified immediate)") > > #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? > TEST_RR(op s" r1, r",1, VAL1,", r",2, val, ", lsl #3") \ > TEST_RR(op s" r2, r",3, VAL1,", r",2, val, ", lsr #4") \ > TEST_RR(op s" r3, r",3, VAL1,", r",2, val, ", asr #5") \ > @@ -764,7 +764,7 @@ CONDITION_INSTRUCTIONS(22, > TEST("nop.w") > TEST("wfi.w") > TEST_SUPPORTED("wfe.w") > - TEST_UNSUPPORTED("dbg.w #0") > + TEST_UNSUPPORTED("dbg #0") > > TEST_UNSUPPORTED("clrex") > TEST_UNSUPPORTED("dsb") > @@ -790,9 +790,9 @@ CONDITION_INSTRUCTIONS(22, > TEST_BB( "b.w 2b") > TEST_BF_X("b.w 2f", SPACE_0x1000) > > - TEST_BF( "bl.w 2f") > - TEST_BB( "bl.w 2b") > - TEST_BB_X("bl.w 2b", SPACE_0x1000) > + TEST_BF( "bl 2f") > + TEST_BB( "bl 2b") > + TEST_BB_X("bl 2b", SPACE_0x1000) > > TEST_X( "blx __dummy_arm_subroutine", > ".arm \n\t" > -- > 2.30.0.365.g02bc693789-goog >
WARNING: multiple messages have this Message-ID (diff)
From: Ard Biesheuvel <ardb@kernel.org> To: Nick Desaulniers <ndesaulniers@google.com> 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 22:03:30 +0100 [thread overview] Message-ID: <CAMj1kXE5uw4+zV3JVpfA2drOD5TZVMs5a_E5wrrnzjEYc=E_fA@mail.gmail.com> (raw) In-Reply-To: <20210128193422.241155-1-ndesaulniers@google.com> On Thu, 28 Jan 2021 at 20:34, Nick Desaulniers <ndesaulniers@google.com> wrote: > > Clang's integrated assembler only accepts UAL syntax, rewrite the > instructions that were changed by RVCTv2.1. > > The document "Assembly language changes after RVCTv2.1" was very > helpful. > > This exposed a bug in Clang's integrated assembler, which hopefully will > land in clang-12, but is required to test this patch with LLVM_IAS=1. > > Link: https://developer.arm.com/documentation/dui0473/c/writing-arm-assembly-language/assembly-language-changes-after-rvctv2-1 > Link: https://github.com/ClangBuiltLinux/linux/issues/1271 > Link: https://reviews.llvm.org/D95586 > Reported-by: Arnd Bergmann <arnd@arndb.de> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > --- > * Fix additonal swpvsb case in test-arm.c when __LINUX_ARM_ARCH__ < 6, > reported by Arnd. > * Fix arch/arm/probes/kprobes/test-thumb.c, reported by Arnd. > * Modify the oneline to note I'm modifying test-*.c. > > arch/arm/probes/kprobes/test-arm.c | 290 +++++++++++++-------------- > arch/arm/probes/kprobes/test-thumb.c | 20 +- > 2 files changed, 155 insertions(+), 155 deletions(-) > ... > diff --git a/arch/arm/probes/kprobes/test-thumb.c b/arch/arm/probes/kprobes/test-thumb.c > index 456c181a7bfe..63277c1006b9 100644 > --- a/arch/arm/probes/kprobes/test-thumb.c > +++ b/arch/arm/probes/kprobes/test-thumb.c > @@ -441,21 +441,21 @@ void kprobe_thumb32_test_cases(void) > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,"]", > + TEST_RX("tbh [pc, r",7, (9f-(1f+4))>>1,", lsl #1]", Why is this change needed? Are the resulting opcodes equivalent? Does GAS infer the lsl #1 but Clang doesn't? > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,"]", > + TEST_RX("tbh [pc, r",12, ((9f-(1f+4))>>1)+1,", lsl #1]", > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > "3: mvn r0, r0 \n\t" > "2: nop \n\t") > > - TEST_RRX("tbh [r",1,9f, ", r",14,1,"]", > + TEST_RRX("tbh [r",1,9f, ", r",14,1,", lsl #1]", > "9: \n\t" > ".short (2f-1b-4)>>1 \n\t" > ".short (3f-1b-4)>>1 \n\t" > @@ -468,15 +468,15 @@ void kprobe_thumb32_test_cases(void) > > TEST_UNSUPPORTED("strexb r0, r1, [r2]") > TEST_UNSUPPORTED("strexh r0, r1, [r2]") > - TEST_UNSUPPORTED("strexd r0, r1, [r2]") > + TEST_UNSUPPORTED("strexd r0, r1, r2, [r2]") > TEST_UNSUPPORTED("ldrexb r0, [r1]") > TEST_UNSUPPORTED("ldrexh r0, [r1]") > - TEST_UNSUPPORTED("ldrexd r0, [r1]") > + TEST_UNSUPPORTED("ldrexd r0, r1, [r1]") > > TEST_GROUP("Data-processing (shifted register) and (modified immediate)") > > #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? > TEST_RR(op s" r1, r",1, VAL1,", r",2, val, ", lsl #3") \ > TEST_RR(op s" r2, r",3, VAL1,", r",2, val, ", lsr #4") \ > TEST_RR(op s" r3, r",3, VAL1,", r",2, val, ", asr #5") \ > @@ -764,7 +764,7 @@ CONDITION_INSTRUCTIONS(22, > TEST("nop.w") > TEST("wfi.w") > TEST_SUPPORTED("wfe.w") > - TEST_UNSUPPORTED("dbg.w #0") > + TEST_UNSUPPORTED("dbg #0") > > TEST_UNSUPPORTED("clrex") > TEST_UNSUPPORTED("dsb") > @@ -790,9 +790,9 @@ CONDITION_INSTRUCTIONS(22, > TEST_BB( "b.w 2b") > TEST_BF_X("b.w 2f", SPACE_0x1000) > > - TEST_BF( "bl.w 2f") > - TEST_BB( "bl.w 2b") > - TEST_BB_X("bl.w 2b", SPACE_0x1000) > + TEST_BF( "bl 2f") > + TEST_BB( "bl 2b") > + TEST_BB_X("bl 2b", SPACE_0x1000) > > TEST_X( "blx __dummy_arm_subroutine", > ".arm \n\t" > -- > 2.30.0.365.g02bc693789-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-01-28 21:05 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 [this message] 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 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='CAMj1kXE5uw4+zV3JVpfA2drOD5TZVMs5a_E5wrrnzjEYc=E_fA@mail.gmail.com' \ --to=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 \ --cc=ndesaulniers@google.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: linkBe 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.