[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzpN2itqrztb+wA1k-KDwYMyQw3nZaMjzkHCu4GLr=t10ug=w@mail.gmail.com>
Date: Mon, 9 Mar 2020 01:08:35 -0400
From: Brian Gerst <brgerst@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Juergen Gross <jgross@...e.com>,
Frederic Weisbecker <frederic@...nel.org>,
Alexandre Chartre <alexandre.chartre@...cle.com>
Subject: Re: [patch part-III V2 05/23] x86/entry/32: Provide macro to emit IDT
entry stubs
On Sun, Mar 8, 2020 at 7:24 PM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> From: Thomas Gleixner <tglx@...utronix.de>
>
> 32 and 64 bit have unnecessary different ways to populate the exception
> entry code. Provide a idtentry macro which allows to consolidate all of
> that.
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Reviewed-by: Alexandre Chartre <alexandre.chartre@...cle.com>
>
> ---
> arch/x86/entry/entry_32.S | 42 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> --- a/arch/x86/entry/entry_32.S
> +++ b/arch/x86/entry/entry_32.S
> @@ -44,6 +44,7 @@
> #include <asm/asm.h>
> #include <asm/smap.h>
> #include <asm/frame.h>
> +#include <asm/trapnr.h>
> #include <asm/nospec-branch.h>
>
> #include "calling.h"
> @@ -726,6 +727,47 @@
>
> .Lend_\@:
> .endm
> +
> +#ifdef CONFIG_X86_INVD_BUG
> +.macro idtentry_push_func vector cfunc
> + .if \vector == X86_TRAP_XF
> + /* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */
> + ALTERNATIVE "pushl $do_general_protection", \
> + "pushl $do_simd_coprocessor_error", \
> + X86_FEATURE_XMM
> + .else
> + pushl $\cfunc
> + .endif
> +.endm
> +#else
> +.macro idtentry_push_func vector cfunc
> + pushl $\cfunc
> +.endm
> +#endif
IMHO it would be better to push this to the C code and not make the
asm more complicated. Something like:
dotraplinkage void
do_simd_coprocessor_error(struct pt_regs *regs, long error_code)
{
#ifdef CONFIG_X86_INVD_BUG
/* AMD 486 bug: invd from userspace calls exception 19 instead of #GP */
if (!static_cpu_has(X86_FEATURE_XMM)) {
do_general_protection(regs, error_code);
return;
}
#endif
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
math_error(regs, error_code, X86_TRAP_XF);
}
--
Brian Gerst
Powered by blists - more mailing lists