On Wed, Dec 30, 2015 at 10:56:41AM -0800, Tony Luck wrote:
> Make per-class functions for exception table fixup. Add #defines
> and general prettiness to make it clear how all the parts tie
> together.
> 
> Add a new class that fills %rax with the fault number of the exception.
> 
> Signed-off-by: Tony Luck <[email protected]>
> ---
>  arch/x86/include/asm/asm.h     | 24 ++++++++++-----
>  arch/x86/include/asm/uaccess.h | 17 ++++++++---
>  arch/x86/kernel/kprobes/core.c |  2 +-
>  arch/x86/kernel/traps.c        |  6 ++--
>  arch/x86/mm/extable.c          | 67 
> +++++++++++++++++++++++++++---------------
>  arch/x86/mm/fault.c            |  2 +-
>  6 files changed, 79 insertions(+), 39 deletions(-)
> 
> diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
> index b64121ffb2da..1888278d0559 100644
> --- a/arch/x86/include/asm/asm.h
> +++ b/arch/x86/include/asm/asm.h
> @@ -44,6 +44,7 @@
>  
>  /* Exception table entry */
>  
> +#define      _EXTABLE_BIAS   0x20000000
>  /*
>   * An exception table entry is 64 bits.  The first 32 bits are the offset
>   * from that entry to the potentially faulting instruction.  sortextable
> @@ -54,26 +55,35 @@
>   * address.  All of these are generated by relocations, so we can only
>   * rely on addition.  We therefore emit:
>   *
> - * (target - here) + (class) + 0x20000000
> + * (target - here) + (class) + _EXTABLE_BIAS
>   *
>   * This has the property that the two high bits are the class and the
>   * rest is easy to decode.
>   */
>  
> -/* There are two bits of extable entry class, added to a signed offset. */
> -#define _EXTABLE_CLASS_DEFAULT       0               /* standard uaccess 
> fixup */
> -#define _EXTABLE_CLASS_EX    0x80000000      /* uaccess + set uaccess_err */
> +/*
> + * There are two bits of extable entry class giving four classes
> + */
> +#define EXTABLE_CLASS_DEFAULT        0       /* standard uaccess fixup */
> +#define EXTABLE_CLASS_FAULT  1       /* provide fault number as well as 
> fixup */
> +#define EXTABLE_CLASS_EX     2       /* uaccess + set uaccess_err */
> +#define EXTABLE_CLASS_UNUSED 3       /* available for something else */
>  
>  /*
> - * The biases are the class constants + 0x20000000, as signed integers.
> + * The biases are the class constants + _EXTABLE_BIAS, as signed integers.
>   * This can't use ordinary arithmetic -- the assembler isn't that smart.
>   */
> -#define _EXTABLE_BIAS_DEFAULT        0x20000000
> -#define _EXTABLE_BIAS_EX     0x20000000 - 0x80000000
> +#define _EXTABLE_BIAS_DEFAULT        _EXTABLE_BIAS
> +#define _EXTABLE_BIAS_FAULT  _EXTABLE_BIAS + 0x40000000
> +#define _EXTABLE_BIAS_EX     _EXTABLE_BIAS - 0x80000000
> +#define _EXTABLE_BIAS_UNUSED _EXTABLE_BIAS - 0x40000000
>  
>  #define _ASM_EXTABLE(from,to)                                                
> \
>       _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_DEFAULT)
>  
> +#define _ASM_EXTABLE_FAULT(from,to)                                  \
> +     _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_FAULT)
> +
>  #define _ASM_EXTABLE_EX(from,to)                                     \
>       _ASM_EXTABLE_CLASS(from, to, _EXTABLE_BIAS_EX)

So you're touching those again in patch 2. Why not add those defines to
patch 1 directly and diminish the churn?

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to