stubdom: complete libxc support
PATCH 1/1 stubdom: complete libxc support
stubdom: complete libxc support
Signed-off-by Samuel Thibault <[email protected]>
extras/mini-os/Config.mk +1 -4
@@ -41,10 +41,7 @@ extra_incl := $(foreach dir,$(EXTRA_INC),-I$(MINI-OS_ROOT)/include/$(dir)) DEF_CPPFLAGS += -I$(MINI-OS_ROOT)/include - -ifeq ($(stubdom),y) -DEF_CPPFLAGS += -DCONFIG_STUBDOM -endif +DEF_CPPFLAGS += -D__MINIOS__ ifeq ($(libc),y) DEF_CPPFLAGS += -DHAVE_LIBC
extras/mini-os/Makefile +1 -1
@@ -96,7 +96,7 @@ endif ifeq ($(libc),y) -LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -lxenctrl -lxenguest +APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc -whole-archive -lxenguest -lxenctrl -no-whole-archive APP_LDLIBS += -lpci APP_LDLIBS += -lz LDLIBS += -lc
extras/mini-os/arch/ia64/mm.c +8 -0
@@ -131,6 +131,14 @@ }/* Helper function used in gnttab.c. */ +void do_map_frames (unsigned long addr, +unsigned long *f,unsigned long n,unsigned long stride, +unsigned long increment,domid_t id,int may_fail,unsigned long prot) +{ +/* TODO */ +ASSERT (0 ); +} +void * map_frames_ex(unsigned long* frames, unsigned long n, unsigned long stride, unsigned long increment, unsigned long alignment, domid_t id,
extras/mini-os/include/lib.h +1 -0
@@ -136,6 +136,7 @@FTYPE_CONSOLE ,FTYPE_FILE ,FTYPE_XENBUS , +FTYPE_XC ,FTYPE_EVTCHN ,FTYPE_SOCKET , FTYPE_TAP,
extras/mini-os/include/mm.h +3 -0
@@ -69,6 +69,9 @@void *map_frames_ex (unsigned long *f,unsigned long n,unsigned long stride,unsigned long increment,unsigned long alignment,domid_t id,int may_fail,unsigned long prot); +void do_map_frames (unsigned long addr, +unsigned long *f,unsigned long n,unsigned long stride, +unsigned long increment,domid_t id,int may_fail,unsigned long prot);#ifdef HAVE_LIBC extern unsigned long heap, brk, heap_mapped, heap_end;#endif
extras/mini-os/include/x86/arch_mm.h +0 -5
@@ -219,11 +219,6 @@#define map_frames (f, n) map_frames_ex(f, n, 1, 0, 1, DOMID_SELF, 0, L1_PROT)#define map_zero (n, a) map_frames_ex(&mfn_zero, n, 0, 0, a, DOMID_SELF, 0, L1_PROT_RO) -#ifndef __ASSEMBLY__ -void do_map_frames (unsigned long addr, -unsigned long *f,unsigned long n,unsigned long stride, -unsigned long increment,domid_t id,int may_fail,unsigned long prot); -#endif #define do_map_zero (start, n) do_map_frames(start, &mfn_zero, n, 0, 0, DOMID_SELF, 0, L1_PROT_RO)#endif /* _ARCH_MM_H_ */
extras/mini-os/lib/sys.c +24 -43
138 lines not on this page · raw message
tools/libxc/Makefile +0 -8
@@ -5,11 +5,9 @@ MINOR = 0 CTRL_SRCS-y := -ifneq ($(stubdom),y) CTRL_SRCS-y += xc_core.c CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c -endif CTRL_SRCS-y += xc_domain.c CTRL_SRCS-y += xc_evtchn.c CTRL_SRCS-y += xc_misc.c
@@ -21,9 +19,7 @@ CTRL_SRCS-y += xc_csched.c CTRL_SRCS-y += xc_tbuf.c CTRL_SRCS-y += xc_pm.c -ifneq ($(stubdom),y) CTRL_SRCS-y += xc_resume.c -endif CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
@@ -33,15 +29,12 @@ GUEST_SRCS-y := GUEST_SRCS-y += xg_private.c -ifneq ($(stubdom),y) GUEST_SRCS-$(CONFIG_MIGRATE) += xc_domain_restore.c xc_domain_save.c GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c -endif VPATH = ../../xen/common/libelf CFLAGS += -I../../xen/common/libelf -ifneq ($(stubdom),y) GUEST_SRCS-y += libelf-tools.c libelf-loader.c GUEST_SRCS-y += libelf-dominfo.c libelf-relocate.c
@@ -55,7 +48,6 @@ GUEST_SRCS-$(CONFIG_X86) += xc_dom_x86.c GUEST_SRCS-$(CONFIG_X86) += xc_cpuid_x86.c GUEST_SRCS-$(CONFIG_IA64) += xc_dom_ia64.c -endif -include $(XEN_TARGET_ARCH)/Makefile
tools/libxc/xc_core.c +9 -9
@@ -64,7 +64,7 @@/* string table */ struct xc_core_strtab {char *strings; -uint16_t current; +uint16_t length;uint16_t max; };
@@ -89,7 +89,7 @@/* index 0 represents none */ strtab->strings[0 ] ='\0' ; - strtab->current =1 ; + strtab->length =1 ;return strtab; }
@@ -107,14 +107,14 @@uint16_t ret =0 ;uint16_t len =strlen (name) +1 ; -if ( strtab->current >UINT16_MAX - len ) +if ( strtab->length >UINT16_MAX - len ) {PERROR ("too long string table" ); errno =E2BIG ;return ret; } -if ( strtab->current + len > strtab->max ) +if ( strtab->length + len > strtab->max ) {char *tmp;if ( strtab->max >UINT16_MAX /2 )
@@ -135,9 +135,9 @@ strtab->max *=2 ; } - ret = strtab->current; -strcpy (strtab->strings + strtab->current, name); - strtab->current += len; + ret = strtab->length; +strcpy (strtab->strings + strtab->length, name); + strtab->length += len;return ret; }
@@ -669,7 +669,7 @@ offset += filesz;/* fixing up section header string table section header */ - filesz = strtab->current; + filesz = strtab->length; sheaders->shdrs[strtab_idx].sh_offset = offset; sheaders->shdrs[strtab_idx].sh_size = filesz;
@@ -829,7 +829,7 @@ goto out;/* elf section header string table: .shstrtab */ - sts =dump_rtn (args, strtab->strings, strtab->current); + sts =dump_rtn (args, strtab->strings, strtab->length);if ( sts !=0 ) goto out;
tools/libxc/xc_minios.c +14 -3
@@ -35,11 +35,12 @@int xc_interface_open (void ) { -return 0 ; +return alloc_fd (FTYPE_XC ); }int xc_interface_close (int xc_handle) { + files[xc_handle].type =FTYPE_NONE ;return 0 ; }
@@ -79,8 +80,12 @@int xc_map_foreign_ranges (int xc_handle,uint32_t dom,privcmd_mmap_entry_t *entries,int nr) { -printf ("xc_map_foreign_ranges, TODO\n" ); -do_exit (); +int i; +for (i =0 ; i < nr; i++) { +unsigned long mfn = entries[i].mfn; +do_map_frames (entries[i].va, &mfn, entries[i].npages,0 ,1 , dom,0 ,L1_PROT ); + } +return 0 ; }int do_xen_hypercall (int xc_handle,privcmd_hypercall_t *hypercall)
@@ -294,6 +299,12 @@return 0 ; } +/* Optionally flush file to disk and discard page cache */ +void discard_file_cache (int fd,int flush) +{ +if (flush) +fsync (fd); +}/* * Local variables: * mode: C
xen/common/libelf/libelf-private.h +1 -1
@@ -43,7 +43,7 @@#define bswap_16 (x) swap16(x)#define bswap_32 (x) swap32(x)#define bswap_64 (x) swap64(x) -#elif defined(__linux__) || defined(__Linux__) +#elif defined(__linux__) || defined(__Linux__) || defined(__MINIOS__)#include <byteswap.h> #else #error Unsupported OS