diff options
-rw-r--r-- | .rootkeys | 53 | ||||
-rw-r--r-- | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in) | 2 | ||||
-rwxr-xr-x | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure) | 2 | ||||
-rw-r--r-- | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in) | 2 | ||||
-rw-r--r-- | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv) | 0 | ||||
-rw-r--r-- | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c) | 0 | ||||
-rw-r--r-- | tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c (renamed from tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c) | 0 | ||||
-rwxr-xr-x | tools/debugger/gdb/gdb-6.2.1-xen-sparse/mkbuildtree (renamed from tools/gdb/gdb-6.2.1-xen-sparse/mkbuildtree) | 0 | ||||
-rwxr-xr-x | tools/debugger/gdb/gdbbuild (renamed from tools/gdb/gdbbuild) | 8 | ||||
-rw-r--r-- | tools/debugger/libxendebug/Makefile | 72 | ||||
-rw-r--r-- | tools/debugger/libxendebug/list.h (renamed from tools/libxc/list.h) | 0 | ||||
-rw-r--r-- | tools/debugger/libxendebug/xendebug.c (renamed from tools/libxc/xc_debug.c) | 129 | ||||
-rw-r--r-- | tools/debugger/libxendebug/xendebug.h (renamed from tools/libxc/xc_debug.h) | 34 | ||||
-rw-r--r-- | tools/debugger/pdb/Domain.ml (renamed from tools/pdb/Domain.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Domain.mli (renamed from tools/pdb/Domain.mli) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Intel.ml (renamed from tools/pdb/Intel.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Makefile (renamed from tools/pdb/Makefile) | 6 | ||||
-rw-r--r-- | tools/debugger/pdb/OCamlMakefile (renamed from tools/pdb/OCamlMakefile) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/PDB.ml (renamed from tools/pdb/PDB.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Process.ml (renamed from tools/pdb/Process.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Process.mli (renamed from tools/pdb/Process.mli) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/Util.ml (renamed from tools/pdb/Util.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/debugger.ml (renamed from tools/pdb/debugger.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/evtchn.ml (renamed from tools/pdb/evtchn.ml) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/evtchn.mli (renamed from tools/pdb/evtchn.mli) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/pdb_caml_xc.c (renamed from tools/pdb/pdb_caml_xc.c) | 26 | ||||
-rw-r--r-- | tools/debugger/pdb/pdb_xen.c (renamed from tools/pdb/pdb_xen.c) | 0 | ||||
-rw-r--r-- | tools/debugger/pdb/server.ml (renamed from tools/pdb/server.ml) | 0 | ||||
-rw-r--r-- | tools/libxc/Makefile | 3 | ||||
-rw-r--r-- | tools/libxc/xc.h | 5 | ||||
-rw-r--r-- | tools/libxc/xc_private.c | 5 | ||||
-rw-r--r-- | tools/libxc/xc_private.h | 2 | ||||
-rw-r--r-- | xen/Rules.mk | 5 | ||||
-rw-r--r-- | xen/common/domain.c | 20 | ||||
-rw-r--r-- | xen/include/asm-x86/debugger.h | 53 | ||||
-rw-r--r-- | xen/include/public/xen.h | 2 | ||||
-rw-r--r-- | xen/include/xen/sched.h | 1 |
37 files changed, 252 insertions, 178 deletions
@@ -519,6 +519,33 @@ 4124b307lnAATmulpXYa0M-dzxLBDA tools/check/check_zlib_devel 4124b308ly20ptMKQoiztPyP_X68Mw tools/check/check_zlib_lib 4124b308O8yPHMKbj4YPR_grPGZmdA tools/check/chk +423d3a7bpoTFd0vqFaocQ-FqC8RuPA tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in +423d3a7b_HtKYGocoTS1adeOpqDFnw tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure +423d3a7b2vJq86I8FbYm6up5BsCwfA tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in +423d3a7bQPownmVb63qOoyq89ebBVA tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv +423d3a7bHtqhyOgiRWhjWt-S-6wbYg tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c +4273458dYPghQKVnj_xu5-fC38CcOg tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c +423d3a7b2ENk2IskDZYZ98pe5NsvIA tools/debugger/gdb/gdb-6.2.1-xen-sparse/mkbuildtree +423d3a7buANO_q-kgxIRffUu7lMnUw tools/debugger/gdb/gdbbuild +42a1a777Dt8l7bna7fm1vKmTEX1FCQ tools/debugger/libxendebug/Makefile +42a0c8d8qbLfvuvDUA0tFB9nHMh-zg tools/debugger/libxendebug/list.h +42a0c8d98XtmbhyddBgIyyHllz5WTw tools/debugger/libxendebug/xendebug.c +42a0c8d9ucRxWO41IHTfYI7xYGoKrw tools/debugger/libxendebug/xendebug.h +42a0c8d9zuGuWoaTux5NW4N3wOw8pg tools/debugger/pdb/Domain.ml +42a0c8d9pigEXFFtdut3R99jbf73NA tools/debugger/pdb/Domain.mli +42a0c8d93wnR_hcSAa7VHgn8CSrWEA tools/debugger/pdb/Intel.ml +42a0c8d95glt-jkgXe8GDOPT6TYN6Q tools/debugger/pdb/Makefile +42a0c8d9UueJDF0IRX3OozEvUhSTmw tools/debugger/pdb/OCamlMakefile +42a0c8d9PgBvaWPzTHSFb9ngii7c7w tools/debugger/pdb/PDB.ml +42a0c8danHHGiNywdeer6j4jzxAc2A tools/debugger/pdb/Process.ml +42a0c8dav_08OtySI4kYP1lahlVrpQ tools/debugger/pdb/Process.mli +42a0c8da51EqubQT5PJ4sxCKLF3xSw tools/debugger/pdb/Util.ml +42a0c8daxftpiXuvLmc9fOOEhdFWiQ tools/debugger/pdb/debugger.ml +42a0c8da81tzhpvIAfkx9nZqUNrQvg tools/debugger/pdb/evtchn.ml +42a0c8dasiso9c-2sCvHBzP6YVjATA tools/debugger/pdb/evtchn.mli +42a0c8daXD_6Y62A_u5-PO_Klrhi0w tools/debugger/pdb/pdb_caml_xc.c +42a0c8danJXun9ay5SPBhhkKvuUPfg tools/debugger/pdb/pdb_xen.c +42a0c8dbjK6Du89D2SUcxsuAdlUu3w tools/debugger/pdb/server.ml 401d7e160vaxMBAUSLSicuZ7AQjJ3w tools/examples/Makefile 401d7e16UgeqroJQTIhwkrDVkoWgZQ tools/examples/README 41597996VhTbNuHbuscYSfRb-WR6fA tools/examples/block-enbd @@ -540,14 +567,6 @@ 41090ec8Pj_bkgCBpg2W7WfmNkumEA tools/examples/xmexample1 40cf2937oKlROYOJTN8GWwWM5AmjBg tools/examples/xmexample2 41fc0c18_k4iL81hu4pMIWQu9dKpKA tools/examples/xmexample3 -423d3a7bpoTFd0vqFaocQ-FqC8RuPA tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in -423d3a7b_HtKYGocoTS1adeOpqDFnw tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure -423d3a7b2vJq86I8FbYm6up5BsCwfA tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in -423d3a7bQPownmVb63qOoyq89ebBVA tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv -423d3a7bHtqhyOgiRWhjWt-S-6wbYg tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c -4273458dYPghQKVnj_xu5-fC38CcOg tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c -423d3a7b2ENk2IskDZYZ98pe5NsvIA tools/gdb/gdb-6.2.1-xen-sparse/mkbuildtree -423d3a7buANO_q-kgxIRffUu7lMnUw tools/gdb/gdbbuild 428d0d82yOaUzYQuYQxH7VzQytKo-g tools/ioemu/COPYING 428d0d82EdPp1TqJBembLgyB1y413w tools/ioemu/COPYING.LIB 428d0d82fd6-QydvFfHmeQBGrKnrrA tools/ioemu/Changelog @@ -681,14 +700,11 @@ 428f0763_67jCiHbdgfGlgAOJqfg9A tools/ioemu/x86_64.ld 3fbba6dbDfYvJSsw9500b4SZyUhxjQ tools/libxc/Makefile 41dde8afKYRKxS4XtLv1KUegGQy_bg tools/libxc/linux_boot_params.h -42a0c8d8qbLfvuvDUA0tFB9nHMh-zg tools/libxc/list.h 41cc934abX-QLXJXW_clV_wRjM0zYg tools/libxc/plan9a.out.h 3fbba6dc1uU7U3IFeF6A-XEOYF2MkQ tools/libxc/rpm.spec 3fbba6dcrNxtygEcgJYAJJ1gCQqfsA tools/libxc/xc.h 3fbba6dbEVkVMX0JuDFzap9jeaucGA tools/libxc/xc_bvtsched.c 4273458dyF2_sKA6CFkNJQYb8eY2dA tools/libxc/xc_core.c -42a0c8d98XtmbhyddBgIyyHllz5WTw tools/libxc/xc_debug.c -42a0c8d9ucRxWO41IHTfYI7xYGoKrw tools/libxc/xc_debug.h 3fbba6dbasJQV-MVElDC0DGSHMiL5w tools/libxc/xc_domain.c 40278d99BLsfUv3qxv0I8C1sClZ0ow tools/libxc/xc_elf.h 403e0977Bjsm_e82pwvl9VvaJxh8Gg tools/libxc/xc_evtchn.c @@ -740,21 +756,6 @@ 41adc641dV-0cDLSyzMs5BT8nL7v3Q tools/misc/xenperf.c 4056f5155QYZdsk-1fLdjsZPFTnlhg tools/misc/xensymoops 40cf2937dqM1jWW87O5OoOYND8leuA tools/misc/xm -42a0c8d9zuGuWoaTux5NW4N3wOw8pg tools/pdb/Domain.ml -42a0c8d9pigEXFFtdut3R99jbf73NA tools/pdb/Domain.mli -42a0c8d93wnR_hcSAa7VHgn8CSrWEA tools/pdb/Intel.ml -42a0c8d95glt-jkgXe8GDOPT6TYN6Q tools/pdb/Makefile -42a0c8d9UueJDF0IRX3OozEvUhSTmw tools/pdb/OCamlMakefile -42a0c8d9PgBvaWPzTHSFb9ngii7c7w tools/pdb/PDB.ml -42a0c8danHHGiNywdeer6j4jzxAc2A tools/pdb/Process.ml -42a0c8dav_08OtySI4kYP1lahlVrpQ tools/pdb/Process.mli -42a0c8da51EqubQT5PJ4sxCKLF3xSw tools/pdb/Util.ml -42a0c8daxftpiXuvLmc9fOOEhdFWiQ tools/pdb/debugger.ml -42a0c8da81tzhpvIAfkx9nZqUNrQvg tools/pdb/evtchn.ml -42a0c8dasiso9c-2sCvHBzP6YVjATA tools/pdb/evtchn.mli -42a0c8daXD_6Y62A_u5-PO_Klrhi0w tools/pdb/pdb_caml_xc.c -42a0c8danJXun9ay5SPBhhkKvuUPfg tools/pdb/pdb_xen.c -42a0c8dbjK6Du89D2SUcxsuAdlUu3w tools/pdb/server.ml 4270cc81g3nSNYCZ1ryCMDEbLtMtbQ tools/pygrub/Makefile 4270deeccyRsJn6jLnRh9odRtMW9SA tools/pygrub/README 4270cc81EIl7NyaS3Av6IPRk2c2a6Q tools/pygrub/setup.py diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in index f6843357e7..e470217934 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/Makefile.in @@ -83,7 +83,7 @@ READLINE_DEP = $$(READLINE_DIR) # -I. for config files. # -I${srcdir} for our headers. # -I$(srcdir)/../regformats for regdef.h. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR) -I../../../../libxc/ +INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR) -I../../../../../libxc/ # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS # from the config/ directory. diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure index d45d933ab3..3cb8c841bd 100755 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure @@ -3475,7 +3475,7 @@ USE_THREAD_DB= GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" -GDBSERVER_LIBS="$srv_libs -L../../../../libxc/ -lxc" +GDBSERVER_LIBS="$srv_libs -L../../../../../libxc/ -lxc" diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in index 1d5c22af0b..bf88ae6dcd 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.in @@ -107,7 +107,7 @@ USE_THREAD_DB= GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" -GDBSERVER_LIBS="$srv_libs -L../../../../libxc/ -lxc" +GDBSERVER_LIBS="$srv_libs -L../../../../../libxc/ -lxc" AC_SUBST(GDBSERVER_DEPFILES) AC_SUBST(GDBSERVER_LIBS) diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv index a586a51db9..a586a51db9 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/configure.srv diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c index 015c4f1938..015c4f1938 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c index 54f508a186..54f508a186 100644 --- a/tools/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/server.c diff --git a/tools/gdb/gdb-6.2.1-xen-sparse/mkbuildtree b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/mkbuildtree index 6be1df1753..6be1df1753 100755 --- a/tools/gdb/gdb-6.2.1-xen-sparse/mkbuildtree +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/mkbuildtree diff --git a/tools/gdb/gdbbuild b/tools/debugger/gdb/gdbbuild index 2a52870849..1c1c9a0242 100755 --- a/tools/gdb/gdbbuild +++ b/tools/debugger/gdb/gdbbuild @@ -3,17 +3,17 @@ XENROOT=`bk root` export XENROOT -cd $XENROOT/tools/gdb +cd $XENROOT/tools/debugger/gdb rm -rf gdb-6.2.1 gdb-6.2.1-linux-i386-xen # FIXME:cw this should be smarter wget -c ftp://ftp.gnu.org/gnu/gdb/gdb-6.2.1.tar.bz2 tar xjf gdb-6.2.1.tar.bz2 -cd $XENROOT/tools/gdb/gdb-6.2.1-xen-sparse +cd $XENROOT/tools/debugger/gdb/gdb-6.2.1-xen-sparse ./mkbuildtree ../gdb-6.2.1 -mkdir $XENROOT/tools/gdb/gdb-6.2.1-linux-i386-xen -cd $XENROOT/tools/gdb/gdb-6.2.1-linux-i386-xen +mkdir $XENROOT/tools/debugger/gdb/gdb-6.2.1-linux-i386-xen +cd $XENROOT/tools/debugger/gdb/gdb-6.2.1-linux-i386-xen ../gdb-6.2.1/configure # some people don't have gmake if which gmake ; then diff --git a/tools/debugger/libxendebug/Makefile b/tools/debugger/libxendebug/Makefile new file mode 100644 index 0000000000..ed478658a4 --- /dev/null +++ b/tools/debugger/libxendebug/Makefile @@ -0,0 +1,72 @@ + +INSTALL = install +INSTALL_PROG = $(INSTALL) -m0755 +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_DIR = $(INSTALL) -d -m0755 + +MAJOR = 3.0 +MINOR = 0 + +CC = gcc + +XEN_ROOT = ../../.. +include $(XEN_ROOT)/tools/Rules.mk + +SRCS := xendebug.c + +CFLAGS += -Wall -Werror -O3 -fno-strict-aliasing +CFLAGS += $(INCLUDES) -I. -I$(XEN_ROOT)/tools/libxc +# Get gcc to generate the dependencies for us. +CFLAGS += -Wp,-MD,.$(@F).d +DEPS = .*.d + +LDFLAGS += -L$(XEN_ROOT)/tools/libxc -lxc + +LIB_OBJS := $(patsubst %.c,%.o,$(SRCS)) +PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS)) + +LIB := libxendebug.a libxendebug.so +LIB += libxendebug.so.$(MAJOR) libxendebug.so.$(MAJOR).$(MINOR) + +all: build +build: + $(MAKE) $(LIB) + +install: build + [ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR) + [ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include + $(INSTALL_PROG) libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR) + $(INSTALL_DATA) libxendebug.a $(DESTDIR)/usr/$(LIBDIR) + ln -sf libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so.$(MAJOR) + ln -sf libxendebug.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so + $(INSTALL_DATA) xendebug.h $(DESTDIR)/usr/include + +.PHONY: TAGS clean rpm install all + +TAGS: + etags -t $(SRCS) *.h + +clean: + rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen + +rpm: build + rm -rf staging + mkdir staging + mkdir staging/i386 + rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \ + --define "_rpmdir$$PWD/staging" -bb rpm.spec + mv staging/i386/*.rpm . + rm -rf staging + +libxendebug.a: $(LIB_OBJS) + $(AR) rc $@ $^ + +libxendebug.so: libxendebug.so.$(MAJOR) + ln -sf $< $@ +libxendebug.so.$(MAJOR): libxendebug.so.$(MAJOR).$(MINOR) + ln -sf $< $@ + +libxendebug.so.$(MAJOR).$(MINOR): $(PIC_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxendebug.so.$(MAJOR) -shared -o $@ $^ + +-include $(DEPS) diff --git a/tools/libxc/list.h b/tools/debugger/libxendebug/list.h index d2ee720f34..d2ee720f34 100644 --- a/tools/libxc/list.h +++ b/tools/debugger/libxendebug/list.h diff --git a/tools/libxc/xc_debug.c b/tools/debugger/libxendebug/xendebug.c index 4f0943168e..844cdf0e03 100644 --- a/tools/libxc/xc_debug.c +++ b/tools/debugger/libxendebug/xendebug.c @@ -1,15 +1,34 @@ /* - * xc_debug.c + * xendebug.c * * alex ho * http://www.cl.cam.ac.uk/netos/pdb * - * xc_debug_memory_page adapted from xc_ptrace.c + * xendebug_memory_page adapted from xc_ptrace.c */ -#include "xc_private.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <sys/mman.h> +#include <xc.h> #include "list.h" +#if defined(__i386__) +#define L1_PAGETABLE_SHIFT 12 +#define L2_PAGETABLE_SHIFT 22 +#elif defined(__x86_64__) +#define L1_PAGETABLE_SHIFT 12 +#define L2_PAGETABLE_SHIFT 21 +#define L3_PAGETABLE_SHIFT 30 +#define L4_PAGETABLE_SHIFT 39 +#endif + +#define PAGE_SHIFT L1_PAGETABLE_SHIFT +#define PAGE_SIZE (1UL<<PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE - 1)) + /* from xen/include/asm-x86/processor.h */ #define X86_EFLAGS_TF 0x00000100 /* Trap Flag */ @@ -54,12 +73,12 @@ static domain_context_t domain_context_list; /* initialization */ -static boolean xc_debug_initialized = false; +static boolean xendebug_initialized = false; static __inline__ void -xc_debug_initialize() +xendebug_initialize() { - if ( !xc_debug_initialized ) + if ( !xendebug_initialized ) { memset((void *) &domain_context_list, 0, sizeof(domain_context_t)); INIT_LIST_HEAD(&domain_context_list.list); @@ -67,14 +86,14 @@ xc_debug_initialize() memset((void *) &bwcpoint_list, 0, sizeof(bwcpoint_t)); INIT_LIST_HEAD(&bwcpoint_list.list); - xc_debug_initialized = true; + xendebug_initialized = true; } } /**************/ static domain_context_p -xc_debug_domain_context_search (u32 domid) +xendebug_domain_context_search (u32 domid) { struct list_head *entry; domain_context_p ctxt; @@ -89,14 +108,14 @@ xc_debug_domain_context_search (u32 domid) } static __inline__ domain_context_p -xc_debug_get_context (int xc_handle, u32 domid, u32 vcpu) +xendebug_get_context (int xc_handle, u32 domid, u32 vcpu) { int rc; domain_context_p ctxt; - xc_debug_initialize(); + xendebug_initialize(); - if ( (ctxt = xc_debug_domain_context_search(domid)) == NULL) + if ( (ctxt = xendebug_domain_context_search(domid)) == NULL) return NULL; if ( !ctxt->valid[vcpu] ) @@ -112,7 +131,7 @@ xc_debug_get_context (int xc_handle, u32 domid, u32 vcpu) } static __inline__ int -xc_debug_set_context (int xc_handle, domain_context_p ctxt, u32 vcpu) +xendebug_set_context (int xc_handle, domain_context_p ctxt, u32 vcpu) { dom0_op_t op; int rc; @@ -129,7 +148,7 @@ xc_debug_set_context (int xc_handle, domain_context_p ctxt, u32 vcpu) if ( (rc = mlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t))) ) return rc; - rc = do_dom0_op(xc_handle, &op); + rc = xc_dom0_op(xc_handle, &op); (void) munlock(&ctxt->context[vcpu], sizeof(vcpu_guest_context_t)); return rc; @@ -138,13 +157,13 @@ xc_debug_set_context (int xc_handle, domain_context_p ctxt, u32 vcpu) /**************/ int -xc_debug_attach(int xc_handle, +xendebug_attach(int xc_handle, u32 domid, u32 vcpu) { domain_context_p ctxt; - xc_debug_initialize(); + xendebug_initialize(); if ( (ctxt = malloc(sizeof(domain_context_t))) == NULL ) return -1; @@ -157,15 +176,15 @@ xc_debug_attach(int xc_handle, } int -xc_debug_detach(int xc_handle, +xendebug_detach(int xc_handle, u32 domid, u32 vcpu) { domain_context_p ctxt; - xc_debug_initialize(); + xendebug_initialize(); - if ( (ctxt = xc_debug_domain_context_search (domid)) == NULL) + if ( (ctxt = xendebug_domain_context_search (domid)) == NULL) return -EINVAL; list_del(&ctxt->list); @@ -178,7 +197,7 @@ xc_debug_detach(int xc_handle, } int -xc_debug_read_registers(int xc_handle, +xendebug_read_registers(int xc_handle, u32 domid, u32 vcpu, cpu_user_regs_t **regs) @@ -186,9 +205,9 @@ xc_debug_read_registers(int xc_handle, domain_context_p ctxt; int rc = -1; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); if (ctxt) { *regs = &ctxt->context[vcpu].user_regs; @@ -199,7 +218,7 @@ xc_debug_read_registers(int xc_handle, } int -xc_debug_read_fpregisters (int xc_handle, +xendebug_read_fpregisters (int xc_handle, u32 domid, u32 vcpu, char **regs) @@ -207,9 +226,9 @@ xc_debug_read_fpregisters (int xc_handle, domain_context_p ctxt; int rc = -1; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); if (ctxt) { *regs = ctxt->context[vcpu].fpu_ctxt.x; @@ -220,7 +239,7 @@ xc_debug_read_fpregisters (int xc_handle, } int -xc_debug_write_registers(int xc_handle, +xendebug_write_registers(int xc_handle, u32 domid, u32 vcpu, cpu_user_regs_t *regs) @@ -228,34 +247,34 @@ xc_debug_write_registers(int xc_handle, domain_context_p ctxt; int rc = -1; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); if (ctxt) { memcpy(&ctxt->context[vcpu].user_regs, regs, sizeof(cpu_user_regs_t)); - rc = xc_debug_set_context(xc_handle, ctxt, vcpu); + rc = xendebug_set_context(xc_handle, ctxt, vcpu); } return rc; } int -xc_debug_step(int xc_handle, +xendebug_step(int xc_handle, u32 domid, u32 vcpu) { domain_context_p ctxt; int rc; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); if (!ctxt) return -EINVAL; ctxt->context[vcpu].user_regs.eflags |= X86_EFLAGS_TF; - if ( (rc = xc_debug_set_context(xc_handle, ctxt, vcpu)) ) + if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) ) return rc; ctxt->valid[vcpu] = false; @@ -263,22 +282,22 @@ xc_debug_step(int xc_handle, } int -xc_debug_continue(int xc_handle, +xendebug_continue(int xc_handle, u32 domid, u32 vcpu) { domain_context_p ctxt; int rc; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); if (!ctxt) return -EINVAL; if ( ctxt->context[vcpu].user_regs.eflags & X86_EFLAGS_TF ) { ctxt->context[vcpu].user_regs.eflags &= ~X86_EFLAGS_TF; - if ( (rc = xc_debug_set_context(xc_handle, ctxt, vcpu)) ) + if ( (rc = xendebug_set_context(xc_handle, ctxt, vcpu)) ) return rc; } ctxt->valid[vcpu] = false; @@ -292,7 +311,7 @@ xc_debug_continue(int xc_handle, /* access to one page */ static int -xc_debug_memory_page (domain_context_p ctxt, int xc_handle, u32 vcpu, +xendebug_memory_page (domain_context_p ctxt, int xc_handle, u32 vcpu, int protection, memory_t address, int length, u8 *buffer) { vcpu_guest_context_t *vcpu_ctxt = &ctxt->context[vcpu]; @@ -388,7 +407,7 @@ xc_debug_memory_page (domain_context_p ctxt, int xc_handle, u32 vcpu, /* divide a memory operation into accesses to individual pages */ static int -xc_debug_memory_op (domain_context_p ctxt, int xc_handle, u32 vcpu, +xendebug_memory_op (domain_context_p ctxt, int xc_handle, u32 vcpu, int protection, memory_t address, int length, u8 *buffer) { int remain; /* number of bytes to touch past this page */ @@ -396,21 +415,21 @@ xc_debug_memory_op (domain_context_p ctxt, int xc_handle, u32 vcpu, while ( (remain = (address + length - 1) - (address | (PAGE_SIZE-1))) > 0) { - bytes += xc_debug_memory_page(ctxt, xc_handle, vcpu, protection, + bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection, address, length - remain, buffer); buffer += (length - remain); length = remain; address = (address | (PAGE_SIZE - 1)) + 1; } - bytes += xc_debug_memory_page(ctxt, xc_handle, vcpu, protection, + bytes += xendebug_memory_page(ctxt, xc_handle, vcpu, protection, address, length, buffer); return bytes; } int -xc_debug_read_memory(int xc_handle, +xendebug_read_memory(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -419,18 +438,18 @@ xc_debug_read_memory(int xc_handle, { domain_context_p ctxt; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); + ctxt = xendebug_get_context(xc_handle, domid, vcpu); - xc_debug_memory_op(ctxt, xc_handle, vcpu, PROT_READ, + xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ, address, length, data); return 0; } int -xc_debug_write_memory(int xc_handle, +xendebug_write_memory(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -439,10 +458,10 @@ xc_debug_write_memory(int xc_handle, { domain_context_p ctxt; - xc_debug_initialize(); + xendebug_initialize(); - ctxt = xc_debug_get_context(xc_handle, domid, vcpu); - xc_debug_memory_op(ctxt, xc_handle, vcpu, PROT_READ | PROT_WRITE, + ctxt = xendebug_get_context(xc_handle, domid, vcpu); + xendebug_memory_op(ctxt, xc_handle, vcpu, PROT_READ | PROT_WRITE, address, length, data); @@ -450,7 +469,7 @@ xc_debug_write_memory(int xc_handle, } int -xc_debug_insert_memory_breakpoint(int xc_handle, +xendebug_insert_memory_breakpoint(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -462,7 +481,7 @@ xc_debug_insert_memory_breakpoint(int xc_handle, printf("insert breakpoint %d:%lx %d\n", domid, address, length); - xc_debug_initialize(); + xendebug_initialize(); bkpt = malloc(sizeof(bwcpoint_t)); if ( bkpt == NULL ) @@ -481,10 +500,10 @@ xc_debug_insert_memory_breakpoint(int xc_handle, bkpt->address = address; bkpt->domain = domid; - xc_debug_read_memory(xc_handle, domid, vcpu, address, 1, + xendebug_read_memory(xc_handle, domid, vcpu, address, 1, &bkpt->old_value); - xc_debug_write_memory(xc_handle, domid, vcpu, address, 1, + xendebug_write_memory(xc_handle, domid, vcpu, address, 1, &breakpoint_opcode); list_add(&bkpt->list, &bwcpoint_list.list); @@ -496,7 +515,7 @@ xc_debug_insert_memory_breakpoint(int xc_handle, } int -xc_debug_remove_memory_breakpoint(int xc_handle, +xendebug_remove_memory_breakpoint(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -523,7 +542,7 @@ xc_debug_remove_memory_breakpoint(int xc_handle, list_del(&bkpt->list); - xc_debug_write_memory(xc_handle, domid, vcpu, address, 1, + xendebug_write_memory(xc_handle, domid, vcpu, address, 1, &bkpt->old_value); free(bkpt); @@ -531,7 +550,7 @@ xc_debug_remove_memory_breakpoint(int xc_handle, } int -xc_debug_query_domain_stop(int xc_handle, int *dom_list, int dom_list_size) +xendebug_query_domain_stop(int xc_handle, int *dom_list, int dom_list_size) { xc_dominfo_t *info; u32 first_dom = 0; diff --git a/tools/libxc/xc_debug.h b/tools/debugger/libxendebug/xendebug.h index ffce175f51..66a45104ba 100644 --- a/tools/libxc/xc_debug.h +++ b/tools/debugger/libxendebug/xendebug.h @@ -1,46 +1,48 @@ /* - * xc_debug.h + * xendebug.h * * alex ho * http://www.cl.cam.ac.uk/netos/pdb * */ -#ifndef _XC_DEBUG_H_DEFINED -#define _XC_DEBUG_H_DEFINED +#ifndef _XENDEBUG_H_DEFINED +#define _XENDEBUG_H_DEFINED -int xc_debug_attach(int xc_handle, +#include <xc.h> + +int xendebug_attach(int xc_handle, u32 domid, u32 vcpu); -int xc_debug_detach(int xc_handle, +int xendebug_detach(int xc_handle, u32 domid, u32 vcpu); -int xc_debug_read_registers(int xc_handle, +int xendebug_read_registers(int xc_handle, u32 domid, u32 vcpu, cpu_user_regs_t **regs); -int xc_debug_read_fpregisters (int xc_handle, +int xendebug_read_fpregisters (int xc_handle, u32 domid, u32 vcpu, char **regs); -int xc_debug_write_registers(int xc_handle, +int xendebug_write_registers(int xc_handle, u32 domid, u32 vcpu, cpu_user_regs_t *regs); -int xc_debug_step(int xc_handle, +int xendebug_step(int xc_handle, u32 domid, u32 vcpu); -int xc_debug_continue(int xc_handle, +int xendebug_continue(int xc_handle, u32 domid, u32 vcpu); -int xc_debug_read_memory(int xc_handle, +int xendebug_read_memory(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -48,7 +50,7 @@ int xc_debug_read_memory(int xc_handle, u8 *data); -int xc_debug_write_memory(int xc_handle, +int xendebug_write_memory(int xc_handle, u32 domid, u32 vcpu, memory_t address, @@ -56,21 +58,21 @@ int xc_debug_write_memory(int xc_handle, u8 *data); -int xc_debug_insert_memory_breakpoint(int xc_handle, +int xendebug_insert_memory_breakpoint(int xc_handle, u32 domid, u32 vcpu, memory_t address, u32 length); -int xc_debug_remove_memory_breakpoint(int xc_handle, +int xendebug_remove_memory_breakpoint(int xc_handle, u32 domid, u32 vcpu, memory_t address, u32 length); -int xc_debug_query_domain_stop(int xc_handle, +int xendebug_query_domain_stop(int xc_handle, int *dom_list, int dom_list_size); -#endif /* _XC_DEBUG_H_DEFINED */ +#endif /* _XENDEBUG_H_DEFINED */ diff --git a/tools/pdb/Domain.ml b/tools/debugger/pdb/Domain.ml index 700699a958..700699a958 100644 --- a/tools/pdb/Domain.ml +++ b/tools/debugger/pdb/Domain.ml diff --git a/tools/pdb/Domain.mli b/tools/debugger/pdb/Domain.mli index 456d19489d..456d19489d 100644 --- a/tools/pdb/Domain.mli +++ b/tools/debugger/pdb/Domain.mli diff --git a/tools/pdb/Intel.ml b/tools/debugger/pdb/Intel.ml index d82ef8b527..d82ef8b527 100644 --- a/tools/pdb/Intel.ml +++ b/tools/debugger/pdb/Intel.ml diff --git a/tools/pdb/Makefile b/tools/debugger/pdb/Makefile index 562b21ccf6..579c7da12c 100644 --- a/tools/pdb/Makefile +++ b/tools/debugger/pdb/Makefile @@ -1,6 +1,6 @@ OCAMLMAKEFILE = OCamlMakefile -XEN_ROOT = ../.. +XEN_ROOT = ../../.. include $(XEN_ROOT)/tools/Rules.mk # overwrite LDFLAGS from xen/tool/Rules.mk @@ -17,6 +17,7 @@ OCAMLLIBPATH= $(OCAML_ROOT)/lib/ocaml INCLUDES += -I $(XEN_XC) INCLUDES += -I $(XEN_LIBXC) +INCLUDES += -I ../libxendebug INCLUDES += -I $(OCAML_ROOT)/lib/ocaml CFLAGS += $(INCLUDES) @@ -25,11 +26,12 @@ CFLAGS += -Werror CFLAGS += -g CLIBS += xc -CLIBS += xutil +CLIBS += xendebug CLIBS += pdb LIBDIRS += $(XEN_LIBXC) LIBDIRS += $(XEN_LIBXUTIL) +LIBDIRS += ../libxendebug LIBDIRS += . LIBS += unix str diff --git a/tools/pdb/OCamlMakefile b/tools/debugger/pdb/OCamlMakefile index 0c6d23ab00..0c6d23ab00 100644 --- a/tools/pdb/OCamlMakefile +++ b/tools/debugger/pdb/OCamlMakefile diff --git a/tools/pdb/PDB.ml b/tools/debugger/pdb/PDB.ml index 0ed121b7aa..0ed121b7aa 100644 --- a/tools/pdb/PDB.ml +++ b/tools/debugger/pdb/PDB.ml diff --git a/tools/pdb/Process.ml b/tools/debugger/pdb/Process.ml index 79632b3298..79632b3298 100644 --- a/tools/pdb/Process.ml +++ b/tools/debugger/pdb/Process.ml diff --git a/tools/pdb/Process.mli b/tools/debugger/pdb/Process.mli index 39b6221892..39b6221892 100644 --- a/tools/pdb/Process.mli +++ b/tools/debugger/pdb/Process.mli diff --git a/tools/pdb/Util.ml b/tools/debugger/pdb/Util.ml index a5722242db..a5722242db 100644 --- a/tools/pdb/Util.ml +++ b/tools/debugger/pdb/Util.ml diff --git a/tools/pdb/debugger.ml b/tools/debugger/pdb/debugger.ml index 5a3002470b..5a3002470b 100644 --- a/tools/pdb/debugger.ml +++ b/tools/debugger/pdb/debugger.ml diff --git a/tools/pdb/evtchn.ml b/tools/debugger/pdb/evtchn.ml index 5443accd9b..5443accd9b 100644 --- a/tools/pdb/evtchn.ml +++ b/tools/debugger/pdb/evtchn.ml diff --git a/tools/pdb/evtchn.mli b/tools/debugger/pdb/evtchn.mli index 18b3ed667b..18b3ed667b 100644 --- a/tools/pdb/evtchn.mli +++ b/tools/debugger/pdb/evtchn.mli diff --git a/tools/pdb/pdb_caml_xc.c b/tools/debugger/pdb/pdb_caml_xc.c index b25f528c65..6ba82a92c2 100644 --- a/tools/pdb/pdb_caml_xc.c +++ b/tools/debugger/pdb/pdb_caml_xc.c @@ -7,7 +7,7 @@ */ #include <xc.h> -#include <xc_debug.h> +#include <xendebug.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> @@ -105,7 +105,7 @@ read_registers (value context) decode_context(&ctx, context); - if ( xc_debug_read_registers(xc_handle, ctx.domain, ctx.vcpu, ®s) ) + if ( xendebug_read_registers(xc_handle, ctx.domain, ctx.vcpu, ®s) ) { printf("(pdb) read registers error!\n"); fflush(stdout); failwith("read registers error"); @@ -156,7 +156,7 @@ write_register (value context, value reg, value newval) decode_context(&ctx, context); - if ( xc_debug_read_registers(xc_handle, ctx.domain, ctx.vcpu, ®s) ) + if ( xendebug_read_registers(xc_handle, ctx.domain, ctx.vcpu, ®s) ) { printf("(pdb) write register (get) error!\n"); fflush(stdout); failwith("write register error"); @@ -186,7 +186,7 @@ write_register (value context, value reg, value newval) case PDB_GS: regs->gs = val; break; } - if ( xc_debug_write_registers(xc_handle, ctx.domain, ctx.vcpu, regs) ) + if ( xendebug_write_registers(xc_handle, ctx.domain, ctx.vcpu, regs) ) { printf("(pdb) write register (set) error!\n"); fflush(stdout); failwith("write register error"); @@ -221,7 +221,7 @@ read_memory (value context, value address, value length) failwith("read memory error"); } - if ( xc_debug_read_memory(xc_handle, ctx.domain, ctx.vcpu, + if ( xendebug_read_memory(xc_handle, ctx.domain, ctx.vcpu, my_address, my_length, buffer) ) { printf("(pdb) read memory error!\n"); fflush(stdout); @@ -285,7 +285,7 @@ write_memory (value context, value address, value val_list) my_address = (memory_t) Int32_val(address); - if ( xc_debug_write_memory(xc_handle, ctx.domain, ctx.vcpu, + if ( xendebug_write_memory(xc_handle, ctx.domain, ctx.vcpu, my_address, length, buffer) ) { printf("(pdb) write memory error!\n"); fflush(stdout); @@ -333,7 +333,7 @@ continue_target (value context) decode_context(&ctx, context); - if ( xc_debug_continue(xc_handle, ctx.domain, ctx.vcpu) ) + if ( xendebug_continue(xc_handle, ctx.domain, ctx.vcpu) ) { printf("(pdb) continue\n"); fflush(stdout); failwith("continue"); @@ -354,7 +354,7 @@ step_target (value context) decode_context(&ctx, context); - if ( xc_debug_step(xc_handle, ctx.domain, ctx.vcpu) ) + if ( xendebug_step(xc_handle, ctx.domain, ctx.vcpu) ) { printf("(pdb) step\n"); fflush(stdout); failwith("step"); @@ -382,7 +382,7 @@ insert_memory_breakpoint (value context, value address, value length) printf ("(pdb) insert memory breakpoint 0x%lx %d\n", my_address, my_length); - if ( xc_debug_insert_memory_breakpoint(xc_handle, ctx.domain, ctx.vcpu, + if ( xendebug_insert_memory_breakpoint(xc_handle, ctx.domain, ctx.vcpu, my_address, my_length) ) { printf("(pdb) error: insert memory breakpoint\n"); fflush(stdout); @@ -411,7 +411,7 @@ remove_memory_breakpoint (value context, value address, value length) decode_context(&ctx, context); - if ( xc_debug_remove_memory_breakpoint(xc_handle, + if ( xendebug_remove_memory_breakpoint(xc_handle, ctx.domain, ctx.vcpu, my_address, my_length) ) { @@ -435,7 +435,7 @@ attach_debugger (value domain, value vcpu) printf ("(pdb) attach domain [%d.%d]\n", my_domain, my_vcpu); - if ( xc_debug_attach(xc_handle, my_domain, my_vcpu) ) + if ( xendebug_attach(xc_handle, my_domain, my_vcpu) ) { printf("(pdb) attach error!\n"); fflush(stdout); failwith("attach error"); @@ -458,7 +458,7 @@ detach_debugger (value domain, value vcpu) printf ("(pdb) detach domain [%d.%d]\n", my_domain, my_vcpu); - if ( xc_debug_detach(xc_handle, my_domain, my_vcpu) ) + if ( xendebug_detach(xc_handle, my_domain, my_vcpu) ) { printf("(pdb) detach error!\n"); fflush(stdout); failwith("detach error"); @@ -514,7 +514,7 @@ query_domain_stop (value unit) int dom_list[max_domains]; int loop, count; - count = xc_debug_query_domain_stop(xc_handle, dom_list, max_domains); + count = xendebug_query_domain_stop(xc_handle, dom_list, max_domains); if ( count < 0 ) { printf("(pdb) query domain stop!\n"); fflush(stdout); diff --git a/tools/pdb/pdb_xen.c b/tools/debugger/pdb/pdb_xen.c index 36671dacc0..36671dacc0 100644 --- a/tools/pdb/pdb_xen.c +++ b/tools/debugger/pdb/pdb_xen.c diff --git a/tools/pdb/server.ml b/tools/debugger/pdb/server.ml index 2d3a3c7c86..2d3a3c7c86 100644 --- a/tools/pdb/server.ml +++ b/tools/debugger/pdb/server.ml diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile index 9a95597eed..598abedb7d 100644 --- a/tools/libxc/Makefile +++ b/tools/libxc/Makefile @@ -17,7 +17,6 @@ SRCS += xc_sedf.c SRCS += xc_bvtsched.c SRCS += xc_core.c SRCS += xc_domain.c -SRCS += xc_debug.c SRCS += xc_evtchn.c SRCS += xc_gnttab.c SRCS += xc_linux_build.c @@ -94,7 +93,7 @@ rpm: build mv staging/i386/*.rpm . rm -rf staging -libxc.a: $(OBJS) +libxc.a: $(LIB_OBJS) $(AR) rc $@ $^ libxc.so: libxc.so.$(MAJOR) diff --git a/tools/libxc/xc.h b/tools/libxc/xc.h index c31222fc90..29e642d4cb 100644 --- a/tools/libxc/xc.h +++ b/tools/libxc/xc.h @@ -499,5 +499,10 @@ int xc_gnttab_dump_table(int xc_handle, u32 dom, s16 *status); +/* Get current total pages allocated to a domain. */ +long xc_get_tot_pages(int xc_handle, u32 domid); + +/* Execute a privileged dom0 operation. */ +int xc_dom0_op(int xc_handle, dom0_op_t *op); #endif /* __XC_H__ */ diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c index 0645af7a91..7b8ec3d113 100644 --- a/tools/libxc/xc_private.c +++ b/tools/libxc/xc_private.c @@ -363,3 +363,8 @@ void xc_map_memcpy(unsigned long dst, char *src, unsigned long size, munmap(va, PAGE_SIZE); } } + +int xc_dom0_op(int xc_handle, dom0_op_t *op) +{ + return do_dom0_op(xc_handle, op); +} diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h index 63ae79606b..f5ab319e66 100644 --- a/tools/libxc/xc_private.h +++ b/tools/libxc/xc_private.h @@ -262,8 +262,6 @@ typedef struct mfn_mapper { unsigned long xc_get_m2p_start_mfn ( int xc_handle ); -long xc_get_tot_pages(int xc_handle, u32 domid); - int xc_copy_to_domain_page(int xc_handle, u32 domid, unsigned long dst_pfn, void *src_page); diff --git a/xen/Rules.mk b/xen/Rules.mk index 9fef534a8b..221882814a 100644 --- a/xen/Rules.mk +++ b/xen/Rules.mk @@ -55,11 +55,6 @@ ifeq ($(domu_debug),y) CFLAGS += -DDOMU_DEBUG endif -ifeq ($(pdb),y) -CFLAGS += -g -DPDB_DEBUG -endif - - ifeq ($(crash_debug),y) CFLAGS += -g -DCRASH_DEBUG endif diff --git a/xen/common/domain.c b/xen/common/domain.c index 47fca238fc..c832a83410 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -224,6 +224,26 @@ void domain_shutdown(u8 reason) } +void domain_pause_for_debugger(void) +{ + struct domain *d = current->domain; + struct vcpu *v; + + /* + * NOTE: This does not synchronously pause the domain. The debugger + * must issue a PAUSEDOMAIN command to ensure that all execution + * has ceased and guest state is committed to memory. + */ + for_each_vcpu ( d, v ) + { + set_bit(_VCPUF_ctrl_pause, &v->vcpu_flags); + domain_sleep_nosync(v); + } + + send_guest_virq(dom0->vcpu[0], VIRQ_DEBUGGER); +} + + /* Release resources belonging to task @p. */ void domain_destruct(struct domain *d) { diff --git a/xen/include/asm-x86/debugger.h b/xen/include/asm-x86/debugger.h index bb5fea1720..aa2050f849 100644 --- a/xen/include/asm-x86/debugger.h +++ b/xen/include/asm-x86/debugger.h @@ -55,69 +55,24 @@ static inline int debugger_trap_fatal( #elif defined(DOMU_DEBUG) -#include <xen/softirq.h> +#include <xen/sched.h> +#include <asm/regs.h> static inline int debugger_trap_entry( unsigned int vector, struct cpu_user_regs *regs) { struct vcpu *v = current; - if ( !KERNEL_MODE(ed, regs) || (ed->domain->domain_id == 0) ) + if ( !KERNEL_MODE(v, regs) || (v->domain->domain_id == 0) ) return 0; switch ( vector ) { case TRAP_int3: case TRAP_debug: - set_bit(_VCPUF_ctrl_pause, &ed->vcpu_flags); - raise_softirq(SCHEDULE_SOFTIRQ); - return 1; - } - - return 0; -} - -#define debugger_trap_fatal(_v, _r) (0) -#define debugger_trap_immediate() - -#elif defined(PDB_DEBUG) - -#include <xen/event.h> -#include <xen/softirq.h> -#include <xen/sched.h> -#include <asm/regs.h> - -static inline int debugger_trap_entry(unsigned int vector, - struct cpu_user_regs *regs) -{ - struct vcpu *vcpu = current; - - if ( !KERNEL_MODE(vcpu, regs) || (vcpu->domain->domain_id == 0) ) - return 0; - - switch ( vector ) - { - case TRAP_debug: - case TRAP_int3: - { - struct vcpu *ptr; - - /* suspend the guest domain */ - for_each_vcpu ( vcpu->domain, ptr ) - { - test_and_set_bit(_VCPUF_ctrl_pause, &ptr->vcpu_flags); - } - sync_lazy_execstate_mask(vcpu->domain->cpumask); /* TLB flush */ - raise_softirq(SCHEDULE_SOFTIRQ); - - /* notify the debugger */ - send_guest_virq(dom0->vcpu[0], VIRQ_PDB); - + domain_pause_for_debugger(); return 1; } - default: - break; - } return 0; } diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index 624ed65510..f114641424 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -70,7 +70,7 @@ #define VIRQ_DOM_EXC 3 /* (DOM0) Exceptional event for some domain. */ #define VIRQ_PARITY_ERR 4 /* (DOM0) NMI parity error. */ #define VIRQ_IO_ERR 5 /* (DOM0) NMI I/O error. */ -#define VIRQ_PDB 6 /* (DOM0) PDB */ +#define VIRQ_DEBUGGER 6 /* (DOM0) A domain has paused for debugging. */ #define NR_VIRQS 7 /* diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 1237da7909..f68abd59e3 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -217,6 +217,7 @@ struct domain *find_domain_by_id(domid_t dom); extern void domain_destruct(struct domain *d); extern void domain_kill(struct domain *d); extern void domain_shutdown(u8 reason); +extern void domain_pause_for_debugger(void); /* * Mark current domain as crashed. This function returns: the domain is not |