[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] x86: move declaration of the exception_table to C



>>> On 28.01.18 at 15:09, <roger.pau@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -119,6 +119,26 @@ boolean_param("ler", opt_ler);
>  #define stack_words_per_line 4
>  #define ESP_BEFORE_EXCEPTION(regs) ((unsigned long *)regs->rsp)
>  
> +void (* const exception_table[TRAP_nr])(struct cpu_user_regs *regs) = {
> +    [TRAP_divide_error]                         = do_trap,
> +    [TRAP_debug]                                = do_debug,
> +    [TRAP_nmi]                                  = (void *)do_nmi,
> +    [TRAP_int3]                                 = do_int3,
> +    [TRAP_overflow ... TRAP_bounds]             = do_trap,

Please can you avoid ... here and below, such that e.g. grep-ing
for one of the TRAP_* values will turn up the respective line here?
I also consider this a little awkward if the range consists of just two
elements.

> +    [TRAP_invalid_op]                           = do_invalid_op,
> +    [TRAP_no_device]                            = do_device_not_available,
> +    [TRAP_double_fault ... TRAP_copro_seg]      = do_reserved_trap,
> +    [TRAP_invalid_tss ... TRAP_stack_error]     = do_trap,
> +    [TRAP_gp_fault]                             = do_general_protection,
> +    [TRAP_page_fault]                           = do_page_fault,
> +    [TRAP_spurious_int]                         = do_reserved_trap,
> +    [TRAP_copro_error ... TRAP_alignment_check] = do_trap,
> +    [TRAP_machine_check]                        = (void *)do_machine_check,
> +    [TRAP_simd_error]                           = do_trap,
> +    [TRAP_virtualisation ...
> +     (ARRAY_SIZE(exception_table) - 1)]         = do_reserved_trap,

This one, as an exception, is fine with me to use ... . Even better
would be to have a [0 ... ARRAY_SIZE() - 1] initializer first, but
iirc clang dislikes such.

> --- a/xen/include/asm-x86/processor.h
> +++ b/xen/include/asm-x86/processor.h
> @@ -501,6 +501,7 @@ DECLARE_TRAP_HANDLER(entry_int82);
>  
>  void trap_nop(void);
>  void enable_nmis(void);
> +void do_trap(struct cpu_user_regs *regs);

No - afaict this function can be static to traps.c now.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.