From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Juergen Gross <jgross@suse.com>, <linux-kernel@vger.kernel.org>,
<xen-devel@lists.xenproject.org>, <x86@kernel.org>
Cc: <sstabellini@kernel.org>, <mingo@redhat.com>, <bp@alien8.de>,
<hpa@zytor.com>, <boris.ostrovsky@oracle.com>,
<tglx@linutronix.de>
Subject: Re: [Xen-devel] [PATCH] x86/xen: fix pv boot
Date: Wed, 7 Nov 2018 12:02:16 +0000 [thread overview]
Message-ID: <6eb96a45-393c-4e06-ee19-549fdbe9e316@citrix.com> (raw)
In-Reply-To: <f95cf3fb-fb49-8211-0c54-f6c7382ac455@citrix.com>
On 07/11/18 11:55, Andrew Cooper wrote:
> On 07/11/18 11:30, Juergen Gross wrote:
>> + return ret;
>> }
>>
>> static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val)
>> {
>> - return __get_user(*val, (unsigned long __user *)addr);
>> + int ret = 0;
>> + unsigned long rval;
>> +
>> + asm volatile("1: mov"__i" %2,%"__r"1\n"
>> + "2:\n"
>> + ".section .fixup,\"ax\"\n"
>> + "3: mov %3,%0\n"
>> + " jmp 2b\n"
>> + ".previous\n"
>> + _ASM_EXTABLE(1b, 3b)
>> + : "=r" (ret), "=r" (rval)
>> + : "m" (*addr), "i" (-1), "0" (ret));
>> + *val = rval;
>> + return ret;
> This also uses rval uninitialised if a fault occurs.
>
> Overall, how about:
>
> static inline int xen_safe_write_ulong(unsigned long *addr, unsigned
> long val)
> {
> int ret = 0;
>
> asm volatile("1: mov %[val], %[ptr]\n"
> "2:\n"
> ".section .fixup, \"ax\"\n"
> "3: mov %[err], %[ret]\n"
Actually, if you want a shorter fixup path, `sub $1, %[ret]` would also
do, and drop the [err] constraint.
~Andrew
next prev parent reply other threads:[~2018-11-07 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 11:30 Juergen Gross
2018-11-07 11:55 ` [Xen-devel] " Andrew Cooper
2018-11-07 12:02 ` Andrew Cooper [this message]
2018-11-07 12:16 ` Juergen Gross
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=6eb96a45-393c-4e06-ee19-549fdbe9e316@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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
all inboxes | Powered by JetHome®