diff --git a/.gitignore b/.gitignore index 1625a8f0e7..a7cc3f36ce 100644 --- a/.gitignore +++ b/.gitignore @@ -293,6 +293,7 @@ xen/.config.old xen/System.map xen/arch/arm/asm-offsets.s xen/arch/arm/xen.lds +xen/arch/x86/asm-macros.i xen/arch/x86/asm-offsets.s xen/arch/x86/boot/mkelf32 xen/arch/x86/xen.lds diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 9b9b63ac63..261c598ff3 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -215,9 +215,22 @@ $(TARGET).efi: prelink-efi.o $(note_file) efi.lds efi/relocs-dummy.o $(BASEDIR)/ efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: $(BASEDIR)/arch/x86/efi/built_in.o efi/boot.init.o efi/runtime.o efi/compat.o efi/buildid.o: ; -asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c +asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(BASEDIR)/include/asm-x86/asm-macros.h $(CC) $(filter-out -Wa$(comma)% -flto,$(CFLAGS)) -S -o $@ $< +asm-macros.i: CFLAGS += -D__ASSEMBLY__ -P + +$(BASEDIR)/include/asm-x86/asm-macros.h: asm-macros.i Makefile + echo '#if 0' >$@.new + echo '.if 0' >>$@.new + echo '#endif' >>$@.new + echo 'asm ( ".include \"$@\"" );' >>$@.new + echo '#if 0' >>$@.new + echo '.endif' >>$@.new + cat $< >>$@.new + echo '#endif' >>$@.new + $(call move-if-changed,$@.new,$@) + xen.lds: xen.lds.S $(CC) -P -E -Ui386 $(filter-out -Wa$(comma)%,$(AFLAGS)) -o $@ $< sed -e 's/xen\.lds\.o:/xen\.lds:/g' <.xen.lds.d >.xen.lds.d.new @@ -237,6 +250,7 @@ efi/mkreloc: efi/mkreloc.c .PHONY: clean clean:: rm -f asm-offsets.s *.lds boot/*.o boot/*~ boot/core boot/mkelf32 + rm -f asm-macros.i $(BASEDIR)/include/asm-x86/asm-macros.* rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d rm -f $(BASEDIR)/.xen.efi.[0-9]* efi/*.efi efi/mkreloc rm -f boot/cmdline.S boot/reloc.S boot/*.lnk boot/*.bin diff --git a/xen/arch/x86/asm-macros.c b/xen/arch/x86/asm-macros.c new file mode 100644 index 0000000000..b963d56a56 --- /dev/null +++ b/xen/arch/x86/asm-macros.c @@ -0,0 +1 @@ +#include diff --git a/xen/include/asm-x86/alternative.h b/xen/include/asm-x86/alternative.h index 66fe791818..d96411f0f3 100644 --- a/xen/include/asm-x86/alternative.h +++ b/xen/include/asm-x86/alternative.h @@ -1,11 +1,12 @@ #ifndef __X86_ALTERNATIVE_H__ #define __X86_ALTERNATIVE_H__ +#ifdef __ASSEMBLY__ #include - -#ifndef __ASSEMBLY__ +#else #include #include +#include struct __packed alt_instr { int32_t orig_offset; /* original instruction */ @@ -26,14 +27,6 @@ extern void add_nops(void *insns, unsigned int len); extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end); extern void alternative_instructions(void); -asm ( ".macro mknops nr_bytes\n\t" -#ifdef HAVE_AS_NOPS_DIRECTIVE - ".nops \\nr_bytes, " __stringify(ASM_NOP_MAX) "\n\t" -#else - ".skip \\nr_bytes, 0x90\n\t" -#endif - ".endm\n\t" ); - #define alt_orig_len "(.LXEN%=_orig_e - .LXEN%=_orig_s)" #define alt_pad_len "(.LXEN%=_orig_p - .LXEN%=_orig_e)" #define alt_total_len "(.LXEN%=_orig_p - .LXEN%=_orig_s)"