aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/Makefile
diff options
context:
space:
mode:
authorEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:28 +0000
committerEmmanuel Ackaouy <ack@xensource.com>2007-01-05 17:34:28 +0000
commit6224725e9357f6056cff046ba5da4c52f0bace8c (patch)
tree9ad38da55854dcad3fa52415aaebdb711c59aa85 /xen/include/Makefile
parentc1990f10a76daa10ea01dd11e9ca6fc92cf55716 (diff)
downloadxen-6224725e9357f6056cff046ba5da4c52f0bace8c.tar.gz
xen-6224725e9357f6056cff046ba5da4c52f0bace8c.tar.bz2
xen-6224725e9357f6056cff046ba5da4c52f0bace8c.zip
Add logic to generate headers reflecting the compatibility mode layout
of hypercall arguments. Provide infrastructure for accessing handles passed from compatibility mode guests. Vector those hypercalls not needing any translation to their native implementations. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/Makefile')
-rw-r--r--xen/include/Makefile57
1 files changed, 57 insertions, 0 deletions
diff --git a/xen/include/Makefile b/xen/include/Makefile
new file mode 100644
index 0000000000..1cc0d79baf
--- /dev/null
+++ b/xen/include/Makefile
@@ -0,0 +1,57 @@
+ifneq ($(CONFIG_COMPAT),)
+
+compat-arch-$(CONFIG_X86) := x86_32
+
+headers-y := $(shell echo public/*.h | sed -e 's,[^[:space:]]*-[^[:space:]]*,,g' -e 's,public/,compat/,g')
+headers-y := $(filter-out %/dom0_ops.h,$(headers-y))
+headers-y += compat/arch-$(compat-arch-y).h
+
+cppflags-y := -include public/xen-compat.h
+cppflags-$(CONFIG_X86) += -m32
+
+# 8-byte types are 4-byte aligned on x86_32 ...
+prefix-$(CONFIG_X86) := \#pragma pack(push, 4)
+suffix-$(CONFIG_X86) := \#pragma pack(pop)
+
+endif
+
+.PHONY: all
+all: $(headers-y)
+
+compat/%.h: compat/%.i Makefile
+ id=_$$(echo $@ | sed 'y,abcdefghijklmnopqrstuvwxyz-/.,ABCDEFGHIJKLMNOPQRSTUVWXYZ___,'); \
+ echo "#ifndef $$id" >$@.new; \
+ echo "#define $$id" >>$@.new; \
+ echo "#include <xen/compat.h>" >>$@.new; \
+ $(if $(filter-out compat/arch-%.h,$@),echo "#include <$(patsubst compat/%,public/%,$@)>" >>$@.new;) \
+ $(if $(prefix-y),echo "$(prefix-y)" >>$@.new;) \
+ grep -v '^# [[:digit:]]' $< | \
+ sed -e 's,__InClUdE__,#include,' \
+ -e 's,"xen-compat.h",<public/xen-compat.h>,' \
+ -e 's,\(struct\|union\|enum\)[[:space:]]\+\(xen_\?\)\?\([[:alpha:]_]\),\1 compat_\3,g' \
+ -e 's,_t\([^[:alnum:]_]\|$$\),_compat_t\1,g' \
+ -e 's,\(8\|16\|32\|64\)_compat_t\([^[:alnum:]_]\|$$\),\1_t\2,g' \
+ -e 's,\(^\|[^[:alnum:]_]\)xen_\?\([[:alnum:]_]*\)_compat_t\([^[:alnum:]_]\|$$\),\1compat_\2_t\3,g' \
+ -e 's,\(^\|[^[:alnum:]_]\)XEN_\?,\1COMPAT_,' \
+ -e 's,\(^\|[^[:alnum:]_]\)Xen_\?,\1Compat_,' \
+ -e 's,\(^\|[^[:alnum:]]\)long\([^[:alnum:]]\|$$\),\1int\2,g' | \
+ uniq >>$@.new; \
+ $(if $(suffix-y),echo "$(suffix-y)" >>$@.new;) \
+ echo "#endif /* $$id */" >>$@.new
+ mv -f $@.new $@
+
+compat/%.i: compat/%.c Makefile
+ $(CPP) $(CFLAGS) $(cppflags-y) -o $@ $<
+
+compat/%.c: public/%.h Makefile
+ mkdir -p $(@D)
+ grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \
+ sed -e 's,^[[:space:]]*#[[:space:]]*include[[:space:]]\+,__InClUdE__ ,' \
+ -e 's,^[[:space:]]*#[[:space:]]*define[[:space:]]\+\([[:upper:]_]*_GUEST_HANDLE\),#define HIDE_\1,' \
+ -e 's,^[[:space:]]*#[[:space:]]*define[[:space:]]\+\([[:lower:]_]*_guest_handle\),#define hide_\1,' \
+ -e 's,XEN_GUEST_HANDLE\(_[[:xdigit:]]\+\)\?,COMPAT_HANDLE,g' \
+ >$@.new
+ mv -f $@.new $@
+
+clean::
+ rm -rf compat