aboutsummaryrefslogtreecommitdiffstats
path: root/Config.mk
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-09-09 10:23:32 +0200
committerJan Beulich <jbeulich@suse.com>2013-09-09 10:23:32 +0200
commitcfd54835e6e8a28c743dc7d67c662d151ab4923a (patch)
tree6a6b59ceee96950731f928c70c81581d4b1bf54d /Config.mk
parentb0df10407df96fe25f3c1a2bffc4be0696d328b4 (diff)
downloadxen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.tar.gz
xen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.tar.bz2
xen-cfd54835e6e8a28c743dc7d67c662d151ab4923a.zip
VMX: use proper instruction mnemonics if assembler supports them
With the hex byte emission we were taking away a good part of flexibility from the compiler, as for simplicity reasons these were built using fixed operands. All half way modern build environments would allow using the mnemonics (but we can't disable the hex variants yet, since the binutils around at the time gcc 4.1 got released didn't support these yet). I didn't convert __vmread() yet because that would, just like for __vmread_safe(), imply converting to a macro so that the output operand can be the caller supplied variable rather than an intermediate one. As that would require touching all invocation points of __vmread() (of which there are quite a few), I'd first like to be certain the approach is acceptable; the main question being whether the now conditional code might be considered to cause future maintenance issues, and the second being that of parameter/argument ordering (here I made __vmread_safe() match __vmwrite(), but one could also take the position that read and write should use the inverse order of one another, in line with the actual instruction operands). Additionally I was quite puzzled to find that all the asm()-s involved here have memory clobbers - what are they needed for? Or can they be dropped at least in some cases? Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org>
Diffstat (limited to 'Config.mk')
-rw-r--r--Config.mk21
1 files changed, 21 insertions, 0 deletions
diff --git a/Config.mk b/Config.mk
index f169be482b..a26c7c0f2b 100644
--- a/Config.mk
+++ b/Config.mk
@@ -4,6 +4,12 @@ ifeq ($(filter /%,$(XEN_ROOT)),)
$(error XEN_ROOT must be absolute)
endif
+# Convenient variables
+comma := ,
+squote := '
+empty :=
+space := $(empty) $(empty)
+
# fallback for older make
realpath = $(wildcard $(foreach file,$(1),$(shell cd -P $(dir $(file)) && echo "$$PWD/$(notdir $(file))")))
@@ -128,6 +134,21 @@ endef
check-$(gcc) = $(call cc-ver-check,CC,0x040100,"Xen requires at least gcc-4.1")
$(eval $(check-y))
+# as-insn: Check whether assembler supports an instruction.
+# Usage: cflags-y += $(call as-insn "insn",option-yes,option-no)
+as-insn = $(if $(shell echo 'void _(void) { asm volatile ( $(2) ); }' \
+ | $(1) -c -x c -o /dev/null - 2>&1),$(4),$(3))
+
+# as-insn-check: Add an option to compilation flags, but only if insn is
+# supported by assembler.
+# Usage: $(call as-insn-check CFLAGS,CC,"nop",-DHAVE_GAS_NOP)
+as-insn-check = $(eval $(call as-insn-check-closure,$(1),$(2),$(3),$(4)))
+define as-insn-check-closure
+ ifeq ($$(call as-insn,$$($(2)),$(3),y,n),y)
+ $(1) += $(4)
+ endif
+endef
+
define buildmakevars2shellvars
export PREFIX="$(PREFIX)"; \
export XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \