ia64/xen-unstable

changeset 6421:2f20c2fce2c5

merge?
author cl349@firebug.cl.cam.ac.uk
date Thu Aug 25 00:55:20 2005 +0000 (2005-08-25)
parents 630feabe7ed6 fdfd511768a3
children e24fd7012ffb
files Config.mk linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 linux-2.6-xen-sparse/arch/xen/kernel/reboot.c linux-2.6-xen-sparse/arch/xen/x86_64/ia32/syscall32.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head.S linux-2.6-xen-sparse/arch/xen/x86_64/kernel/head64.c linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c linux-2.6-xen-sparse/arch/xen/x86_64/mm/init.c linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/netback/Makefile linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/interface.c linux-2.6-xen-sparse/drivers/xen/netback/netback.c linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h tools/blktap/blktaplib.h tools/blktap/parallax/block-async.h tools/blktap/parallax/blockstore.h tools/console/Makefile tools/console/client/main.c tools/console/daemon/io.c tools/console/daemon/main.c tools/console/daemon/utils.c tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c tools/debugger/libxendebug/Makefile tools/debugger/libxendebug/xendebug.c tools/debugger/libxendebug/xendebug.h tools/debugger/pdb/pdb_caml_domain.c tools/debugger/pdb/pdb_caml_evtchn.c tools/debugger/pdb/pdb_caml_process.c tools/debugger/pdb/pdb_caml_xc.c tools/debugger/pdb/pdb_caml_xcs.c tools/debugger/pdb/pdb_xen.c tools/firmware/acpi/acpi2_0.h tools/ioemu/hw/i8254.c tools/ioemu/hw/i8259.c tools/ioemu/hw/ioapic.h tools/ioemu/target-i386-dm/Makefile tools/ioemu/target-i386-dm/helper2.c tools/ioemu/vl.c tools/libxc/Makefile tools/libxc/xc_core.c tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_load_aout9.c tools/libxc/xc_load_bin.c tools/libxc/xc_load_elf.c tools/libxc/xc_private.c tools/libxc/xc_private.h tools/libxc/xc_vmx_build.c tools/libxc/xenctrl.h tools/libxc/xenguest.h tools/libxc/xg_private.c tools/libxc/xg_private.h tools/misc/Makefile tools/misc/cpuperf/Makefile tools/misc/cpuperf/cpuperf_xeno.h tools/misc/xc_shadow.c tools/misc/xenperf.c tools/python/setup.py tools/python/xen/lowlevel/xc/xc.c tools/python/xen/lowlevel/xu/xu.c tools/python/xen/xend/XendDomainInfo.py tools/python/xen/xm/main.py tools/xcs/Makefile tools/xcs/dump.h tools/xcs/xcs.h tools/xcs/xcsdump.c tools/xcutils/Makefile tools/xcutils/xc_restore.c tools/xcutils/xc_save.c tools/xenstore/Makefile tools/xenstore/xs_dom0_test.c tools/xenstore/xs_lib.h tools/xentrace/Makefile tools/xentrace/xenctx.c xen/arch/x86/cpu/amd.c xen/arch/x86/mm.c
line diff
     1.1 --- a/tools/blktap/blktaplib.h	Wed Aug 24 22:24:10 2005 +0000
     1.2 +++ b/tools/blktap/blktaplib.h	Thu Aug 25 00:55:20 2005 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  #ifndef __BLKTAPLIB_H__
     1.5  #define __BLKTAPLIB_H__
     1.6  
     1.7 -#include <xc.h>
     1.8 +#include <xenctrl.h>
     1.9  #include <sys/user.h>
    1.10  #include <xen/xen.h>
    1.11  #include <xen/io/blkif.h>
     2.1 --- a/tools/blktap/parallax/block-async.h	Wed Aug 24 22:24:10 2005 +0000
     2.2 +++ b/tools/blktap/parallax/block-async.h	Thu Aug 25 00:55:20 2005 +0000
     2.3 @@ -7,7 +7,7 @@
     2.4  #define _BLOCKASYNC_H_
     2.5  
     2.6  #include <assert.h>
     2.7 -#include <xc.h>
     2.8 +#include <xenctrl.h>
     2.9  #include "vdi.h"
    2.10  
    2.11  struct io_ret
     3.1 --- a/tools/blktap/parallax/blockstore.h	Wed Aug 24 22:24:10 2005 +0000
     3.2 +++ b/tools/blktap/parallax/blockstore.h	Thu Aug 25 00:55:20 2005 +0000
     3.3 @@ -10,7 +10,7 @@
     3.4  #define __BLOCKSTORE_H__
     3.5  
     3.6  #include <netinet/in.h>
     3.7 -#include <xc.h>
     3.8 +#include <xenctrl.h>
     3.9  
    3.10  #define BLOCK_SIZE  4096
    3.11  #define BLOCK_SHIFT   12
     4.1 --- a/tools/console/Makefile	Wed Aug 24 22:24:10 2005 +0000
     4.2 +++ b/tools/console/Makefile	Thu Aug 25 00:55:20 2005 +0000
     4.3 @@ -26,11 +26,11 @@ clean:
     4.4  
     4.5  xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
     4.6  	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
     4.7 -              -lxc -lxenstore
     4.8 +              -lxenctrl -lxenstore
     4.9  
    4.10  xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
    4.11  	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
    4.12 -	      -lxc -lxenstore
    4.13 +	      -lxenctrl -lxenstore
    4.14  
    4.15  install: $(BIN)
    4.16  	$(INSTALL_DIR) -p $(DESTDIR)/$(DAEMON_INSTALL_DIR)
     5.1 --- a/tools/console/client/main.c	Wed Aug 24 22:24:10 2005 +0000
     5.2 +++ b/tools/console/client/main.c	Thu Aug 25 00:55:20 2005 +0000
     5.3 @@ -36,7 +36,7 @@
     5.4  #include <errno.h>
     5.5  #include <pty.h>
     5.6  
     5.7 -#include "xc.h"
     5.8 +#include "xenctrl.h"
     5.9  #include "xs.h"
    5.10  
    5.11  #define ESCAPE_CHARACTER 0x1d
     6.1 --- a/tools/console/daemon/io.c	Wed Aug 24 22:24:10 2005 +0000
     6.2 +++ b/tools/console/daemon/io.c	Thu Aug 25 00:55:20 2005 +0000
     6.3 @@ -23,7 +23,7 @@
     6.4  #include "utils.h"
     6.5  #include "io.h"
     6.6  
     6.7 -#include "xc.h"
     6.8 +#include "xenctrl.h"
     6.9  #include "xs.h"
    6.10  #include "xen/io/domain_controller.h"
    6.11  #include "xcs_proto.h"
     7.1 --- a/tools/console/daemon/main.c	Wed Aug 24 22:24:10 2005 +0000
     7.2 +++ b/tools/console/daemon/main.c	Thu Aug 25 00:55:20 2005 +0000
     7.3 @@ -25,7 +25,7 @@
     7.4  #include <unistd.h>
     7.5  #include <sys/types.h>
     7.6  
     7.7 -#include "xc.h"
     7.8 +#include "xenctrl.h"
     7.9  #include "xen/io/domain_controller.h"
    7.10  #include "xcs_proto.h"
    7.11  
     8.1 --- a/tools/console/daemon/utils.c	Wed Aug 24 22:24:10 2005 +0000
     8.2 +++ b/tools/console/daemon/utils.c	Thu Aug 25 00:55:20 2005 +0000
     8.3 @@ -33,7 +33,7 @@
     8.4  #include <sys/un.h>
     8.5  #include <string.h>
     8.6  
     8.7 -#include "xc.h"
     8.8 +#include "xenctrl.h"
     8.9  #include "xen/io/domain_controller.h"
    8.10  #include "xcs_proto.h"
    8.11  
     9.1 --- a/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c	Wed Aug 24 22:24:10 2005 +0000
     9.2 +++ b/tools/debugger/gdb/gdb-6.2.1-xen-sparse/gdb/gdbserver/linux-xen-low.c	Thu Aug 25 00:55:20 2005 +0000
     9.3 @@ -35,7 +35,7 @@
     9.4  #include <stdlib.h>
     9.5  #include <unistd.h>
     9.6  #include <errno.h>
     9.7 -#include <xc.h>
     9.8 +#include <xenctrl.h>
     9.9  #define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */
    9.10  long (*myptrace)(enum __ptrace_request, pid_t, long, long);
    9.11  int (*myxcwait)(int domain, int *status, int options) ;
    10.1 --- a/tools/debugger/libxendebug/Makefile	Wed Aug 24 22:24:10 2005 +0000
    10.2 +++ b/tools/debugger/libxendebug/Makefile	Thu Aug 25 00:55:20 2005 +0000
    10.3 @@ -20,7 +20,7 @@ CFLAGS   += $(INCLUDES) -I. -I$(XEN_ROOT
    10.4  CFLAGS   += -Wp,-MD,.$(@F).d
    10.5  DEPS     = .*.d
    10.6  
    10.7 -LDFLAGS  += -L$(XEN_ROOT)/tools/libxc -lxc
    10.8 +LDFLAGS  += -L$(XEN_ROOT)/tools/libxc -lxenctrl
    10.9  
   10.10  LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
   10.11  PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
    11.1 --- a/tools/debugger/libxendebug/xendebug.c	Wed Aug 24 22:24:10 2005 +0000
    11.2 +++ b/tools/debugger/libxendebug/xendebug.c	Thu Aug 25 00:55:20 2005 +0000
    11.3 @@ -12,7 +12,7 @@
    11.4  #include <string.h>
    11.5  #include <errno.h>
    11.6  #include <sys/mman.h>
    11.7 -#include <xc.h>
    11.8 +#include <xenctrl.h>
    11.9  #include "list.h"
   11.10  
   11.11  #if defined(__i386__)
    12.1 --- a/tools/debugger/libxendebug/xendebug.h	Wed Aug 24 22:24:10 2005 +0000
    12.2 +++ b/tools/debugger/libxendebug/xendebug.h	Thu Aug 25 00:55:20 2005 +0000
    12.3 @@ -9,7 +9,7 @@
    12.4  #ifndef _XENDEBUG_H_DEFINED
    12.5  #define _XENDEBUG_H_DEFINED
    12.6  
    12.7 -#include <xc.h>
    12.8 +#include <xenctrl.h>
    12.9  
   12.10  int xendebug_attach(int xc_handle,
   12.11  		    u32 domid,
    13.1 --- a/tools/debugger/pdb/pdb_caml_domain.c	Wed Aug 24 22:24:10 2005 +0000
    13.2 +++ b/tools/debugger/pdb/pdb_caml_domain.c	Thu Aug 25 00:55:20 2005 +0000
    13.3 @@ -6,7 +6,7 @@
    13.4   * PDB's OCaml interface library for debugging domains
    13.5   */
    13.6  
    13.7 -#include <xc.h>
    13.8 +#include <xenctrl.h>
    13.9  #include <xendebug.h>
   13.10  #include <errno.h>
   13.11  #include <stdio.h>
    14.1 --- a/tools/debugger/pdb/pdb_caml_evtchn.c	Wed Aug 24 22:24:10 2005 +0000
    14.2 +++ b/tools/debugger/pdb/pdb_caml_evtchn.c	Thu Aug 25 00:55:20 2005 +0000
    14.3 @@ -6,7 +6,7 @@
    14.4   * PDB's OCaml interface library for event channels
    14.5   */
    14.6  
    14.7 -#include <xc.h>
    14.8 +#include <xenctrl.h>
    14.9  #include <stdio.h>
   14.10  #include <stdlib.h>
   14.11  #include <string.h>
    15.1 --- a/tools/debugger/pdb/pdb_caml_process.c	Wed Aug 24 22:24:10 2005 +0000
    15.2 +++ b/tools/debugger/pdb/pdb_caml_process.c	Thu Aug 25 00:55:20 2005 +0000
    15.3 @@ -15,7 +15,7 @@
    15.4  #include <caml/memory.h>
    15.5  #include <caml/mlvalues.h>
    15.6  
    15.7 -#include <xc.h>
    15.8 +#include <xenctrl.h>
    15.9  #include <xen/xen.h>
   15.10  #include <xen/io/domain_controller.h>
   15.11  #include <xen/linux/privcmd.h>
    16.1 --- a/tools/debugger/pdb/pdb_caml_xc.c	Wed Aug 24 22:24:10 2005 +0000
    16.2 +++ b/tools/debugger/pdb/pdb_caml_xc.c	Thu Aug 25 00:55:20 2005 +0000
    16.3 @@ -6,7 +6,7 @@
    16.4   * PDB's OCaml interface library for debugging domains
    16.5   */
    16.6  
    16.7 -#include <xc.h>
    16.8 +#include <xenctrl.h>
    16.9  #include <xendebug.h>
   16.10  #include <errno.h>
   16.11  #include <stdio.h>
    17.1 --- a/tools/debugger/pdb/pdb_caml_xcs.c	Wed Aug 24 22:24:10 2005 +0000
    17.2 +++ b/tools/debugger/pdb/pdb_caml_xcs.c	Thu Aug 25 00:55:20 2005 +0000
    17.3 @@ -17,7 +17,7 @@
    17.4  #include <sys/types.h>
    17.5  #include <sys/socket.h>
    17.6  #include <errno.h>
    17.7 -#include <xc.h>
    17.8 +#include <xenctrl.h>
    17.9  
   17.10  #include <xen/xen.h>
   17.11  #include <xen/io/domain_controller.h>
    18.1 --- a/tools/debugger/pdb/pdb_xen.c	Wed Aug 24 22:24:10 2005 +0000
    18.2 +++ b/tools/debugger/pdb/pdb_xen.c	Thu Aug 25 00:55:20 2005 +0000
    18.3 @@ -7,7 +7,7 @@
    18.4   * PDB interface library for accessing Xen
    18.5   */
    18.6  
    18.7 -#include <xc.h>
    18.8 +#include <xenctrl.h>
    18.9  #include <stdio.h>
   18.10  #include <stdlib.h>
   18.11  #include <errno.h>
    19.1 --- a/tools/firmware/acpi/acpi2_0.h	Wed Aug 24 22:24:10 2005 +0000
    19.2 +++ b/tools/firmware/acpi/acpi2_0.h	Thu Aug 25 00:55:20 2005 +0000
    19.3 @@ -18,7 +18,7 @@
    19.4  #ifndef _ACPI_2_0_H_
    19.5  #define _ACPI_2_0_H_
    19.6  
    19.7 -#include "xc.h"  // for u8, u16, u32, u64 definition
    19.8 +#include "xenctrl.h"  // for u8, u16, u32, u64 definition
    19.9  
   19.10  #pragma pack (1)
   19.11  
    20.1 --- a/tools/ioemu/hw/i8254.c	Wed Aug 24 22:24:10 2005 +0000
    20.2 +++ b/tools/ioemu/hw/i8254.c	Thu Aug 25 00:55:20 2005 +0000
    20.3 @@ -22,7 +22,7 @@
    20.4   * THE SOFTWARE.
    20.5   */
    20.6  #include "vl.h"
    20.7 -#include "xc.h"
    20.8 +#include "xenctrl.h"
    20.9  #include <io/ioreq.h>
   20.10  
   20.11  //#define DEBUG_PIT
    21.1 --- a/tools/ioemu/hw/i8259.c	Wed Aug 24 22:24:10 2005 +0000
    21.2 +++ b/tools/ioemu/hw/i8259.c	Thu Aug 25 00:55:20 2005 +0000
    21.3 @@ -22,7 +22,7 @@
    21.4   * THE SOFTWARE.
    21.5   */
    21.6  #include "vl.h"
    21.7 -#include "xc.h"
    21.8 +#include "xenctrl.h"
    21.9  #include <io/ioreq.h>
   21.10  
   21.11  /* debug PIC */
    22.1 --- a/tools/ioemu/hw/ioapic.h	Wed Aug 24 22:24:10 2005 +0000
    22.2 +++ b/tools/ioemu/hw/ioapic.h	Thu Aug 25 00:55:20 2005 +0000
    22.3 @@ -26,7 +26,7 @@
    22.4  #ifndef __IOAPIC_H
    22.5  #define __IOAPIC_H
    22.6  
    22.7 -#include "xc.h"
    22.8 +#include "xenctrl.h"
    22.9  #include <io/ioreq.h>
   22.10  #include <io/vmx_vlapic.h>
   22.11  
    23.1 --- a/tools/ioemu/target-i386-dm/Makefile	Wed Aug 24 22:24:10 2005 +0000
    23.2 +++ b/tools/ioemu/target-i386-dm/Makefile	Thu Aug 25 00:55:20 2005 +0000
    23.3 @@ -188,7 +188,7 @@ endif
    23.4  #########################################################
    23.5  
    23.6  DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DAPIC_SUPPORT
    23.7 -LIBS+=-lm -L../../libxc -lxc
    23.8 +LIBS+=-lm -L../../libxc -lxenctrl
    23.9  ifndef CONFIG_USER_ONLY
   23.10  LIBS+=-lz
   23.11  endif
    24.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Wed Aug 24 22:24:10 2005 +0000
    24.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Thu Aug 25 00:55:20 2005 +0000
    24.3 @@ -47,7 +47,7 @@
    24.4  #include <fcntl.h>
    24.5  #include <sys/ioctl.h>
    24.6  
    24.7 -#include "xc.h"
    24.8 +#include "xenctrl.h"
    24.9  #include <io/ioreq.h>
   24.10  
   24.11  #include "cpu.h"
    25.1 --- a/tools/ioemu/vl.c	Wed Aug 24 22:24:10 2005 +0000
    25.2 +++ b/tools/ioemu/vl.c	Thu Aug 25 00:55:20 2005 +0000
    25.3 @@ -72,7 +72,7 @@
    25.4  #endif
    25.5  #endif /* CONFIG_SDL */
    25.6  
    25.7 -#include "xc.h"
    25.8 +#include "xenctrl.h"
    25.9  #include "exec-all.h"
   25.10  
   25.11  //#define DO_TB_FLUSH
    26.1 --- a/tools/libxc/Makefile	Wed Aug 24 22:24:10 2005 +0000
    26.2 +++ b/tools/libxc/Makefile	Thu Aug 25 00:55:20 2005 +0000
    26.3 @@ -12,28 +12,32 @@ CC       = gcc
    26.4  XEN_ROOT = ../..
    26.5  include $(XEN_ROOT)/tools/Rules.mk
    26.6  
    26.7 -SRCS     :=
    26.8 -SRCS     += xc_sedf.c
    26.9 -SRCS     += xc_bvtsched.c
   26.10 -SRCS     += xc_core.c
   26.11 -SRCS     += xc_domain.c
   26.12 -SRCS     += xc_evtchn.c
   26.13 -SRCS     += xc_gnttab.c
   26.14 -SRCS     += xc_load_bin.c
   26.15 -SRCS     += xc_load_elf.c
   26.16 -SRCS     += xc_linux_build.c
   26.17 -SRCS     += xc_misc.c
   26.18 -SRCS     += xc_physdev.c
   26.19 -SRCS     += xc_private.c
   26.20 +SRCS       :=
   26.21 +BUILD_SRCS :=
   26.22 +SRCS       += xc_bvtsched.c
   26.23 +SRCS       += xc_core.c
   26.24 +SRCS       += xc_domain.c
   26.25 +SRCS       += xc_evtchn.c
   26.26 +SRCS       += xc_gnttab.c
   26.27 +SRCS       += xc_misc.c
   26.28 +SRCS       += xc_physdev.c
   26.29 +SRCS       += xc_private.c
   26.30 +SRCS       += xc_sedf.c
   26.31 +
   26.32  ifeq ($(XEN_TARGET_ARCH),ia64)
   26.33 -SRCS     += xc_ia64_stubs.c
   26.34 +BUILD_SRCS += xc_ia64_stubs.c
   26.35  else
   26.36 -SRCS     += xc_load_aout9.c
   26.37 -SRCS     += xc_linux_restore.c
   26.38 -SRCS     += xc_linux_save.c
   26.39 -SRCS     += xc_vmx_build.c
   26.40 -SRCS     += xc_ptrace.c
   26.41 -SRCS     += xc_ptrace_core.c
   26.42 +SRCS       += xc_ptrace.c
   26.43 +SRCS       += xc_ptrace_core.c
   26.44 +
   26.45 +BUILD_SRCS := xc_load_aout9.c
   26.46 +BUILD_SRCS += xc_load_bin.c
   26.47 +BUILD_SRCS += xc_load_elf.c
   26.48 +BUILD_SRCS += xc_linux_build.c
   26.49 +BUILD_SRCS += xc_linux_restore.c
   26.50 +BUILD_SRCS += xc_linux_save.c
   26.51 +BUILD_SRCS += xc_vmx_build.c
   26.52 +BUILD_SRCS += xg_private.c
   26.53  endif
   26.54  
   26.55  CFLAGS   += -Wall
   26.56 @@ -43,13 +47,20 @@ CFLAGS   += -fno-strict-aliasing
   26.57  CFLAGS   += $(INCLUDES) -I.
   26.58  # Get gcc to generate the dependencies for us.
   26.59  CFLAGS   += -Wp,-MD,.$(@F).d
   26.60 +LDFLAGS  += -L.
   26.61  DEPS     = .*.d
   26.62  
   26.63  LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
   26.64  PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
   26.65  
   26.66 -LIB      := libxc.a libxc-pic.a
   26.67 -LIB      += libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
   26.68 +LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS))
   26.69 +PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS))
   26.70 +
   26.71 +LIB := libxenctrl.a
   26.72 +LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
   26.73 +
   26.74 +LIB += libxenguest.a
   26.75 +LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
   26.76  
   26.77  all: build
   26.78  build: check-for-zlib mk-symlinks
   26.79 @@ -77,11 +88,16 @@ mk-symlinks:
   26.80  install: build
   26.81  	[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
   26.82  	[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
   26.83 -	$(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   26.84 -	$(INSTALL_DATA) libxc.a $(DESTDIR)/usr/$(LIBDIR)
   26.85 -	ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so.$(MAJOR)
   26.86 -	ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so
   26.87 -	$(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
   26.88 +	$(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   26.89 +	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
   26.90 +	ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
   26.91 +	ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
   26.92 +	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen
   26.93 +
   26.94 +	$(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   26.95 +	$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
   26.96 +	ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
   26.97 +	ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
   26.98  
   26.99  .PHONY: TAGS clean rpm install all
  26.100  
  26.101 @@ -100,18 +116,30 @@ rpm: build
  26.102  	mv staging/i386/*.rpm .
  26.103  	rm -rf staging
  26.104  
  26.105 -libxc.a: $(LIB_OBJS)
  26.106 -	$(AR) rc $@ $^
  26.107 +# libxenctrl
  26.108  
  26.109 -libxc-pic.a: $(PIC_OBJS)
  26.110 +libxenctrl.a: $(LIB_OBJS)
  26.111  	$(AR) rc $@ $^
  26.112  
  26.113 -libxc.so: libxc.so.$(MAJOR)
  26.114 +libxenctrl.so: libxenctrl.so.$(MAJOR)
  26.115  	ln -sf $< $@
  26.116 -libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
  26.117 +libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
  26.118  	ln -sf $< $@
  26.119  
  26.120 -libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
  26.121 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -lz
  26.122 +libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
  26.123 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
  26.124 +
  26.125 +# libxenguest
  26.126 +
  26.127 +libxenguest.a: $(LIB_BUILD_OBJS)
  26.128 +	$(AR) rc $@ $^
  26.129 +
  26.130 +libxenguest.so: libxenguest.so.$(MAJOR)
  26.131 +	ln -sf $< $@
  26.132 +libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
  26.133 +	ln -sf $< $@
  26.134 +
  26.135 +libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS)
  26.136 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl
  26.137  
  26.138  -include $(DEPS)
    27.1 --- a/tools/libxc/xc.h	Wed Aug 24 22:24:10 2005 +0000
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,558 +0,0 @@
    27.4 -/******************************************************************************
    27.5 - * xc.h
    27.6 - * 
    27.7 - * A library for low-level access to the Xen control interfaces.
    27.8 - * 
    27.9 - * Copyright (c) 2003-2004, K A Fraser.
   27.10 - */
   27.11 -
   27.12 -#ifndef __XC_H__
   27.13 -#define __XC_H__
   27.14 -
   27.15 -#include <stdint.h>
   27.16 -
   27.17 -typedef uint8_t            u8;
   27.18 -typedef uint16_t           u16;
   27.19 -typedef uint32_t           u32;
   27.20 -typedef uint64_t           u64;
   27.21 -typedef int8_t             s8;
   27.22 -typedef int16_t            s16;
   27.23 -typedef int32_t            s32;
   27.24 -typedef int64_t            s64;
   27.25 -
   27.26 -#include <sys/ptrace.h>
   27.27 -#include <xen/xen.h>
   27.28 -#include <xen/dom0_ops.h>
   27.29 -#include <xen/event_channel.h>
   27.30 -#include <xen/sched_ctl.h>
   27.31 -#include <xen/acm.h>
   27.32 -
   27.33 -#ifdef __ia64__
   27.34 -#define XC_PAGE_SHIFT           14
   27.35 -#else
   27.36 -#define XC_PAGE_SHIFT           12
   27.37 -#endif
   27.38 -#define XC_PAGE_SIZE            (1UL << XC_PAGE_SHIFT)
   27.39 -#define XC_PAGE_MASK            (~(XC_PAGE_SIZE-1))
   27.40 -
   27.41 -/*
   27.42 - *  DEFINITIONS FOR CPU BARRIERS
   27.43 - */ 
   27.44 -
   27.45 -#if defined(__i386__)
   27.46 -#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   27.47 -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   27.48 -#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   27.49 -#elif defined(__x86_64__)
   27.50 -#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
   27.51 -#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
   27.52 -#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   27.53 -#elif defined(__ia64__)
   27.54 -/* FIXME */
   27.55 -#define mb()
   27.56 -#define rmb()
   27.57 -#define wmb()
   27.58 -#else
   27.59 -#error "Define barriers"
   27.60 -#endif
   27.61 -
   27.62 -/*
   27.63 - *  INITIALIZATION FUNCTIONS
   27.64 - */ 
   27.65 -
   27.66 -/**
   27.67 - * This function opens a handle to the hypervisor interface.  This function can
   27.68 - * be called multiple times within a single process.  Multiple processes can
   27.69 - * have an open hypervisor interface at the same time.
   27.70 - *
   27.71 - * Each call to this function should have a corresponding call to
   27.72 - * xc_interface_close().
   27.73 - *
   27.74 - * This function can fail if the caller does not have superuser permission or
   27.75 - * if a Xen-enabled kernel is not currently running.
   27.76 - *
   27.77 - * @return a handle to the hypervisor interface or -1 on failure
   27.78 - */
   27.79 -int xc_interface_open(void);
   27.80 -
   27.81 -/**
   27.82 - * This function closes an open hypervisor interface.
   27.83 - *
   27.84 - * This function can fail if the handle does not represent an open interface or
   27.85 - * if there were problems closing the interface.
   27.86 - *
   27.87 - * @parm xc_handle a handle to an open hypervisor interface
   27.88 - * @return 0 on success, -1 otherwise.
   27.89 - */
   27.90 -int xc_interface_close(int xc_handle);
   27.91 -
   27.92 -/*
   27.93 - * DOMAIN DEBUGGING FUNCTIONS
   27.94 - */
   27.95 -
   27.96 -typedef struct xc_core_header {
   27.97 -    unsigned int xch_magic;
   27.98 -    unsigned int xch_nr_vcpus;
   27.99 -    unsigned int xch_nr_pages;
  27.100 -    unsigned int xch_ctxt_offset;
  27.101 -    unsigned int xch_index_offset;
  27.102 -    unsigned int xch_pages_offset;
  27.103 -} xc_core_header_t;
  27.104 -
  27.105 -
  27.106 -long xc_ptrace(enum __ptrace_request request, 
  27.107 -               u32  domid,
  27.108 -               long addr, 
  27.109 -               long data);
  27.110 -
  27.111 -long xc_ptrace_core(enum __ptrace_request request, 
  27.112 -                    u32 domid, 
  27.113 -                    long addr, 
  27.114 -                    long data);
  27.115 -
  27.116 -int xc_waitdomain(int domain, 
  27.117 -                  int *status, 
  27.118 -                  int options);
  27.119 -
  27.120 -int xc_waitdomain_core(int domain, 
  27.121 -                       int *status, 
  27.122 -                       int options);
  27.123 -
  27.124 -/*
  27.125 - * DOMAIN MANAGEMENT FUNCTIONS
  27.126 - */
  27.127 -
  27.128 -typedef struct {
  27.129 -    u32           domid;
  27.130 -    u32           ssidref;
  27.131 -    unsigned int  dying:1, crashed:1, shutdown:1, 
  27.132 -                  paused:1, blocked:1, running:1;
  27.133 -    unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
  27.134 -    unsigned long nr_pages;
  27.135 -    unsigned long shared_info_frame;
  27.136 -    u64           cpu_time;
  27.137 -    unsigned long max_memkb;
  27.138 -    unsigned int  vcpus;
  27.139 -    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
  27.140 -    cpumap_t      cpumap[MAX_VIRT_CPUS];
  27.141 -} xc_dominfo_t;
  27.142 -
  27.143 -typedef dom0_getdomaininfo_t xc_domaininfo_t;
  27.144 -int xc_domain_create(int xc_handle, 
  27.145 -                     u32 ssidref,
  27.146 -                     u32 *pdomid);
  27.147 -
  27.148 -
  27.149 -int xc_domain_dumpcore(int xc_handle, 
  27.150 -                       u32 domid,
  27.151 -                       const char *corename);
  27.152 -
  27.153 -
  27.154 -/**
  27.155 - * This function pauses a domain. A paused domain still exists in memory
  27.156 - * however it does not receive any timeslices from the hypervisor.
  27.157 - *
  27.158 - * @parm xc_handle a handle to an open hypervisor interface
  27.159 - * @parm domid the domain id to pause
  27.160 - * @return 0 on success, -1 on failure.
  27.161 - */
  27.162 -int xc_domain_pause(int xc_handle, 
  27.163 -                    u32 domid);
  27.164 -/**
  27.165 - * This function unpauses a domain.  The domain should have been previously
  27.166 - * paused.
  27.167 - *
  27.168 - * @parm xc_handle a handle to an open hypervisor interface
  27.169 - * @parm domid the domain id to unpause
  27.170 - * return 0 on success, -1 on failure
  27.171 - */
  27.172 -int xc_domain_unpause(int xc_handle, 
  27.173 -                      u32 domid);
  27.174 -
  27.175 -/**
  27.176 - * This function will destroy a domain.  Destroying a domain removes the domain
  27.177 - * completely from memory.  This function should be called after sending the
  27.178 - * domain a SHUTDOWN control message to free up the domain resources.
  27.179 - *
  27.180 - * @parm xc_handle a handle to an open hypervisor interface
  27.181 - * @parm domid the domain id to destroy
  27.182 - * @return 0 on success, -1 on failure
  27.183 - */
  27.184 -int xc_domain_destroy(int xc_handle, 
  27.185 -                      u32 domid);
  27.186 -int xc_domain_pincpu(int xc_handle,
  27.187 -                     u32 domid,
  27.188 -                     int vcpu,
  27.189 -                     cpumap_t *cpumap);
  27.190 -/**
  27.191 - * This function will return information about one or more domains. It is
  27.192 - * designed to iterate over the list of domains. If a single domain is
  27.193 - * requested, this function will return the next domain in the list - if
  27.194 - * one exists. It is, therefore, important in this case to make sure the
  27.195 - * domain requested was the one returned.
  27.196 - *
  27.197 - * @parm xc_handle a handle to an open hypervisor interface
  27.198 - * @parm first_domid the first domain to enumerate information from.  Domains
  27.199 - *                   are currently enumerate in order of creation.
  27.200 - * @parm max_doms the number of elements in info
  27.201 - * @parm info an array of max_doms size that will contain the information for
  27.202 - *            the enumerated domains.
  27.203 - * @return the number of domains enumerated or -1 on error
  27.204 - */
  27.205 -int xc_domain_getinfo(int xc_handle,
  27.206 -                      u32 first_domid, 
  27.207 -                      unsigned int max_doms,
  27.208 -                      xc_dominfo_t *info);
  27.209 -
  27.210 -/**
  27.211 - * This function will return information about one or more domains, using a
  27.212 - * single hypercall.  The domain information will be stored into the supplied
  27.213 - * array of xc_domaininfo_t structures.
  27.214 - *
  27.215 - * @parm xc_handle a handle to an open hypervisor interface
  27.216 - * @parm first_domain the first domain to enumerate information from.
  27.217 - *                    Domains are currently enumerate in order of creation.
  27.218 - * @parm max_domains the number of elements in info
  27.219 - * @parm info an array of max_doms size that will contain the information for
  27.220 - *            the enumerated domains.
  27.221 - * @return the number of domains enumerated or -1 on error
  27.222 - */
  27.223 -int xc_domain_getinfolist(int xc_handle,
  27.224 -                          u32 first_domain,
  27.225 -                          unsigned int max_domains,
  27.226 -                          xc_domaininfo_t *info);
  27.227 -
  27.228 -/**
  27.229 - * This function returns information about one domain.  This information is
  27.230 - * more detailed than the information from xc_domain_getinfo().
  27.231 - *
  27.232 - * @parm xc_handle a handle to an open hypervisor interface
  27.233 - * @parm domid the domain to get information from
  27.234 - * @parm info a pointer to an xc_domaininfo_t to store the domain information
  27.235 - * @parm ctxt a pointer to a structure to store the execution context of the
  27.236 - *            domain
  27.237 - * @return 0 on success, -1 on failure
  27.238 - */
  27.239 -int xc_domain_get_vcpu_context(int xc_handle,
  27.240 -                               u32 domid,
  27.241 -                               u32 vcpu,
  27.242 -                               vcpu_guest_context_t *ctxt);
  27.243 -
  27.244 -int xc_domain_setcpuweight(int xc_handle,
  27.245 -                           u32 domid,
  27.246 -                           float weight);
  27.247 -long long xc_domain_get_cpu_usage(int xc_handle,
  27.248 -                                  domid_t domid,
  27.249 -                                  int vcpu);
  27.250 -
  27.251 -
  27.252 -typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
  27.253 -int xc_shadow_control(int xc_handle,
  27.254 -                      u32 domid, 
  27.255 -                      unsigned int sop,
  27.256 -                      unsigned long *dirty_bitmap,
  27.257 -                      unsigned long pages,
  27.258 -                      xc_shadow_control_stats_t *stats);
  27.259 -
  27.260 -
  27.261 -#define XCFLAGS_VERBOSE   1
  27.262 -#define XCFLAGS_LIVE      2
  27.263 -#define XCFLAGS_DEBUG     4
  27.264 -#define XCFLAGS_CONFIGURE 8
  27.265 -
  27.266 -struct XcIOContext;
  27.267 -
  27.268 -/**
  27.269 - * This function will save a domain running Linux.
  27.270 - *
  27.271 - * @parm xc_handle a handle to an open hypervisor interface
  27.272 - * @parm fd the file descriptor to save a domain to
  27.273 - * @parm dom the id of the domain
  27.274 - * @return 0 on success, -1 on failure
  27.275 - */
  27.276 -int xc_linux_save(int xc_handle, int fd, u32 dom);
  27.277 -
  27.278 -/**
  27.279 - * This function will restore a saved domain running Linux.
  27.280 - *
  27.281 - * @parm xc_handle a handle to an open hypervisor interface
  27.282 - * @parm fd the file descriptor to restore a domain from
  27.283 - * @parm dom the id of the domain
  27.284 - * @parm nr_pfns the number of pages
  27.285 - * @parm store_evtchn the store event channel for this domain to use
  27.286 - * @parm store_mfn returned with the mfn of the store page
  27.287 - * @return 0 on success, -1 on failure
  27.288 - */
  27.289 -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
  27.290 -		     unsigned int store_evtchn, unsigned long *store_mfn);
  27.291 -
  27.292 -int xc_linux_build(int xc_handle,
  27.293 -                   u32 domid,
  27.294 -                   const char *image_name,
  27.295 -                   const char *ramdisk_name,
  27.296 -                   const char *cmdline,
  27.297 -                   unsigned int control_evtchn,
  27.298 -                   unsigned long flags,
  27.299 -                   unsigned int vcpus,
  27.300 -                   unsigned int store_evtchn,
  27.301 -                   unsigned long *store_mfn);
  27.302 -
  27.303 -struct mem_map;
  27.304 -int xc_vmx_build(int xc_handle,
  27.305 -                 u32 domid,
  27.306 -                 int memsize,
  27.307 -                 const char *image_name,
  27.308 -                 struct mem_map *memmap,
  27.309 -                 const char *ramdisk_name,
  27.310 -                 const char *cmdline,
  27.311 -                 unsigned int control_evtchn,
  27.312 -                 unsigned long flags,
  27.313 -                 unsigned int vcpus,
  27.314 -                 unsigned int store_evtchn,
  27.315 -                 unsigned long *store_mfn);
  27.316 -
  27.317 -int xc_bvtsched_global_set(int xc_handle,
  27.318 -                           unsigned long ctx_allow);
  27.319 -
  27.320 -int xc_bvtsched_domain_set(int xc_handle,
  27.321 -                           u32 domid,
  27.322 -                           u32 mcuadv,
  27.323 -                           int warpback,
  27.324 -                           s32 warpvalue,
  27.325 -                           long long warpl,
  27.326 -                           long long warpu);
  27.327 -
  27.328 -int xc_bvtsched_global_get(int xc_handle,
  27.329 -                           unsigned long *ctx_allow);
  27.330 -
  27.331 -int xc_bvtsched_domain_get(int xc_handle,
  27.332 -                           u32 domid,
  27.333 -                           u32 *mcuadv,
  27.334 -                           int *warpback,
  27.335 -                           s32 *warpvalue,
  27.336 -                           long long *warpl,
  27.337 -                           long long *warpu);
  27.338 -
  27.339 -int xc_sedf_domain_set(int xc_handle,
  27.340 -                          u32 domid,
  27.341 -                          u64 period, u64 slice, u64 latency, u16 extratime, u16 weight);
  27.342 -
  27.343 -int xc_sedf_domain_get(int xc_handle,
  27.344 -                          u32 domid,
  27.345 -                          u64* period, u64 *slice, u64 *latency, u16 *extratime, u16* weight);
  27.346 -
  27.347 -typedef evtchn_status_t xc_evtchn_status_t;
  27.348 -
  27.349 -/*
  27.350 - * EVENT CHANNEL FUNCTIONS
  27.351 - */
  27.352 -
  27.353 -/**
  27.354 - * This function allocates an unbound port.  Ports are named endpoints used for
  27.355 - * interdomain communication.  This function is most useful in opening a
  27.356 - * well-known port within a domain to receive events on.
  27.357 - *
  27.358 - * @parm xc_handle a handle to an open hypervisor interface
  27.359 - * @parm dom the ID of the domain.  This maybe DOMID_SELF
  27.360 - * @parm port a pointer to a port.  This is an in/out parameter.  If *port is
  27.361 - *            0, then a new port will be assigned, if port is > 0 then that
  27.362 - *            port is allocated if the port is unallocated.
  27.363 - * @return 0 on success, -1 on failure
  27.364 - */
  27.365 -int xc_evtchn_alloc_unbound(int xc_handle,
  27.366 -                            u32 dom,
  27.367 -                            int *port);
  27.368 -
  27.369 -/**
  27.370 - * This function creates a pair of ports between two domains.  A port can only
  27.371 - * be bound once within a domain.
  27.372 - *
  27.373 - * @parm xc_handle a handle to an open hypervisor interface
  27.374 - * @parm dom1 one of the two domains to connect.  Can be DOMID_SELF.
  27.375 - * @parm dom2 the other domain to connect.  Can be DOMID_SELF.
  27.376 - * @parm port1 an in/out parameter.  If > 0, then try to connect *port.  If
  27.377 - *             0, then allocate a new port and store the port in *port.
  27.378 - * @parm port2 the port connected on port2.  This parameter behaves the same
  27.379 - *             way as port1.
  27.380 - * @return 0 on success, -1 on error.
  27.381 - */
  27.382 -int xc_evtchn_bind_interdomain(int xc_handle,
  27.383 -                               u32 dom1,
  27.384 -                               u32 dom2,
  27.385 -                               int *port1,
  27.386 -                               int *port2);
  27.387 -int xc_evtchn_bind_virq(int xc_handle,
  27.388 -                        int virq,
  27.389 -                        int *port);
  27.390 -
  27.391 -/**
  27.392 - * This function will close a single port on an event channel.
  27.393 - *
  27.394 - * @parm xc_handle a handle to an open hypervisor interface
  27.395 - * @parm dom the domain that the port exists on.  May be DOMID_SELF.
  27.396 - * @parm port the port to close
  27.397 - * @return 0 on success, -1 on error
  27.398 - */
  27.399 -int xc_evtchn_close(int xc_handle,
  27.400 -                    u32 dom,   /* may be DOMID_SELF */
  27.401 -                    int port);
  27.402 -
  27.403 -/**
  27.404 - * This function generates a notify event on a bound port.
  27.405 - *
  27.406 - * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
  27.407 - * a 16 bit value.  The result will be the port the event occurred on.  When
  27.408 - * events occur, the port is masked until the 16 bit port value is written back
  27.409 - * to the file.  When /dev/xen/evtchn is opened, it has to be bound via an
  27.410 - * ioctl to each port to listen on.  The ioctl for binding is _IO('E', 2).  The
  27.411 - * parameter is the port to listen on.
  27.412 - *
  27.413 - * @parm xc_handle a handle to an open hypervisor interface
  27.414 - * @parm local_port the port to generate the notify on
  27.415 - * @return 0 on success, -1 on error
  27.416 - */
  27.417 -int xc_evtchn_send(int xc_handle,
  27.418 -                   int local_port);
  27.419 -int xc_evtchn_status(int xc_handle,
  27.420 -                     u32 dom, /* may be DOMID_SELF */
  27.421 -                     int port,
  27.422 -                     xc_evtchn_status_t *status);
  27.423 -
  27.424 -int xc_physdev_pci_access_modify(int xc_handle,
  27.425 -                                 u32 domid,
  27.426 -                                 int bus,
  27.427 -                                 int dev,
  27.428 -                                 int func,
  27.429 -                                 int enable);
  27.430 -
  27.431 -int xc_readconsolering(int xc_handle,
  27.432 -                       char **pbuffer,
  27.433 -                       unsigned int *pnr_chars, 
  27.434 -                       int clear);
  27.435 -
  27.436 -typedef dom0_physinfo_t xc_physinfo_t;
  27.437 -int xc_physinfo(int xc_handle,
  27.438 -                xc_physinfo_t *info);
  27.439 -
  27.440 -int xc_sched_id(int xc_handle,
  27.441 -                int *sched_id);
  27.442 -
  27.443 -int xc_domain_setmaxmem(int xc_handle,
  27.444 -                        u32 domid, 
  27.445 -                        unsigned int max_memkb);
  27.446 -
  27.447 -int xc_domain_memory_increase_reservation(int xc_handle,
  27.448 -                                          u32 domid, 
  27.449 -                                          unsigned int mem_kb);
  27.450 -
  27.451 -typedef dom0_perfc_desc_t xc_perfc_desc_t;
  27.452 -/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
  27.453 -int xc_perfc_control(int xc_handle,
  27.454 -                     u32 op,
  27.455 -                     xc_perfc_desc_t *desc);
  27.456 -
  27.457 -/* read/write msr */
  27.458 -long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
  27.459 -int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  27.460 -                  unsigned int high);
  27.461 -
  27.462 -/**
  27.463 - * Memory maps a range within one domain to a local address range.  Mappings
  27.464 - * should be unmapped with munmap and should follow the same rules as mmap
  27.465 - * regarding page alignment.  Returns NULL on failure.
  27.466 - *
  27.467 - * In Linux, the ring queue for the control channel is accessible by mapping
  27.468 - * the shared_info_frame (from xc_domain_getinfo()) + 2048.  The structure
  27.469 - * stored there is of type control_if_t.
  27.470 - *
  27.471 - * @parm xc_handle a handle on an open hypervisor interface
  27.472 - * @parm dom the domain to map memory from
  27.473 - * @parm size the amount of memory to map (in multiples of page size)
  27.474 - * @parm prot same flag as in mmap().
  27.475 - * @parm mfn the frame address to map.
  27.476 - */
  27.477 -void *xc_map_foreign_range(int xc_handle, u32 dom,
  27.478 -                            int size, int prot,
  27.479 -                            unsigned long mfn );
  27.480 -
  27.481 -void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
  27.482 -                           unsigned long *arr, int num );
  27.483 -
  27.484 -int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  27.485 -                    unsigned long max_pfns);
  27.486 -
  27.487 -int xc_ia64_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  27.488 -                    unsigned int start_page, unsigned int nr_pages);
  27.489 -
  27.490 -/*\
  27.491 - *  GRANT TABLE FUNCTIONS
  27.492 -\*/ 
  27.493 -
  27.494 -/**
  27.495 - * This function opens a handle to the more restricted grant table hypervisor
  27.496 - * interface. This may be used where the standard interface is not
  27.497 - * available because the domain is not privileged.
  27.498 - * This function can  be called multiple times within a single process.
  27.499 - * Multiple processes can have an open hypervisor interface at the same time.
  27.500 - *
  27.501 - * Each call to this function should have a corresponding call to
  27.502 - * xc_grant_interface_close().
  27.503 - *
  27.504 - * This function can fail if a Xen-enabled kernel is not currently running.
  27.505 - *
  27.506 - * @return a handle to the hypervisor grant table interface or -1 on failure
  27.507 - */
  27.508 -int xc_grant_interface_open(void);
  27.509 -
  27.510 -/**
  27.511 - * This function closes an open grant table hypervisor interface.
  27.512 - *
  27.513 - * This function can fail if the handle does not represent an open interface or
  27.514 - * if there were problems closing the interface.
  27.515 - *
  27.516 - * @parm xc_handle a handle to an open grant table hypervisor interface
  27.517 - * @return 0 on success, -1 otherwise.
  27.518 - */
  27.519 -int xc_grant_interface_close(int xc_handle);
  27.520 -
  27.521 -int xc_gnttab_map_grant_ref(int  xc_handle,
  27.522 -                            u64  host_virt_addr,
  27.523 -                            u32  dom,
  27.524 -                            u16  ref,
  27.525 -                            u16  flags,
  27.526 -                            s16 *handle,
  27.527 -                            u64 *dev_bus_addr);
  27.528 -
  27.529 -int xc_gnttab_unmap_grant_ref(int  xc_handle,
  27.530 -                              u64  host_virt_addr,
  27.531 -                              u64  dev_bus_addr,
  27.532 -                              u16  handle,
  27.533 -                              s16 *status);
  27.534 -
  27.535 -int xc_gnttab_setup_table(int        xc_handle,
  27.536 -                          u32        dom,
  27.537 -                          u16        nr_frames,
  27.538 -                          s16       *status,
  27.539 -                          unsigned long **frame_list);
  27.540 -
  27.541 -/* Grant debug builds only: */
  27.542 -int xc_gnttab_dump_table(int        xc_handle,
  27.543 -                         u32        dom,
  27.544 -                         s16       *status);
  27.545 -
  27.546 -/* Get current total pages allocated to a domain. */
  27.547 -long xc_get_tot_pages(int xc_handle, u32 domid);
  27.548 -
  27.549 -/* Execute a privileged dom0 operation. */
  27.550 -int xc_dom0_op(int xc_handle, dom0_op_t *op);
  27.551 -
  27.552 -/* Initializes the store (for dom0)
  27.553 -   remote_port should be the remote end of a bound interdomain channel between
  27.554 -   the store and dom0.
  27.555 -
  27.556 -   This function returns a shared frame that should be passed to
  27.557 -   xs_introduce_domain
  27.558 - */
  27.559 -long xc_init_store(int xc_handle, int remote_port);
  27.560 -
  27.561 -#endif /* __XC_H__ */
    28.1 --- a/tools/libxc/xc_core.c	Wed Aug 24 22:24:10 2005 +0000
    28.2 +++ b/tools/libxc/xc_core.c	Thu Aug 25 00:55:20 2005 +0000
    28.3 @@ -1,4 +1,4 @@
    28.4 -#include "xc_private.h"
    28.5 +#include "xg_private.h"
    28.6  #define ELFSIZE 32
    28.7  #include "xc_elf.h"
    28.8  #include <stdlib.h>
    29.1 --- a/tools/libxc/xc_domain.c	Wed Aug 24 22:24:10 2005 +0000
    29.2 +++ b/tools/libxc/xc_domain.c	Thu Aug 25 00:55:20 2005 +0000
    29.3 @@ -266,7 +266,7 @@ int xc_domain_memory_increase_reservatio
    29.4      int err;
    29.5      unsigned int npages = mem_kb / (PAGE_SIZE/1024);
    29.6  
    29.7 -    err = do_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
    29.8 +    err = xc_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
    29.9                          npages, 0, domid);
   29.10      if (err == npages)
   29.11          return 0;
    30.1 --- a/tools/libxc/xc_linux_build.c	Wed Aug 24 22:24:10 2005 +0000
    30.2 +++ b/tools/libxc/xc_linux_build.c	Thu Aug 25 00:55:20 2005 +0000
    30.3 @@ -2,7 +2,8 @@
    30.4   * xc_linux_build.c
    30.5   */
    30.6  
    30.7 -#include "xc_private.h"
    30.8 +#include "xg_private.h"
    30.9 +#include <xenctrl.h>
   30.10  
   30.11  #if defined(__i386__)
   30.12  #define ELFSIZE 32
   30.13 @@ -340,7 +341,7 @@ static int setup_guest(int xc_handle,
   30.14      unsigned long count, i;
   30.15      start_info_t *start_info;
   30.16      shared_info_t *shared_info;
   30.17 -    mmu_t *mmu = NULL;
   30.18 +    xc_mmu_t *mmu = NULL;
   30.19      int rc;
   30.20  
   30.21      unsigned long nr_pt_pages;
   30.22 @@ -490,7 +491,7 @@ static int setup_guest(int xc_handle,
   30.23          }
   30.24      }
   30.25  
   30.26 -    if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
   30.27 +    if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
   30.28          goto error_out;
   30.29  
   30.30      /* setup page tables */
   30.31 @@ -520,9 +521,9 @@ static int setup_guest(int xc_handle,
   30.32          page_array[physmap_pfn++]);
   30.33      for ( count = 0; count < nr_pages; count++ )
   30.34      {
   30.35 -        if ( add_mmu_update(xc_handle, mmu,
   30.36 -                            (page_array[count] << PAGE_SHIFT) | 
   30.37 -                            MMU_MACHPHYS_UPDATE, count) )
   30.38 +        if ( xc_add_mmu_update(xc_handle, mmu,
   30.39 +			       (page_array[count] << PAGE_SHIFT) | 
   30.40 +			       MMU_MACHPHYS_UPDATE, count) )
   30.41          {
   30.42              munmap(physmap, PAGE_SIZE);
   30.43              goto error_out;
   30.44 @@ -602,7 +603,7 @@ static int setup_guest(int xc_handle,
   30.45      munmap(shared_info, PAGE_SIZE);
   30.46  
   30.47      /* Send the page update requests down to the hypervisor. */
   30.48 -    if ( finish_mmu_updates(xc_handle, mmu) )
   30.49 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   30.50          goto error_out;
   30.51  
   30.52      free(mmu);
   30.53 @@ -676,7 +677,7 @@ int xc_linux_build(int xc_handle,
   30.54  
   30.55      op.cmd = DOM0_GETDOMAININFO;
   30.56      op.u.getdomaininfo.domain = (domid_t)domid;
   30.57 -    if ( (do_dom0_op(xc_handle, &op) < 0) || 
   30.58 +    if ( (xc_dom0_op(xc_handle, &op) < 0) || 
   30.59           ((u16)op.u.getdomaininfo.domain != domid) )
   30.60      {
   30.61          PERROR("Could not get info on domain");
   30.62 @@ -793,7 +794,7 @@ int xc_linux_build(int xc_handle,
   30.63      launch_op.u.setdomaininfo.ctxt   = ctxt;
   30.64  
   30.65      launch_op.cmd = DOM0_SETDOMAININFO;
   30.66 -    rc = do_dom0_op(xc_handle, &launch_op);
   30.67 +    rc = xc_dom0_op(xc_handle, &launch_op);
   30.68      
   30.69      return rc;
   30.70  
    31.1 --- a/tools/libxc/xc_linux_restore.c	Wed Aug 24 22:24:10 2005 +0000
    31.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Aug 25 00:55:20 2005 +0000
    31.3 @@ -6,7 +6,12 @@
    31.4   * Copyright (c) 2003, K A Fraser.
    31.5   */
    31.6  
    31.7 -#include "xc_private.h"
    31.8 +#include <stdlib.h>
    31.9 +#include <unistd.h>
   31.10 +
   31.11 +#include "xg_private.h"
   31.12 +#include <xenctrl.h>
   31.13 +
   31.14  #include <xen/linux/suspend.h>
   31.15  
   31.16  #define MAX_BATCH_SIZE 1024
   31.17 @@ -89,7 +94,7 @@ int xc_linux_restore(int xc_handle, int 
   31.18  
   31.19      char *region_base;
   31.20  
   31.21 -    mmu_t *mmu = NULL;
   31.22 +    xc_mmu_t *mmu = NULL;
   31.23  
   31.24      /* used by debug verify code */
   31.25      unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
   31.26 @@ -132,7 +137,7 @@ int xc_linux_restore(int xc_handle, int 
   31.27      /* Get the domain's shared-info frame. */
   31.28      op.cmd = DOM0_GETDOMAININFO;
   31.29      op.u.getdomaininfo.domain = (domid_t)dom;
   31.30 -    if (do_dom0_op(xc_handle, &op) < 0) {
   31.31 +    if (xc_dom0_op(xc_handle, &op) < 0) {
   31.32          ERR("Could not get information on new domain");
   31.33          goto out;
   31.34      }
   31.35 @@ -158,7 +163,7 @@ int xc_linux_restore(int xc_handle, int 
   31.36          goto out;
   31.37      }
   31.38  
   31.39 -    mmu = init_mmu_updates(xc_handle, dom);
   31.40 +    mmu = xc_init_mmu_updates(xc_handle, dom);
   31.41      if (mmu == NULL) {
   31.42          ERR("Could not initialise for MMU updates");
   31.43          goto out;
   31.44 @@ -355,8 +360,9 @@ int xc_linux_restore(int xc_handle, int 
   31.45                  }
   31.46              }
   31.47  
   31.48 -            if ( add_mmu_update(xc_handle, mmu,
   31.49 -                                (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
   31.50 +            if ( xc_add_mmu_update(xc_handle, mmu,
   31.51 +				   (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
   31.52 +				   pfn) )
   31.53              {
   31.54                  printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
   31.55                  goto out;
   31.56 @@ -370,7 +376,7 @@ int xc_linux_restore(int xc_handle, int 
   31.57  
   31.58      DPRINTF("Received all pages\n");
   31.59  
   31.60 -    if ( finish_mmu_updates(xc_handle, mmu) )
   31.61 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   31.62          goto out;
   31.63  
   31.64      /*
   31.65 @@ -388,14 +394,14 @@ int xc_linux_restore(int xc_handle, int 
   31.66          pin[nr_pins].mfn = pfn_to_mfn_table[i];
   31.67          if ( ++nr_pins == MAX_PIN_BATCH )
   31.68          {
   31.69 -            if ( do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
   31.70 +            if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
   31.71                  goto out;
   31.72              nr_pins = 0;
   31.73          }
   31.74      }
   31.75  
   31.76      if ( (nr_pins != 0) &&
   31.77 -         (do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
   31.78 +         (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
   31.79          goto out;
   31.80  
   31.81      DPRINTF("\b\b\b\b100%%\n");
   31.82 @@ -435,7 +441,7 @@ int xc_linux_restore(int xc_handle, int 
   31.83  
   31.84  	if ( count > 0 )
   31.85  	{
   31.86 -	    if ( (rc = do_dom_mem_op( xc_handle,
   31.87 +	    if ( (rc = xc_dom_mem_op( xc_handle,
   31.88  				       MEMOP_decrease_reservation,
   31.89  				       pfntab, count, 0, dom )) <0 )
   31.90  	    {
   31.91 @@ -586,7 +592,7 @@ int xc_linux_restore(int xc_handle, int 
   31.92      op.u.setdomaininfo.domain = (domid_t)dom;
   31.93      op.u.setdomaininfo.vcpu   = 0;
   31.94      op.u.setdomaininfo.ctxt   = &ctxt;
   31.95 -    rc = do_dom0_op(xc_handle, &op);
   31.96 +    rc = xc_dom0_op(xc_handle, &op);
   31.97  
   31.98      if ( rc != 0 )
   31.99      {
  31.100 @@ -597,7 +603,7 @@ int xc_linux_restore(int xc_handle, int 
  31.101      DPRINTF("Domain ready to be unpaused\n");
  31.102      op.cmd = DOM0_UNPAUSEDOMAIN;
  31.103      op.u.unpausedomain.domain = (domid_t)dom;
  31.104 -    rc = do_dom0_op(xc_handle, &op);
  31.105 +    rc = xc_dom0_op(xc_handle, &op);
  31.106      if (rc == 0) {
  31.107          /* Success: print the domain id. */
  31.108          DPRINTF("DOM=%u\n", dom);
    32.1 --- a/tools/libxc/xc_linux_save.c	Wed Aug 24 22:24:10 2005 +0000
    32.2 +++ b/tools/libxc/xc_linux_save.c	Thu Aug 25 00:55:20 2005 +0000
    32.3 @@ -7,11 +7,15 @@
    32.4   */
    32.5  
    32.6  #include <inttypes.h>
    32.7 +#include <time.h>
    32.8 +#include <stdlib.h>
    32.9 +#include <unistd.h>
   32.10  #include <sys/time.h>
   32.11 -#include "xc_private.h"
   32.12 +
   32.13 +#include "xg_private.h"
   32.14 +
   32.15  #include <xen/linux/suspend.h>
   32.16  #include <xen/io/domain_controller.h>
   32.17 -#include <time.h>
   32.18  
   32.19  #define BATCH_SIZE 1024   /* 1024 pages (4MB) at a time */
   32.20  
   32.21 @@ -772,7 +776,7 @@ int xc_linux_save(int xc_handle, int io_
   32.22                  goto out;
   32.23              }
   32.24       
   32.25 -            if ( get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
   32.26 +            if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
   32.27                  ERR("get_pfn_type_batch failed");
   32.28                  goto out;
   32.29              }
    33.1 --- a/tools/libxc/xc_load_aout9.c	Wed Aug 24 22:24:10 2005 +0000
    33.2 +++ b/tools/libxc/xc_load_aout9.c	Thu Aug 25 00:55:20 2005 +0000
    33.3 @@ -1,5 +1,5 @@
    33.4  
    33.5 -#include "xc_private.h"
    33.6 +#include "xg_private.h"
    33.7  #include "xc_aout9.h"
    33.8  
    33.9  #if defined(__i386__)
    34.1 --- a/tools/libxc/xc_load_bin.c	Wed Aug 24 22:24:10 2005 +0000
    34.2 +++ b/tools/libxc/xc_load_bin.c	Thu Aug 25 00:55:20 2005 +0000
    34.3 @@ -66,7 +66,7 @@
    34.4   * Free Software Foundation, Inc.
    34.5   */
    34.6  
    34.7 -#include "xc_private.h"
    34.8 +#include "xg_private.h"
    34.9  #include <stdlib.h>
   34.10  
   34.11  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
    35.1 --- a/tools/libxc/xc_load_elf.c	Wed Aug 24 22:24:10 2005 +0000
    35.2 +++ b/tools/libxc/xc_load_elf.c	Thu Aug 25 00:55:20 2005 +0000
    35.3 @@ -2,7 +2,7 @@
    35.4   * xc_elf_load.c
    35.5   */
    35.6  
    35.7 -#include "xc_private.h"
    35.8 +#include "xg_private.h"
    35.9  
   35.10  #if defined(__i386__)
   35.11  #define ELFSIZE 32
    36.1 --- a/tools/libxc/xc_private.c	Wed Aug 24 22:24:10 2005 +0000
    36.2 +++ b/tools/libxc/xc_private.c	Thu Aug 25 00:55:20 2005 +0000
    36.3 @@ -64,8 +64,8 @@ void *xc_map_foreign_range(int xc_handle
    36.4  /*******************/
    36.5  
    36.6  /* NB: arr must be mlock'ed */
    36.7 -int get_pfn_type_batch(int xc_handle, 
    36.8 -                       u32 dom, int num, unsigned long *arr)
    36.9 +int xc_get_pfn_type_batch(int xc_handle, 
   36.10 +			  u32 dom, int num, unsigned long *arr)
   36.11  {
   36.12      dom0_op_t op;
   36.13      op.cmd = DOM0_GETPAGEFRAMEINFO2;
   36.14 @@ -92,25 +92,40 @@ unsigned int get_pfn_type(int xc_handle,
   36.15      return op.u.getpageframeinfo.type;
   36.16  }
   36.17  
   36.18 -
   36.19 -
   36.20 -/*******************/
   36.21 -
   36.22 -int pin_table(
   36.23 -    int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
   36.24 +int xc_mmuext_op(
   36.25 +    int xc_handle,
   36.26 +    struct mmuext_op *op,
   36.27 +    unsigned int nr_ops,
   36.28 +    domid_t dom)
   36.29  {
   36.30 -    struct mmuext_op op;
   36.31 +    privcmd_hypercall_t hypercall;
   36.32 +    long ret = -EINVAL;
   36.33  
   36.34 -    op.cmd = type;
   36.35 -    op.mfn = mfn;
   36.36 +    hypercall.op     = __HYPERVISOR_mmuext_op;
   36.37 +    hypercall.arg[0] = (unsigned long)op;
   36.38 +    hypercall.arg[1] = (unsigned long)nr_ops;
   36.39 +    hypercall.arg[2] = (unsigned long)0;
   36.40 +    hypercall.arg[3] = (unsigned long)dom;
   36.41  
   36.42 -    if ( do_mmuext_op(xc_handle, &op, 1, dom) < 0 )
   36.43 -        return 1;
   36.44 +    if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
   36.45 +    {
   36.46 +        PERROR("Could not lock memory for Xen hypercall");
   36.47 +        goto out1;
   36.48 +    }
   36.49  
   36.50 -    return 0;
   36.51 -}
   36.52 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   36.53 +    {
   36.54 +	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
   36.55 +                    " rebuild the user-space tool set?\n",ret,errno);
   36.56 +    }
   36.57  
   36.58 -static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
   36.59 +    safe_munlock(op, nr_ops*sizeof(*op));
   36.60 +
   36.61 + out1:
   36.62 +    return ret;
   36.63 +}    
   36.64 +
   36.65 +static int flush_mmu_updates(int xc_handle, xc_mmu_t *mmu)
   36.66  {
   36.67      int err = 0;
   36.68      privcmd_hypercall_t hypercall;
   36.69 @@ -145,9 +160,9 @@ static int flush_mmu_updates(int xc_hand
   36.70      return err;
   36.71  }
   36.72  
   36.73 -mmu_t *init_mmu_updates(int xc_handle, domid_t dom)
   36.74 +xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom)
   36.75  {
   36.76 -    mmu_t *mmu = malloc(sizeof(mmu_t));
   36.77 +    xc_mmu_t *mmu = malloc(sizeof(xc_mmu_t));
   36.78      if ( mmu == NULL )
   36.79          return mmu;
   36.80      mmu->idx     = 0;
   36.81 @@ -155,8 +170,8 @@ mmu_t *init_mmu_updates(int xc_handle, d
   36.82      return mmu;
   36.83  }
   36.84  
   36.85 -int add_mmu_update(int xc_handle, mmu_t *mmu, 
   36.86 -                   unsigned long ptr, unsigned long val)
   36.87 +int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
   36.88 +		      unsigned long ptr, unsigned long val)
   36.89  {
   36.90      mmu->updates[mmu->idx].ptr = ptr;
   36.91      mmu->updates[mmu->idx].val = val;
   36.92 @@ -167,11 +182,48 @@ int add_mmu_update(int xc_handle, mmu_t 
   36.93      return 0;
   36.94  }
   36.95  
   36.96 -int finish_mmu_updates(int xc_handle, mmu_t *mmu)
   36.97 +int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu)
   36.98  {
   36.99      return flush_mmu_updates(xc_handle, mmu);
  36.100  }
  36.101  
  36.102 +int xc_dom_mem_op(int xc_handle,
  36.103 +		  unsigned int memop, 
  36.104 +		  unsigned int *extent_list, 
  36.105 +		  unsigned int nr_extents,
  36.106 +		  unsigned int extent_order,
  36.107 +		  domid_t domid)
  36.108 +{
  36.109 +    privcmd_hypercall_t hypercall;
  36.110 +    long ret = -EINVAL;
  36.111 +
  36.112 +    hypercall.op     = __HYPERVISOR_dom_mem_op;
  36.113 +    hypercall.arg[0] = (unsigned long)memop;
  36.114 +    hypercall.arg[1] = (unsigned long)extent_list;
  36.115 +    hypercall.arg[2] = (unsigned long)nr_extents;
  36.116 +    hypercall.arg[3] = (unsigned long)extent_order;
  36.117 +    hypercall.arg[4] = (unsigned long)domid;
  36.118 +
  36.119 +    if ( (extent_list != NULL) && 
  36.120 +         (mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
  36.121 +    {
  36.122 +        PERROR("Could not lock memory for Xen hypercall");
  36.123 +        goto out1;
  36.124 +    }
  36.125 +
  36.126 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  36.127 +    {
  36.128 +	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  36.129 +                " rebuild the user-space tool set?\n",ret,errno);
  36.130 +    }
  36.131 +
  36.132 +    if ( extent_list != NULL )
  36.133 +        safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
  36.134 +
  36.135 + out1:
  36.136 +    return ret;
  36.137 +}    
  36.138 +
  36.139  
  36.140  long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
  36.141  {
  36.142 @@ -190,19 +242,6 @@ long long xc_domain_get_cpu_usage( int x
  36.143  }
  36.144  
  36.145  
  36.146 -/* This is shared between save and restore, and may generally be useful. */
  36.147 -unsigned long csum_page (void * page)
  36.148 -{
  36.149 -    int i;
  36.150 -    unsigned long *p = page;
  36.151 -    unsigned long long sum=0;
  36.152 -
  36.153 -    for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
  36.154 -        sum += p[i];
  36.155 -
  36.156 -    return sum ^ (sum>>32);
  36.157 -}
  36.158 -
  36.159  unsigned long xc_get_m2p_start_mfn ( int xc_handle )
  36.160  {
  36.161      unsigned long mfn;
  36.162 @@ -332,53 +371,6 @@ unsigned long xc_get_filesz(int fd)
  36.163      return sz;
  36.164  }
  36.165  
  36.166 -char *xc_read_kernel_image(const char *filename, unsigned long *size)
  36.167 -{
  36.168 -    int kernel_fd = -1;
  36.169 -    gzFile kernel_gfd = NULL;
  36.170 -    char *image = NULL;
  36.171 -    unsigned int bytes;
  36.172 -
  36.173 -    if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
  36.174 -    {
  36.175 -        PERROR("Could not open kernel image");
  36.176 -        goto out;
  36.177 -    }
  36.178 -
  36.179 -    if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
  36.180 -    {
  36.181 -        PERROR("Could not read kernel image");
  36.182 -        goto out;
  36.183 -    }
  36.184 -
  36.185 -    if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
  36.186 -    {
  36.187 -        PERROR("Could not allocate decompression state for state file");
  36.188 -        goto out;
  36.189 -    }
  36.190 -
  36.191 -    if ( (image = malloc(*size)) == NULL )
  36.192 -    {
  36.193 -        PERROR("Could not allocate memory for kernel image");
  36.194 -        goto out;
  36.195 -    }
  36.196 -
  36.197 -    if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
  36.198 -    {
  36.199 -        PERROR("Error reading kernel image, could not"
  36.200 -               " read the whole image (%d != %ld).", bytes, *size);
  36.201 -        free(image);
  36.202 -        image = NULL;
  36.203 -    }
  36.204 -
  36.205 - out:
  36.206 -    if ( kernel_gfd != NULL )
  36.207 -        gzclose(kernel_gfd);
  36.208 -    else if ( kernel_fd >= 0 )
  36.209 -        close(kernel_fd);
  36.210 -    return image;
  36.211 -}
  36.212 -
  36.213  void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  36.214                     int xch, u32 dom, unsigned long *parray,
  36.215                     unsigned long vstart)
    37.1 --- a/tools/libxc/xc_private.h	Wed Aug 24 22:24:10 2005 +0000
    37.2 +++ b/tools/libxc/xc_private.h	Thu Aug 25 00:55:20 2005 +0000
    37.3 @@ -1,124 +1,26 @@
    37.4  
    37.5 -#ifndef __XC_PRIVATE_H__
    37.6 -#define __XC_PRIVATE_H__
    37.7 +#ifndef XC_PRIVATE_H
    37.8 +#define XC_PRIVATE_H
    37.9  
   37.10  #include <unistd.h>
   37.11  #include <stdio.h>
   37.12  #include <errno.h>
   37.13  #include <fcntl.h>
   37.14 +#include <string.h>
   37.15  #include <sys/mman.h>
   37.16  #include <sys/types.h>
   37.17  #include <sys/stat.h>
   37.18  #include <stdlib.h>
   37.19  #include <sys/ioctl.h>
   37.20 -#include <errno.h>
   37.21 -#include <string.h>
   37.22  
   37.23 -#include "xc.h"
   37.24 +#include "xenctrl.h"
   37.25  
   37.26  #include <xen/linux/privcmd.h>
   37.27  
   37.28 -#define _PAGE_PRESENT   0x001
   37.29 -#define _PAGE_RW        0x002
   37.30 -#define _PAGE_USER      0x004
   37.31 -#define _PAGE_PWT       0x008
   37.32 -#define _PAGE_PCD       0x010
   37.33 -#define _PAGE_ACCESSED  0x020
   37.34 -#define _PAGE_DIRTY     0x040
   37.35 -#define _PAGE_PAT       0x080
   37.36 -#define _PAGE_PSE       0x080
   37.37 -#define _PAGE_GLOBAL    0x100
   37.38 -
   37.39 -#if defined(__i386__)
   37.40 -#define L1_PAGETABLE_SHIFT       12
   37.41 -#define L2_PAGETABLE_SHIFT       22
   37.42 -#define L1_PAGETABLE_SHIFT_PAE   12
   37.43 -#define L2_PAGETABLE_SHIFT_PAE   21
   37.44 -#define L3_PAGETABLE_SHIFT_PAE   30
   37.45 -#elif defined(__x86_64__)
   37.46 -#define L1_PAGETABLE_SHIFT      12
   37.47 -#define L2_PAGETABLE_SHIFT      21
   37.48 -#define L3_PAGETABLE_SHIFT      30
   37.49 -#define L4_PAGETABLE_SHIFT      39
   37.50 -#endif
   37.51 -
   37.52 -#if defined(__i386__) 
   37.53 -#define ENTRIES_PER_L1_PAGETABLE 1024
   37.54 -#define ENTRIES_PER_L2_PAGETABLE 1024
   37.55 -#define L1_PAGETABLE_ENTRIES_PAE  512
   37.56 -#define L2_PAGETABLE_ENTRIES_PAE  512
   37.57 -#define L3_PAGETABLE_ENTRIES_PAE    4
   37.58 -#elif defined(__x86_64__)
   37.59 -#define L1_PAGETABLE_ENTRIES    512
   37.60 -#define L2_PAGETABLE_ENTRIES    512
   37.61 -#define L3_PAGETABLE_ENTRIES    512
   37.62 -#define L4_PAGETABLE_ENTRIES    512
   37.63 -#endif
   37.64 - 
   37.65  #define PAGE_SHIFT              XC_PAGE_SHIFT
   37.66  #define PAGE_SIZE               (1UL << PAGE_SHIFT)
   37.67  #define PAGE_MASK               (~(PAGE_SIZE-1))
   37.68  
   37.69 -typedef u32 l1_pgentry_32_t;
   37.70 -typedef u32 l2_pgentry_32_t;
   37.71 -typedef u64 l1_pgentry_64_t;
   37.72 -typedef u64 l2_pgentry_64_t;
   37.73 -typedef u64 l3_pgentry_64_t;
   37.74 -typedef unsigned long l1_pgentry_t;
   37.75 -typedef unsigned long l2_pgentry_t;
   37.76 -#if defined(__x86_64__)
   37.77 -typedef unsigned long l3_pgentry_t;
   37.78 -typedef unsigned long l4_pgentry_t;
   37.79 -#endif
   37.80 -
   37.81 -#if defined(__i386__)
   37.82 -#define l1_table_offset(_a) \
   37.83 -          (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
   37.84 -#define l2_table_offset(_a) \
   37.85 -          ((_a) >> L2_PAGETABLE_SHIFT)
   37.86 -#define l1_table_offset_pae(_a) \
   37.87 -  (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
   37.88 -#define l2_table_offset_pae(_a) \
   37.89 -  (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
   37.90 -#define l3_table_offset_pae(_a) \
   37.91 -	(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
   37.92 -#elif defined(__x86_64__)
   37.93 -#define l1_table_offset(_a) \
   37.94 -  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   37.95 -#define l2_table_offset(_a) \
   37.96 -  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   37.97 -#define l3_table_offset(_a) \
   37.98 -	(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   37.99 -#define l4_table_offset(_a) \
  37.100 -	(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
  37.101 -#endif
  37.102 -
  37.103 -struct domain_setup_info
  37.104 -{
  37.105 -    unsigned long v_start;
  37.106 -    unsigned long v_end;
  37.107 -    unsigned long v_kernstart;
  37.108 -    unsigned long v_kernend;
  37.109 -    unsigned long v_kernentry;
  37.110 -
  37.111 -    unsigned int  load_symtab;
  37.112 -    unsigned int  pae_kernel;
  37.113 -    unsigned long symtab_addr;
  37.114 -    unsigned long symtab_len;
  37.115 -};
  37.116 -
  37.117 -typedef int (*parseimagefunc)(char *image, unsigned long image_size,
  37.118 -			      struct domain_setup_info *dsi);
  37.119 -typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
  37.120 -			     u32 dom, unsigned long *parray,
  37.121 -			     struct domain_setup_info *dsi);
  37.122 -
  37.123 -struct load_funcs
  37.124 -{
  37.125 -    parseimagefunc parseimage;
  37.126 -    loadimagefunc loadimage;
  37.127 -};
  37.128 -
  37.129  #define ERROR(_m, _a...)                                \
  37.130  do {                                                    \
  37.131      int __saved_errno = errno;                          \
  37.132 @@ -186,97 +88,6 @@ static inline int do_dom0_op(int xc_hand
  37.133      return ret;
  37.134  }
  37.135  
  37.136 -static inline int do_dom_mem_op(int            xc_handle,
  37.137 -				unsigned int   memop, 
  37.138 -				unsigned int *extent_list, 
  37.139 -				unsigned int  nr_extents,
  37.140 -				unsigned int   extent_order,
  37.141 -				domid_t        domid)
  37.142 -{
  37.143 -    privcmd_hypercall_t hypercall;
  37.144 -    long ret = -EINVAL;
  37.145 -
  37.146 -    hypercall.op     = __HYPERVISOR_dom_mem_op;
  37.147 -    hypercall.arg[0] = (unsigned long)memop;
  37.148 -    hypercall.arg[1] = (unsigned long)extent_list;
  37.149 -    hypercall.arg[2] = (unsigned long)nr_extents;
  37.150 -    hypercall.arg[3] = (unsigned long)extent_order;
  37.151 -    hypercall.arg[4] = (unsigned long)domid;
  37.152 -
  37.153 -    if ( (extent_list != NULL) && 
  37.154 -         (mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
  37.155 -    {
  37.156 -        PERROR("Could not lock memory for Xen hypercall");
  37.157 -        goto out1;
  37.158 -    }
  37.159 -
  37.160 -    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  37.161 -    {
  37.162 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  37.163 -                " rebuild the user-space tool set?\n",ret,errno);
  37.164 -    }
  37.165 -
  37.166 -    if ( extent_list != NULL )
  37.167 -        safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
  37.168 -
  37.169 - out1:
  37.170 -    return ret;
  37.171 -}    
  37.172 -
  37.173 -static inline int do_mmuext_op(
  37.174 -    int xc_handle,
  37.175 -    struct mmuext_op *op,
  37.176 -    unsigned int nr_ops,
  37.177 -    domid_t dom)
  37.178 -{
  37.179 -    privcmd_hypercall_t hypercall;
  37.180 -    long ret = -EINVAL;
  37.181 -
  37.182 -    hypercall.op     = __HYPERVISOR_mmuext_op;
  37.183 -    hypercall.arg[0] = (unsigned long)op;
  37.184 -    hypercall.arg[1] = (unsigned long)nr_ops;
  37.185 -    hypercall.arg[2] = (unsigned long)0;
  37.186 -    hypercall.arg[3] = (unsigned long)dom;
  37.187 -
  37.188 -    if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
  37.189 -    {
  37.190 -        PERROR("Could not lock memory for Xen hypercall");
  37.191 -        goto out1;
  37.192 -    }
  37.193 -
  37.194 -    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  37.195 -    {
  37.196 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  37.197 -                    " rebuild the user-space tool set?\n",ret,errno);
  37.198 -    }
  37.199 -
  37.200 -    safe_munlock(op, nr_ops*sizeof(*op));
  37.201 -
  37.202 - out1:
  37.203 -    return ret;
  37.204 -}    
  37.205 -
  37.206 -
  37.207 -/*
  37.208 - * PFN mapping.
  37.209 - */
  37.210 -int get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
  37.211 -unsigned long csum_page (void * page);
  37.212 -
  37.213 -/*
  37.214 - * MMU updates.
  37.215 - */
  37.216 -#define MAX_MMU_UPDATES 1024
  37.217 -typedef struct {
  37.218 -    mmu_update_t updates[MAX_MMU_UPDATES];
  37.219 -    int          idx;
  37.220 -    domid_t      subject;
  37.221 -} mmu_t;
  37.222 -mmu_t *init_mmu_updates(int xc_handle, domid_t dom);
  37.223 -int add_mmu_update(int xc_handle, mmu_t *mmu, 
  37.224 -                   unsigned long ptr, unsigned long val);
  37.225 -int finish_mmu_updates(int xc_handle, mmu_t *mmu);
  37.226 -
  37.227  
  37.228  /*
  37.229   * ioctl-based mfn mapping interface
  37.230 @@ -296,38 +107,4 @@ typedef struct privcmd_mmap {
  37.231  } privcmd_mmap_t; 
  37.232  */
  37.233  
  37.234 -#define mfn_mapper_queue_size 128
  37.235 -
  37.236 -typedef struct mfn_mapper {
  37.237 -    int xc_handle;
  37.238 -    int size;
  37.239 -    int prot;
  37.240 -    int error;
  37.241 -    int max_queue_size;
  37.242 -    void * addr;
  37.243 -    privcmd_mmap_t ioctl; 
  37.244 -    
  37.245 -} mfn_mapper_t;
  37.246 -
  37.247 -unsigned long xc_get_m2p_start_mfn (int xc_handle);
  37.248 -
  37.249 -int xc_copy_to_domain_page(int xc_handle, u32 domid,
  37.250 -                            unsigned long dst_pfn, void *src_page);
  37.251 -
  37.252 -unsigned long xc_get_filesz(int fd);
  37.253 -
  37.254 -char *xc_read_kernel_image(const char *filename, unsigned long *size);
  37.255 -
  37.256 -void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  37.257 -                   int xch, u32 dom, unsigned long *parray,
  37.258 -                   unsigned long vstart);
  37.259 -
  37.260 -int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
  37.261 -	      domid_t dom);
  37.262 -
  37.263 -/* image loading */
  37.264 -int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
  37.265 -int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
  37.266 -int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
  37.267 -
  37.268  #endif /* __XC_PRIVATE_H__ */
    38.1 --- a/tools/libxc/xc_vmx_build.c	Wed Aug 24 22:24:10 2005 +0000
    38.2 +++ b/tools/libxc/xc_vmx_build.c	Thu Aug 25 00:55:20 2005 +0000
    38.3 @@ -3,7 +3,7 @@
    38.4   */
    38.5  
    38.6  #include <stddef.h>
    38.7 -#include "xc_private.h"
    38.8 +#include "xg_private.h"
    38.9  #define ELFSIZE 32
   38.10  #include "xc_elf.h"
   38.11  #include <stdlib.h>
   38.12 @@ -243,7 +243,7 @@ static int setup_guest(int xc_handle,
   38.13      shared_info_t *shared_info;
   38.14      struct linux_boot_params * boot_paramsp;
   38.15      __u16 * boot_gdtp;
   38.16 -    mmu_t *mmu = NULL;
   38.17 +    xc_mmu_t *mmu = NULL;
   38.18      int rc;
   38.19  
   38.20      unsigned long nr_pt_pages;
   38.21 @@ -358,7 +358,7 @@ static int setup_guest(int xc_handle,
   38.22          }
   38.23      }
   38.24  
   38.25 -    if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
   38.26 +    if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
   38.27          goto error_out;
   38.28  
   38.29  #ifdef __i386__
   38.30 @@ -459,9 +459,9 @@ static int setup_guest(int xc_handle,
   38.31      /* Write the machine->phys table entries. */
   38.32      for ( count = 0; count < nr_pages; count++ )
   38.33      {
   38.34 -        if ( add_mmu_update(xc_handle, mmu,
   38.35 -                            (page_array[count] << PAGE_SHIFT) | 
   38.36 -                            MMU_MACHPHYS_UPDATE, count) )
   38.37 +        if ( xc_add_mmu_update(xc_handle, mmu,
   38.38 +			       (page_array[count] << PAGE_SHIFT) | 
   38.39 +			       MMU_MACHPHYS_UPDATE, count) )
   38.40  	    goto error_out;
   38.41      }
   38.42      
   38.43 @@ -587,7 +587,7 @@ static int setup_guest(int xc_handle,
   38.44  #endif
   38.45  
   38.46      /* Send the page update requests down to the hypervisor. */
   38.47 -    if ( finish_mmu_updates(xc_handle, mmu) )
   38.48 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   38.49          goto error_out;
   38.50  
   38.51      free(mmu);
   38.52 @@ -708,7 +708,7 @@ int xc_vmx_build(int xc_handle,
   38.53  
   38.54      op.cmd = DOM0_GETDOMAININFO;
   38.55      op.u.getdomaininfo.domain = (domid_t)domid;
   38.56 -    if ( (do_dom0_op(xc_handle, &op) < 0) || 
   38.57 +    if ( (xc_dom0_op(xc_handle, &op) < 0) || 
   38.58           ((u16)op.u.getdomaininfo.domain != domid) )
   38.59      {
   38.60          PERROR("Could not get info on domain");
   38.61 @@ -789,7 +789,7 @@ int xc_vmx_build(int xc_handle,
   38.62      launch_op.u.setdomaininfo.ctxt   = ctxt;
   38.63  
   38.64      launch_op.cmd = DOM0_SETDOMAININFO;
   38.65 -    rc = do_dom0_op(xc_handle, &launch_op);
   38.66 +    rc = xc_dom0_op(xc_handle, &launch_op);
   38.67      
   38.68      return rc;
   38.69  
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/tools/libxc/xenctrl.h	Thu Aug 25 00:55:20 2005 +0000
    39.3 @@ -0,0 +1,526 @@
    39.4 +/******************************************************************************
    39.5 + * xenctrl.h
    39.6 + * 
    39.7 + * A library for low-level access to the Xen control interfaces.
    39.8 + * 
    39.9 + * Copyright (c) 2003-2004, K A Fraser.
   39.10 + */
   39.11 +
   39.12 +#ifndef XENCTRL_H
   39.13 +#define XENCTRL_H
   39.14 +
   39.15 +#include <stdint.h>
   39.16 +
   39.17 +typedef uint8_t            u8;
   39.18 +typedef uint16_t           u16;
   39.19 +typedef uint32_t           u32;
   39.20 +typedef uint64_t           u64;
   39.21 +typedef int8_t             s8;
   39.22 +typedef int16_t            s16;
   39.23 +typedef int32_t            s32;
   39.24 +typedef int64_t            s64;
   39.25 +
   39.26 +#include <sys/ptrace.h>
   39.27 +#include <xen/xen.h>
   39.28 +#include <xen/dom0_ops.h>
   39.29 +#include <xen/event_channel.h>
   39.30 +#include <xen/sched_ctl.h>
   39.31 +#include <xen/acm.h>
   39.32 +
   39.33 +#ifdef __ia64__
   39.34 +#define XC_PAGE_SHIFT           14
   39.35 +#else
   39.36 +#define XC_PAGE_SHIFT           12
   39.37 +#endif
   39.38 +#define XC_PAGE_SIZE            (1UL << XC_PAGE_SHIFT)
   39.39 +#define XC_PAGE_MASK            (~(XC_PAGE_SIZE-1))
   39.40 +
   39.41 +/*
   39.42 + *  DEFINITIONS FOR CPU BARRIERS
   39.43 + */ 
   39.44 +
   39.45 +#if defined(__i386__)
   39.46 +#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   39.47 +#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   39.48 +#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   39.49 +#elif defined(__x86_64__)
   39.50 +#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
   39.51 +#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
   39.52 +#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   39.53 +#elif defined(__ia64__)
   39.54 +/* FIXME */
   39.55 +#define mb()
   39.56 +#define rmb()
   39.57 +#define wmb()
   39.58 +#else
   39.59 +#error "Define barriers"
   39.60 +#endif
   39.61 +
   39.62 +/*
   39.63 + *  INITIALIZATION FUNCTIONS
   39.64 + */ 
   39.65 +
   39.66 +/**
   39.67 + * This function opens a handle to the hypervisor interface.  This function can
   39.68 + * be called multiple times within a single process.  Multiple processes can
   39.69 + * have an open hypervisor interface at the same time.
   39.70 + *
   39.71 + * Each call to this function should have a corresponding call to
   39.72 + * xc_interface_close().
   39.73 + *
   39.74 + * This function can fail if the caller does not have superuser permission or
   39.75 + * if a Xen-enabled kernel is not currently running.
   39.76 + *
   39.77 + * @return a handle to the hypervisor interface or -1 on failure
   39.78 + */
   39.79 +int xc_interface_open(void);
   39.80 +
   39.81 +/**
   39.82 + * This function closes an open hypervisor interface.
   39.83 + *
   39.84 + * This function can fail if the handle does not represent an open interface or
   39.85 + * if there were problems closing the interface.
   39.86 + *
   39.87 + * @parm xc_handle a handle to an open hypervisor interface
   39.88 + * @return 0 on success, -1 otherwise.
   39.89 + */
   39.90 +int xc_interface_close(int xc_handle);
   39.91 +
   39.92 +/*
   39.93 + * DOMAIN DEBUGGING FUNCTIONS
   39.94 + */
   39.95 +
   39.96 +typedef struct xc_core_header {
   39.97 +    unsigned int xch_magic;
   39.98 +    unsigned int xch_nr_vcpus;
   39.99 +    unsigned int xch_nr_pages;
  39.100 +    unsigned int xch_ctxt_offset;
  39.101 +    unsigned int xch_index_offset;
  39.102 +    unsigned int xch_pages_offset;
  39.103 +} xc_core_header_t;
  39.104 +
  39.105 +
  39.106 +long xc_ptrace(enum __ptrace_request request, 
  39.107 +               u32  domid,
  39.108 +               long addr, 
  39.109 +               long data);
  39.110 +
  39.111 +long xc_ptrace_core(enum __ptrace_request request, 
  39.112 +                    u32 domid, 
  39.113 +                    long addr, 
  39.114 +                    long data);
  39.115 +
  39.116 +int xc_waitdomain(int domain, 
  39.117 +                  int *status, 
  39.118 +                  int options);
  39.119 +
  39.120 +int xc_waitdomain_core(int domain, 
  39.121 +                       int *status, 
  39.122 +                       int options);
  39.123 +
  39.124 +/*
  39.125 + * DOMAIN MANAGEMENT FUNCTIONS
  39.126 + */
  39.127 +
  39.128 +typedef struct {
  39.129 +    u32           domid;
  39.130 +    u32           ssidref;
  39.131 +    unsigned int  dying:1, crashed:1, shutdown:1, 
  39.132 +                  paused:1, blocked:1, running:1;
  39.133 +    unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
  39.134 +    unsigned long nr_pages;
  39.135 +    unsigned long shared_info_frame;
  39.136 +    u64           cpu_time;
  39.137 +    unsigned long max_memkb;
  39.138 +    unsigned int  vcpus;
  39.139 +    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
  39.140 +    cpumap_t      cpumap[MAX_VIRT_CPUS];
  39.141 +} xc_dominfo_t;
  39.142 +
  39.143 +typedef dom0_getdomaininfo_t xc_domaininfo_t;
  39.144 +int xc_domain_create(int xc_handle, 
  39.145 +                     u32 ssidref,
  39.146 +                     u32 *pdomid);
  39.147 +
  39.148 +
  39.149 +int xc_domain_dumpcore(int xc_handle, 
  39.150 +                       u32 domid,
  39.151 +                       const char *corename);
  39.152 +
  39.153 +
  39.154 +/**
  39.155 + * This function pauses a domain. A paused domain still exists in memory
  39.156 + * however it does not receive any timeslices from the hypervisor.
  39.157 + *
  39.158 + * @parm xc_handle a handle to an open hypervisor interface
  39.159 + * @parm domid the domain id to pause
  39.160 + * @return 0 on success, -1 on failure.
  39.161 + */
  39.162 +int xc_domain_pause(int xc_handle, 
  39.163 +                    u32 domid);
  39.164 +/**
  39.165 + * This function unpauses a domain.  The domain should have been previously
  39.166 + * paused.
  39.167 + *
  39.168 + * @parm xc_handle a handle to an open hypervisor interface
  39.169 + * @parm domid the domain id to unpause
  39.170 + * return 0 on success, -1 on failure
  39.171 + */
  39.172 +int xc_domain_unpause(int xc_handle, 
  39.173 +                      u32 domid);
  39.174 +
  39.175 +/**
  39.176 + * This function will destroy a domain.  Destroying a domain removes the domain
  39.177 + * completely from memory.  This function should be called after sending the
  39.178 + * domain a SHUTDOWN control message to free up the domain resources.
  39.179 + *
  39.180 + * @parm xc_handle a handle to an open hypervisor interface
  39.181 + * @parm domid the domain id to destroy
  39.182 + * @return 0 on success, -1 on failure
  39.183 + */
  39.184 +int xc_domain_destroy(int xc_handle, 
  39.185 +                      u32 domid);
  39.186 +int xc_domain_pincpu(int xc_handle,
  39.187 +                     u32 domid,
  39.188 +                     int vcpu,
  39.189 +                     cpumap_t *cpumap);
  39.190 +/**
  39.191 + * This function will return information about one or more domains. It is
  39.192 + * designed to iterate over the list of domains. If a single domain is
  39.193 + * requested, this function will return the next domain in the list - if
  39.194 + * one exists. It is, therefore, important in this case to make sure the
  39.195 + * domain requested was the one returned.
  39.196 + *
  39.197 + * @parm xc_handle a handle to an open hypervisor interface
  39.198 + * @parm first_domid the first domain to enumerate information from.  Domains
  39.199 + *                   are currently enumerate in order of creation.
  39.200 + * @parm max_doms the number of elements in info
  39.201 + * @parm info an array of max_doms size that will contain the information for
  39.202 + *            the enumerated domains.
  39.203 + * @return the number of domains enumerated or -1 on error
  39.204 + */
  39.205 +int xc_domain_getinfo(int xc_handle,
  39.206 +                      u32 first_domid, 
  39.207 +                      unsigned int max_doms,
  39.208 +                      xc_dominfo_t *info);
  39.209 +
  39.210 +/**
  39.211 + * This function will return information about one or more domains, using a
  39.212 + * single hypercall.  The domain information will be stored into the supplied
  39.213 + * array of xc_domaininfo_t structures.
  39.214 + *
  39.215 + * @parm xc_handle a handle to an open hypervisor interface
  39.216 + * @parm first_domain the first domain to enumerate information from.
  39.217 + *                    Domains are currently enumerate in order of creation.
  39.218 + * @parm max_domains the number of elements in info
  39.219 + * @parm info an array of max_doms size that will contain the information for
  39.220 + *            the enumerated domains.
  39.221 + * @return the number of domains enumerated or -1 on error
  39.222 + */
  39.223 +int xc_domain_getinfolist(int xc_handle,
  39.224 +                          u32 first_domain,
  39.225 +                          unsigned int max_domains,
  39.226 +                          xc_domaininfo_t *info);
  39.227 +
  39.228 +/**
  39.229 + * This function returns information about one domain.  This information is
  39.230 + * more detailed than the information from xc_domain_getinfo().
  39.231 + *
  39.232 + * @parm xc_handle a handle to an open hypervisor interface
  39.233 + * @parm domid the domain to get information from
  39.234 + * @parm info a pointer to an xc_domaininfo_t to store the domain information
  39.235 + * @parm ctxt a pointer to a structure to store the execution context of the
  39.236 + *            domain
  39.237 + * @return 0 on success, -1 on failure
  39.238 + */
  39.239 +int xc_domain_get_vcpu_context(int xc_handle,
  39.240 +                               u32 domid,
  39.241 +                               u32 vcpu,
  39.242 +                               vcpu_guest_context_t *ctxt);
  39.243 +
  39.244 +int xc_domain_setcpuweight(int xc_handle,
  39.245 +                           u32 domid,
  39.246 +                           float weight);
  39.247 +long long xc_domain_get_cpu_usage(int xc_handle,
  39.248 +                                  domid_t domid,
  39.249 +                                  int vcpu);
  39.250 +
  39.251 +
  39.252 +typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
  39.253 +int xc_shadow_control(int xc_handle,
  39.254 +                      u32 domid, 
  39.255 +                      unsigned int sop,
  39.256 +                      unsigned long *dirty_bitmap,
  39.257 +                      unsigned long pages,
  39.258 +                      xc_shadow_control_stats_t *stats);
  39.259 +
  39.260 +int xc_bvtsched_global_set(int xc_handle,
  39.261 +                           unsigned long ctx_allow);
  39.262 +
  39.263 +int xc_bvtsched_domain_set(int xc_handle,
  39.264 +                           u32 domid,
  39.265 +                           u32 mcuadv,
  39.266 +                           int warpback,
  39.267 +                           s32 warpvalue,
  39.268 +                           long long warpl,
  39.269 +                           long long warpu);
  39.270 +
  39.271 +int xc_bvtsched_global_get(int xc_handle,
  39.272 +                           unsigned long *ctx_allow);
  39.273 +
  39.274 +int xc_bvtsched_domain_get(int xc_handle,
  39.275 +                           u32 domid,
  39.276 +                           u32 *mcuadv,
  39.277 +                           int *warpback,
  39.278 +                           s32 *warpvalue,
  39.279 +                           long long *warpl,
  39.280 +                           long long *warpu);
  39.281 +
  39.282 +int xc_sedf_domain_set(int xc_handle,
  39.283 +                          u32 domid,
  39.284 +                          u64 period, u64 slice, u64 latency, u16 extratime, u16 weight);
  39.285 +
  39.286 +int xc_sedf_domain_get(int xc_handle,
  39.287 +                          u32 domid,
  39.288 +                          u64* period, u64 *slice, u64 *latency, u16 *extratime, u16* weight);
  39.289 +
  39.290 +typedef evtchn_status_t xc_evtchn_status_t;
  39.291 +
  39.292 +/*
  39.293 + * EVENT CHANNEL FUNCTIONS
  39.294 + */
  39.295 +
  39.296 +/**
  39.297 + * This function allocates an unbound port.  Ports are named endpoints used for
  39.298 + * interdomain communication.  This function is most useful in opening a
  39.299 + * well-known port within a domain to receive events on.
  39.300 + *
  39.301 + * @parm xc_handle a handle to an open hypervisor interface
  39.302 + * @parm dom the ID of the domain.  This maybe DOMID_SELF
  39.303 + * @parm port a pointer to a port.  This is an in/out parameter.  If *port is
  39.304 + *            0, then a new port will be assigned, if port is > 0 then that
  39.305 + *            port is allocated if the port is unallocated.
  39.306 + * @return 0 on success, -1 on failure
  39.307 + */
  39.308 +int xc_evtchn_alloc_unbound(int xc_handle,
  39.309 +                            u32 dom,
  39.310 +                            int *port);
  39.311 +
  39.312 +/**
  39.313 + * This function creates a pair of ports between two domains.  A port can only
  39.314 + * be bound once within a domain.
  39.315 + *
  39.316 + * @parm xc_handle a handle to an open hypervisor interface
  39.317 + * @parm dom1 one of the two domains to connect.  Can be DOMID_SELF.
  39.318 + * @parm dom2 the other domain to connect.  Can be DOMID_SELF.
  39.319 + * @parm port1 an in/out parameter.  If > 0, then try to connect *port.  If
  39.320 + *             0, then allocate a new port and store the port in *port.
  39.321 + * @parm port2 the port connected on port2.  This parameter behaves the same
  39.322 + *             way as port1.
  39.323 + * @return 0 on success, -1 on error.
  39.324 + */
  39.325 +int xc_evtchn_bind_interdomain(int xc_handle,
  39.326 +                               u32 dom1,
  39.327 +                               u32 dom2,
  39.328 +                               int *port1,
  39.329 +                               int *port2);
  39.330 +int xc_evtchn_bind_virq(int xc_handle,
  39.331 +                        int virq,
  39.332 +                        int *port);
  39.333 +
  39.334 +/**
  39.335 + * This function will close a single port on an event channel.
  39.336 + *
  39.337 + * @parm xc_handle a handle to an open hypervisor interface
  39.338 + * @parm dom the domain that the port exists on.  May be DOMID_SELF.
  39.339 + * @parm port the port to close
  39.340 + * @return 0 on success, -1 on error
  39.341 + */
  39.342 +int xc_evtchn_close(int xc_handle,
  39.343 +                    u32 dom,   /* may be DOMID_SELF */
  39.344 +                    int port);
  39.345 +
  39.346 +/**
  39.347 + * This function generates a notify event on a bound port.
  39.348 + *
  39.349 + * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
  39.350 + * a 16 bit value.  The result will be the port the event occurred on.  When
  39.351 + * events occur, the port is masked until the 16 bit port value is written back
  39.352 + * to the file.  When /dev/xen/evtchn is opened, it has to be bound via an
  39.353 + * ioctl to each port to listen on.  The ioctl for binding is _IO('E', 2).  The
  39.354 + * parameter is the port to listen on.
  39.355 + *
  39.356 + * @parm xc_handle a handle to an open hypervisor interface
  39.357 + * @parm local_port the port to generate the notify on
  39.358 + * @return 0 on success, -1 on error
  39.359 + */
  39.360 +int xc_evtchn_send(int xc_handle,
  39.361 +                   int local_port);
  39.362 +int xc_evtchn_status(int xc_handle,
  39.363 +                     u32 dom, /* may be DOMID_SELF */
  39.364 +                     int port,
  39.365 +                     xc_evtchn_status_t *status);
  39.366 +
  39.367 +int xc_physdev_pci_access_modify(int xc_handle,
  39.368 +                                 u32 domid,
  39.369 +                                 int bus,
  39.370 +                                 int dev,
  39.371 +                                 int func,
  39.372 +                                 int enable);
  39.373 +
  39.374 +int xc_readconsolering(int xc_handle,
  39.375 +                       char **pbuffer,
  39.376 +                       unsigned int *pnr_chars, 
  39.377 +                       int clear);
  39.378 +
  39.379 +typedef dom0_physinfo_t xc_physinfo_t;
  39.380 +int xc_physinfo(int xc_handle,
  39.381 +                xc_physinfo_t *info);
  39.382 +
  39.383 +int xc_sched_id(int xc_handle,
  39.384 +                int *sched_id);
  39.385 +
  39.386 +int xc_domain_setmaxmem(int xc_handle,
  39.387 +                        u32 domid, 
  39.388 +                        unsigned int max_memkb);
  39.389 +
  39.390 +int xc_domain_memory_increase_reservation(int xc_handle,
  39.391 +                                          u32 domid, 
  39.392 +                                          unsigned int mem_kb);
  39.393 +
  39.394 +typedef dom0_perfc_desc_t xc_perfc_desc_t;
  39.395 +/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
  39.396 +int xc_perfc_control(int xc_handle,
  39.397 +                     u32 op,
  39.398 +                     xc_perfc_desc_t *desc);
  39.399 +
  39.400 +/* read/write msr */
  39.401 +long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
  39.402 +int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  39.403 +                  unsigned int high);
  39.404 +
  39.405 +/**
  39.406 + * Memory maps a range within one domain to a local address range.  Mappings
  39.407 + * should be unmapped with munmap and should follow the same rules as mmap
  39.408 + * regarding page alignment.  Returns NULL on failure.
  39.409 + *
  39.410 + * In Linux, the ring queue for the control channel is accessible by mapping
  39.411 + * the shared_info_frame (from xc_domain_getinfo()) + 2048.  The structure
  39.412 + * stored there is of type control_if_t.
  39.413 + *
  39.414 + * @parm xc_handle a handle on an open hypervisor interface
  39.415 + * @parm dom the domain to map memory from
  39.416 + * @parm size the amount of memory to map (in multiples of page size)
  39.417 + * @parm prot same flag as in mmap().
  39.418 + * @parm mfn the frame address to map.
  39.419 + */
  39.420 +void *xc_map_foreign_range(int xc_handle, u32 dom,
  39.421 +                            int size, int prot,
  39.422 +                            unsigned long mfn );
  39.423 +
  39.424 +void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
  39.425 +                           unsigned long *arr, int num );
  39.426 +
  39.427 +int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  39.428 +                    unsigned long max_pfns);
  39.429 +
  39.430 +int xc_ia64_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  39.431 +                    unsigned int start_page, unsigned int nr_pages);
  39.432 +
  39.433 +int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
  39.434 +		 domid_t dom);
  39.435 +
  39.436 +int xc_dom_mem_op(int xc_handle, unsigned int memop, unsigned int *extent_list,
  39.437 +		  unsigned int nr_extents, unsigned int extent_order,
  39.438 +		  domid_t domid);
  39.439 +
  39.440 +int xc_get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
  39.441 +
  39.442 +
  39.443 +/*\
  39.444 + *  GRANT TABLE FUNCTIONS
  39.445 +\*/ 
  39.446 +
  39.447 +/**
  39.448 + * This function opens a handle to the more restricted grant table hypervisor
  39.449 + * interface. This may be used where the standard interface is not
  39.450 + * available because the domain is not privileged.
  39.451 + * This function can  be called multiple times within a single process.
  39.452 + * Multiple processes can have an open hypervisor interface at the same time.
  39.453 + *
  39.454 + * Each call to this function should have a corresponding call to
  39.455 + * xc_grant_interface_close().
  39.456 + *
  39.457 + * This function can fail if a Xen-enabled kernel is not currently running.
  39.458 + *
  39.459 + * @return a handle to the hypervisor grant table interface or -1 on failure
  39.460 + */
  39.461 +int xc_grant_interface_open(void);
  39.462 +
  39.463 +/**
  39.464 + * This function closes an open grant table hypervisor interface.
  39.465 + *
  39.466 + * This function can fail if the handle does not represent an open interface or
  39.467 + * if there were problems closing the interface.
  39.468 + *
  39.469 + * @parm xc_handle a handle to an open grant table hypervisor interface
  39.470 + * @return 0 on success, -1 otherwise.
  39.471 + */
  39.472 +int xc_grant_interface_close(int xc_handle);
  39.473 +
  39.474 +int xc_gnttab_map_grant_ref(int  xc_handle,
  39.475 +                            u64  host_virt_addr,
  39.476 +                            u32  dom,
  39.477 +                            u16  ref,
  39.478 +                            u16  flags,
  39.479 +                            s16 *handle,
  39.480 +                            u64 *dev_bus_addr);
  39.481 +
  39.482 +int xc_gnttab_unmap_grant_ref(int  xc_handle,
  39.483 +                              u64  host_virt_addr,
  39.484 +                              u64  dev_bus_addr,
  39.485 +                              u16  handle,
  39.486 +                              s16 *status);
  39.487 +
  39.488 +int xc_gnttab_setup_table(int        xc_handle,
  39.489 +                          u32        dom,
  39.490 +                          u16        nr_frames,
  39.491 +                          s16       *status,
  39.492 +                          unsigned long **frame_list);
  39.493 +
  39.494 +/* Grant debug builds only: */
  39.495 +int xc_gnttab_dump_table(int        xc_handle,
  39.496 +                         u32        dom,
  39.497 +                         s16       *status);
  39.498 +
  39.499 +/* Get current total pages allocated to a domain. */
  39.500 +long xc_get_tot_pages(int xc_handle, u32 domid);
  39.501 +
  39.502 +/* Execute a privileged dom0 operation. */
  39.503 +int xc_dom0_op(int xc_handle, dom0_op_t *op);
  39.504 +
  39.505 +/* Initializes the store (for dom0)
  39.506 +   remote_port should be the remote end of a bound interdomain channel between
  39.507 +   the store and dom0.
  39.508 +
  39.509 +   This function returns a shared frame that should be passed to
  39.510 +   xs_introduce_domain
  39.511 + */
  39.512 +long xc_init_store(int xc_handle, int remote_port);
  39.513 +
  39.514 +/*
  39.515 + * MMU updates.
  39.516 + */
  39.517 +#define MAX_MMU_UPDATES 1024
  39.518 +struct xc_mmu {
  39.519 +    mmu_update_t updates[MAX_MMU_UPDATES];
  39.520 +    int          idx;
  39.521 +    domid_t      subject;
  39.522 +};
  39.523 +typedef struct xc_mmu xc_mmu_t;
  39.524 +xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
  39.525 +int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
  39.526 +                   unsigned long ptr, unsigned long val);
  39.527 +int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
  39.528 +
  39.529 +#endif
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/tools/libxc/xenguest.h	Thu Aug 25 00:55:20 2005 +0000
    40.3 @@ -0,0 +1,66 @@
    40.4 +/******************************************************************************
    40.5 + * xenguest.h
    40.6 + * 
    40.7 + * A library for guest domain management in Xen.
    40.8 + * 
    40.9 + * Copyright (c) 2003-2004, K A Fraser.
   40.10 + */
   40.11 +
   40.12 +#ifndef XENBUILD_H
   40.13 +#define XENBUILD_H
   40.14 +
   40.15 +#define XCFLAGS_VERBOSE   1
   40.16 +#define XCFLAGS_LIVE      2
   40.17 +#define XCFLAGS_DEBUG     4
   40.18 +#define XCFLAGS_CONFIGURE 8
   40.19 +
   40.20 +/**
   40.21 + * This function will save a domain running Linux.
   40.22 + *
   40.23 + * @parm xc_handle a handle to an open hypervisor interface
   40.24 + * @parm fd the file descriptor to save a domain to
   40.25 + * @parm dom the id of the domain
   40.26 + * @return 0 on success, -1 on failure
   40.27 + */
   40.28 +int xc_linux_save(int xc_handle, int fd, uint32_t dom);
   40.29 +
   40.30 +/**
   40.31 + * This function will restore a saved domain running Linux.
   40.32 + *
   40.33 + * @parm xc_handle a handle to an open hypervisor interface
   40.34 + * @parm fd the file descriptor to restore a domain from
   40.35 + * @parm dom the id of the domain
   40.36 + * @parm nr_pfns the number of pages
   40.37 + * @parm store_evtchn the store event channel for this domain to use
   40.38 + * @parm store_mfn returned with the mfn of the store page
   40.39 + * @return 0 on success, -1 on failure
   40.40 + */
   40.41 +int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pfns,
   40.42 +		     unsigned int store_evtchn, unsigned long *store_mfn);
   40.43 +
   40.44 +int xc_linux_build(int xc_handle,
   40.45 +                   uint32_t domid,
   40.46 +                   const char *image_name,
   40.47 +                   const char *ramdisk_name,
   40.48 +                   const char *cmdline,
   40.49 +                   unsigned int control_evtchn,
   40.50 +                   unsigned long flags,
   40.51 +                   unsigned int vcpus,
   40.52 +                   unsigned int store_evtchn,
   40.53 +                   unsigned long *store_mfn);
   40.54 +
   40.55 +struct mem_map;
   40.56 +int xc_vmx_build(int xc_handle,
   40.57 +                 uint32_t domid,
   40.58 +                 int memsize,
   40.59 +                 const char *image_name,
   40.60 +                 struct mem_map *memmap,
   40.61 +                 const char *ramdisk_name,
   40.62 +                 const char *cmdline,
   40.63 +                 unsigned int control_evtchn,
   40.64 +                 unsigned long flags,
   40.65 +                 unsigned int vcpus,
   40.66 +                 unsigned int store_evtchn,
   40.67 +                 unsigned long *store_mfn);
   40.68 +
   40.69 +#endif
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/tools/libxc/xg_private.c	Thu Aug 25 00:55:20 2005 +0000
    41.3 @@ -0,0 +1,86 @@
    41.4 +/******************************************************************************
    41.5 + * xg_private.c
    41.6 + * 
    41.7 + * Helper functions for the rest of the library.
    41.8 + */
    41.9 +
   41.10 +#include <stdlib.h>
   41.11 +#include <zlib.h>
   41.12 +
   41.13 +#include "xg_private.h"
   41.14 +
   41.15 +char *xc_read_kernel_image(const char *filename, unsigned long *size)
   41.16 +{
   41.17 +    int kernel_fd = -1;
   41.18 +    gzFile kernel_gfd = NULL;
   41.19 +    char *image = NULL;
   41.20 +    unsigned int bytes;
   41.21 +
   41.22 +    if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
   41.23 +    {
   41.24 +        PERROR("Could not open kernel image");
   41.25 +        goto out;
   41.26 +    }
   41.27 +
   41.28 +    if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
   41.29 +    {
   41.30 +        PERROR("Could not read kernel image");
   41.31 +        goto out;
   41.32 +    }
   41.33 +
   41.34 +    if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
   41.35 +    {
   41.36 +        PERROR("Could not allocate decompression state for state file");
   41.37 +        goto out;
   41.38 +    }
   41.39 +
   41.40 +    if ( (image = malloc(*size)) == NULL )
   41.41 +    {
   41.42 +        PERROR("Could not allocate memory for kernel image");
   41.43 +        goto out;
   41.44 +    }
   41.45 +
   41.46 +    if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
   41.47 +    {
   41.48 +        PERROR("Error reading kernel image, could not"
   41.49 +               " read the whole image (%d != %ld).", bytes, *size);
   41.50 +        free(image);
   41.51 +        image = NULL;
   41.52 +    }
   41.53 +
   41.54 + out:
   41.55 +    if ( kernel_gfd != NULL )
   41.56 +        gzclose(kernel_gfd);
   41.57 +    else if ( kernel_fd >= 0 )
   41.58 +        close(kernel_fd);
   41.59 +    return image;
   41.60 +}
   41.61 +
   41.62 +/*******************/
   41.63 +
   41.64 +int pin_table(
   41.65 +    int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
   41.66 +{
   41.67 +    struct mmuext_op op;
   41.68 +
   41.69 +    op.cmd = type;
   41.70 +    op.mfn = mfn;
   41.71 +
   41.72 +    if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 )
   41.73 +        return 1;
   41.74 +
   41.75 +    return 0;
   41.76 +}
   41.77 +
   41.78 +/* This is shared between save and restore, and may generally be useful. */
   41.79 +unsigned long csum_page (void * page)
   41.80 +{
   41.81 +    int i;
   41.82 +    unsigned long *p = page;
   41.83 +    unsigned long long sum=0;
   41.84 +
   41.85 +    for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
   41.86 +        sum += p[i];
   41.87 +
   41.88 +    return sum ^ (sum>>32);
   41.89 +}
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/tools/libxc/xg_private.h	Thu Aug 25 00:55:20 2005 +0000
    42.3 @@ -0,0 +1,170 @@
    42.4 +#ifndef XG_PRIVATE_H
    42.5 +#define XG_PRIVATE_H
    42.6 +
    42.7 +#include <errno.h>
    42.8 +#include <fcntl.h>
    42.9 +#include <stdio.h>
   42.10 +#include <string.h>
   42.11 +#include <sys/mman.h>
   42.12 +#include <sys/types.h>
   42.13 +#include <sys/stat.h>
   42.14 +
   42.15 +#include "xenctrl.h"
   42.16 +
   42.17 +#include <xen/linux/privcmd.h>
   42.18 +
   42.19 +char *xc_read_kernel_image(const char *filename, unsigned long *size);
   42.20 +unsigned long csum_page (void * page);
   42.21 +
   42.22 +#define _PAGE_PRESENT   0x001
   42.23 +#define _PAGE_RW        0x002
   42.24 +#define _PAGE_USER      0x004
   42.25 +#define _PAGE_PWT       0x008
   42.26 +#define _PAGE_PCD       0x010
   42.27 +#define _PAGE_ACCESSED  0x020
   42.28 +#define _PAGE_DIRTY     0x040
   42.29 +#define _PAGE_PAT       0x080
   42.30 +#define _PAGE_PSE       0x080
   42.31 +#define _PAGE_GLOBAL    0x100
   42.32 +
   42.33 +#if defined(__i386__)
   42.34 +#define L1_PAGETABLE_SHIFT       12
   42.35 +#define L2_PAGETABLE_SHIFT       22
   42.36 +#define L1_PAGETABLE_SHIFT_PAE   12
   42.37 +#define L2_PAGETABLE_SHIFT_PAE   21
   42.38 +#define L3_PAGETABLE_SHIFT_PAE   30
   42.39 +#elif defined(__x86_64__)
   42.40 +#define L1_PAGETABLE_SHIFT      12
   42.41 +#define L2_PAGETABLE_SHIFT      21
   42.42 +#define L3_PAGETABLE_SHIFT      30
   42.43 +#define L4_PAGETABLE_SHIFT      39
   42.44 +#endif
   42.45 +
   42.46 +#if defined(__i386__) 
   42.47 +#define ENTRIES_PER_L1_PAGETABLE 1024
   42.48 +#define ENTRIES_PER_L2_PAGETABLE 1024
   42.49 +#define L1_PAGETABLE_ENTRIES_PAE  512
   42.50 +#define L2_PAGETABLE_ENTRIES_PAE  512
   42.51 +#define L3_PAGETABLE_ENTRIES_PAE    4
   42.52 +#elif defined(__x86_64__)
   42.53 +#define L1_PAGETABLE_ENTRIES    512
   42.54 +#define L2_PAGETABLE_ENTRIES    512
   42.55 +#define L3_PAGETABLE_ENTRIES    512
   42.56 +#define L4_PAGETABLE_ENTRIES    512
   42.57 +#endif
   42.58 + 
   42.59 +#define PAGE_SHIFT              XC_PAGE_SHIFT
   42.60 +#define PAGE_SIZE               (1UL << PAGE_SHIFT)
   42.61 +#define PAGE_MASK               (~(PAGE_SIZE-1))
   42.62 +
   42.63 +typedef u32 l1_pgentry_32_t;
   42.64 +typedef u32 l2_pgentry_32_t;
   42.65 +typedef u64 l1_pgentry_64_t;
   42.66 +typedef u64 l2_pgentry_64_t;
   42.67 +typedef u64 l3_pgentry_64_t;
   42.68 +typedef unsigned long l1_pgentry_t;
   42.69 +typedef unsigned long l2_pgentry_t;
   42.70 +#if defined(__x86_64__)
   42.71 +typedef unsigned long l3_pgentry_t;
   42.72 +typedef unsigned long l4_pgentry_t;
   42.73 +#endif
   42.74 +
   42.75 +#if defined(__i386__)
   42.76 +#define l1_table_offset(_a) \
   42.77 +          (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
   42.78 +#define l2_table_offset(_a) \
   42.79 +          ((_a) >> L2_PAGETABLE_SHIFT)
   42.80 +#define l1_table_offset_pae(_a) \
   42.81 +  (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
   42.82 +#define l2_table_offset_pae(_a) \
   42.83 +  (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
   42.84 +#define l3_table_offset_pae(_a) \
   42.85 +	(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
   42.86 +#elif defined(__x86_64__)
   42.87 +#define l1_table_offset(_a) \
   42.88 +  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   42.89 +#define l2_table_offset(_a) \
   42.90 +  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   42.91 +#define l3_table_offset(_a) \
   42.92 +	(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   42.93 +#define l4_table_offset(_a) \
   42.94 +	(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
   42.95 +#endif
   42.96 +
   42.97 +#define ERROR(_m, _a...)                                \
   42.98 +do {                                                    \
   42.99 +    int __saved_errno = errno;                          \
  42.100 +    fprintf(stderr, "ERROR: " _m "\n" , ## _a );        \
  42.101 +    errno = __saved_errno;                              \
  42.102 +} while (0)
  42.103 +
  42.104 +
  42.105 +#define PERROR(_m, _a...)                                       \
  42.106 +do {                                                            \
  42.107 +    int __saved_errno = errno;                                  \
  42.108 +    fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a ,       \
  42.109 +            __saved_errno, strerror(__saved_errno));            \
  42.110 +    errno = __saved_errno;                                      \
  42.111 +} while (0)
  42.112 +
  42.113 +
  42.114 +struct domain_setup_info
  42.115 +{
  42.116 +    unsigned long v_start;
  42.117 +    unsigned long v_end;
  42.118 +    unsigned long v_kernstart;
  42.119 +    unsigned long v_kernend;
  42.120 +    unsigned long v_kernentry;
  42.121 +
  42.122 +    unsigned int  load_symtab;
  42.123 +    unsigned int  pae_kernel;
  42.124 +    unsigned long symtab_addr;
  42.125 +    unsigned long symtab_len;
  42.126 +};
  42.127 +
  42.128 +typedef int (*parseimagefunc)(char *image, unsigned long image_size,
  42.129 +			      struct domain_setup_info *dsi);
  42.130 +typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
  42.131 +			     u32 dom, unsigned long *parray,
  42.132 +			     struct domain_setup_info *dsi);
  42.133 +
  42.134 +struct load_funcs
  42.135 +{
  42.136 +    parseimagefunc parseimage;
  42.137 +    loadimagefunc loadimage;
  42.138 +};
  42.139 +
  42.140 +#define mfn_mapper_queue_size 128
  42.141 +
  42.142 +typedef struct mfn_mapper {
  42.143 +    int xc_handle;
  42.144 +    int size;
  42.145 +    int prot;
  42.146 +    int error;
  42.147 +    int max_queue_size;
  42.148 +    void * addr;
  42.149 +    privcmd_mmap_t ioctl; 
  42.150 +    
  42.151 +} mfn_mapper_t;
  42.152 +
  42.153 +unsigned long xc_get_m2p_start_mfn (int xc_handle);
  42.154 +
  42.155 +int xc_copy_to_domain_page(int xc_handle, u32 domid,
  42.156 +                            unsigned long dst_pfn, void *src_page);
  42.157 +
  42.158 +unsigned long xc_get_filesz(int fd);
  42.159 +
  42.160 +void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  42.161 +                   int xch, u32 dom, unsigned long *parray,
  42.162 +                   unsigned long vstart);
  42.163 +
  42.164 +int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
  42.165 +	      domid_t dom);
  42.166 +
  42.167 +/* image loading */
  42.168 +int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
  42.169 +int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
  42.170 +int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
  42.171 +
  42.172 +#endif
  42.173 +
    43.1 --- a/tools/misc/Makefile	Wed Aug 24 22:24:10 2005 +0000
    43.2 +++ b/tools/misc/Makefile	Thu Aug 25 00:55:20 2005 +0000
    43.3 @@ -50,4 +50,4 @@ clean:
    43.4  	$(CC) -c $(CFLAGS) -o $@ $<
    43.5  
    43.6  $(TARGETS): %: %.o Makefile
    43.7 -	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
    43.8 +	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
    44.1 --- a/tools/misc/cpuperf/Makefile	Wed Aug 24 22:24:10 2005 +0000
    44.2 +++ b/tools/misc/cpuperf/Makefile	Thu Aug 25 00:55:20 2005 +0000
    44.3 @@ -37,7 +37,7 @@ clean:
    44.4  	$(CC) $(CFLAGS) -o $@ $<
    44.5  
    44.6  cpuperf-xen: cpuperf.c $(HDRS) Makefile
    44.7 -	$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxc -DXENO -o $@ $<
    44.8 +	$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxenctrl -DXENO -o $@ $<
    44.9  
   44.10  cpuperf-perfcntr: cpuperf.c $(HDRS) Makefile
   44.11  	$(CC) $(CFLAGS) -DPERFCNTR -o $@ $<
    45.1 --- a/tools/misc/cpuperf/cpuperf_xeno.h	Wed Aug 24 22:24:10 2005 +0000
    45.2 +++ b/tools/misc/cpuperf/cpuperf_xeno.h	Thu Aug 25 00:55:20 2005 +0000
    45.3 @@ -9,7 +9,7 @@
    45.4   *
    45.5   */
    45.6  
    45.7 -#include <xc.h>
    45.8 +#include <xenctrl.h>
    45.9  
   45.10  static int xc_handle;
   45.11  
    46.1 --- a/tools/misc/xc_shadow.c	Wed Aug 24 22:24:10 2005 +0000
    46.2 +++ b/tools/misc/xc_shadow.c	Thu Aug 25 00:55:20 2005 +0000
    46.3 @@ -11,7 +11,7 @@
    46.4   */
    46.5  
    46.6  
    46.7 -#include <xc.h>
    46.8 +#include <xenctrl.h>
    46.9  #include <stdio.h>
   46.10  #include <stdlib.h>
   46.11  #include <sys/mman.h>
    47.1 --- a/tools/misc/xenperf.c	Wed Aug 24 22:24:10 2005 +0000
    47.2 +++ b/tools/misc/xenperf.c	Thu Aug 25 00:55:20 2005 +0000
    47.3 @@ -11,7 +11,7 @@
    47.4   */
    47.5  
    47.6  
    47.7 -#include <xc.h>
    47.8 +#include <xenctrl.h>
    47.9  #include <stdio.h>
   47.10  #include <stdlib.h>
   47.11  #include <sys/mman.h>
    48.1 --- a/tools/python/setup.py	Wed Aug 24 22:24:10 2005 +0000
    48.2 +++ b/tools/python/setup.py	Thu Aug 25 00:55:20 2005 +0000
    48.3 @@ -17,7 +17,7 @@ library_dirs = [ XEN_ROOT + "/tools/libx
    48.4                   XEN_ROOT + "/tools/xenstore",
    48.5                   ]
    48.6  
    48.7 -libraries = [ "xc", "xenstore" ]
    48.8 +libraries = [ "xenctrl", "xenguest", "xenstore" ]
    48.9  
   48.10  xc = Extension("xc",
   48.11                 extra_compile_args = extra_compile_args,
   48.12 @@ -41,7 +41,7 @@ xs = Extension("xs",
   48.13                 sources            = [ "xen/lowlevel/xs/xs.c" ])
   48.14  
   48.15  setup(name            = 'xen',
   48.16 -      version         = '2.0',
   48.17 +      version         = '3.0',
   48.18        description     = 'Xen',
   48.19        packages        = ['xen',
   48.20                           'xen.lowlevel',
    49.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Aug 24 22:24:10 2005 +0000
    49.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Aug 25 00:55:20 2005 +0000
    49.3 @@ -5,7 +5,8 @@
    49.4   */
    49.5  
    49.6  #include <Python.h>
    49.7 -#include <xc.h>
    49.8 +#include <xenctrl.h>
    49.9 +#include <xenguest.h>
   49.10  #include <zlib.h>
   49.11  #include <fcntl.h>
   49.12  #include <netinet/in.h>
    50.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Wed Aug 24 22:24:10 2005 +0000
    50.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Thu Aug 25 00:55:20 2005 +0000
    50.3 @@ -21,7 +21,7 @@
    50.4  #include <unistd.h>
    50.5  #include <errno.h>
    50.6  #include <signal.h>
    50.7 -#include <xc.h>
    50.8 +#include <xenctrl.h>
    50.9  
   50.10  #include <xen/xen.h>
   50.11  #include <xen/io/domain_controller.h>
    51.1 --- a/tools/xcs/Makefile	Wed Aug 24 22:24:10 2005 +0000
    51.2 +++ b/tools/xcs/Makefile	Thu Aug 25 00:55:20 2005 +0000
    51.3 @@ -34,10 +34,10 @@ clean:
    51.4  
    51.5  xcsdump: xcsdump.c dump.c
    51.6  	$(CC) $(CFLAGS) -o xcsdump xcsdump.c -L$(XEN_LIBXC) \
    51.7 -              ctrl_interface.c evtchn.c dump.c -lxc
    51.8 +              ctrl_interface.c evtchn.c dump.c -lxenctrl
    51.9  
   51.10  $(BIN): $(OBJS)
   51.11 -	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxc 
   51.12 +	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxenctrl 
   51.13  
   51.14  $(OBJS): $(HDRS)
   51.15  
    52.1 --- a/tools/xcs/dump.h	Wed Aug 24 22:24:10 2005 +0000
    52.2 +++ b/tools/xcs/dump.h	Thu Aug 25 00:55:20 2005 +0000
    52.3 @@ -20,7 +20,7 @@
    52.4  #define XENCTLD_ERROR_H
    52.5  
    52.6  #include <stdint.h>
    52.7 -#include <xc.h>
    52.8 +#include <xenctrl.h>
    52.9  #include <xen/io/domain_controller.h>
   52.10  
   52.11  void dump_msg(const control_msg_t *msg, uint64_t flags);
    53.1 --- a/tools/xcs/xcs.h	Wed Aug 24 22:24:10 2005 +0000
    53.2 +++ b/tools/xcs/xcs.h	Thu Aug 25 00:55:20 2005 +0000
    53.3 @@ -11,7 +11,7 @@
    53.4  #define __XCS_H__
    53.5  
    53.6  #include <pthread.h>
    53.7 -#include <xc.h>
    53.8 +#include <xenctrl.h>
    53.9  #include <xen/xen.h>
   53.10  #include <xen/io/domain_controller.h>
   53.11  #include <xen/linux/privcmd.h>
    54.1 --- a/tools/xcs/xcsdump.c	Wed Aug 24 22:24:10 2005 +0000
    54.2 +++ b/tools/xcs/xcsdump.c	Thu Aug 25 00:55:20 2005 +0000
    54.3 @@ -16,7 +16,7 @@
    54.4  #include <sys/socket.h>
    54.5  #include <sys/un.h>
    54.6  #include <ctype.h>
    54.7 -#include <xc.h>
    54.8 +#include <xenctrl.h>
    54.9  #include <xen/xen.h>
   54.10  #include <xen/io/domain_controller.h>
   54.11  #include <getopt.h>
    55.1 --- a/tools/xcutils/Makefile	Wed Aug 24 22:24:10 2005 +0000
    55.2 +++ b/tools/xcutils/Makefile	Thu Aug 25 00:55:20 2005 +0000
    55.3 @@ -30,7 +30,7 @@ PROG_DEP = .*.d
    55.4  
    55.5  PROGRAMS		= xc_restore xc_save
    55.6  
    55.7 -LDLIBS			= -L$(XEN_LIBXC) -lxc
    55.8 +LDLIBS			= -L$(XEN_LIBXC) -lxenguest -lxenctrl
    55.9  
   55.10  .PHONY: all
   55.11  all: build
    56.1 --- a/tools/xcutils/xc_restore.c	Wed Aug 24 22:24:10 2005 +0000
    56.2 +++ b/tools/xcutils/xc_restore.c	Thu Aug 25 00:55:20 2005 +0000
    56.3 @@ -7,11 +7,12 @@
    56.4   *
    56.5   */
    56.6  
    56.7 +#include <err.h>
    56.8  #include <stdlib.h>
    56.9 +#include <stdint.h>
   56.10  #include <stdio.h>
   56.11 -#include <err.h>
   56.12  
   56.13 -#include <xc.h>
   56.14 +#include <xenguest.h>
   56.15  
   56.16  int
   56.17  main(int argc, char **argv)
    57.1 --- a/tools/xcutils/xc_save.c	Wed Aug 24 22:24:10 2005 +0000
    57.2 +++ b/tools/xcutils/xc_save.c	Thu Aug 25 00:55:20 2005 +0000
    57.3 @@ -7,11 +7,12 @@
    57.4   *
    57.5   */
    57.6  
    57.7 +#include <err.h>
    57.8  #include <stdlib.h>
    57.9 +#include <stdint.h>
   57.10  #include <stdio.h>
   57.11 -#include <err.h>
   57.12  
   57.13 -#include <xc.h>
   57.14 +#include <xenguest.h>
   57.15  
   57.16  int
   57.17  main(int argc, char **argv)
    58.1 --- a/tools/xenstore/Makefile	Wed Aug 24 22:24:10 2005 +0000
    58.2 +++ b/tools/xenstore/Makefile	Thu Aug 25 00:55:20 2005 +0000
    58.3 @@ -32,7 +32,7 @@ xen:
    58.4  	ln -sf $(XEN_ROOT)/xen/include/public $@
    58.5  
    58.6  xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o
    58.7 -	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
    58.8 +	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
    58.9  
   58.10  xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o
   58.11  	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
   58.12 @@ -103,7 +103,7 @@ stresstest: xs_stress xenstored_test
   58.13  	export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
   58.14  
   58.15  xs_dom0_test: xs_dom0_test.o utils.o
   58.16 -	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
   58.17 +	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
   58.18  
   58.19  TAGS:
   58.20  	etags `find . -name '*.[ch]'`
    59.1 --- a/tools/xenstore/xs_dom0_test.c	Wed Aug 24 22:24:10 2005 +0000
    59.2 +++ b/tools/xenstore/xs_dom0_test.c	Thu Aug 25 00:55:20 2005 +0000
    59.3 @@ -3,7 +3,7 @@
    59.4  #include <sys/ioctl.h>
    59.5  #include "xs.h"
    59.6  #include "utils.h"
    59.7 -#include <xc.h>
    59.8 +#include <xenctrl.h>
    59.9  #include <xen/linux/privcmd.h>
   59.10  #include <stdio.h>
   59.11  #include <unistd.h>
    60.1 --- a/tools/xenstore/xs_lib.h	Wed Aug 24 22:24:10 2005 +0000
    60.2 +++ b/tools/xenstore/xs_lib.h	Thu Aug 25 00:55:20 2005 +0000
    60.3 @@ -22,7 +22,7 @@
    60.4  
    60.5  #include <stdbool.h>
    60.6  #include <limits.h>
    60.7 -#include <xc.h>
    60.8 +#include <xenctrl.h>
    60.9  
   60.10  /* Bitmask of permissions. */
   60.11  enum xs_perm_type {
    61.1 --- a/tools/xentrace/Makefile	Wed Aug 24 22:24:10 2005 +0000
    61.2 +++ b/tools/xentrace/Makefile	Thu Aug 25 00:55:20 2005 +0000
    61.3 @@ -36,4 +36,4 @@ clean:
    61.4  	$(RM) *.a *.so *.o *.rpm $(BIN)
    61.5  
    61.6  %: %.c $(HDRS) Makefile
    61.7 -	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
    61.8 +	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
    62.1 --- a/tools/xentrace/xenctx.c	Wed Aug 24 22:24:10 2005 +0000
    62.2 +++ b/tools/xentrace/xenctx.c	Thu Aug 25 00:55:20 2005 +0000
    62.3 @@ -21,7 +21,7 @@
    62.4  #include <argp.h>
    62.5  #include <signal.h>
    62.6  
    62.7 -#include "xc.h"
    62.8 +#include "xenctrl.h"
    62.9  
   62.10  #ifdef __i386__
   62.11  void print_ctx(vcpu_guest_context_t *ctx1)