Generate general usable headers with arch-specific structs.
PATCH 1/1 Generate general usable headers with arch-specific structs.
Signed-off-by Gerd Hoffmann <[email protected]>
--- tools/Rules.mk | 2 xen/Makefile | 5 xen/include/public/foreign/Makefile | 26 +++++ xen/include/public/foreign/mkchecker.py | 56 ++++++++++ xen/include/public/foreign/mkheader.py | 153 ++++++++++++++++++++++++++++++ xen/include/public/foreign/reference.size | 16 +++ xen/include/public/foreign/structs.py | 34 ++++++ 7 files changed, 292 insertions(+)
xen/include/public/foreign/Makefile new file +26 -0
@@ -0,0 +1,26 @@ +XEN_ROOT := ../../../.. +include $(XEN_ROOT)/tools/Rules.mk + +architectures := x86_32 x86_64 ia64 +headers := $(patsubst %, %.h, $(architectures)) +scripts := $(wildcard *.py) + +.PHONY: all clean check-headers +all: $(headers) check-headers + +clean: + rm -f $(headers) + rm -f checker checker.c $(XEN_TARGET_ARCH).size + rm -f *.pyc *.o *~ + +check-headers: checker + ./checker > $(XEN_TARGET_ARCH).size + diff -u reference.size $(XEN_TARGET_ARCH).size + +%.h: ../arch-%.h ../xen.h $(scripts) + python mkheader.py $* $@ $< ../xen.h + +checker.o: checker.c $(headers) + +checker.c: $(scripts) + python mkchecker.py $(XEN_TARGET_ARCH) $@ $(architectures)
xen/include/public/foreign/mkheader.py new file +153 -0
153 lines not on this page · raw message
xen/include/public/foreign/structs.py new file +34 -0
@@ -0,0 +1,34 @@ +# configuration: what needs translation + +structs = [ "start_info", + "trap_info", + "pt_fpreg", + "cpu_user_regs", + "ia64_tr_entry", + "vcpu_extra_regs", + "vcpu_guest_context", + "arch_vcpu_info", + "vcpu_time_info", + "vcpu_info", + "arch_shared_info", + "shared_info" ]; + +defines = [ "FLAT_RING1_CS", + "FLAT_RING1_DS", + "FLAT_RING1_SS", + + "FLAT_RING3_CS64", + "FLAT_RING3_DS64", + "FLAT_RING3_SS64", + "FLAT_KERNEL_CS64", + "FLAT_KERNEL_DS64", + "FLAT_KERNEL_SS64", + + "FLAT_KERNEL_CS", + "FLAT_KERNEL_DS", + "FLAT_KERNEL_SS", + + "xen_pfn_to_cr3", + "MAX_VIRT_CPUS", + "MAX_GUEST_CMDLINE" ]; +
xen/include/public/foreign/reference.size new file +16 -0
@@ -0,0 +1,16 @@ + +structs | x86_32 x86_64 ia64 + +start_info | 1104 1152 1152 +trap_info | 8 16 - +pt_fpreg | - - 16 +cpu_user_regs | 68 200 496 +ia64_tr_entry | - - 32 +vcpu_extra_regs | - - 536 +vcpu_guest_context | 2800 5168 1048 +arch_vcpu_info | 24 16 0 +vcpu_time_info | 32 32 32 +vcpu_info | 64 64 48 +arch_shared_info | 268 280 272 +shared_info | 2584 3368 4384 +
xen/Makefile +5 -0
@@ -31,8 +31,11 @@ _install: $(TARGET).gz $(INSTALL_DATA) $(TARGET)-syms $(DESTDIR)/boot/$(notdir $(TARGET))-syms-$(XEN_FULLVERSION) [ -d $(DESTDIR)/usr/include/xen/io ] || \ $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/io + [ -d $(DESTDIR)/usr/include/xen/foreign ] || \ + $(INSTALL_DIR) $(DESTDIR)/usr/include/xen/foreign $(INSTALL_DATA) include/public/*.h $(DESTDIR)/usr/include/xen $(INSTALL_DATA) include/public/io/*.h $(DESTDIR)/usr/include/xen/io + $(INSTALL_DATA) include/public/foreign/*.h $(DESTDIR)/usr/include/xen/foreign $(INSTALL_DATA) include/public/COPYING $(DESTDIR)/usr/include/xen .PHONY: _debug
@@ -42,6 +45,7 @@ _debug: .PHONY: _clean _clean: delete-unfresh-files $(MAKE) -C tools clean + $(MAKE) -C include/public/foreign clean $(MAKE) -f $(BASEDIR)/Rules.mk -C common clean $(MAKE) -f $(BASEDIR)/Rules.mk -C drivers clean $(MAKE) -f $(BASEDIR)/Rules.mk -C acm clean
@@ -60,6 +64,7 @@ $(TARGET).gz: $(TARGET) $(TARGET): delete-unfresh-files $(MAKE) -C tools + $(MAKE) -C include/public/foreign $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/compile.h $(MAKE) -f $(BASEDIR)/Rules.mk include/xen/acm_policy.h [ -e include/asm ] || ln -sf asm-$(TARGET_ARCH) include/asm
xen/include/public/foreign/mkchecker.py new file +56 -0
56 lines not on this page · raw message
tools/Rules.mk +2 -0
@@ -41,5 +41,7 @@ mk-symlinks-xen: ( cd xen/hvm && ln -sf ../../$(XEN_ROOT)/xen/include/public/hvm/*.h . ) mkdir -p xen/io ( cd xen/io && ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . ) + mkdir -p xen/foreign + ( cd xen/foreign && ln -sf ../../$(XEN_ROOT)/xen/include/public/foreign/*.h . ) mk-symlinks: mk-symlinks-xen mk-symlinks-$(XEN_OS)
--