Re: [PATCH] x86: merge asm-x86/alternative.h

H. Peter Anvin
2008-01-18T05:08:17Z

Kyle McMartin wrote:
> Straightforward merge. Kind of a pity that gas doesn't really have the
> concept of a "long" (long is 4-bytes for some reason.) Nor is it able to
> pad to a non-power of two boundary (for struct alignment) to get rid
> of the struct alt_instr padding.
>
> Build tested on i386, i386 with lguest & xen paravirt enabled, and
> x86_64. Boot tested on x86_64.
>
>
> diff --git a/include/asm-x86/alternative.h b/include/asm-x86/alternative.h
> index 9eef6a3..7047a0f 100644
> --- a/include/asm-x86/alternative.h
> +++ b/include/asm-x86/alternative.h
> @@ -1,5 +1,168 @@
> -#ifdef CONFIG_X86_32
> -# include "alternative_32.h"
> +#ifndef _X86_ALTERNATIVE_H
> +#define _X86_ALTERNATIVE_H
> +
> +#ifdef __KERNEL__
> +
> +#include <linux/types.h>
> +#include <linux/stddef.h>
> +
> +#ifdef CONFIG_X86_64
> +# define ALT_ASMPTR ".quad"
> +# define ALT_ALIGN "8"
> +# define ALT_INSTR_PAD 5
> #else
> -# include "alternative_64.h"
> +# define ALT_ASMPTR ".long"
> +# define ALT_ALIGN "4"
> +# define ALT_INSTR_PAD 1
> #endif

Please use existing macros from <asm/asm.h> (in the x86 tree.)

-hpa