From: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Petr Mladek <pmladek@suse.com>,
Joe Lawrence <joe.lawrence@redhat.com>,
<live-patching@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Alexei Starovoitov <ast@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Luis Chamberlain <mcgrof@kernel.org>,
<linux-modules@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
David Laight <David.Laight@aculab.com>,
linux-m68k <linux-m68k@lists.linux-m68k.org>,
"Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: Re: [PATCH v9] kallsyms: Add self-test facility
Date: Fri, 16 Dec 2022 21:31:04 +0800 [thread overview]
Message-ID: <1739960e-7f95-88ef-9b91-31c7504bb7fd@huawei.com> (raw)
In-Reply-To: <87h6xvk1dc.fsf@igel.home>
On 2022/12/16 19:57, Andreas Schwab wrote:
> On Dez 16 2022, Leizhen (ThunderTown) wrote:
>
>> It seems that the problem is still strcmp(). After I commented strcmp() in
>> arch/m68k/include/asm/string.h, and force it to use the one in lib/string.c,
>> it works well.
>
> Does that help?
It still needs to add 'volatile' to prevent compiler optimizations.
Otherwise,
Tested-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
> index f759d944c449..cdafd67774e0 100644
> --- a/arch/m68k/include/asm/string.h
> +++ b/arch/m68k/include/asm/string.h
> @@ -42,18 +42,19 @@ static inline char *strncpy(char *dest, const char *src, size_t n)
> #define __HAVE_ARCH_STRCMP
> static inline int strcmp(const char *cs, const char *ct)
> {
> - char res;
> + int res = 0, tmp = 0;
>
> asm ("\n"
- asm ("\n"
+ asm volatile ("\n"
> "1: move.b (%0)+,%2\n" /* get *cs */
> - " cmp.b (%1)+,%2\n" /* compare a byte */
> + " move.b (%1)+,%3\n" /* get *ct */
> + " cmp.b %3,%2\n" /* compare a byte */
> " jne 2f\n" /* not equal, break out */
> " tst.b %2\n" /* at end of cs? */
> " jne 1b\n" /* no, keep going */
> " jra 3f\n" /* strings are equal */
> - "2: sub.b -(%1),%2\n" /* *cs - *ct */
> + "2: sub.l %3,%2\n" /* *cs - *ct */
> "3:"
> - : "+a" (cs), "+a" (ct), "=d" (res));
> + : "+a" (cs), "+a" (ct), "+d" (res), "+d" (tmp));
> return res;
> }
> #endif /* CONFIG_COLDFIRE */
>
--
Regards,
Zhen Lei
next prev parent reply other threads:[~2022-12-16 13:31 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 8:33 [PATCH v9] kallsyms: Add self-test facility Zhen Lei
2022-11-15 8:42 ` Luis Chamberlain
2022-11-15 8:43 ` Leizhen (ThunderTown)
2022-12-15 8:50 ` Geert Uytterhoeven
2022-12-15 9:16 ` Leizhen (ThunderTown)
2022-12-15 9:39 ` Geert Uytterhoeven
2022-12-15 12:33 ` Leizhen (ThunderTown)
2022-12-15 13:24 ` Geert Uytterhoeven
2022-12-15 13:58 ` Leizhen (ThunderTown)
2022-12-15 14:40 ` Leizhen (ThunderTown)
2022-12-15 14:51 ` Geert Uytterhoeven
2022-12-16 7:42 ` Leizhen (ThunderTown)
2022-12-16 9:36 ` Leizhen (ThunderTown)
2022-12-16 11:28 ` Geert Uytterhoeven
2022-12-16 12:01 ` Leizhen (ThunderTown)
2022-12-16 13:29 ` David Laight
2022-12-16 14:44 ` David Laight
2022-12-16 15:19 ` Andreas Schwab
2022-12-16 15:25 ` David Laight
2022-12-16 15:54 ` Andreas Schwab
2022-12-16 16:09 ` David Laight
2022-12-16 16:11 ` Andreas Schwab
2022-12-16 16:32 ` David Laight
2022-12-16 16:53 ` Steven Rostedt
2022-12-16 16:57 ` David Laight
2022-12-16 17:19 ` Steven Rostedt
2022-12-16 17:38 ` Steven Rostedt
2022-12-16 19:27 ` David Laight
2022-12-17 7:31 ` Leizhen (ThunderTown)
2022-12-17 13:37 ` Geert Uytterhoeven
2022-12-17 17:37 ` David Laight
2022-12-16 11:57 ` Andreas Schwab
2022-12-16 13:31 ` Leizhen (ThunderTown) [this message]
2022-12-16 13:47 ` Andreas Schwab
2022-12-15 14:43 ` Geert Uytterhoeven
2022-12-15 14:51 ` Andreas Schwab
2022-12-16 10:40 ` David Laight
2022-12-16 11:40 ` Leizhen (ThunderTown)
2022-12-16 11:44 ` Andreas Schwab
2022-12-16 11:57 ` Leizhen (ThunderTown)
2022-12-16 12:39 ` Andreas Schwab
2022-12-16 13:31 ` Leizhen (ThunderTown)
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=1739960e-7f95-88ef-9b91-31c7504bb7fd@huawei.com \
--to=thunder.leizhen@huawei.com \
--cc=David.Laight@aculab.com \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=ast@kernel.org \
--cc=geert@linux-m68k.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-modules@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mbenes@suse.cz \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=schwab@linux-m68k.org \
/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