aboutsummaryrefslogtreecommitdiffstats
path: root/stubdom
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@hp.com>2008-02-14 09:34:27 -0700
committerAlex Williamson <alex.williamson@hp.com>2008-02-14 09:34:27 -0700
commite38c4f55fe6ef6c393388ae181630ab3a92f77dd (patch)
tree24970faea32f21f96b9048f8a36c8e8d9dafe2b2 /stubdom
parent03c9b741df33f676c99c7885ca7f795190df37d5 (diff)
parentdf5b25e9af9248d8e00d0ef7e4ce3eec9eb44f97 (diff)
downloadxen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.gz
xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.tar.bz2
xen-e38c4f55fe6ef6c393388ae181630ab3a92f77dd.zip
merge with xen-unstable.hg
Diffstat (limited to 'stubdom')
-rw-r--r--stubdom/Makefile259
-rw-r--r--stubdom/README41
-rw-r--r--stubdom/binutils.patch14
-rw-r--r--stubdom/caml/Makefile18
-rw-r--r--stubdom/caml/hello.ml4
-rw-r--r--stubdom/gcc.patch31
-rw-r--r--stubdom/libpci.config.h5
-rw-r--r--stubdom/libpci.config.mak2
-rw-r--r--stubdom/newlib.patch203
-rw-r--r--stubdom/stubdom-dm97
10 files changed, 674 insertions, 0 deletions
diff --git a/stubdom/Makefile b/stubdom/Makefile
new file mode 100644
index 0000000000..7fdcdb22c0
--- /dev/null
+++ b/stubdom/Makefile
@@ -0,0 +1,259 @@
+XEN_ROOT = ..
+
+export XEN_OS=MiniOS
+
+include $(XEN_ROOT)/Config.mk
+export stubdom=y
+export debug=y
+
+IOEMU_OPTIONS=--disable-vnc-tls
+BINUTILS_VERSION=2.18
+GCC_VERSION=4.2.2
+ZLIB_VERSION=1.2.3
+LIBPCI_VERSION=2.2.9
+NEWLIB_DATE=2008-01-01
+LWIP_DATE=2008-02-08
+
+WGET=wget -c
+
+GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+GNU_TARGET_ARCH:=i686
+endif
+
+ifeq ($(GNU_TARGET_ARCH), i686)
+TARGET_CFLAGS=
+endif
+ifeq ($(GNU_TARGET_ARCH), x86_64)
+TARGET_CFLAGS=-mno-red-zone
+endif
+ifeq ($(GNU_TARGET_ARCH), ia64)
+TARGET_CFLAGS=-mconstant-gp
+endif
+
+CROSS_ROOT=cross-root-$(GNU_TARGET_ARCH)
+CROSS_PREFIX=$(CURDIR)/$(CROSS_ROOT)
+export CROSS_COMPILE=$(GNU_TARGET_ARCH)-xen-elf-
+export PATH:=$(CROSS_PREFIX)/bin:$(PATH)
+
+.PHONY: all
+all: qemu-stubdom
+
+################
+# Cross-binutils
+################
+
+binutils-$(BINUTILS_VERSION).tar.bz2:
+ $(WGET) http://ftp.gnu.org/gnu/binutils/$@
+binutils-$(BINUTILS_VERSION): binutils-$(BINUTILS_VERSION).tar.bz2
+ tar xjf $@.tar.bz2
+ ( cd binutils-$(BINUTILS_VERSION) && patch -p1 < ../binutils.patch )
+ touch $@
+
+BINUTILS_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-ar
+.PHONY: cross-binutils
+cross-binutils: $(BINUTILS_STAMPFILE)
+$(BINUTILS_STAMPFILE): binutils-$(BINUTILS_VERSION)
+ mkdir -p binutils-build
+ ( cd binutils-build && \
+ ../binutils-$(BINUTILS_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf && \
+ $(MAKE) && \
+ $(MAKE) check && \
+ $(MAKE) install )
+
+###########
+# Cross-gcc
+###########
+
+gcc-$(GCC_VERSION).tar.bz2:
+ $(WGET) http://ftp.gnu.org/gnu/gcc/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2
+gcc-$(GCC_VERSION): gcc-$(GCC_VERSION).tar.bz2
+ tar xjf gcc-$(GCC_VERSION).tar.bz2
+ ( cd gcc-$(GCC_VERSION) && patch -p1 < ../gcc.patch )
+ touch $@
+
+GCC_STAMPFILE=$(CROSS_ROOT)/bin/$(GNU_TARGET_ARCH)-xen-elf-gcc-$(GCC_VERSION)
+.PHONY: cross-gcc
+cross-gcc: $(GCC_STAMPFILE)
+$(GCC_STAMPFILE): gcc-$(GCC_VERSION) $(BINUTILS_STAMPFILE)
+ mkdir -p gcc-build
+ ( cd gcc-build && \
+ ../gcc-$(GCC_VERSION)/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-languages=c --disable-libssp --with-gnu-as --with-gnu-ld && \
+ $(MAKE) GCC_FOR_TARGET='$$$$r/gcc/xgcc -B$$$$r/gcc/ '"$(TARGET_CFLAGS)"' $$(FLAGS_FOR_TARGET)' && \
+ $(MAKE) install )
+
+##############
+# Cross-newlib
+##############
+
+newlib-cvs:
+ cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co -D $(NEWLIB_DATE) newlib
+ mv src newlib-cvs
+ ( cd newlib-cvs && patch -p0 < ../newlib.patch)
+
+NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
+.PHONY: cross-newlib
+cross-newlib: $(NEWLIB_STAMPFILE)
+$(NEWLIB_STAMPFILE): newlib-cvs $(GCC_STAMPFILE)
+ mkdir -p newlib-build
+ ( cd newlib-build && \
+ CC_FOR_TARGET="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" ../newlib-cvs/configure --prefix=$(CROSS_PREFIX) --verbose --target=$(GNU_TARGET_ARCH)-xen-elf --enable-newlib-io-long-long && \
+ $(MAKE) && \
+ $(MAKE) install )
+
+############
+# Cross-zlib
+############
+
+zlib-$(ZLIB_VERSION).tar.gz:
+ $(WGET) http://www.zlib.net/zlib-$(ZLIB_VERSION).tar.gz
+
+ZLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libz.a
+.PHONY: cross-zlib
+cross-zlib: $(ZLIB_STAMPFILE)
+$(ZLIB_STAMPFILE): zlib-$(ZLIB_VERSION).tar.gz $(NEWLIB_STAMPFILE)
+ tar xzf $<
+ ( cd zlib-$(ZLIB_VERSION) && \
+ CFLAGS="$(TARGET_CFLAGS)" CC=$(GNU_TARGET_ARCH)-xen-elf-gcc ./configure --prefix=$(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf && \
+ $(MAKE) libz.a && \
+ $(MAKE) install )
+
+##############
+# Cross-libpci
+##############
+
+pciutils-$(LIBPCI_VERSION).tar.bz2:
+ $(WGET) http://www.kernel.org/pub/software/utils/pciutils/pciutils-$(LIBPCI_VERSION).tar.bz2
+
+LIBPCI_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libpci.a
+.PHONY: cross-libpci
+cross-libpci: $(LIBPCI_STAMPFILE)
+$(LIBPCI_STAMPFILE): pciutils-$(LIBPCI_VERSION).tar.bz2 $(NEWLIB_STAMPFILE) $(ZLIB_STAMPFILE)
+ tar xjf $<
+ ( cd pciutils-$(LIBPCI_VERSION) && \
+ cp ../libpci.config.h lib/config.h && \
+ echo '#define PCILIB_VERSION "$(LIBPCI_VERSION)"' >> lib/config.h && \
+ cp ../libpci.config.mak lib/config.mk && \
+ $(MAKE) CC="$(GNU_TARGET_ARCH)-xen-elf-gcc $(TARGET_CFLAGS)" lib/libpci.a && \
+ $(INSTALL_DATA) lib/libpci.a $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/lib/ && \
+ $(INSTALL_DIR) $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci && \
+ $(INSTALL_DATA) lib/{config,header,pci,types}.h $(CROSS_PREFIX)/$(GNU_TARGET_ARCH)-xen-elf/include/pci/ \
+ )
+
+######
+# lwIP
+######
+
+lwip-cvs:
+ cvs -z 9 -d :pserver:anonymous@cvs.savannah.nongnu.org:/sources/lwip co -D $(LWIP_DATE) lwip
+ mv lwip lwip-cvs
+
+#######
+# Links
+#######
+
+.PHONY: $(CROSS_ROOT)
+$(CROSS_ROOT): cross-newlib cross-zlib cross-libpci
+
+.PHONY: mk-symlinks
+mk-symlinks:
+ [ -h include ] || ln -sf ../tools/include .
+ mkdir -p libxc
+ [ -h libxc/Makefile ] || ( cd libxc && \
+ ln -sf ../../tools/libxc/*.h . && \
+ ln -sf ../../tools/libxc/*.c . && \
+ ln -sf ../../tools/libxc/Makefile . )
+ mkdir -p libxc/$(XEN_TARGET_ARCH)
+ [ -h libxc/$(XEN_TARGET_ARCH) ] || ( cd libxc/$(XEN_TARGET_ARCH) && \
+ ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.c . && \
+ ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/*.h . && \
+ ln -sf ../../tools/libxc/$(XEN_TARGET_ARCH)/Makefile . )
+ mkdir -p ioemu
+ [ -h ioemu/Makefile ] || ( cd ioemu && \
+ ln -sf ../../tools/ioemu/* . && \
+ ([ ! -h config-host.h ] || rm -f config-host.h) && \
+ ([ ! -h config-host.mak ] || rm -f config-host.mak) )
+ [ -h mini-os ] || ln -sf ../extras/mini-os .
+
+#######
+# libxc
+#######
+
+.PHONY: libxc
+libxc: cross-zlib mk-symlinks
+ $(MAKE) -C $@
+
+#######
+# ioemu
+#######
+
+.PHONY: ioemu
+ioemu: cross-zlib cross-libpci mk-symlinks libxc
+ [ -f ioemu/config-host.mak ] || \
+ ( cd ioemu ; XEN_TARGET_ARCH=$(XEN_TARGET_ARCH) sh configure --prefix=/usr --enable-stubdom $(IOEMU_OPTIONS))
+ $(MAKE) -C ioemu LWIPDIR=$(CURDIR)/lwip-cvs
+
+######
+# caml
+######
+
+.PHONY: caml
+caml:
+ $(MAKE) -C $@
+
+########
+# minios
+########
+
+.PHONY: qemu-stubdom
+qemu-stubdom: mk-symlinks lwip-cvs libxc ioemu
+ $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs QEMUDIR=$(CURDIR)/ioemu
+
+.PHONY: caml-stubdom
+caml-stubdom: mk-symlinks lwip-cvs libxc cross-libpci caml
+ $(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwia-cvs CAMLDIR=$(CURDIR)/caml
+
+#########
+# install
+#########
+
+install: mini-os/mini-os.gz
+ $(INSTALL_PROG) stubdom-dm "$(DESTDIR)/usr/lib/xen/bin"
+ $(INSTALL_PROG) mini-os/mini-os.gz "$(DESTDIR)/usr/lib/xen/boot/stubdom.gz"
+
+#######
+# clean
+#######
+
+# Only clean the libxc/ioemu/mini-os part
+.PHONY: clean
+clean:
+ -$(MAKE) -C mini-os LWIPDIR=$(CURDIR)/lwip-cvs clean
+ $(MAKE) -C caml clean
+ rm -fr libxc ioemu mini-os include
+
+# clean the cross-compilation result
+.PHONY: crossclean
+crossclean: clean
+ rm -fr $(CROSS_ROOT)
+ rm -fr binutils-build gcc-build newlib-build
+ rm -fr zlib-$(ZLIB_VERSION) pciutils-$(LIBPCI_VERSION)
+
+# clean patched sources
+.PHONY: patchclean
+patchclean: crossclean
+ rm -fr binutils-$(BINUTILS_VERSION)
+ rm -fr gcc-$(GCC_VERSION)
+ rm -fr newlib-cvs
+ rm -fr lwip-cvs
+
+# clean downloads
+.PHONY: downloadclean
+downloadclean: patchclean
+ rm -f binutils-$(BINUTILS_VERSION).tar.bz2
+ rm -f gcc-$(GCC_VERSION).tar.bz2
+ rm -f zlib-$(ZLIB_VERSION).tar.gz
+ rm -f pciutils-$(LIBPCI_VERSION).tar.bz2
+
+.PHONY: distclean
+distclean: downloadclean
diff --git a/stubdom/README b/stubdom/README
new file mode 100644
index 0000000000..42c47601fa
--- /dev/null
+++ b/stubdom/README
@@ -0,0 +1,41 @@
+To compile
+==========
+
+Just run make -j 4, that will download / patch / compile
+Then make install to install the result.
+
+Also, run make and make install in $XEN_ROOT/tools/fs-back
+
+To run
+======
+
+mkdir -p /exports/usr/share/qemu
+ln -s /usr/share/qemu/keymaps /exports/usr/share/qemu
+/usr/sbin/fs-backend &
+
+
+In your HVM config "hvmconfig",
+
+- use VNC, set vnclisten to "172.30.206.1" for instance:
+
+vnc=1
+vnclisten="172.30.206.1"
+
+- use /usr/lib/xen/bin/stubdom-dm as dm script
+
+device_model = '/usr/lib/xen/bin/stubdom-dm'
+
+- comment the disk statement:
+#disk = [ 'file:/tmp/install.iso,hdc:cdrom,r', 'phy:/dev/sda6,hda,w', 'file:/tmp/test,hdb,r' ]
+
+Create /etc/xen/stubdom-hvmconfig ("hvmconfig" must match your main config file)
+with
+
+kernel="/usr/lib/xen/boot/stubdom.gz"
+vif=[ 'ip=172.30.206.1', 'ip=10.0.1.1,mac=aa:00:00:12:23:34']
+disk = [ 'file:/tmp/install.iso,hdc:cdrom,r', 'phy:/dev/sda6,hda,w', 'file:/tmp/test,hdb,r' ]
+
+where
+- 172.30.206.1 is the IP for vnc,
+- 'ip=10.0.1.1,mac=' is the same net configuration as in the hvmconfig script,
+- and disk = is the same block configuration as in the hvmconfig script.
diff --git a/stubdom/binutils.patch b/stubdom/binutils.patch
new file mode 100644
index 0000000000..65f120a377
--- /dev/null
+++ b/stubdom/binutils.patch
@@ -0,0 +1,14 @@
+It looks like binutils has troubles with makeinfo and the doc generation.
+We don't need it anyway
+
+--- binutils-2.18/bfd/Makefile.inorig 2008-01-16 16:17:43.004484000 +0000
++++ binutils-2.18/bfd/Makefile.in 2008-01-16 16:17:50.505526000 +0000
+@@ -271,7 +271,7 @@
+ INCDIR = $(srcdir)/../include
+ CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
+ MKDEP = gcc -MM
+-SUBDIRS = doc po
++SUBDIRS = po
+ bfddocdir = doc
+ bfdlib_LTLIBRARIES = libbfd.la
+ AM_CFLAGS = $(WARN_CFLAGS)
diff --git a/stubdom/caml/Makefile b/stubdom/caml/Makefile
new file mode 100644
index 0000000000..69595a8f99
--- /dev/null
+++ b/stubdom/caml/Makefile
@@ -0,0 +1,18 @@
+XEN_ROOT = ../..
+
+include $(XEN_ROOT)/Config.mk
+
+OCAMLFIND=ocamlfind
+OCAMLOPT=ocamlopt
+
+OBJS := hello.cmx
+LIBS :=
+
+%.cmx: %.ml
+ $(OCAMLFIND) $(OCAMLOPT) -c $< -o $@
+
+caml.o: $(OBJS)
+ $(OCAMLFIND) $(OCAMLOPT) $(LIBS) $^ -output-obj -o $@
+
+clean:
+ rm -f *.o *.cmx *.cmi
diff --git a/stubdom/caml/hello.ml b/stubdom/caml/hello.ml
new file mode 100644
index 0000000000..3a7181134a
--- /dev/null
+++ b/stubdom/caml/hello.ml
@@ -0,0 +1,4 @@
+let main arg =
+ Printf.printf "Hello, world!\n%!."
+
+let _ = Callback.register "main" main
diff --git a/stubdom/gcc.patch b/stubdom/gcc.patch
new file mode 100644
index 0000000000..d593986ab7
--- /dev/null
+++ b/stubdom/gcc.patch
@@ -0,0 +1,31 @@
+Backported from later versions
+
+--- gcc-4.2.2/gcc/config.gcc 2007-11-22 16:27:45.000000000 +0000
++++ gcc-4.2.2/gcc/config.gcc 2007-11-22 16:23:00.000000000 +0000
+@@ -1033,6 +1033,11 @@
+ tmake_file="i386/t-i386elf t-svr4"
+ use_fixproto=yes
+ ;;
++x86_64-*-elf*)
++ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h i386/i386elf.h i386/x86-64.h"
++ tmake_file="i386/t-i386elf t-svr4"
++ use_fixproto=yes
++ ;;
+ i[34567]86-sequent-ptx4* | i[34567]86-sequent-sysv4*)
+ if test x$gas = xyes
+ then
+
+We don't have a libc yet at this stage. Unused anyway
+
+--- gcc-4.2.2/gcc/unwind-generic.h.orig 2008-01-11 18:54:40.000000000 +0100
++++ gcc-4.2.2/gcc/unwind-generic.h 2008-01-11 18:54:31.000000000 +0100
+@@ -203,7 +203,6 @@
+ compatible with the standard ABI for IA-64, we inline these. */
+
+ #ifdef __ia64__
+-#include <stdlib.h>
+
+ static inline _Unwind_Ptr
+ _Unwind_GetDataRelBase (struct _Unwind_Context *_C)
+Backported from later versions
+
diff --git a/stubdom/libpci.config.h b/stubdom/libpci.config.h
new file mode 100644
index 0000000000..a84ead5708
--- /dev/null
+++ b/stubdom/libpci.config.h
@@ -0,0 +1,5 @@
+#define PCI_OS_STUBDOM
+#define PCI_HAVE_STDINT_H
+#define PCI_PATH_IDS_DIR "."
+#define PCI_COMPRESSED_IDS
+#define PCI_IDS "pci.ids.gz"
diff --git a/stubdom/libpci.config.mak b/stubdom/libpci.config.mak
new file mode 100644
index 0000000000..5bc5b261d0
--- /dev/null
+++ b/stubdom/libpci.config.mak
@@ -0,0 +1,2 @@
+LIBZ=-lz
+LDLIBS+=$(LIBZ)
diff --git a/stubdom/newlib.patch b/stubdom/newlib.patch
new file mode 100644
index 0000000000..217205cccf
--- /dev/null
+++ b/stubdom/newlib.patch
@@ -0,0 +1,203 @@
+There is a mix between longs and long longs.
+
+Index: newlib/libc/include/inttypes.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/inttypes.h,v
+retrieving revision 1.3
+diff -u -p -r1.3 inttypes.h
+--- newlib/libc/include/inttypes.h 16 Dec 2005 19:03:12 -0000 1.3
++++ newlib/libc/include/inttypes.h 8 Nov 2007 16:32:44 -0000
+@@ -163,12 +163,12 @@
+
+
+ /* 64-bit types */
+-#if __have_longlong64
+-#define __PRI64(x) __STRINGIFY(ll##x)
+-#define __SCN64(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRI64(x) __STRINGIFY(l##x)
+ #define __SCN64(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRI64(x) __STRINGIFY(ll##x)
++#define __SCN64(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRI64(x) __STRINGIFY(x)
+ #define __SCN64(x) __STRINGIFY(x)
+@@ -217,12 +217,12 @@
+ #endif
+
+ /* max-bit types */
+-#if __have_longlong64
+-#define __PRIMAX(x) __STRINGIFY(ll##x)
+-#define __SCNMAX(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIMAX(x) __STRINGIFY(l##x)
+ #define __SCNMAX(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIMAX(x) __STRINGIFY(ll##x)
++#define __SCNMAX(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIMAX(x) __STRINGIFY(x)
+ #define __SCNMAX(x) __STRINGIFY(x)
+@@ -242,12 +242,12 @@
+ #define SCNxMAX __SCNMAX(x)
+
+ /* ptr types */
+-#if __have_longlong64
+-#define __PRIPTR(x) __STRINGIFY(ll##x)
+-#define __SCNPTR(x) __STRINGIFY(ll##x)
+-#elif __have_long64
++#if __have_long64
+ #define __PRIPTR(x) __STRINGIFY(l##x)
+ #define __SCNPTR(x) __STRINGIFY(l##x)
++#elif __have_longlong64
++#define __PRIPTR(x) __STRINGIFY(ll##x)
++#define __SCNPTR(x) __STRINGIFY(ll##x)
+ #else
+ #define __PRIPTR(x) __STRINGIFY(x)
+ #define __SCNPTR(x) __STRINGIFY(x)
+
+We don't want u?int32_t to be long as our code assume in a lot of places to be
+int.
+
+Index: newlib/libc/include/stdint.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/stdint.h,v
+retrieving revision 1.10
+diff -u -p -r1.10 stdint.h
+--- newlib/libc/include/stdint.h 16 Aug 2006 21:39:43 -0000 1.10
++++ newlib/libc/include/stdint.h 12 Feb 2008 13:07:52 -0000
+@@ -38,7 +38,7 @@ extern "C" {
+ #if __STDINT_EXP(LONG_MAX) > 0x7fffffff
+ #define __have_long64 1
+ #elif __STDINT_EXP(LONG_MAX) == 0x7fffffff && !defined(__SPU__)
+-#define __have_long32 1
++/* #define __have_long32 1 */
+ #endif
+
+ #if __STDINT_EXP(SCHAR_MAX) == 0x7f
+
+Define the basic ia64 jump buffer
+
+Index: newlib/libc/include/machine/setjmp.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
+retrieving revision 1.34
+diff -u -p -r1.34 setjmp.h
+--- newlib/libc/include/machine/setjmp.h 7 Nov 2007 21:42:24 -0000 1.34
++++ newlib/libc/include/machine/setjmp.h 11 Jan 2008 18:10:43 -0000
+@@ -72,6 +72,11 @@ _BEGIN_STD_C
+ #define _JBLEN 8
+ #endif
+
++#ifdef __ia64__
++#define _JBTYPE long
++#define _JBLEN 70
++#endif
++
+ #ifdef __i960__
+ #define _JBLEN 35
+ #endif
+
+In mini-os we use a dynamic reentrency buffer.
+
+Index: newlib/libc/include/sys/config.h
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
+retrieving revision 1.47
+diff -u -p -r1.47 config.h
+--- newlib/libc/include/sys/config.h 15 Mar 2007 21:32:12 -0000 1.47
++++ newlib/libc/include/sys/config.h 8 Nov 2007 16:32:44 -0000
+@@ -71,6 +71,10 @@
+ #endif
+ #endif
+
++#ifndef __DYNAMIC_REENT__
++#define __DYNAMIC_REENT__
++#endif
++
+ #ifdef __mn10200__
+ #define __SMALL_BITFIELDS
+ #endif
+
+Dynamic pointer to our reentrancy zone
+
+Index: newlib/libc/reent/getreent.c
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/reent/getreent.c,v
+retrieving revision 1.2
+diff -u -p -r1.2 getreent.c
+--- newlib/libc/reent/getreent.c 7 Sep 2007 00:45:55 -0000 1.2
++++ newlib/libc/reent/getreent.c 8 Nov 2007 16:32:44 -0000
+@@ -3,12 +3,20 @@
+ #include <_ansi.h>
+ #include <reent.h>
+
++#define weak_alias(name, aliasname) \
++ extern __typeof (name) aliasname __attribute__ ((weak, alias (#name)));
++
+ #ifdef __getreent
+ #undef __getreent
+ #endif
++#ifdef __libc_getreent
++#undef __libc_getreent
++#endif
+
+ struct _reent *
+-_DEFUN_VOID(__getreent)
++__libc_getreent (void)
+ {
+ return _impure_ptr;
+ }
++weak_alias(__libc_getreent,__getreent)
++
+
+We can't provide a red zone in mini-os.
+
+Index: newlib/libc/machine/x86_64/memcpy.S
+===================================================================
+RCS file: /cvs/src/src/newlib/libc/machine/x86_64/memcpy.S,v
+retrieving revision 1.1
+diff -u -p -r1.1 memcpy.S
+--- newlib/libc/machine/x86_64/memcpy.S 28 Aug 2007 21:56:49 -0000 1.1
++++ newlib/libc/machine/x86_64/memcpy.S 8 Nov 2007 16:32:44 -0000
+@@ -30,10 +30,18 @@ quadword_aligned:
+ cmpq $256, rdx
+ jb quadword_copy
+
++#if 1
++ subq $32, rsp
++ movq rax, 24 (rsp)
++ movq r12, 16 (rsp)
++ movq r13, 8 (rsp)
++ movq r14, 0 (rsp)
++#else
+ movq rax, -8 (rsp)
+ movq r12, -16 (rsp)
+ movq r13, -24 (rsp)
+ movq r14, -32 (rsp)
++#endif
+
+ movq rdx, rcx /* Copy 128 bytes at a time with minimum cache polution */
+ shrq $7, rcx
+@@ -89,10 +97,18 @@ loop:
+ movq rdx, rcx
+ andq $127, rcx
+ rep movsb
++#if 1
++ movq 24 (rsp), rax
++ movq 16 (rsp), r12
++ movq 8 (rsp), r13
++ movq 0 (rsp), r14
++ addq $32, rsp
++#else
+ movq -8 (rsp), rax
+ movq -16 (rsp), r12
+ movq -24 (rsp), r13
+ movq -32 (rsp), r14
++#endif
+ ret
+
+
diff --git a/stubdom/stubdom-dm b/stubdom/stubdom-dm
new file mode 100644
index 0000000000..3edeb9d2dc
--- /dev/null
+++ b/stubdom/stubdom-dm
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+# Copyright 2007-2008 Samuel Thibault <samuel.thibault@eu.citrix.net>
+#
+# dm script around stubdomains.
+#
+
+# To fit xterms nicely
+height=339
+
+# Parse arguments
+
+domid=
+domname=
+vncviewer=0
+vncpid=
+while [ "$#" -gt 0 ];
+do
+ if [ "$#" -ge 2 ];
+ then
+ case "$1" in
+ -d) domid=$2; shift ;;
+ -domain-name) domname=$2; shift ;;
+ -vnc)
+ ip=${2%:*};
+ vnc_port=${2#*:};
+ shift
+ ;;
+ esac
+ fi
+ case "$1" in
+ -vncviewer) vncviewer=1 ;;
+ esac
+ shift
+done
+
+[ -z "$domid" ] && ( echo "couldn't find domain ID" ; exit 1 )
+[ -z "$domname" ] && ( echo "couldn't find domain name" ; exit 1 )
+
+# Termination handler
+
+term() {
+ kill %1
+ (
+ [ -n "$vncpid" ] && kill -9 $vncpid
+ xm destroy stubdom-$domname
+ #xm destroy $domname
+ ) &
+ # We need to exit immediately so as to let xend do the commands above
+ exit 0
+}
+
+trap term SIGHUP
+
+############
+# stubdomain
+# Wait for any previous stubdom to terminate
+while xm list | grep stubdom-$domname
+do
+ sleep 1
+done
+
+creation="xm create -c stubdom-$domname target=$domid memory=32"
+
+(while true ; do sleep 60 ; done) | $creation &
+#xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
+consolepid=$!
+
+
+while ! vnc_port=`xenstore-read /local/domain/$domid/console/vnc-port`
+do
+ # Check that the stubdom job is still alive
+ kill -0 $consolepid || term
+ sleep 1
+done
+
+################
+# DEBUG: tcpdump
+#while ! stubdomid=`xm domid stubdom-$domname`
+#do
+# sleep 1
+#done
+#xterm -geometry 160x25+0+$height -e /bin/sh -c "tcpdump -n -i vif$stubdomid.0" &
+#xterm -geometry 160x25+0+$((2 * $height)) -e /bin/sh -c "tcpdump -n -i vif$stubdomid.1" &
+
+###########
+# vncviewer
+if [ "$vncviewer" = 1 ]
+then
+ vncviewer $ip:$vnc_port &
+ vncpid=$!
+fi
+
+# wait for SIGHUP or stubdom termination
+wait $consolepid
+
+term