[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YS1HXyQu2mvMzbL/@zeniv-ca.linux.org.uk>
Date: Mon, 30 Aug 2021 21:02:23 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Borislav Petkov <bp@...en8.de>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [patch 01/10] x86/fpu/signal: Clarify exception handling in
restore_fpregs_from_user()
On Mon, Aug 30, 2021 at 10:09:27PM +0200, Thomas Gleixner wrote:
> +++ b/arch/x86/include/asm/fpu/internal.h
> @@ -88,7 +88,11 @@ static inline void fpstate_init_soft(str
> #endif
> extern void save_fpregs_to_fpstate(struct fpu *fpu);
>
> -/* Returns 0 or the negated trap number, which results in -EFAULT for #PF */
> +/*
> + * Returns 0 on success or the negated trap number when the operation
> + * raises an exception (The exception fixup function ex_handler_fault()
> + * stores the trap number in EAX).
> + */
> #define user_insn(insn, output, input...) \
> ({ \
> int err; \
> @@ -199,7 +203,8 @@ static inline void fxsave(struct fxregs_
>
> /*
> * After this @err contains 0 on success or the negated trap number when
> - * the operation raises an exception. For faults this results in -EFAULT.
> + * the operation raises an exception (The exception fixup function
> + * ex_handler_fault() stores the trap number in EAX).
> */
> #define XSTATE_OP(op, st, lmask, hmask, err) \
> asm volatile("1:" op "\n\t" \
Incidentally, why do we bother with negation in those? Why not have
user_insn(), XSTATE_OP() and kernel_insn_err() return 0 or trap number...
Powered by blists - more mailing lists