direct-io.hg

changeset 6406: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
    20.1 --- a/tools/blktap/blktaplib.h	Wed Aug 24 22:24:10 2005 +0000
    20.2 +++ b/tools/blktap/blktaplib.h	Thu Aug 25 00:55:20 2005 +0000
    20.3 @@ -7,7 +7,7 @@
    20.4  #ifndef __BLKTAPLIB_H__
    20.5  #define __BLKTAPLIB_H__
    20.6  
    20.7 -#include <xc.h>
    20.8 +#include <xenctrl.h>
    20.9  #include <sys/user.h>
   20.10  #include <xen/xen.h>
   20.11  #include <xen/io/blkif.h>
    21.1 --- a/tools/blktap/parallax/block-async.h	Wed Aug 24 22:24:10 2005 +0000
    21.2 +++ b/tools/blktap/parallax/block-async.h	Thu Aug 25 00:55:20 2005 +0000
    21.3 @@ -7,7 +7,7 @@
    21.4  #define _BLOCKASYNC_H_
    21.5  
    21.6  #include <assert.h>
    21.7 -#include <xc.h>
    21.8 +#include <xenctrl.h>
    21.9  #include "vdi.h"
   21.10  
   21.11  struct io_ret
    22.1 --- a/tools/blktap/parallax/blockstore.h	Wed Aug 24 22:24:10 2005 +0000
    22.2 +++ b/tools/blktap/parallax/blockstore.h	Thu Aug 25 00:55:20 2005 +0000
    22.3 @@ -10,7 +10,7 @@
    22.4  #define __BLOCKSTORE_H__
    22.5  
    22.6  #include <netinet/in.h>
    22.7 -#include <xc.h>
    22.8 +#include <xenctrl.h>
    22.9  
   22.10  #define BLOCK_SIZE  4096
   22.11  #define BLOCK_SHIFT   12
    23.1 --- a/tools/console/Makefile	Wed Aug 24 22:24:10 2005 +0000
    23.2 +++ b/tools/console/Makefile	Thu Aug 25 00:55:20 2005 +0000
    23.3 @@ -26,11 +26,11 @@ clean:
    23.4  
    23.5  xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
    23.6  	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
    23.7 -              -lxc -lxenstore
    23.8 +              -lxenctrl -lxenstore
    23.9  
   23.10  xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
   23.11  	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
   23.12 -	      -lxc -lxenstore
   23.13 +	      -lxenctrl -lxenstore
   23.14  
   23.15  install: $(BIN)
   23.16  	$(INSTALL_DIR) -p $(DESTDIR)/$(DAEMON_INSTALL_DIR)
    24.1 --- a/tools/console/client/main.c	Wed Aug 24 22:24:10 2005 +0000
    24.2 +++ b/tools/console/client/main.c	Thu Aug 25 00:55:20 2005 +0000
    24.3 @@ -36,7 +36,7 @@
    24.4  #include <errno.h>
    24.5  #include <pty.h>
    24.6  
    24.7 -#include "xc.h"
    24.8 +#include "xenctrl.h"
    24.9  #include "xs.h"
   24.10  
   24.11  #define ESCAPE_CHARACTER 0x1d
    25.1 --- a/tools/console/daemon/io.c	Wed Aug 24 22:24:10 2005 +0000
    25.2 +++ b/tools/console/daemon/io.c	Thu Aug 25 00:55:20 2005 +0000
    25.3 @@ -23,7 +23,7 @@
    25.4  #include "utils.h"
    25.5  #include "io.h"
    25.6  
    25.7 -#include "xc.h"
    25.8 +#include "xenctrl.h"
    25.9  #include "xs.h"
   25.10  #include "xen/io/domain_controller.h"
   25.11  #include "xcs_proto.h"
    26.1 --- a/tools/console/daemon/main.c	Wed Aug 24 22:24:10 2005 +0000
    26.2 +++ b/tools/console/daemon/main.c	Thu Aug 25 00:55:20 2005 +0000
    26.3 @@ -25,7 +25,7 @@
    26.4  #include <unistd.h>
    26.5  #include <sys/types.h>
    26.6  
    26.7 -#include "xc.h"
    26.8 +#include "xenctrl.h"
    26.9  #include "xen/io/domain_controller.h"
   26.10  #include "xcs_proto.h"
   26.11  
    27.1 --- a/tools/console/daemon/utils.c	Wed Aug 24 22:24:10 2005 +0000
    27.2 +++ b/tools/console/daemon/utils.c	Thu Aug 25 00:55:20 2005 +0000
    27.3 @@ -33,7 +33,7 @@
    27.4  #include <sys/un.h>
    27.5  #include <string.h>
    27.6  
    27.7 -#include "xc.h"
    27.8 +#include "xenctrl.h"
    27.9  #include "xen/io/domain_controller.h"
   27.10  #include "xcs_proto.h"
   27.11  
    28.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
    28.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
    28.3 @@ -35,7 +35,7 @@
    28.4  #include <stdlib.h>
    28.5  #include <unistd.h>
    28.6  #include <errno.h>
    28.7 -#include <xc.h>
    28.8 +#include <xenctrl.h>
    28.9  #define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */
   28.10  long (*myptrace)(enum __ptrace_request, pid_t, long, long);
   28.11  int (*myxcwait)(int domain, int *status, int options) ;
    29.1 --- a/tools/debugger/libxendebug/Makefile	Wed Aug 24 22:24:10 2005 +0000
    29.2 +++ b/tools/debugger/libxendebug/Makefile	Thu Aug 25 00:55:20 2005 +0000
    29.3 @@ -20,7 +20,7 @@ CFLAGS   += $(INCLUDES) -I. -I$(XEN_ROOT
    29.4  CFLAGS   += -Wp,-MD,.$(@F).d
    29.5  DEPS     = .*.d
    29.6  
    29.7 -LDFLAGS  += -L$(XEN_ROOT)/tools/libxc -lxc
    29.8 +LDFLAGS  += -L$(XEN_ROOT)/tools/libxc -lxenctrl
    29.9  
   29.10  LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
   29.11  PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
    30.1 --- a/tools/debugger/libxendebug/xendebug.c	Wed Aug 24 22:24:10 2005 +0000
    30.2 +++ b/tools/debugger/libxendebug/xendebug.c	Thu Aug 25 00:55:20 2005 +0000
    30.3 @@ -12,7 +12,7 @@
    30.4  #include <string.h>
    30.5  #include <errno.h>
    30.6  #include <sys/mman.h>
    30.7 -#include <xc.h>
    30.8 +#include <xenctrl.h>
    30.9  #include "list.h"
   30.10  
   30.11  #if defined(__i386__)
    31.1 --- a/tools/debugger/libxendebug/xendebug.h	Wed Aug 24 22:24:10 2005 +0000
    31.2 +++ b/tools/debugger/libxendebug/xendebug.h	Thu Aug 25 00:55:20 2005 +0000
    31.3 @@ -9,7 +9,7 @@
    31.4  #ifndef _XENDEBUG_H_DEFINED
    31.5  #define _XENDEBUG_H_DEFINED
    31.6  
    31.7 -#include <xc.h>
    31.8 +#include <xenctrl.h>
    31.9  
   31.10  int xendebug_attach(int xc_handle,
   31.11  		    u32 domid,
    32.1 --- a/tools/debugger/pdb/pdb_caml_domain.c	Wed Aug 24 22:24:10 2005 +0000
    32.2 +++ b/tools/debugger/pdb/pdb_caml_domain.c	Thu Aug 25 00:55:20 2005 +0000
    32.3 @@ -6,7 +6,7 @@
    32.4   * PDB's OCaml interface library for debugging domains
    32.5   */
    32.6  
    32.7 -#include <xc.h>
    32.8 +#include <xenctrl.h>
    32.9  #include <xendebug.h>
   32.10  #include <errno.h>
   32.11  #include <stdio.h>
    33.1 --- a/tools/debugger/pdb/pdb_caml_evtchn.c	Wed Aug 24 22:24:10 2005 +0000
    33.2 +++ b/tools/debugger/pdb/pdb_caml_evtchn.c	Thu Aug 25 00:55:20 2005 +0000
    33.3 @@ -6,7 +6,7 @@
    33.4   * PDB's OCaml interface library for event channels
    33.5   */
    33.6  
    33.7 -#include <xc.h>
    33.8 +#include <xenctrl.h>
    33.9  #include <stdio.h>
   33.10  #include <stdlib.h>
   33.11  #include <string.h>
    34.1 --- a/tools/debugger/pdb/pdb_caml_process.c	Wed Aug 24 22:24:10 2005 +0000
    34.2 +++ b/tools/debugger/pdb/pdb_caml_process.c	Thu Aug 25 00:55:20 2005 +0000
    34.3 @@ -15,7 +15,7 @@
    34.4  #include <caml/memory.h>
    34.5  #include <caml/mlvalues.h>
    34.6  
    34.7 -#include <xc.h>
    34.8 +#include <xenctrl.h>
    34.9  #include <xen/xen.h>
   34.10  #include <xen/io/domain_controller.h>
   34.11  #include <xen/linux/privcmd.h>
    35.1 --- a/tools/debugger/pdb/pdb_caml_xc.c	Wed Aug 24 22:24:10 2005 +0000
    35.2 +++ b/tools/debugger/pdb/pdb_caml_xc.c	Thu Aug 25 00:55:20 2005 +0000
    35.3 @@ -6,7 +6,7 @@
    35.4   * PDB's OCaml interface library for debugging domains
    35.5   */
    35.6  
    35.7 -#include <xc.h>
    35.8 +#include <xenctrl.h>
    35.9  #include <xendebug.h>
   35.10  #include <errno.h>
   35.11  #include <stdio.h>
    36.1 --- a/tools/debugger/pdb/pdb_caml_xcs.c	Wed Aug 24 22:24:10 2005 +0000
    36.2 +++ b/tools/debugger/pdb/pdb_caml_xcs.c	Thu Aug 25 00:55:20 2005 +0000
    36.3 @@ -17,7 +17,7 @@
    36.4  #include <sys/types.h>
    36.5  #include <sys/socket.h>
    36.6  #include <errno.h>
    36.7 -#include <xc.h>
    36.8 +#include <xenctrl.h>
    36.9  
   36.10  #include <xen/xen.h>
   36.11  #include <xen/io/domain_controller.h>
    37.1 --- a/tools/debugger/pdb/pdb_xen.c	Wed Aug 24 22:24:10 2005 +0000
    37.2 +++ b/tools/debugger/pdb/pdb_xen.c	Thu Aug 25 00:55:20 2005 +0000
    37.3 @@ -7,7 +7,7 @@
    37.4   * PDB interface library for accessing Xen
    37.5   */
    37.6  
    37.7 -#include <xc.h>
    37.8 +#include <xenctrl.h>
    37.9  #include <stdio.h>
   37.10  #include <stdlib.h>
   37.11  #include <errno.h>
    38.1 --- a/tools/firmware/acpi/acpi2_0.h	Wed Aug 24 22:24:10 2005 +0000
    38.2 +++ b/tools/firmware/acpi/acpi2_0.h	Thu Aug 25 00:55:20 2005 +0000
    38.3 @@ -18,7 +18,7 @@
    38.4  #ifndef _ACPI_2_0_H_
    38.5  #define _ACPI_2_0_H_
    38.6  
    38.7 -#include "xc.h"  // for u8, u16, u32, u64 definition
    38.8 +#include "xenctrl.h"  // for u8, u16, u32, u64 definition
    38.9  
   38.10  #pragma pack (1)
   38.11  
    39.1 --- a/tools/ioemu/hw/i8254.c	Wed Aug 24 22:24:10 2005 +0000
    39.2 +++ b/tools/ioemu/hw/i8254.c	Thu Aug 25 00:55:20 2005 +0000
    39.3 @@ -22,7 +22,7 @@
    39.4   * THE SOFTWARE.
    39.5   */
    39.6  #include "vl.h"
    39.7 -#include "xc.h"
    39.8 +#include "xenctrl.h"
    39.9  #include <io/ioreq.h>
   39.10  
   39.11  //#define DEBUG_PIT
    40.1 --- a/tools/ioemu/hw/i8259.c	Wed Aug 24 22:24:10 2005 +0000
    40.2 +++ b/tools/ioemu/hw/i8259.c	Thu Aug 25 00:55:20 2005 +0000
    40.3 @@ -22,7 +22,7 @@
    40.4   * THE SOFTWARE.
    40.5   */
    40.6  #include "vl.h"
    40.7 -#include "xc.h"
    40.8 +#include "xenctrl.h"
    40.9  #include <io/ioreq.h>
   40.10  
   40.11  /* debug PIC */
    41.1 --- a/tools/ioemu/hw/ioapic.h	Wed Aug 24 22:24:10 2005 +0000
    41.2 +++ b/tools/ioemu/hw/ioapic.h	Thu Aug 25 00:55:20 2005 +0000
    41.3 @@ -26,7 +26,7 @@
    41.4  #ifndef __IOAPIC_H
    41.5  #define __IOAPIC_H
    41.6  
    41.7 -#include "xc.h"
    41.8 +#include "xenctrl.h"
    41.9  #include <io/ioreq.h>
   41.10  #include <io/vmx_vlapic.h>
   41.11  
    42.1 --- a/tools/ioemu/target-i386-dm/Makefile	Wed Aug 24 22:24:10 2005 +0000
    42.2 +++ b/tools/ioemu/target-i386-dm/Makefile	Thu Aug 25 00:55:20 2005 +0000
    42.3 @@ -188,7 +188,7 @@ endif
    42.4  #########################################################
    42.5  
    42.6  DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DAPIC_SUPPORT
    42.7 -LIBS+=-lm -L../../libxc -lxc
    42.8 +LIBS+=-lm -L../../libxc -lxenctrl
    42.9  ifndef CONFIG_USER_ONLY
   42.10  LIBS+=-lz
   42.11  endif
    43.1 --- a/tools/ioemu/target-i386-dm/helper2.c	Wed Aug 24 22:24:10 2005 +0000
    43.2 +++ b/tools/ioemu/target-i386-dm/helper2.c	Thu Aug 25 00:55:20 2005 +0000
    43.3 @@ -47,7 +47,7 @@
    43.4  #include <fcntl.h>
    43.5  #include <sys/ioctl.h>
    43.6  
    43.7 -#include "xc.h"
    43.8 +#include "xenctrl.h"
    43.9  #include <io/ioreq.h>
   43.10  
   43.11  #include "cpu.h"
    44.1 --- a/tools/ioemu/vl.c	Wed Aug 24 22:24:10 2005 +0000
    44.2 +++ b/tools/ioemu/vl.c	Thu Aug 25 00:55:20 2005 +0000
    44.3 @@ -72,7 +72,7 @@
    44.4  #endif
    44.5  #endif /* CONFIG_SDL */
    44.6  
    44.7 -#include "xc.h"
    44.8 +#include "xenctrl.h"
    44.9  #include "exec-all.h"
   44.10  
   44.11  //#define DO_TB_FLUSH
    45.1 --- a/tools/libxc/Makefile	Wed Aug 24 22:24:10 2005 +0000
    45.2 +++ b/tools/libxc/Makefile	Thu Aug 25 00:55:20 2005 +0000
    45.3 @@ -12,28 +12,32 @@ CC       = gcc
    45.4  XEN_ROOT = ../..
    45.5  include $(XEN_ROOT)/tools/Rules.mk
    45.6  
    45.7 -SRCS     :=
    45.8 -SRCS     += xc_sedf.c
    45.9 -SRCS     += xc_bvtsched.c
   45.10 -SRCS     += xc_core.c
   45.11 -SRCS     += xc_domain.c
   45.12 -SRCS     += xc_evtchn.c
   45.13 -SRCS     += xc_gnttab.c
   45.14 -SRCS     += xc_load_bin.c
   45.15 -SRCS     += xc_load_elf.c
   45.16 -SRCS     += xc_linux_build.c
   45.17 -SRCS     += xc_misc.c
   45.18 -SRCS     += xc_physdev.c
   45.19 -SRCS     += xc_private.c
   45.20 +SRCS       :=
   45.21 +BUILD_SRCS :=
   45.22 +SRCS       += xc_bvtsched.c
   45.23 +SRCS       += xc_core.c
   45.24 +SRCS       += xc_domain.c
   45.25 +SRCS       += xc_evtchn.c
   45.26 +SRCS       += xc_gnttab.c
   45.27 +SRCS       += xc_misc.c
   45.28 +SRCS       += xc_physdev.c
   45.29 +SRCS       += xc_private.c
   45.30 +SRCS       += xc_sedf.c
   45.31 +
   45.32  ifeq ($(XEN_TARGET_ARCH),ia64)
   45.33 -SRCS     += xc_ia64_stubs.c
   45.34 +BUILD_SRCS += xc_ia64_stubs.c
   45.35  else
   45.36 -SRCS     += xc_load_aout9.c
   45.37 -SRCS     += xc_linux_restore.c
   45.38 -SRCS     += xc_linux_save.c
   45.39 -SRCS     += xc_vmx_build.c
   45.40 -SRCS     += xc_ptrace.c
   45.41 -SRCS     += xc_ptrace_core.c
   45.42 +SRCS       += xc_ptrace.c
   45.43 +SRCS       += xc_ptrace_core.c
   45.44 +
   45.45 +BUILD_SRCS := xc_load_aout9.c
   45.46 +BUILD_SRCS += xc_load_bin.c
   45.47 +BUILD_SRCS += xc_load_elf.c
   45.48 +BUILD_SRCS += xc_linux_build.c
   45.49 +BUILD_SRCS += xc_linux_restore.c
   45.50 +BUILD_SRCS += xc_linux_save.c
   45.51 +BUILD_SRCS += xc_vmx_build.c
   45.52 +BUILD_SRCS += xg_private.c
   45.53  endif
   45.54  
   45.55  CFLAGS   += -Wall
   45.56 @@ -43,13 +47,20 @@ CFLAGS   += -fno-strict-aliasing
   45.57  CFLAGS   += $(INCLUDES) -I.
   45.58  # Get gcc to generate the dependencies for us.
   45.59  CFLAGS   += -Wp,-MD,.$(@F).d
   45.60 +LDFLAGS  += -L.
   45.61  DEPS     = .*.d
   45.62  
   45.63  LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
   45.64  PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
   45.65  
   45.66 -LIB      := libxc.a libxc-pic.a
   45.67 -LIB      += libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
   45.68 +LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS))
   45.69 +PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS))
   45.70 +
   45.71 +LIB := libxenctrl.a
   45.72 +LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
   45.73 +
   45.74 +LIB += libxenguest.a
   45.75 +LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
   45.76  
   45.77  all: build
   45.78  build: check-for-zlib mk-symlinks
   45.79 @@ -77,11 +88,16 @@ mk-symlinks:
   45.80  install: build
   45.81  	[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
   45.82  	[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
   45.83 -	$(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   45.84 -	$(INSTALL_DATA) libxc.a $(DESTDIR)/usr/$(LIBDIR)
   45.85 -	ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so.$(MAJOR)
   45.86 -	ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so
   45.87 -	$(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
   45.88 +	$(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   45.89 +	$(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
   45.90 +	ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
   45.91 +	ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
   45.92 +	$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen
   45.93 +
   45.94 +	$(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
   45.95 +	$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
   45.96 +	ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
   45.97 +	ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
   45.98  
   45.99  .PHONY: TAGS clean rpm install all
  45.100  
  45.101 @@ -100,18 +116,30 @@ rpm: build
  45.102  	mv staging/i386/*.rpm .
  45.103  	rm -rf staging
  45.104  
  45.105 -libxc.a: $(LIB_OBJS)
  45.106 -	$(AR) rc $@ $^
  45.107 +# libxenctrl
  45.108  
  45.109 -libxc-pic.a: $(PIC_OBJS)
  45.110 +libxenctrl.a: $(LIB_OBJS)
  45.111  	$(AR) rc $@ $^
  45.112  
  45.113 -libxc.so: libxc.so.$(MAJOR)
  45.114 +libxenctrl.so: libxenctrl.so.$(MAJOR)
  45.115  	ln -sf $< $@
  45.116 -libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
  45.117 +libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
  45.118  	ln -sf $< $@
  45.119  
  45.120 -libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
  45.121 -	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -lz
  45.122 +libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
  45.123 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
  45.124 +
  45.125 +# libxenguest
  45.126 +
  45.127 +libxenguest.a: $(LIB_BUILD_OBJS)
  45.128 +	$(AR) rc $@ $^
  45.129 +
  45.130 +libxenguest.so: libxenguest.so.$(MAJOR)
  45.131 +	ln -sf $< $@
  45.132 +libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
  45.133 +	ln -sf $< $@
  45.134 +
  45.135 +libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS)
  45.136 +	$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl
  45.137  
  45.138  -include $(DEPS)
    46.1 --- a/tools/libxc/xc.h	Wed Aug 24 22:24:10 2005 +0000
    46.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    46.3 @@ -1,558 +0,0 @@
    46.4 -/******************************************************************************
    46.5 - * xc.h
    46.6 - * 
    46.7 - * A library for low-level access to the Xen control interfaces.
    46.8 - * 
    46.9 - * Copyright (c) 2003-2004, K A Fraser.
   46.10 - */
   46.11 -
   46.12 -#ifndef __XC_H__
   46.13 -#define __XC_H__
   46.14 -
   46.15 -#include <stdint.h>
   46.16 -
   46.17 -typedef uint8_t            u8;
   46.18 -typedef uint16_t           u16;
   46.19 -typedef uint32_t           u32;
   46.20 -typedef uint64_t           u64;
   46.21 -typedef int8_t             s8;
   46.22 -typedef int16_t            s16;
   46.23 -typedef int32_t            s32;
   46.24 -typedef int64_t            s64;
   46.25 -
   46.26 -#include <sys/ptrace.h>
   46.27 -#include <xen/xen.h>
   46.28 -#include <xen/dom0_ops.h>
   46.29 -#include <xen/event_channel.h>
   46.30 -#include <xen/sched_ctl.h>
   46.31 -#include <xen/acm.h>
   46.32 -
   46.33 -#ifdef __ia64__
   46.34 -#define XC_PAGE_SHIFT           14
   46.35 -#else
   46.36 -#define XC_PAGE_SHIFT           12
   46.37 -#endif
   46.38 -#define XC_PAGE_SIZE            (1UL << XC_PAGE_SHIFT)
   46.39 -#define XC_PAGE_MASK            (~(XC_PAGE_SIZE-1))
   46.40 -
   46.41 -/*
   46.42 - *  DEFINITIONS FOR CPU BARRIERS
   46.43 - */ 
   46.44 -
   46.45 -#if defined(__i386__)
   46.46 -#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   46.47 -#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   46.48 -#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   46.49 -#elif defined(__x86_64__)
   46.50 -#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
   46.51 -#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
   46.52 -#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   46.53 -#elif defined(__ia64__)
   46.54 -/* FIXME */
   46.55 -#define mb()
   46.56 -#define rmb()
   46.57 -#define wmb()
   46.58 -#else
   46.59 -#error "Define barriers"
   46.60 -#endif
   46.61 -
   46.62 -/*
   46.63 - *  INITIALIZATION FUNCTIONS
   46.64 - */ 
   46.65 -
   46.66 -/**
   46.67 - * This function opens a handle to the hypervisor interface.  This function can
   46.68 - * be called multiple times within a single process.  Multiple processes can
   46.69 - * have an open hypervisor interface at the same time.
   46.70 - *
   46.71 - * Each call to this function should have a corresponding call to
   46.72 - * xc_interface_close().
   46.73 - *
   46.74 - * This function can fail if the caller does not have superuser permission or
   46.75 - * if a Xen-enabled kernel is not currently running.
   46.76 - *
   46.77 - * @return a handle to the hypervisor interface or -1 on failure
   46.78 - */
   46.79 -int xc_interface_open(void);
   46.80 -
   46.81 -/**
   46.82 - * This function closes an open hypervisor interface.
   46.83 - *
   46.84 - * This function can fail if the handle does not represent an open interface or
   46.85 - * if there were problems closing the interface.
   46.86 - *
   46.87 - * @parm xc_handle a handle to an open hypervisor interface
   46.88 - * @return 0 on success, -1 otherwise.
   46.89 - */
   46.90 -int xc_interface_close(int xc_handle);
   46.91 -
   46.92 -/*
   46.93 - * DOMAIN DEBUGGING FUNCTIONS
   46.94 - */
   46.95 -
   46.96 -typedef struct xc_core_header {
   46.97 -    unsigned int xch_magic;
   46.98 -    unsigned int xch_nr_vcpus;
   46.99 -    unsigned int xch_nr_pages;
  46.100 -    unsigned int xch_ctxt_offset;
  46.101 -    unsigned int xch_index_offset;
  46.102 -    unsigned int xch_pages_offset;
  46.103 -} xc_core_header_t;
  46.104 -
  46.105 -
  46.106 -long xc_ptrace(enum __ptrace_request request, 
  46.107 -               u32  domid,
  46.108 -               long addr, 
  46.109 -               long data);
  46.110 -
  46.111 -long xc_ptrace_core(enum __ptrace_request request, 
  46.112 -                    u32 domid, 
  46.113 -                    long addr, 
  46.114 -                    long data);
  46.115 -
  46.116 -int xc_waitdomain(int domain, 
  46.117 -                  int *status, 
  46.118 -                  int options);
  46.119 -
  46.120 -int xc_waitdomain_core(int domain, 
  46.121 -                       int *status, 
  46.122 -                       int options);
  46.123 -
  46.124 -/*
  46.125 - * DOMAIN MANAGEMENT FUNCTIONS
  46.126 - */
  46.127 -
  46.128 -typedef struct {
  46.129 -    u32           domid;
  46.130 -    u32           ssidref;
  46.131 -    unsigned int  dying:1, crashed:1, shutdown:1, 
  46.132 -                  paused:1, blocked:1, running:1;
  46.133 -    unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
  46.134 -    unsigned long nr_pages;
  46.135 -    unsigned long shared_info_frame;
  46.136 -    u64           cpu_time;
  46.137 -    unsigned long max_memkb;
  46.138 -    unsigned int  vcpus;
  46.139 -    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
  46.140 -    cpumap_t      cpumap[MAX_VIRT_CPUS];
  46.141 -} xc_dominfo_t;
  46.142 -
  46.143 -typedef dom0_getdomaininfo_t xc_domaininfo_t;
  46.144 -int xc_domain_create(int xc_handle, 
  46.145 -                     u32 ssidref,
  46.146 -                     u32 *pdomid);
  46.147 -
  46.148 -
  46.149 -int xc_domain_dumpcore(int xc_handle, 
  46.150 -                       u32 domid,
  46.151 -                       const char *corename);
  46.152 -
  46.153 -
  46.154 -/**
  46.155 - * This function pauses a domain. A paused domain still exists in memory
  46.156 - * however it does not receive any timeslices from the hypervisor.
  46.157 - *
  46.158 - * @parm xc_handle a handle to an open hypervisor interface
  46.159 - * @parm domid the domain id to pause
  46.160 - * @return 0 on success, -1 on failure.
  46.161 - */
  46.162 -int xc_domain_pause(int xc_handle, 
  46.163 -                    u32 domid);
  46.164 -/**
  46.165 - * This function unpauses a domain.  The domain should have been previously
  46.166 - * paused.
  46.167 - *
  46.168 - * @parm xc_handle a handle to an open hypervisor interface
  46.169 - * @parm domid the domain id to unpause
  46.170 - * return 0 on success, -1 on failure
  46.171 - */
  46.172 -int xc_domain_unpause(int xc_handle, 
  46.173 -                      u32 domid);
  46.174 -
  46.175 -/**
  46.176 - * This function will destroy a domain.  Destroying a domain removes the domain
  46.177 - * completely from memory.  This function should be called after sending the
  46.178 - * domain a SHUTDOWN control message to free up the domain resources.
  46.179 - *
  46.180 - * @parm xc_handle a handle to an open hypervisor interface
  46.181 - * @parm domid the domain id to destroy
  46.182 - * @return 0 on success, -1 on failure
  46.183 - */
  46.184 -int xc_domain_destroy(int xc_handle, 
  46.185 -                      u32 domid);
  46.186 -int xc_domain_pincpu(int xc_handle,
  46.187 -                     u32 domid,
  46.188 -                     int vcpu,
  46.189 -                     cpumap_t *cpumap);
  46.190 -/**
  46.191 - * This function will return information about one or more domains. It is
  46.192 - * designed to iterate over the list of domains. If a single domain is
  46.193 - * requested, this function will return the next domain in the list - if
  46.194 - * one exists. It is, therefore, important in this case to make sure the
  46.195 - * domain requested was the one returned.
  46.196 - *
  46.197 - * @parm xc_handle a handle to an open hypervisor interface
  46.198 - * @parm first_domid the first domain to enumerate information from.  Domains
  46.199 - *                   are currently enumerate in order of creation.
  46.200 - * @parm max_doms the number of elements in info
  46.201 - * @parm info an array of max_doms size that will contain the information for
  46.202 - *            the enumerated domains.
  46.203 - * @return the number of domains enumerated or -1 on error
  46.204 - */
  46.205 -int xc_domain_getinfo(int xc_handle,
  46.206 -                      u32 first_domid, 
  46.207 -                      unsigned int max_doms,
  46.208 -                      xc_dominfo_t *info);
  46.209 -
  46.210 -/**
  46.211 - * This function will return information about one or more domains, using a
  46.212 - * single hypercall.  The domain information will be stored into the supplied
  46.213 - * array of xc_domaininfo_t structures.
  46.214 - *
  46.215 - * @parm xc_handle a handle to an open hypervisor interface
  46.216 - * @parm first_domain the first domain to enumerate information from.
  46.217 - *                    Domains are currently enumerate in order of creation.
  46.218 - * @parm max_domains the number of elements in info
  46.219 - * @parm info an array of max_doms size that will contain the information for
  46.220 - *            the enumerated domains.
  46.221 - * @return the number of domains enumerated or -1 on error
  46.222 - */
  46.223 -int xc_domain_getinfolist(int xc_handle,
  46.224 -                          u32 first_domain,
  46.225 -                          unsigned int max_domains,
  46.226 -                          xc_domaininfo_t *info);
  46.227 -
  46.228 -/**
  46.229 - * This function returns information about one domain.  This information is
  46.230 - * more detailed than the information from xc_domain_getinfo().
  46.231 - *
  46.232 - * @parm xc_handle a handle to an open hypervisor interface
  46.233 - * @parm domid the domain to get information from
  46.234 - * @parm info a pointer to an xc_domaininfo_t to store the domain information
  46.235 - * @parm ctxt a pointer to a structure to store the execution context of the
  46.236 - *            domain
  46.237 - * @return 0 on success, -1 on failure
  46.238 - */
  46.239 -int xc_domain_get_vcpu_context(int xc_handle,
  46.240 -                               u32 domid,
  46.241 -                               u32 vcpu,
  46.242 -                               vcpu_guest_context_t *ctxt);
  46.243 -
  46.244 -int xc_domain_setcpuweight(int xc_handle,
  46.245 -                           u32 domid,
  46.246 -                           float weight);
  46.247 -long long xc_domain_get_cpu_usage(int xc_handle,
  46.248 -                                  domid_t domid,
  46.249 -                                  int vcpu);
  46.250 -
  46.251 -
  46.252 -typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
  46.253 -int xc_shadow_control(int xc_handle,
  46.254 -                      u32 domid, 
  46.255 -                      unsigned int sop,
  46.256 -                      unsigned long *dirty_bitmap,
  46.257 -                      unsigned long pages,
  46.258 -                      xc_shadow_control_stats_t *stats);
  46.259 -
  46.260 -
  46.261 -#define XCFLAGS_VERBOSE   1
  46.262 -#define XCFLAGS_LIVE      2
  46.263 -#define XCFLAGS_DEBUG     4
  46.264 -#define XCFLAGS_CONFIGURE 8
  46.265 -
  46.266 -struct XcIOContext;
  46.267 -
  46.268 -/**
  46.269 - * This function will save a domain running Linux.
  46.270 - *
  46.271 - * @parm xc_handle a handle to an open hypervisor interface
  46.272 - * @parm fd the file descriptor to save a domain to
  46.273 - * @parm dom the id of the domain
  46.274 - * @return 0 on success, -1 on failure
  46.275 - */
  46.276 -int xc_linux_save(int xc_handle, int fd, u32 dom);
  46.277 -
  46.278 -/**
  46.279 - * This function will restore a saved domain running Linux.
  46.280 - *
  46.281 - * @parm xc_handle a handle to an open hypervisor interface
  46.282 - * @parm fd the file descriptor to restore a domain from
  46.283 - * @parm dom the id of the domain
  46.284 - * @parm nr_pfns the number of pages
  46.285 - * @parm store_evtchn the store event channel for this domain to use
  46.286 - * @parm store_mfn returned with the mfn of the store page
  46.287 - * @return 0 on success, -1 on failure
  46.288 - */
  46.289 -int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
  46.290 -		     unsigned int store_evtchn, unsigned long *store_mfn);
  46.291 -
  46.292 -int xc_linux_build(int xc_handle,
  46.293 -                   u32 domid,
  46.294 -                   const char *image_name,
  46.295 -                   const char *ramdisk_name,
  46.296 -                   const char *cmdline,
  46.297 -                   unsigned int control_evtchn,
  46.298 -                   unsigned long flags,
  46.299 -                   unsigned int vcpus,
  46.300 -                   unsigned int store_evtchn,
  46.301 -                   unsigned long *store_mfn);
  46.302 -
  46.303 -struct mem_map;
  46.304 -int xc_vmx_build(int xc_handle,
  46.305 -                 u32 domid,
  46.306 -                 int memsize,
  46.307 -                 const char *image_name,
  46.308 -                 struct mem_map *memmap,
  46.309 -                 const char *ramdisk_name,
  46.310 -                 const char *cmdline,
  46.311 -                 unsigned int control_evtchn,
  46.312 -                 unsigned long flags,
  46.313 -                 unsigned int vcpus,
  46.314 -                 unsigned int store_evtchn,
  46.315 -                 unsigned long *store_mfn);
  46.316 -
  46.317 -int xc_bvtsched_global_set(int xc_handle,
  46.318 -                           unsigned long ctx_allow);
  46.319 -
  46.320 -int xc_bvtsched_domain_set(int xc_handle,
  46.321 -                           u32 domid,
  46.322 -                           u32 mcuadv,
  46.323 -                           int warpback,
  46.324 -                           s32 warpvalue,
  46.325 -                           long long warpl,
  46.326 -                           long long warpu);
  46.327 -
  46.328 -int xc_bvtsched_global_get(int xc_handle,
  46.329 -                           unsigned long *ctx_allow);
  46.330 -
  46.331 -int xc_bvtsched_domain_get(int xc_handle,
  46.332 -                           u32 domid,
  46.333 -                           u32 *mcuadv,
  46.334 -                           int *warpback,
  46.335 -                           s32 *warpvalue,
  46.336 -                           long long *warpl,
  46.337 -                           long long *warpu);
  46.338 -
  46.339 -int xc_sedf_domain_set(int xc_handle,
  46.340 -                          u32 domid,
  46.341 -                          u64 period, u64 slice, u64 latency, u16 extratime, u16 weight);
  46.342 -
  46.343 -int xc_sedf_domain_get(int xc_handle,
  46.344 -                          u32 domid,
  46.345 -                          u64* period, u64 *slice, u64 *latency, u16 *extratime, u16* weight);
  46.346 -
  46.347 -typedef evtchn_status_t xc_evtchn_status_t;
  46.348 -
  46.349 -/*
  46.350 - * EVENT CHANNEL FUNCTIONS
  46.351 - */
  46.352 -
  46.353 -/**
  46.354 - * This function allocates an unbound port.  Ports are named endpoints used for
  46.355 - * interdomain communication.  This function is most useful in opening a
  46.356 - * well-known port within a domain to receive events on.
  46.357 - *
  46.358 - * @parm xc_handle a handle to an open hypervisor interface
  46.359 - * @parm dom the ID of the domain.  This maybe DOMID_SELF
  46.360 - * @parm port a pointer to a port.  This is an in/out parameter.  If *port is
  46.361 - *            0, then a new port will be assigned, if port is > 0 then that
  46.362 - *            port is allocated if the port is unallocated.
  46.363 - * @return 0 on success, -1 on failure
  46.364 - */
  46.365 -int xc_evtchn_alloc_unbound(int xc_handle,
  46.366 -                            u32 dom,
  46.367 -                            int *port);
  46.368 -
  46.369 -/**
  46.370 - * This function creates a pair of ports between two domains.  A port can only
  46.371 - * be bound once within a domain.
  46.372 - *
  46.373 - * @parm xc_handle a handle to an open hypervisor interface
  46.374 - * @parm dom1 one of the two domains to connect.  Can be DOMID_SELF.
  46.375 - * @parm dom2 the other domain to connect.  Can be DOMID_SELF.
  46.376 - * @parm port1 an in/out parameter.  If > 0, then try to connect *port.  If
  46.377 - *             0, then allocate a new port and store the port in *port.
  46.378 - * @parm port2 the port connected on port2.  This parameter behaves the same
  46.379 - *             way as port1.
  46.380 - * @return 0 on success, -1 on error.
  46.381 - */
  46.382 -int xc_evtchn_bind_interdomain(int xc_handle,
  46.383 -                               u32 dom1,
  46.384 -                               u32 dom2,
  46.385 -                               int *port1,
  46.386 -                               int *port2);
  46.387 -int xc_evtchn_bind_virq(int xc_handle,
  46.388 -                        int virq,
  46.389 -                        int *port);
  46.390 -
  46.391 -/**
  46.392 - * This function will close a single port on an event channel.
  46.393 - *
  46.394 - * @parm xc_handle a handle to an open hypervisor interface
  46.395 - * @parm dom the domain that the port exists on.  May be DOMID_SELF.
  46.396 - * @parm port the port to close
  46.397 - * @return 0 on success, -1 on error
  46.398 - */
  46.399 -int xc_evtchn_close(int xc_handle,
  46.400 -                    u32 dom,   /* may be DOMID_SELF */
  46.401 -                    int port);
  46.402 -
  46.403 -/**
  46.404 - * This function generates a notify event on a bound port.
  46.405 - *
  46.406 - * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
  46.407 - * a 16 bit value.  The result will be the port the event occurred on.  When
  46.408 - * events occur, the port is masked until the 16 bit port value is written back
  46.409 - * to the file.  When /dev/xen/evtchn is opened, it has to be bound via an
  46.410 - * ioctl to each port to listen on.  The ioctl for binding is _IO('E', 2).  The
  46.411 - * parameter is the port to listen on.
  46.412 - *
  46.413 - * @parm xc_handle a handle to an open hypervisor interface
  46.414 - * @parm local_port the port to generate the notify on
  46.415 - * @return 0 on success, -1 on error
  46.416 - */
  46.417 -int xc_evtchn_send(int xc_handle,
  46.418 -                   int local_port);
  46.419 -int xc_evtchn_status(int xc_handle,
  46.420 -                     u32 dom, /* may be DOMID_SELF */
  46.421 -                     int port,
  46.422 -                     xc_evtchn_status_t *status);
  46.423 -
  46.424 -int xc_physdev_pci_access_modify(int xc_handle,
  46.425 -                                 u32 domid,
  46.426 -                                 int bus,
  46.427 -                                 int dev,
  46.428 -                                 int func,
  46.429 -                                 int enable);
  46.430 -
  46.431 -int xc_readconsolering(int xc_handle,
  46.432 -                       char **pbuffer,
  46.433 -                       unsigned int *pnr_chars, 
  46.434 -                       int clear);
  46.435 -
  46.436 -typedef dom0_physinfo_t xc_physinfo_t;
  46.437 -int xc_physinfo(int xc_handle,
  46.438 -                xc_physinfo_t *info);
  46.439 -
  46.440 -int xc_sched_id(int xc_handle,
  46.441 -                int *sched_id);
  46.442 -
  46.443 -int xc_domain_setmaxmem(int xc_handle,
  46.444 -                        u32 domid, 
  46.445 -                        unsigned int max_memkb);
  46.446 -
  46.447 -int xc_domain_memory_increase_reservation(int xc_handle,
  46.448 -                                          u32 domid, 
  46.449 -                                          unsigned int mem_kb);
  46.450 -
  46.451 -typedef dom0_perfc_desc_t xc_perfc_desc_t;
  46.452 -/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
  46.453 -int xc_perfc_control(int xc_handle,
  46.454 -                     u32 op,
  46.455 -                     xc_perfc_desc_t *desc);
  46.456 -
  46.457 -/* read/write msr */
  46.458 -long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
  46.459 -int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  46.460 -                  unsigned int high);
  46.461 -
  46.462 -/**
  46.463 - * Memory maps a range within one domain to a local address range.  Mappings
  46.464 - * should be unmapped with munmap and should follow the same rules as mmap
  46.465 - * regarding page alignment.  Returns NULL on failure.
  46.466 - *
  46.467 - * In Linux, the ring queue for the control channel is accessible by mapping
  46.468 - * the shared_info_frame (from xc_domain_getinfo()) + 2048.  The structure
  46.469 - * stored there is of type control_if_t.
  46.470 - *
  46.471 - * @parm xc_handle a handle on an open hypervisor interface
  46.472 - * @parm dom the domain to map memory from
  46.473 - * @parm size the amount of memory to map (in multiples of page size)
  46.474 - * @parm prot same flag as in mmap().
  46.475 - * @parm mfn the frame address to map.
  46.476 - */
  46.477 -void *xc_map_foreign_range(int xc_handle, u32 dom,
  46.478 -                            int size, int prot,
  46.479 -                            unsigned long mfn );
  46.480 -
  46.481 -void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
  46.482 -                           unsigned long *arr, int num );
  46.483 -
  46.484 -int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  46.485 -                    unsigned long max_pfns);
  46.486 -
  46.487 -int xc_ia64_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  46.488 -                    unsigned int start_page, unsigned int nr_pages);
  46.489 -
  46.490 -/*\
  46.491 - *  GRANT TABLE FUNCTIONS
  46.492 -\*/ 
  46.493 -
  46.494 -/**
  46.495 - * This function opens a handle to the more restricted grant table hypervisor
  46.496 - * interface. This may be used where the standard interface is not
  46.497 - * available because the domain is not privileged.
  46.498 - * This function can  be called multiple times within a single process.
  46.499 - * Multiple processes can have an open hypervisor interface at the same time.
  46.500 - *
  46.501 - * Each call to this function should have a corresponding call to
  46.502 - * xc_grant_interface_close().
  46.503 - *
  46.504 - * This function can fail if a Xen-enabled kernel is not currently running.
  46.505 - *
  46.506 - * @return a handle to the hypervisor grant table interface or -1 on failure
  46.507 - */
  46.508 -int xc_grant_interface_open(void);
  46.509 -
  46.510 -/**
  46.511 - * This function closes an open grant table hypervisor interface.
  46.512 - *
  46.513 - * This function can fail if the handle does not represent an open interface or
  46.514 - * if there were problems closing the interface.
  46.515 - *
  46.516 - * @parm xc_handle a handle to an open grant table hypervisor interface
  46.517 - * @return 0 on success, -1 otherwise.
  46.518 - */
  46.519 -int xc_grant_interface_close(int xc_handle);
  46.520 -
  46.521 -int xc_gnttab_map_grant_ref(int  xc_handle,
  46.522 -                            u64  host_virt_addr,
  46.523 -                            u32  dom,
  46.524 -                            u16  ref,
  46.525 -                            u16  flags,
  46.526 -                            s16 *handle,
  46.527 -                            u64 *dev_bus_addr);
  46.528 -
  46.529 -int xc_gnttab_unmap_grant_ref(int  xc_handle,
  46.530 -                              u64  host_virt_addr,
  46.531 -                              u64  dev_bus_addr,
  46.532 -                              u16  handle,
  46.533 -                              s16 *status);
  46.534 -
  46.535 -int xc_gnttab_setup_table(int        xc_handle,
  46.536 -                          u32        dom,
  46.537 -                          u16        nr_frames,
  46.538 -                          s16       *status,
  46.539 -                          unsigned long **frame_list);
  46.540 -
  46.541 -/* Grant debug builds only: */
  46.542 -int xc_gnttab_dump_table(int        xc_handle,
  46.543 -                         u32        dom,
  46.544 -                         s16       *status);
  46.545 -
  46.546 -/* Get current total pages allocated to a domain. */
  46.547 -long xc_get_tot_pages(int xc_handle, u32 domid);
  46.548 -
  46.549 -/* Execute a privileged dom0 operation. */
  46.550 -int xc_dom0_op(int xc_handle, dom0_op_t *op);
  46.551 -
  46.552 -/* Initializes the store (for dom0)
  46.553 -   remote_port should be the remote end of a bound interdomain channel between
  46.554 -   the store and dom0.
  46.555 -
  46.556 -   This function returns a shared frame that should be passed to
  46.557 -   xs_introduce_domain
  46.558 - */
  46.559 -long xc_init_store(int xc_handle, int remote_port);
  46.560 -
  46.561 -#endif /* __XC_H__ */
    47.1 --- a/tools/libxc/xc_core.c	Wed Aug 24 22:24:10 2005 +0000
    47.2 +++ b/tools/libxc/xc_core.c	Thu Aug 25 00:55:20 2005 +0000
    47.3 @@ -1,4 +1,4 @@
    47.4 -#include "xc_private.h"
    47.5 +#include "xg_private.h"
    47.6  #define ELFSIZE 32
    47.7  #include "xc_elf.h"
    47.8  #include <stdlib.h>
    48.1 --- a/tools/libxc/xc_domain.c	Wed Aug 24 22:24:10 2005 +0000
    48.2 +++ b/tools/libxc/xc_domain.c	Thu Aug 25 00:55:20 2005 +0000
    48.3 @@ -266,7 +266,7 @@ int xc_domain_memory_increase_reservatio
    48.4      int err;
    48.5      unsigned int npages = mem_kb / (PAGE_SIZE/1024);
    48.6  
    48.7 -    err = do_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
    48.8 +    err = xc_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
    48.9                          npages, 0, domid);
   48.10      if (err == npages)
   48.11          return 0;
    49.1 --- a/tools/libxc/xc_linux_build.c	Wed Aug 24 22:24:10 2005 +0000
    49.2 +++ b/tools/libxc/xc_linux_build.c	Thu Aug 25 00:55:20 2005 +0000
    49.3 @@ -2,7 +2,8 @@
    49.4   * xc_linux_build.c
    49.5   */
    49.6  
    49.7 -#include "xc_private.h"
    49.8 +#include "xg_private.h"
    49.9 +#include <xenctrl.h>
   49.10  
   49.11  #if defined(__i386__)
   49.12  #define ELFSIZE 32
   49.13 @@ -340,7 +341,7 @@ static int setup_guest(int xc_handle,
   49.14      unsigned long count, i;
   49.15      start_info_t *start_info;
   49.16      shared_info_t *shared_info;
   49.17 -    mmu_t *mmu = NULL;
   49.18 +    xc_mmu_t *mmu = NULL;
   49.19      int rc;
   49.20  
   49.21      unsigned long nr_pt_pages;
   49.22 @@ -490,7 +491,7 @@ static int setup_guest(int xc_handle,
   49.23          }
   49.24      }
   49.25  
   49.26 -    if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
   49.27 +    if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
   49.28          goto error_out;
   49.29  
   49.30      /* setup page tables */
   49.31 @@ -520,9 +521,9 @@ static int setup_guest(int xc_handle,
   49.32          page_array[physmap_pfn++]);
   49.33      for ( count = 0; count < nr_pages; count++ )
   49.34      {
   49.35 -        if ( add_mmu_update(xc_handle, mmu,
   49.36 -                            (page_array[count] << PAGE_SHIFT) | 
   49.37 -                            MMU_MACHPHYS_UPDATE, count) )
   49.38 +        if ( xc_add_mmu_update(xc_handle, mmu,
   49.39 +			       (page_array[count] << PAGE_SHIFT) | 
   49.40 +			       MMU_MACHPHYS_UPDATE, count) )
   49.41          {
   49.42              munmap(physmap, PAGE_SIZE);
   49.43              goto error_out;
   49.44 @@ -602,7 +603,7 @@ static int setup_guest(int xc_handle,
   49.45      munmap(shared_info, PAGE_SIZE);
   49.46  
   49.47      /* Send the page update requests down to the hypervisor. */
   49.48 -    if ( finish_mmu_updates(xc_handle, mmu) )
   49.49 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   49.50          goto error_out;
   49.51  
   49.52      free(mmu);
   49.53 @@ -676,7 +677,7 @@ int xc_linux_build(int xc_handle,
   49.54  
   49.55      op.cmd = DOM0_GETDOMAININFO;
   49.56      op.u.getdomaininfo.domain = (domid_t)domid;
   49.57 -    if ( (do_dom0_op(xc_handle, &op) < 0) || 
   49.58 +    if ( (xc_dom0_op(xc_handle, &op) < 0) || 
   49.59           ((u16)op.u.getdomaininfo.domain != domid) )
   49.60      {
   49.61          PERROR("Could not get info on domain");
   49.62 @@ -793,7 +794,7 @@ int xc_linux_build(int xc_handle,
   49.63      launch_op.u.setdomaininfo.ctxt   = ctxt;
   49.64  
   49.65      launch_op.cmd = DOM0_SETDOMAININFO;
   49.66 -    rc = do_dom0_op(xc_handle, &launch_op);
   49.67 +    rc = xc_dom0_op(xc_handle, &launch_op);
   49.68      
   49.69      return rc;
   49.70  
    50.1 --- a/tools/libxc/xc_linux_restore.c	Wed Aug 24 22:24:10 2005 +0000
    50.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Aug 25 00:55:20 2005 +0000
    50.3 @@ -6,7 +6,12 @@
    50.4   * Copyright (c) 2003, K A Fraser.
    50.5   */
    50.6  
    50.7 -#include "xc_private.h"
    50.8 +#include <stdlib.h>
    50.9 +#include <unistd.h>
   50.10 +
   50.11 +#include "xg_private.h"
   50.12 +#include <xenctrl.h>
   50.13 +
   50.14  #include <xen/linux/suspend.h>
   50.15  
   50.16  #define MAX_BATCH_SIZE 1024
   50.17 @@ -89,7 +94,7 @@ int xc_linux_restore(int xc_handle, int 
   50.18  
   50.19      char *region_base;
   50.20  
   50.21 -    mmu_t *mmu = NULL;
   50.22 +    xc_mmu_t *mmu = NULL;
   50.23  
   50.24      /* used by debug verify code */
   50.25      unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
   50.26 @@ -132,7 +137,7 @@ int xc_linux_restore(int xc_handle, int 
   50.27      /* Get the domain's shared-info frame. */
   50.28      op.cmd = DOM0_GETDOMAININFO;
   50.29      op.u.getdomaininfo.domain = (domid_t)dom;
   50.30 -    if (do_dom0_op(xc_handle, &op) < 0) {
   50.31 +    if (xc_dom0_op(xc_handle, &op) < 0) {
   50.32          ERR("Could not get information on new domain");
   50.33          goto out;
   50.34      }
   50.35 @@ -158,7 +163,7 @@ int xc_linux_restore(int xc_handle, int 
   50.36          goto out;
   50.37      }
   50.38  
   50.39 -    mmu = init_mmu_updates(xc_handle, dom);
   50.40 +    mmu = xc_init_mmu_updates(xc_handle, dom);
   50.41      if (mmu == NULL) {
   50.42          ERR("Could not initialise for MMU updates");
   50.43          goto out;
   50.44 @@ -355,8 +360,9 @@ int xc_linux_restore(int xc_handle, int 
   50.45                  }
   50.46              }
   50.47  
   50.48 -            if ( add_mmu_update(xc_handle, mmu,
   50.49 -                                (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
   50.50 +            if ( xc_add_mmu_update(xc_handle, mmu,
   50.51 +				   (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
   50.52 +				   pfn) )
   50.53              {
   50.54                  printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
   50.55                  goto out;
   50.56 @@ -370,7 +376,7 @@ int xc_linux_restore(int xc_handle, int 
   50.57  
   50.58      DPRINTF("Received all pages\n");
   50.59  
   50.60 -    if ( finish_mmu_updates(xc_handle, mmu) )
   50.61 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   50.62          goto out;
   50.63  
   50.64      /*
   50.65 @@ -388,14 +394,14 @@ int xc_linux_restore(int xc_handle, int 
   50.66          pin[nr_pins].mfn = pfn_to_mfn_table[i];
   50.67          if ( ++nr_pins == MAX_PIN_BATCH )
   50.68          {
   50.69 -            if ( do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
   50.70 +            if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
   50.71                  goto out;
   50.72              nr_pins = 0;
   50.73          }
   50.74      }
   50.75  
   50.76      if ( (nr_pins != 0) &&
   50.77 -         (do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
   50.78 +         (xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
   50.79          goto out;
   50.80  
   50.81      DPRINTF("\b\b\b\b100%%\n");
   50.82 @@ -435,7 +441,7 @@ int xc_linux_restore(int xc_handle, int 
   50.83  
   50.84  	if ( count > 0 )
   50.85  	{
   50.86 -	    if ( (rc = do_dom_mem_op( xc_handle,
   50.87 +	    if ( (rc = xc_dom_mem_op( xc_handle,
   50.88  				       MEMOP_decrease_reservation,
   50.89  				       pfntab, count, 0, dom )) <0 )
   50.90  	    {
   50.91 @@ -586,7 +592,7 @@ int xc_linux_restore(int xc_handle, int 
   50.92      op.u.setdomaininfo.domain = (domid_t)dom;
   50.93      op.u.setdomaininfo.vcpu   = 0;
   50.94      op.u.setdomaininfo.ctxt   = &ctxt;
   50.95 -    rc = do_dom0_op(xc_handle, &op);
   50.96 +    rc = xc_dom0_op(xc_handle, &op);
   50.97  
   50.98      if ( rc != 0 )
   50.99      {
  50.100 @@ -597,7 +603,7 @@ int xc_linux_restore(int xc_handle, int 
  50.101      DPRINTF("Domain ready to be unpaused\n");
  50.102      op.cmd = DOM0_UNPAUSEDOMAIN;
  50.103      op.u.unpausedomain.domain = (domid_t)dom;
  50.104 -    rc = do_dom0_op(xc_handle, &op);
  50.105 +    rc = xc_dom0_op(xc_handle, &op);
  50.106      if (rc == 0) {
  50.107          /* Success: print the domain id. */
  50.108          DPRINTF("DOM=%u\n", dom);
    51.1 --- a/tools/libxc/xc_linux_save.c	Wed Aug 24 22:24:10 2005 +0000
    51.2 +++ b/tools/libxc/xc_linux_save.c	Thu Aug 25 00:55:20 2005 +0000
    51.3 @@ -7,11 +7,15 @@
    51.4   */
    51.5  
    51.6  #include <inttypes.h>
    51.7 +#include <time.h>
    51.8 +#include <stdlib.h>
    51.9 +#include <unistd.h>
   51.10  #include <sys/time.h>
   51.11 -#include "xc_private.h"
   51.12 +
   51.13 +#include "xg_private.h"
   51.14 +
   51.15  #include <xen/linux/suspend.h>
   51.16  #include <xen/io/domain_controller.h>
   51.17 -#include <time.h>
   51.18  
   51.19  #define BATCH_SIZE 1024   /* 1024 pages (4MB) at a time */
   51.20  
   51.21 @@ -772,7 +776,7 @@ int xc_linux_save(int xc_handle, int io_
   51.22                  goto out;
   51.23              }
   51.24       
   51.25 -            if ( get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
   51.26 +            if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
   51.27                  ERR("get_pfn_type_batch failed");
   51.28                  goto out;
   51.29              }
    52.1 --- a/tools/libxc/xc_load_aout9.c	Wed Aug 24 22:24:10 2005 +0000
    52.2 +++ b/tools/libxc/xc_load_aout9.c	Thu Aug 25 00:55:20 2005 +0000
    52.3 @@ -1,5 +1,5 @@
    52.4  
    52.5 -#include "xc_private.h"
    52.6 +#include "xg_private.h"
    52.7  #include "xc_aout9.h"
    52.8  
    52.9  #if defined(__i386__)
    53.1 --- a/tools/libxc/xc_load_bin.c	Wed Aug 24 22:24:10 2005 +0000
    53.2 +++ b/tools/libxc/xc_load_bin.c	Thu Aug 25 00:55:20 2005 +0000
    53.3 @@ -66,7 +66,7 @@
    53.4   * Free Software Foundation, Inc.
    53.5   */
    53.6  
    53.7 -#include "xc_private.h"
    53.8 +#include "xg_private.h"
    53.9  #include <stdlib.h>
   53.10  
   53.11  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
    54.1 --- a/tools/libxc/xc_load_elf.c	Wed Aug 24 22:24:10 2005 +0000
    54.2 +++ b/tools/libxc/xc_load_elf.c	Thu Aug 25 00:55:20 2005 +0000
    54.3 @@ -2,7 +2,7 @@
    54.4   * xc_elf_load.c
    54.5   */
    54.6  
    54.7 -#include "xc_private.h"
    54.8 +#include "xg_private.h"
    54.9  
   54.10  #if defined(__i386__)
   54.11  #define ELFSIZE 32
    55.1 --- a/tools/libxc/xc_private.c	Wed Aug 24 22:24:10 2005 +0000
    55.2 +++ b/tools/libxc/xc_private.c	Thu Aug 25 00:55:20 2005 +0000
    55.3 @@ -64,8 +64,8 @@ void *xc_map_foreign_range(int xc_handle
    55.4  /*******************/
    55.5  
    55.6  /* NB: arr must be mlock'ed */
    55.7 -int get_pfn_type_batch(int xc_handle, 
    55.8 -                       u32 dom, int num, unsigned long *arr)
    55.9 +int xc_get_pfn_type_batch(int xc_handle, 
   55.10 +			  u32 dom, int num, unsigned long *arr)
   55.11  {
   55.12      dom0_op_t op;
   55.13      op.cmd = DOM0_GETPAGEFRAMEINFO2;
   55.14 @@ -92,25 +92,40 @@ unsigned int get_pfn_type(int xc_handle,
   55.15      return op.u.getpageframeinfo.type;
   55.16  }
   55.17  
   55.18 -
   55.19 -
   55.20 -/*******************/
   55.21 +int xc_mmuext_op(
   55.22 +    int xc_handle,
   55.23 +    struct mmuext_op *op,
   55.24 +    unsigned int nr_ops,
   55.25 +    domid_t dom)
   55.26 +{
   55.27 +    privcmd_hypercall_t hypercall;
   55.28 +    long ret = -EINVAL;
   55.29  
   55.30 -int pin_table(
   55.31 -    int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
   55.32 -{
   55.33 -    struct mmuext_op op;
   55.34 +    hypercall.op     = __HYPERVISOR_mmuext_op;
   55.35 +    hypercall.arg[0] = (unsigned long)op;
   55.36 +    hypercall.arg[1] = (unsigned long)nr_ops;
   55.37 +    hypercall.arg[2] = (unsigned long)0;
   55.38 +    hypercall.arg[3] = (unsigned long)dom;
   55.39  
   55.40 -    op.cmd = type;
   55.41 -    op.mfn = mfn;
   55.42 +    if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
   55.43 +    {
   55.44 +        PERROR("Could not lock memory for Xen hypercall");
   55.45 +        goto out1;
   55.46 +    }
   55.47  
   55.48 -    if ( do_mmuext_op(xc_handle, &op, 1, dom) < 0 )
   55.49 -        return 1;
   55.50 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   55.51 +    {
   55.52 +	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
   55.53 +                    " rebuild the user-space tool set?\n",ret,errno);
   55.54 +    }
   55.55  
   55.56 -    return 0;
   55.57 -}
   55.58 +    safe_munlock(op, nr_ops*sizeof(*op));
   55.59  
   55.60 -static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
   55.61 + out1:
   55.62 +    return ret;
   55.63 +}    
   55.64 +
   55.65 +static int flush_mmu_updates(int xc_handle, xc_mmu_t *mmu)
   55.66  {
   55.67      int err = 0;
   55.68      privcmd_hypercall_t hypercall;
   55.69 @@ -145,9 +160,9 @@ static int flush_mmu_updates(int xc_hand
   55.70      return err;
   55.71  }
   55.72  
   55.73 -mmu_t *init_mmu_updates(int xc_handle, domid_t dom)
   55.74 +xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom)
   55.75  {
   55.76 -    mmu_t *mmu = malloc(sizeof(mmu_t));
   55.77 +    xc_mmu_t *mmu = malloc(sizeof(xc_mmu_t));
   55.78      if ( mmu == NULL )
   55.79          return mmu;
   55.80      mmu->idx     = 0;
   55.81 @@ -155,8 +170,8 @@ mmu_t *init_mmu_updates(int xc_handle, d
   55.82      return mmu;
   55.83  }
   55.84  
   55.85 -int add_mmu_update(int xc_handle, mmu_t *mmu, 
   55.86 -                   unsigned long ptr, unsigned long val)
   55.87 +int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
   55.88 +		      unsigned long ptr, unsigned long val)
   55.89  {
   55.90      mmu->updates[mmu->idx].ptr = ptr;
   55.91      mmu->updates[mmu->idx].val = val;
   55.92 @@ -167,11 +182,48 @@ int add_mmu_update(int xc_handle, mmu_t 
   55.93      return 0;
   55.94  }
   55.95  
   55.96 -int finish_mmu_updates(int xc_handle, mmu_t *mmu)
   55.97 +int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu)
   55.98  {
   55.99      return flush_mmu_updates(xc_handle, mmu);
  55.100  }
  55.101  
  55.102 +int xc_dom_mem_op(int xc_handle,
  55.103 +		  unsigned int memop, 
  55.104 +		  unsigned int *extent_list, 
  55.105 +		  unsigned int nr_extents,
  55.106 +		  unsigned int extent_order,
  55.107 +		  domid_t domid)
  55.108 +{
  55.109 +    privcmd_hypercall_t hypercall;
  55.110 +    long ret = -EINVAL;
  55.111 +
  55.112 +    hypercall.op     = __HYPERVISOR_dom_mem_op;
  55.113 +    hypercall.arg[0] = (unsigned long)memop;
  55.114 +    hypercall.arg[1] = (unsigned long)extent_list;
  55.115 +    hypercall.arg[2] = (unsigned long)nr_extents;
  55.116 +    hypercall.arg[3] = (unsigned long)extent_order;
  55.117 +    hypercall.arg[4] = (unsigned long)domid;
  55.118 +
  55.119 +    if ( (extent_list != NULL) && 
  55.120 +         (mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
  55.121 +    {
  55.122 +        PERROR("Could not lock memory for Xen hypercall");
  55.123 +        goto out1;
  55.124 +    }
  55.125 +
  55.126 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  55.127 +    {
  55.128 +	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  55.129 +                " rebuild the user-space tool set?\n",ret,errno);
  55.130 +    }
  55.131 +
  55.132 +    if ( extent_list != NULL )
  55.133 +        safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
  55.134 +
  55.135 + out1:
  55.136 +    return ret;
  55.137 +}    
  55.138 +
  55.139  
  55.140  long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
  55.141  {
  55.142 @@ -190,19 +242,6 @@ long long xc_domain_get_cpu_usage( int x
  55.143  }
  55.144  
  55.145  
  55.146 -/* This is shared between save and restore, and may generally be useful. */
  55.147 -unsigned long csum_page (void * page)
  55.148 -{
  55.149 -    int i;
  55.150 -    unsigned long *p = page;
  55.151 -    unsigned long long sum=0;
  55.152 -
  55.153 -    for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
  55.154 -        sum += p[i];
  55.155 -
  55.156 -    return sum ^ (sum>>32);
  55.157 -}
  55.158 -
  55.159  unsigned long xc_get_m2p_start_mfn ( int xc_handle )
  55.160  {
  55.161      unsigned long mfn;
  55.162 @@ -332,53 +371,6 @@ unsigned long xc_get_filesz(int fd)
  55.163      return sz;
  55.164  }
  55.165  
  55.166 -char *xc_read_kernel_image(const char *filename, unsigned long *size)
  55.167 -{
  55.168 -    int kernel_fd = -1;
  55.169 -    gzFile kernel_gfd = NULL;
  55.170 -    char *image = NULL;
  55.171 -    unsigned int bytes;
  55.172 -
  55.173 -    if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
  55.174 -    {
  55.175 -        PERROR("Could not open kernel image");
  55.176 -        goto out;
  55.177 -    }
  55.178 -
  55.179 -    if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
  55.180 -    {
  55.181 -        PERROR("Could not read kernel image");
  55.182 -        goto out;
  55.183 -    }
  55.184 -
  55.185 -    if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
  55.186 -    {
  55.187 -        PERROR("Could not allocate decompression state for state file");
  55.188 -        goto out;
  55.189 -    }
  55.190 -
  55.191 -    if ( (image = malloc(*size)) == NULL )
  55.192 -    {
  55.193 -        PERROR("Could not allocate memory for kernel image");
  55.194 -        goto out;
  55.195 -    }
  55.196 -
  55.197 -    if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
  55.198 -    {
  55.199 -        PERROR("Error reading kernel image, could not"
  55.200 -               " read the whole image (%d != %ld).", bytes, *size);
  55.201 -        free(image);
  55.202 -        image = NULL;
  55.203 -    }
  55.204 -
  55.205 - out:
  55.206 -    if ( kernel_gfd != NULL )
  55.207 -        gzclose(kernel_gfd);
  55.208 -    else if ( kernel_fd >= 0 )
  55.209 -        close(kernel_fd);
  55.210 -    return image;
  55.211 -}
  55.212 -
  55.213  void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  55.214                     int xch, u32 dom, unsigned long *parray,
  55.215                     unsigned long vstart)
    56.1 --- a/tools/libxc/xc_private.h	Wed Aug 24 22:24:10 2005 +0000
    56.2 +++ b/tools/libxc/xc_private.h	Thu Aug 25 00:55:20 2005 +0000
    56.3 @@ -1,124 +1,26 @@
    56.4  
    56.5 -#ifndef __XC_PRIVATE_H__
    56.6 -#define __XC_PRIVATE_H__
    56.7 +#ifndef XC_PRIVATE_H
    56.8 +#define XC_PRIVATE_H
    56.9  
   56.10  #include <unistd.h>
   56.11  #include <stdio.h>
   56.12  #include <errno.h>
   56.13  #include <fcntl.h>
   56.14 +#include <string.h>
   56.15  #include <sys/mman.h>
   56.16  #include <sys/types.h>
   56.17  #include <sys/stat.h>
   56.18  #include <stdlib.h>
   56.19  #include <sys/ioctl.h>
   56.20 -#include <errno.h>
   56.21 -#include <string.h>
   56.22  
   56.23 -#include "xc.h"
   56.24 +#include "xenctrl.h"
   56.25  
   56.26  #include <xen/linux/privcmd.h>
   56.27  
   56.28 -#define _PAGE_PRESENT   0x001
   56.29 -#define _PAGE_RW        0x002
   56.30 -#define _PAGE_USER      0x004
   56.31 -#define _PAGE_PWT       0x008
   56.32 -#define _PAGE_PCD       0x010
   56.33 -#define _PAGE_ACCESSED  0x020
   56.34 -#define _PAGE_DIRTY     0x040
   56.35 -#define _PAGE_PAT       0x080
   56.36 -#define _PAGE_PSE       0x080
   56.37 -#define _PAGE_GLOBAL    0x100
   56.38 -
   56.39 -#if defined(__i386__)
   56.40 -#define L1_PAGETABLE_SHIFT       12
   56.41 -#define L2_PAGETABLE_SHIFT       22
   56.42 -#define L1_PAGETABLE_SHIFT_PAE   12
   56.43 -#define L2_PAGETABLE_SHIFT_PAE   21
   56.44 -#define L3_PAGETABLE_SHIFT_PAE   30
   56.45 -#elif defined(__x86_64__)
   56.46 -#define L1_PAGETABLE_SHIFT      12
   56.47 -#define L2_PAGETABLE_SHIFT      21
   56.48 -#define L3_PAGETABLE_SHIFT      30
   56.49 -#define L4_PAGETABLE_SHIFT      39
   56.50 -#endif
   56.51 -
   56.52 -#if defined(__i386__) 
   56.53 -#define ENTRIES_PER_L1_PAGETABLE 1024
   56.54 -#define ENTRIES_PER_L2_PAGETABLE 1024
   56.55 -#define L1_PAGETABLE_ENTRIES_PAE  512
   56.56 -#define L2_PAGETABLE_ENTRIES_PAE  512
   56.57 -#define L3_PAGETABLE_ENTRIES_PAE    4
   56.58 -#elif defined(__x86_64__)
   56.59 -#define L1_PAGETABLE_ENTRIES    512
   56.60 -#define L2_PAGETABLE_ENTRIES    512
   56.61 -#define L3_PAGETABLE_ENTRIES    512
   56.62 -#define L4_PAGETABLE_ENTRIES    512
   56.63 -#endif
   56.64 - 
   56.65  #define PAGE_SHIFT              XC_PAGE_SHIFT
   56.66  #define PAGE_SIZE               (1UL << PAGE_SHIFT)
   56.67  #define PAGE_MASK               (~(PAGE_SIZE-1))
   56.68  
   56.69 -typedef u32 l1_pgentry_32_t;
   56.70 -typedef u32 l2_pgentry_32_t;
   56.71 -typedef u64 l1_pgentry_64_t;
   56.72 -typedef u64 l2_pgentry_64_t;
   56.73 -typedef u64 l3_pgentry_64_t;
   56.74 -typedef unsigned long l1_pgentry_t;
   56.75 -typedef unsigned long l2_pgentry_t;
   56.76 -#if defined(__x86_64__)
   56.77 -typedef unsigned long l3_pgentry_t;
   56.78 -typedef unsigned long l4_pgentry_t;
   56.79 -#endif
   56.80 -
   56.81 -#if defined(__i386__)
   56.82 -#define l1_table_offset(_a) \
   56.83 -          (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
   56.84 -#define l2_table_offset(_a) \
   56.85 -          ((_a) >> L2_PAGETABLE_SHIFT)
   56.86 -#define l1_table_offset_pae(_a) \
   56.87 -  (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
   56.88 -#define l2_table_offset_pae(_a) \
   56.89 -  (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
   56.90 -#define l3_table_offset_pae(_a) \
   56.91 -	(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
   56.92 -#elif defined(__x86_64__)
   56.93 -#define l1_table_offset(_a) \
   56.94 -  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   56.95 -#define l2_table_offset(_a) \
   56.96 -  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   56.97 -#define l3_table_offset(_a) \
   56.98 -	(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   56.99 -#define l4_table_offset(_a) \
  56.100 -	(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
  56.101 -#endif
  56.102 -
  56.103 -struct domain_setup_info
  56.104 -{
  56.105 -    unsigned long v_start;
  56.106 -    unsigned long v_end;
  56.107 -    unsigned long v_kernstart;
  56.108 -    unsigned long v_kernend;
  56.109 -    unsigned long v_kernentry;
  56.110 -
  56.111 -    unsigned int  load_symtab;
  56.112 -    unsigned int  pae_kernel;
  56.113 -    unsigned long symtab_addr;
  56.114 -    unsigned long symtab_len;
  56.115 -};
  56.116 -
  56.117 -typedef int (*parseimagefunc)(char *image, unsigned long image_size,
  56.118 -			      struct domain_setup_info *dsi);
  56.119 -typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
  56.120 -			     u32 dom, unsigned long *parray,
  56.121 -			     struct domain_setup_info *dsi);
  56.122 -
  56.123 -struct load_funcs
  56.124 -{
  56.125 -    parseimagefunc parseimage;
  56.126 -    loadimagefunc loadimage;
  56.127 -};
  56.128 -
  56.129  #define ERROR(_m, _a...)                                \
  56.130  do {                                                    \
  56.131      int __saved_errno = errno;                          \
  56.132 @@ -186,97 +88,6 @@ static inline int do_dom0_op(int xc_hand
  56.133      return ret;
  56.134  }
  56.135  
  56.136 -static inline int do_dom_mem_op(int            xc_handle,
  56.137 -				unsigned int   memop, 
  56.138 -				unsigned int *extent_list, 
  56.139 -				unsigned int  nr_extents,
  56.140 -				unsigned int   extent_order,
  56.141 -				domid_t        domid)
  56.142 -{
  56.143 -    privcmd_hypercall_t hypercall;
  56.144 -    long ret = -EINVAL;
  56.145 -
  56.146 -    hypercall.op     = __HYPERVISOR_dom_mem_op;
  56.147 -    hypercall.arg[0] = (unsigned long)memop;
  56.148 -    hypercall.arg[1] = (unsigned long)extent_list;
  56.149 -    hypercall.arg[2] = (unsigned long)nr_extents;
  56.150 -    hypercall.arg[3] = (unsigned long)extent_order;
  56.151 -    hypercall.arg[4] = (unsigned long)domid;
  56.152 -
  56.153 -    if ( (extent_list != NULL) && 
  56.154 -         (mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
  56.155 -    {
  56.156 -        PERROR("Could not lock memory for Xen hypercall");
  56.157 -        goto out1;
  56.158 -    }
  56.159 -
  56.160 -    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  56.161 -    {
  56.162 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  56.163 -                " rebuild the user-space tool set?\n",ret,errno);
  56.164 -    }
  56.165 -
  56.166 -    if ( extent_list != NULL )
  56.167 -        safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
  56.168 -
  56.169 - out1:
  56.170 -    return ret;
  56.171 -}    
  56.172 -
  56.173 -static inline int do_mmuext_op(
  56.174 -    int xc_handle,
  56.175 -    struct mmuext_op *op,
  56.176 -    unsigned int nr_ops,
  56.177 -    domid_t dom)
  56.178 -{
  56.179 -    privcmd_hypercall_t hypercall;
  56.180 -    long ret = -EINVAL;
  56.181 -
  56.182 -    hypercall.op     = __HYPERVISOR_mmuext_op;
  56.183 -    hypercall.arg[0] = (unsigned long)op;
  56.184 -    hypercall.arg[1] = (unsigned long)nr_ops;
  56.185 -    hypercall.arg[2] = (unsigned long)0;
  56.186 -    hypercall.arg[3] = (unsigned long)dom;
  56.187 -
  56.188 -    if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
  56.189 -    {
  56.190 -        PERROR("Could not lock memory for Xen hypercall");
  56.191 -        goto out1;
  56.192 -    }
  56.193 -
  56.194 -    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
  56.195 -    {
  56.196 -	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
  56.197 -                    " rebuild the user-space tool set?\n",ret,errno);
  56.198 -    }
  56.199 -
  56.200 -    safe_munlock(op, nr_ops*sizeof(*op));
  56.201 -
  56.202 - out1:
  56.203 -    return ret;
  56.204 -}    
  56.205 -
  56.206 -
  56.207 -/*
  56.208 - * PFN mapping.
  56.209 - */
  56.210 -int get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
  56.211 -unsigned long csum_page (void * page);
  56.212 -
  56.213 -/*
  56.214 - * MMU updates.
  56.215 - */
  56.216 -#define MAX_MMU_UPDATES 1024
  56.217 -typedef struct {
  56.218 -    mmu_update_t updates[MAX_MMU_UPDATES];
  56.219 -    int          idx;
  56.220 -    domid_t      subject;
  56.221 -} mmu_t;
  56.222 -mmu_t *init_mmu_updates(int xc_handle, domid_t dom);
  56.223 -int add_mmu_update(int xc_handle, mmu_t *mmu, 
  56.224 -                   unsigned long ptr, unsigned long val);
  56.225 -int finish_mmu_updates(int xc_handle, mmu_t *mmu);
  56.226 -
  56.227  
  56.228  /*
  56.229   * ioctl-based mfn mapping interface
  56.230 @@ -296,38 +107,4 @@ typedef struct privcmd_mmap {
  56.231  } privcmd_mmap_t; 
  56.232  */
  56.233  
  56.234 -#define mfn_mapper_queue_size 128
  56.235 -
  56.236 -typedef struct mfn_mapper {
  56.237 -    int xc_handle;
  56.238 -    int size;
  56.239 -    int prot;
  56.240 -    int error;
  56.241 -    int max_queue_size;
  56.242 -    void * addr;
  56.243 -    privcmd_mmap_t ioctl; 
  56.244 -    
  56.245 -} mfn_mapper_t;
  56.246 -
  56.247 -unsigned long xc_get_m2p_start_mfn (int xc_handle);
  56.248 -
  56.249 -int xc_copy_to_domain_page(int xc_handle, u32 domid,
  56.250 -                            unsigned long dst_pfn, void *src_page);
  56.251 -
  56.252 -unsigned long xc_get_filesz(int fd);
  56.253 -
  56.254 -char *xc_read_kernel_image(const char *filename, unsigned long *size);
  56.255 -
  56.256 -void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  56.257 -                   int xch, u32 dom, unsigned long *parray,
  56.258 -                   unsigned long vstart);
  56.259 -
  56.260 -int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
  56.261 -	      domid_t dom);
  56.262 -
  56.263 -/* image loading */
  56.264 -int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
  56.265 -int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
  56.266 -int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
  56.267 -
  56.268  #endif /* __XC_PRIVATE_H__ */
    57.1 --- a/tools/libxc/xc_vmx_build.c	Wed Aug 24 22:24:10 2005 +0000
    57.2 +++ b/tools/libxc/xc_vmx_build.c	Thu Aug 25 00:55:20 2005 +0000
    57.3 @@ -3,7 +3,7 @@
    57.4   */
    57.5  
    57.6  #include <stddef.h>
    57.7 -#include "xc_private.h"
    57.8 +#include "xg_private.h"
    57.9  #define ELFSIZE 32
   57.10  #include "xc_elf.h"
   57.11  #include <stdlib.h>
   57.12 @@ -243,7 +243,7 @@ static int setup_guest(int xc_handle,
   57.13      shared_info_t *shared_info;
   57.14      struct linux_boot_params * boot_paramsp;
   57.15      __u16 * boot_gdtp;
   57.16 -    mmu_t *mmu = NULL;
   57.17 +    xc_mmu_t *mmu = NULL;
   57.18      int rc;
   57.19  
   57.20      unsigned long nr_pt_pages;
   57.21 @@ -358,7 +358,7 @@ static int setup_guest(int xc_handle,
   57.22          }
   57.23      }
   57.24  
   57.25 -    if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
   57.26 +    if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
   57.27          goto error_out;
   57.28  
   57.29  #ifdef __i386__
   57.30 @@ -459,9 +459,9 @@ static int setup_guest(int xc_handle,
   57.31      /* Write the machine->phys table entries. */
   57.32      for ( count = 0; count < nr_pages; count++ )
   57.33      {
   57.34 -        if ( add_mmu_update(xc_handle, mmu,
   57.35 -                            (page_array[count] << PAGE_SHIFT) | 
   57.36 -                            MMU_MACHPHYS_UPDATE, count) )
   57.37 +        if ( xc_add_mmu_update(xc_handle, mmu,
   57.38 +			       (page_array[count] << PAGE_SHIFT) | 
   57.39 +			       MMU_MACHPHYS_UPDATE, count) )
   57.40  	    goto error_out;
   57.41      }
   57.42      
   57.43 @@ -587,7 +587,7 @@ static int setup_guest(int xc_handle,
   57.44  #endif
   57.45  
   57.46      /* Send the page update requests down to the hypervisor. */
   57.47 -    if ( finish_mmu_updates(xc_handle, mmu) )
   57.48 +    if ( xc_finish_mmu_updates(xc_handle, mmu) )
   57.49          goto error_out;
   57.50  
   57.51      free(mmu);
   57.52 @@ -708,7 +708,7 @@ int xc_vmx_build(int xc_handle,
   57.53  
   57.54      op.cmd = DOM0_GETDOMAININFO;
   57.55      op.u.getdomaininfo.domain = (domid_t)domid;
   57.56 -    if ( (do_dom0_op(xc_handle, &op) < 0) || 
   57.57 +    if ( (xc_dom0_op(xc_handle, &op) < 0) || 
   57.58           ((u16)op.u.getdomaininfo.domain != domid) )
   57.59      {
   57.60          PERROR("Could not get info on domain");
   57.61 @@ -789,7 +789,7 @@ int xc_vmx_build(int xc_handle,
   57.62      launch_op.u.setdomaininfo.ctxt   = ctxt;
   57.63  
   57.64      launch_op.cmd = DOM0_SETDOMAININFO;
   57.65 -    rc = do_dom0_op(xc_handle, &launch_op);
   57.66 +    rc = xc_dom0_op(xc_handle, &launch_op);
   57.67      
   57.68      return rc;
   57.69  
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/tools/libxc/xenctrl.h	Thu Aug 25 00:55:20 2005 +0000
    58.3 @@ -0,0 +1,526 @@
    58.4 +/******************************************************************************
    58.5 + * xenctrl.h
    58.6 + * 
    58.7 + * A library for low-level access to the Xen control interfaces.
    58.8 + * 
    58.9 + * Copyright (c) 2003-2004, K A Fraser.
   58.10 + */
   58.11 +
   58.12 +#ifndef XENCTRL_H
   58.13 +#define XENCTRL_H
   58.14 +
   58.15 +#include <stdint.h>
   58.16 +
   58.17 +typedef uint8_t            u8;
   58.18 +typedef uint16_t           u16;
   58.19 +typedef uint32_t           u32;
   58.20 +typedef uint64_t           u64;
   58.21 +typedef int8_t             s8;
   58.22 +typedef int16_t            s16;
   58.23 +typedef int32_t            s32;
   58.24 +typedef int64_t            s64;
   58.25 +
   58.26 +#include <sys/ptrace.h>
   58.27 +#include <xen/xen.h>
   58.28 +#include <xen/dom0_ops.h>
   58.29 +#include <xen/event_channel.h>
   58.30 +#include <xen/sched_ctl.h>
   58.31 +#include <xen/acm.h>
   58.32 +
   58.33 +#ifdef __ia64__
   58.34 +#define XC_PAGE_SHIFT           14
   58.35 +#else
   58.36 +#define XC_PAGE_SHIFT           12
   58.37 +#endif
   58.38 +#define XC_PAGE_SIZE            (1UL << XC_PAGE_SHIFT)
   58.39 +#define XC_PAGE_MASK            (~(XC_PAGE_SIZE-1))
   58.40 +
   58.41 +/*
   58.42 + *  DEFINITIONS FOR CPU BARRIERS
   58.43 + */ 
   58.44 +
   58.45 +#if defined(__i386__)
   58.46 +#define mb()  __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   58.47 +#define rmb() __asm__ __volatile__ ( "lock; addl $0,0(%%esp)" : : : "memory" )
   58.48 +#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   58.49 +#elif defined(__x86_64__)
   58.50 +#define mb()  __asm__ __volatile__ ( "mfence" : : : "memory")
   58.51 +#define rmb() __asm__ __volatile__ ( "lfence" : : : "memory")
   58.52 +#define wmb() __asm__ __volatile__ ( "" : : : "memory")
   58.53 +#elif defined(__ia64__)
   58.54 +/* FIXME */
   58.55 +#define mb()
   58.56 +#define rmb()
   58.57 +#define wmb()
   58.58 +#else
   58.59 +#error "Define barriers"
   58.60 +#endif
   58.61 +
   58.62 +/*
   58.63 + *  INITIALIZATION FUNCTIONS
   58.64 + */ 
   58.65 +
   58.66 +/**
   58.67 + * This function opens a handle to the hypervisor interface.  This function can
   58.68 + * be called multiple times within a single process.  Multiple processes can
   58.69 + * have an open hypervisor interface at the same time.
   58.70 + *
   58.71 + * Each call to this function should have a corresponding call to
   58.72 + * xc_interface_close().
   58.73 + *
   58.74 + * This function can fail if the caller does not have superuser permission or
   58.75 + * if a Xen-enabled kernel is not currently running.
   58.76 + *
   58.77 + * @return a handle to the hypervisor interface or -1 on failure
   58.78 + */
   58.79 +int xc_interface_open(void);
   58.80 +
   58.81 +/**
   58.82 + * This function closes an open hypervisor interface.
   58.83 + *
   58.84 + * This function can fail if the handle does not represent an open interface or
   58.85 + * if there were problems closing the interface.
   58.86 + *
   58.87 + * @parm xc_handle a handle to an open hypervisor interface
   58.88 + * @return 0 on success, -1 otherwise.
   58.89 + */
   58.90 +int xc_interface_close(int xc_handle);
   58.91 +
   58.92 +/*
   58.93 + * DOMAIN DEBUGGING FUNCTIONS
   58.94 + */
   58.95 +
   58.96 +typedef struct xc_core_header {
   58.97 +    unsigned int xch_magic;
   58.98 +    unsigned int xch_nr_vcpus;
   58.99 +    unsigned int xch_nr_pages;
  58.100 +    unsigned int xch_ctxt_offset;
  58.101 +    unsigned int xch_index_offset;
  58.102 +    unsigned int xch_pages_offset;
  58.103 +} xc_core_header_t;
  58.104 +
  58.105 +
  58.106 +long xc_ptrace(enum __ptrace_request request, 
  58.107 +               u32  domid,
  58.108 +               long addr, 
  58.109 +               long data);
  58.110 +
  58.111 +long xc_ptrace_core(enum __ptrace_request request, 
  58.112 +                    u32 domid, 
  58.113 +                    long addr, 
  58.114 +                    long data);
  58.115 +
  58.116 +int xc_waitdomain(int domain, 
  58.117 +                  int *status, 
  58.118 +                  int options);
  58.119 +
  58.120 +int xc_waitdomain_core(int domain, 
  58.121 +                       int *status, 
  58.122 +                       int options);
  58.123 +
  58.124 +/*
  58.125 + * DOMAIN MANAGEMENT FUNCTIONS
  58.126 + */
  58.127 +
  58.128 +typedef struct {
  58.129 +    u32           domid;
  58.130 +    u32           ssidref;
  58.131 +    unsigned int  dying:1, crashed:1, shutdown:1, 
  58.132 +                  paused:1, blocked:1, running:1;
  58.133 +    unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
  58.134 +    unsigned long nr_pages;
  58.135 +    unsigned long shared_info_frame;
  58.136 +    u64           cpu_time;
  58.137 +    unsigned long max_memkb;
  58.138 +    unsigned int  vcpus;
  58.139 +    s32           vcpu_to_cpu[MAX_VIRT_CPUS];
  58.140 +    cpumap_t      cpumap[MAX_VIRT_CPUS];
  58.141 +} xc_dominfo_t;
  58.142 +
  58.143 +typedef dom0_getdomaininfo_t xc_domaininfo_t;
  58.144 +int xc_domain_create(int xc_handle, 
  58.145 +                     u32 ssidref,
  58.146 +                     u32 *pdomid);
  58.147 +
  58.148 +
  58.149 +int xc_domain_dumpcore(int xc_handle, 
  58.150 +                       u32 domid,
  58.151 +                       const char *corename);
  58.152 +
  58.153 +
  58.154 +/**
  58.155 + * This function pauses a domain. A paused domain still exists in memory
  58.156 + * however it does not receive any timeslices from the hypervisor.
  58.157 + *
  58.158 + * @parm xc_handle a handle to an open hypervisor interface
  58.159 + * @parm domid the domain id to pause
  58.160 + * @return 0 on success, -1 on failure.
  58.161 + */
  58.162 +int xc_domain_pause(int xc_handle, 
  58.163 +                    u32 domid);
  58.164 +/**
  58.165 + * This function unpauses a domain.  The domain should have been previously
  58.166 + * paused.
  58.167 + *
  58.168 + * @parm xc_handle a handle to an open hypervisor interface
  58.169 + * @parm domid the domain id to unpause
  58.170 + * return 0 on success, -1 on failure
  58.171 + */
  58.172 +int xc_domain_unpause(int xc_handle, 
  58.173 +                      u32 domid);
  58.174 +
  58.175 +/**
  58.176 + * This function will destroy a domain.  Destroying a domain removes the domain
  58.177 + * completely from memory.  This function should be called after sending the
  58.178 + * domain a SHUTDOWN control message to free up the domain resources.
  58.179 + *
  58.180 + * @parm xc_handle a handle to an open hypervisor interface
  58.181 + * @parm domid the domain id to destroy
  58.182 + * @return 0 on success, -1 on failure
  58.183 + */
  58.184 +int xc_domain_destroy(int xc_handle, 
  58.185 +                      u32 domid);
  58.186 +int xc_domain_pincpu(int xc_handle,
  58.187 +                     u32 domid,
  58.188 +                     int vcpu,
  58.189 +                     cpumap_t *cpumap);
  58.190 +/**
  58.191 + * This function will return information about one or more domains. It is
  58.192 + * designed to iterate over the list of domains. If a single domain is
  58.193 + * requested, this function will return the next domain in the list - if
  58.194 + * one exists. It is, therefore, important in this case to make sure the
  58.195 + * domain requested was the one returned.
  58.196 + *
  58.197 + * @parm xc_handle a handle to an open hypervisor interface
  58.198 + * @parm first_domid the first domain to enumerate information from.  Domains
  58.199 + *                   are currently enumerate in order of creation.
  58.200 + * @parm max_doms the number of elements in info
  58.201 + * @parm info an array of max_doms size that will contain the information for
  58.202 + *            the enumerated domains.
  58.203 + * @return the number of domains enumerated or -1 on error
  58.204 + */
  58.205 +int xc_domain_getinfo(int xc_handle,
  58.206 +                      u32 first_domid, 
  58.207 +                      unsigned int max_doms,
  58.208 +                      xc_dominfo_t *info);
  58.209 +
  58.210 +/**
  58.211 + * This function will return information about one or more domains, using a
  58.212 + * single hypercall.  The domain information will be stored into the supplied
  58.213 + * array of xc_domaininfo_t structures.
  58.214 + *
  58.215 + * @parm xc_handle a handle to an open hypervisor interface
  58.216 + * @parm first_domain the first domain to enumerate information from.
  58.217 + *                    Domains are currently enumerate in order of creation.
  58.218 + * @parm max_domains the number of elements in info
  58.219 + * @parm info an array of max_doms size that will contain the information for
  58.220 + *            the enumerated domains.
  58.221 + * @return the number of domains enumerated or -1 on error
  58.222 + */
  58.223 +int xc_domain_getinfolist(int xc_handle,
  58.224 +                          u32 first_domain,
  58.225 +                          unsigned int max_domains,
  58.226 +                          xc_domaininfo_t *info);
  58.227 +
  58.228 +/**
  58.229 + * This function returns information about one domain.  This information is
  58.230 + * more detailed than the information from xc_domain_getinfo().
  58.231 + *
  58.232 + * @parm xc_handle a handle to an open hypervisor interface
  58.233 + * @parm domid the domain to get information from
  58.234 + * @parm info a pointer to an xc_domaininfo_t to store the domain information
  58.235 + * @parm ctxt a pointer to a structure to store the execution context of the
  58.236 + *            domain
  58.237 + * @return 0 on success, -1 on failure
  58.238 + */
  58.239 +int xc_domain_get_vcpu_context(int xc_handle,
  58.240 +                               u32 domid,
  58.241 +                               u32 vcpu,
  58.242 +                               vcpu_guest_context_t *ctxt);
  58.243 +
  58.244 +int xc_domain_setcpuweight(int xc_handle,
  58.245 +                           u32 domid,
  58.246 +                           float weight);
  58.247 +long long xc_domain_get_cpu_usage(int xc_handle,
  58.248 +                                  domid_t domid,
  58.249 +                                  int vcpu);
  58.250 +
  58.251 +
  58.252 +typedef dom0_shadow_control_stats_t xc_shadow_control_stats_t;
  58.253 +int xc_shadow_control(int xc_handle,
  58.254 +                      u32 domid, 
  58.255 +                      unsigned int sop,
  58.256 +                      unsigned long *dirty_bitmap,
  58.257 +                      unsigned long pages,
  58.258 +                      xc_shadow_control_stats_t *stats);
  58.259 +
  58.260 +int xc_bvtsched_global_set(int xc_handle,
  58.261 +                           unsigned long ctx_allow);
  58.262 +
  58.263 +int xc_bvtsched_domain_set(int xc_handle,
  58.264 +                           u32 domid,
  58.265 +                           u32 mcuadv,
  58.266 +                           int warpback,
  58.267 +                           s32 warpvalue,
  58.268 +                           long long warpl,
  58.269 +                           long long warpu);
  58.270 +
  58.271 +int xc_bvtsched_global_get(int xc_handle,
  58.272 +                           unsigned long *ctx_allow);
  58.273 +
  58.274 +int xc_bvtsched_domain_get(int xc_handle,
  58.275 +                           u32 domid,
  58.276 +                           u32 *mcuadv,
  58.277 +                           int *warpback,
  58.278 +                           s32 *warpvalue,
  58.279 +                           long long *warpl,
  58.280 +                           long long *warpu);
  58.281 +
  58.282 +int xc_sedf_domain_set(int xc_handle,
  58.283 +                          u32 domid,
  58.284 +                          u64 period, u64 slice, u64 latency, u16 extratime, u16 weight);
  58.285 +
  58.286 +int xc_sedf_domain_get(int xc_handle,
  58.287 +                          u32 domid,
  58.288 +                          u64* period, u64 *slice, u64 *latency, u16 *extratime, u16* weight);
  58.289 +
  58.290 +typedef evtchn_status_t xc_evtchn_status_t;
  58.291 +
  58.292 +/*
  58.293 + * EVENT CHANNEL FUNCTIONS
  58.294 + */
  58.295 +
  58.296 +/**
  58.297 + * This function allocates an unbound port.  Ports are named endpoints used for
  58.298 + * interdomain communication.  This function is most useful in opening a
  58.299 + * well-known port within a domain to receive events on.
  58.300 + *
  58.301 + * @parm xc_handle a handle to an open hypervisor interface
  58.302 + * @parm dom the ID of the domain.  This maybe DOMID_SELF
  58.303 + * @parm port a pointer to a port.  This is an in/out parameter.  If *port is
  58.304 + *            0, then a new port will be assigned, if port is > 0 then that
  58.305 + *            port is allocated if the port is unallocated.
  58.306 + * @return 0 on success, -1 on failure
  58.307 + */
  58.308 +int xc_evtchn_alloc_unbound(int xc_handle,
  58.309 +                            u32 dom,
  58.310 +                            int *port);
  58.311 +
  58.312 +/**
  58.313 + * This function creates a pair of ports between two domains.  A port can only
  58.314 + * be bound once within a domain.
  58.315 + *
  58.316 + * @parm xc_handle a handle to an open hypervisor interface
  58.317 + * @parm dom1 one of the two domains to connect.  Can be DOMID_SELF.
  58.318 + * @parm dom2 the other domain to connect.  Can be DOMID_SELF.
  58.319 + * @parm port1 an in/out parameter.  If > 0, then try to connect *port.  If
  58.320 + *             0, then allocate a new port and store the port in *port.
  58.321 + * @parm port2 the port connected on port2.  This parameter behaves the same
  58.322 + *             way as port1.
  58.323 + * @return 0 on success, -1 on error.
  58.324 + */
  58.325 +int xc_evtchn_bind_interdomain(int xc_handle,
  58.326 +                               u32 dom1,
  58.327 +                               u32 dom2,
  58.328 +                               int *port1,
  58.329 +                               int *port2);
  58.330 +int xc_evtchn_bind_virq(int xc_handle,
  58.331 +                        int virq,
  58.332 +                        int *port);
  58.333 +
  58.334 +/**
  58.335 + * This function will close a single port on an event channel.
  58.336 + *
  58.337 + * @parm xc_handle a handle to an open hypervisor interface
  58.338 + * @parm dom the domain that the port exists on.  May be DOMID_SELF.
  58.339 + * @parm port the port to close
  58.340 + * @return 0 on success, -1 on error
  58.341 + */
  58.342 +int xc_evtchn_close(int xc_handle,
  58.343 +                    u32 dom,   /* may be DOMID_SELF */
  58.344 +                    int port);
  58.345 +
  58.346 +/**
  58.347 + * This function generates a notify event on a bound port.
  58.348 + *
  58.349 + * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
  58.350 + * a 16 bit value.  The result will be the port the event occurred on.  When
  58.351 + * events occur, the port is masked until the 16 bit port value is written back
  58.352 + * to the file.  When /dev/xen/evtchn is opened, it has to be bound via an
  58.353 + * ioctl to each port to listen on.  The ioctl for binding is _IO('E', 2).  The
  58.354 + * parameter is the port to listen on.
  58.355 + *
  58.356 + * @parm xc_handle a handle to an open hypervisor interface
  58.357 + * @parm local_port the port to generate the notify on
  58.358 + * @return 0 on success, -1 on error
  58.359 + */
  58.360 +int xc_evtchn_send(int xc_handle,
  58.361 +                   int local_port);
  58.362 +int xc_evtchn_status(int xc_handle,
  58.363 +                     u32 dom, /* may be DOMID_SELF */
  58.364 +                     int port,
  58.365 +                     xc_evtchn_status_t *status);
  58.366 +
  58.367 +int xc_physdev_pci_access_modify(int xc_handle,
  58.368 +                                 u32 domid,
  58.369 +                                 int bus,
  58.370 +                                 int dev,
  58.371 +                                 int func,
  58.372 +                                 int enable);
  58.373 +
  58.374 +int xc_readconsolering(int xc_handle,
  58.375 +                       char **pbuffer,
  58.376 +                       unsigned int *pnr_chars, 
  58.377 +                       int clear);
  58.378 +
  58.379 +typedef dom0_physinfo_t xc_physinfo_t;
  58.380 +int xc_physinfo(int xc_handle,
  58.381 +                xc_physinfo_t *info);
  58.382 +
  58.383 +int xc_sched_id(int xc_handle,
  58.384 +                int *sched_id);
  58.385 +
  58.386 +int xc_domain_setmaxmem(int xc_handle,
  58.387 +                        u32 domid, 
  58.388 +                        unsigned int max_memkb);
  58.389 +
  58.390 +int xc_domain_memory_increase_reservation(int xc_handle,
  58.391 +                                          u32 domid, 
  58.392 +                                          unsigned int mem_kb);
  58.393 +
  58.394 +typedef dom0_perfc_desc_t xc_perfc_desc_t;
  58.395 +/* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
  58.396 +int xc_perfc_control(int xc_handle,
  58.397 +                     u32 op,
  58.398 +                     xc_perfc_desc_t *desc);
  58.399 +
  58.400 +/* read/write msr */
  58.401 +long long xc_msr_read(int xc_handle, int cpu_mask, int msr);
  58.402 +int xc_msr_write(int xc_handle, int cpu_mask, int msr, unsigned int low,
  58.403 +                  unsigned int high);
  58.404 +
  58.405 +/**
  58.406 + * Memory maps a range within one domain to a local address range.  Mappings
  58.407 + * should be unmapped with munmap and should follow the same rules as mmap
  58.408 + * regarding page alignment.  Returns NULL on failure.
  58.409 + *
  58.410 + * In Linux, the ring queue for the control channel is accessible by mapping
  58.411 + * the shared_info_frame (from xc_domain_getinfo()) + 2048.  The structure
  58.412 + * stored there is of type control_if_t.
  58.413 + *
  58.414 + * @parm xc_handle a handle on an open hypervisor interface
  58.415 + * @parm dom the domain to map memory from
  58.416 + * @parm size the amount of memory to map (in multiples of page size)
  58.417 + * @parm prot same flag as in mmap().
  58.418 + * @parm mfn the frame address to map.
  58.419 + */
  58.420 +void *xc_map_foreign_range(int xc_handle, u32 dom,
  58.421 +                            int size, int prot,
  58.422 +                            unsigned long mfn );
  58.423 +
  58.424 +void *xc_map_foreign_batch(int xc_handle, u32 dom, int prot,
  58.425 +                           unsigned long *arr, int num );
  58.426 +
  58.427 +int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  58.428 +                    unsigned long max_pfns);
  58.429 +
  58.430 +int xc_ia64_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf, 
  58.431 +                    unsigned int start_page, unsigned int nr_pages);
  58.432 +
  58.433 +int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
  58.434 +		 domid_t dom);
  58.435 +
  58.436 +int xc_dom_mem_op(int xc_handle, unsigned int memop, unsigned int *extent_list,
  58.437 +		  unsigned int nr_extents, unsigned int extent_order,
  58.438 +		  domid_t domid);
  58.439 +
  58.440 +int xc_get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
  58.441 +
  58.442 +
  58.443 +/*\
  58.444 + *  GRANT TABLE FUNCTIONS
  58.445 +\*/ 
  58.446 +
  58.447 +/**
  58.448 + * This function opens a handle to the more restricted grant table hypervisor
  58.449 + * interface. This may be used where the standard interface is not
  58.450 + * available because the domain is not privileged.
  58.451 + * This function can  be called multiple times within a single process.
  58.452 + * Multiple processes can have an open hypervisor interface at the same time.
  58.453 + *
  58.454 + * Each call to this function should have a corresponding call to
  58.455 + * xc_grant_interface_close().
  58.456 + *
  58.457 + * This function can fail if a Xen-enabled kernel is not currently running.
  58.458 + *
  58.459 + * @return a handle to the hypervisor grant table interface or -1 on failure
  58.460 + */
  58.461 +int xc_grant_interface_open(void);
  58.462 +
  58.463 +/**
  58.464 + * This function closes an open grant table hypervisor interface.
  58.465 + *
  58.466 + * This function can fail if the handle does not represent an open interface or
  58.467 + * if there were problems closing the interface.
  58.468 + *
  58.469 + * @parm xc_handle a handle to an open grant table hypervisor interface
  58.470 + * @return 0 on success, -1 otherwise.
  58.471 + */
  58.472 +int xc_grant_interface_close(int xc_handle);
  58.473 +
  58.474 +int xc_gnttab_map_grant_ref(int  xc_handle,
  58.475 +                            u64  host_virt_addr,
  58.476 +                            u32  dom,
  58.477 +                            u16  ref,
  58.478 +                            u16  flags,
  58.479 +                            s16 *handle,
  58.480 +                            u64 *dev_bus_addr);
  58.481 +
  58.482 +int xc_gnttab_unmap_grant_ref(int  xc_handle,
  58.483 +                              u64  host_virt_addr,
  58.484 +                              u64  dev_bus_addr,
  58.485 +                              u16  handle,
  58.486 +                              s16 *status);
  58.487 +
  58.488 +int xc_gnttab_setup_table(int        xc_handle,
  58.489 +                          u32        dom,
  58.490 +                          u16        nr_frames,
  58.491 +                          s16       *status,
  58.492 +                          unsigned long **frame_list);
  58.493 +
  58.494 +/* Grant debug builds only: */
  58.495 +int xc_gnttab_dump_table(int        xc_handle,
  58.496 +                         u32        dom,
  58.497 +                         s16       *status);
  58.498 +
  58.499 +/* Get current total pages allocated to a domain. */
  58.500 +long xc_get_tot_pages(int xc_handle, u32 domid);
  58.501 +
  58.502 +/* Execute a privileged dom0 operation. */
  58.503 +int xc_dom0_op(int xc_handle, dom0_op_t *op);
  58.504 +
  58.505 +/* Initializes the store (for dom0)
  58.506 +   remote_port should be the remote end of a bound interdomain channel between
  58.507 +   the store and dom0.
  58.508 +
  58.509 +   This function returns a shared frame that should be passed to
  58.510 +   xs_introduce_domain
  58.511 + */
  58.512 +long xc_init_store(int xc_handle, int remote_port);
  58.513 +
  58.514 +/*
  58.515 + * MMU updates.
  58.516 + */
  58.517 +#define MAX_MMU_UPDATES 1024
  58.518 +struct xc_mmu {
  58.519 +    mmu_update_t updates[MAX_MMU_UPDATES];
  58.520 +    int          idx;
  58.521 +    domid_t      subject;
  58.522 +};
  58.523 +typedef struct xc_mmu xc_mmu_t;
  58.524 +xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
  58.525 +int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu, 
  58.526 +                   unsigned long ptr, unsigned long val);
  58.527 +int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
  58.528 +
  58.529 +#endif
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/tools/libxc/xenguest.h	Thu Aug 25 00:55:20 2005 +0000
    59.3 @@ -0,0 +1,66 @@
    59.4 +/******************************************************************************
    59.5 + * xenguest.h
    59.6 + * 
    59.7 + * A library for guest domain management in Xen.
    59.8 + * 
    59.9 + * Copyright (c) 2003-2004, K A Fraser.
   59.10 + */
   59.11 +
   59.12 +#ifndef XENBUILD_H
   59.13 +#define XENBUILD_H
   59.14 +
   59.15 +#define XCFLAGS_VERBOSE   1
   59.16 +#define XCFLAGS_LIVE      2
   59.17 +#define XCFLAGS_DEBUG     4
   59.18 +#define XCFLAGS_CONFIGURE 8
   59.19 +
   59.20 +/**
   59.21 + * This function will save a domain running Linux.
   59.22 + *
   59.23 + * @parm xc_handle a handle to an open hypervisor interface
   59.24 + * @parm fd the file descriptor to save a domain to
   59.25 + * @parm dom the id of the domain
   59.26 + * @return 0 on success, -1 on failure
   59.27 + */
   59.28 +int xc_linux_save(int xc_handle, int fd, uint32_t dom);
   59.29 +
   59.30 +/**
   59.31 + * This function will restore a saved domain running Linux.
   59.32 + *
   59.33 + * @parm xc_handle a handle to an open hypervisor interface
   59.34 + * @parm fd the file descriptor to restore a domain from
   59.35 + * @parm dom the id of the domain
   59.36 + * @parm nr_pfns the number of pages
   59.37 + * @parm store_evtchn the store event channel for this domain to use
   59.38 + * @parm store_mfn returned with the mfn of the store page
   59.39 + * @return 0 on success, -1 on failure
   59.40 + */
   59.41 +int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pfns,
   59.42 +		     unsigned int store_evtchn, unsigned long *store_mfn);
   59.43 +
   59.44 +int xc_linux_build(int xc_handle,
   59.45 +                   uint32_t domid,
   59.46 +                   const char *image_name,
   59.47 +                   const char *ramdisk_name,
   59.48 +                   const char *cmdline,
   59.49 +                   unsigned int control_evtchn,
   59.50 +                   unsigned long flags,
   59.51 +                   unsigned int vcpus,
   59.52 +                   unsigned int store_evtchn,
   59.53 +                   unsigned long *store_mfn);
   59.54 +
   59.55 +struct mem_map;
   59.56 +int xc_vmx_build(int xc_handle,
   59.57 +                 uint32_t domid,
   59.58 +                 int memsize,
   59.59 +                 const char *image_name,
   59.60 +                 struct mem_map *memmap,
   59.61 +                 const char *ramdisk_name,
   59.62 +                 const char *cmdline,
   59.63 +                 unsigned int control_evtchn,
   59.64 +                 unsigned long flags,
   59.65 +                 unsigned int vcpus,
   59.66 +                 unsigned int store_evtchn,
   59.67 +                 unsigned long *store_mfn);
   59.68 +
   59.69 +#endif
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/tools/libxc/xg_private.c	Thu Aug 25 00:55:20 2005 +0000
    60.3 @@ -0,0 +1,86 @@
    60.4 +/******************************************************************************
    60.5 + * xg_private.c
    60.6 + * 
    60.7 + * Helper functions for the rest of the library.
    60.8 + */
    60.9 +
   60.10 +#include <stdlib.h>
   60.11 +#include <zlib.h>
   60.12 +
   60.13 +#include "xg_private.h"
   60.14 +
   60.15 +char *xc_read_kernel_image(const char *filename, unsigned long *size)
   60.16 +{
   60.17 +    int kernel_fd = -1;
   60.18 +    gzFile kernel_gfd = NULL;
   60.19 +    char *image = NULL;
   60.20 +    unsigned int bytes;
   60.21 +
   60.22 +    if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
   60.23 +    {
   60.24 +        PERROR("Could not open kernel image");
   60.25 +        goto out;
   60.26 +    }
   60.27 +
   60.28 +    if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
   60.29 +    {
   60.30 +        PERROR("Could not read kernel image");
   60.31 +        goto out;
   60.32 +    }
   60.33 +
   60.34 +    if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
   60.35 +    {
   60.36 +        PERROR("Could not allocate decompression state for state file");
   60.37 +        goto out;
   60.38 +    }
   60.39 +
   60.40 +    if ( (image = malloc(*size)) == NULL )
   60.41 +    {
   60.42 +        PERROR("Could not allocate memory for kernel image");
   60.43 +        goto out;
   60.44 +    }
   60.45 +
   60.46 +    if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
   60.47 +    {
   60.48 +        PERROR("Error reading kernel image, could not"
   60.49 +               " read the whole image (%d != %ld).", bytes, *size);
   60.50 +        free(image);
   60.51 +        image = NULL;
   60.52 +    }
   60.53 +
   60.54 + out:
   60.55 +    if ( kernel_gfd != NULL )
   60.56 +        gzclose(kernel_gfd);
   60.57 +    else if ( kernel_fd >= 0 )
   60.58 +        close(kernel_fd);
   60.59 +    return image;
   60.60 +}
   60.61 +
   60.62 +/*******************/
   60.63 +
   60.64 +int pin_table(
   60.65 +    int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
   60.66 +{
   60.67 +    struct mmuext_op op;
   60.68 +
   60.69 +    op.cmd = type;
   60.70 +    op.mfn = mfn;
   60.71 +
   60.72 +    if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 )
   60.73 +        return 1;
   60.74 +
   60.75 +    return 0;
   60.76 +}
   60.77 +
   60.78 +/* This is shared between save and restore, and may generally be useful. */
   60.79 +unsigned long csum_page (void * page)
   60.80 +{
   60.81 +    int i;
   60.82 +    unsigned long *p = page;
   60.83 +    unsigned long long sum=0;
   60.84 +
   60.85 +    for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
   60.86 +        sum += p[i];
   60.87 +
   60.88 +    return sum ^ (sum>>32);
   60.89 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/tools/libxc/xg_private.h	Thu Aug 25 00:55:20 2005 +0000
    61.3 @@ -0,0 +1,170 @@
    61.4 +#ifndef XG_PRIVATE_H
    61.5 +#define XG_PRIVATE_H
    61.6 +
    61.7 +#include <errno.h>
    61.8 +#include <fcntl.h>
    61.9 +#include <stdio.h>
   61.10 +#include <string.h>
   61.11 +#include <sys/mman.h>
   61.12 +#include <sys/types.h>
   61.13 +#include <sys/stat.h>
   61.14 +
   61.15 +#include "xenctrl.h"
   61.16 +
   61.17 +#include <xen/linux/privcmd.h>
   61.18 +
   61.19 +char *xc_read_kernel_image(const char *filename, unsigned long *size);
   61.20 +unsigned long csum_page (void * page);
   61.21 +
   61.22 +#define _PAGE_PRESENT   0x001
   61.23 +#define _PAGE_RW        0x002
   61.24 +#define _PAGE_USER      0x004
   61.25 +#define _PAGE_PWT       0x008
   61.26 +#define _PAGE_PCD       0x010
   61.27 +#define _PAGE_ACCESSED  0x020
   61.28 +#define _PAGE_DIRTY     0x040
   61.29 +#define _PAGE_PAT       0x080
   61.30 +#define _PAGE_PSE       0x080
   61.31 +#define _PAGE_GLOBAL    0x100
   61.32 +
   61.33 +#if defined(__i386__)
   61.34 +#define L1_PAGETABLE_SHIFT       12
   61.35 +#define L2_PAGETABLE_SHIFT       22
   61.36 +#define L1_PAGETABLE_SHIFT_PAE   12
   61.37 +#define L2_PAGETABLE_SHIFT_PAE   21
   61.38 +#define L3_PAGETABLE_SHIFT_PAE   30
   61.39 +#elif defined(__x86_64__)
   61.40 +#define L1_PAGETABLE_SHIFT      12
   61.41 +#define L2_PAGETABLE_SHIFT      21
   61.42 +#define L3_PAGETABLE_SHIFT      30
   61.43 +#define L4_PAGETABLE_SHIFT      39
   61.44 +#endif
   61.45 +
   61.46 +#if defined(__i386__) 
   61.47 +#define ENTRIES_PER_L1_PAGETABLE 1024
   61.48 +#define ENTRIES_PER_L2_PAGETABLE 1024
   61.49 +#define L1_PAGETABLE_ENTRIES_PAE  512
   61.50 +#define L2_PAGETABLE_ENTRIES_PAE  512
   61.51 +#define L3_PAGETABLE_ENTRIES_PAE    4
   61.52 +#elif defined(__x86_64__)
   61.53 +#define L1_PAGETABLE_ENTRIES    512
   61.54 +#define L2_PAGETABLE_ENTRIES    512
   61.55 +#define L3_PAGETABLE_ENTRIES    512
   61.56 +#define L4_PAGETABLE_ENTRIES    512
   61.57 +#endif
   61.58 + 
   61.59 +#define PAGE_SHIFT              XC_PAGE_SHIFT
   61.60 +#define PAGE_SIZE               (1UL << PAGE_SHIFT)
   61.61 +#define PAGE_MASK               (~(PAGE_SIZE-1))
   61.62 +
   61.63 +typedef u32 l1_pgentry_32_t;
   61.64 +typedef u32 l2_pgentry_32_t;
   61.65 +typedef u64 l1_pgentry_64_t;
   61.66 +typedef u64 l2_pgentry_64_t;
   61.67 +typedef u64 l3_pgentry_64_t;
   61.68 +typedef unsigned long l1_pgentry_t;
   61.69 +typedef unsigned long l2_pgentry_t;
   61.70 +#if defined(__x86_64__)
   61.71 +typedef unsigned long l3_pgentry_t;
   61.72 +typedef unsigned long l4_pgentry_t;
   61.73 +#endif
   61.74 +
   61.75 +#if defined(__i386__)
   61.76 +#define l1_table_offset(_a) \
   61.77 +          (((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
   61.78 +#define l2_table_offset(_a) \
   61.79 +          ((_a) >> L2_PAGETABLE_SHIFT)
   61.80 +#define l1_table_offset_pae(_a) \
   61.81 +  (((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
   61.82 +#define l2_table_offset_pae(_a) \
   61.83 +  (((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
   61.84 +#define l3_table_offset_pae(_a) \
   61.85 +	(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
   61.86 +#elif defined(__x86_64__)
   61.87 +#define l1_table_offset(_a) \
   61.88 +  (((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
   61.89 +#define l2_table_offset(_a) \
   61.90 +  (((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
   61.91 +#define l3_table_offset(_a) \
   61.92 +	(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
   61.93 +#define l4_table_offset(_a) \
   61.94 +	(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
   61.95 +#endif
   61.96 +
   61.97 +#define ERROR(_m, _a...)                                \
   61.98 +do {                                                    \
   61.99 +    int __saved_errno = errno;                          \
  61.100 +    fprintf(stderr, "ERROR: " _m "\n" , ## _a );        \
  61.101 +    errno = __saved_errno;                              \
  61.102 +} while (0)
  61.103 +
  61.104 +
  61.105 +#define PERROR(_m, _a...)                                       \
  61.106 +do {                                                            \
  61.107 +    int __saved_errno = errno;                                  \
  61.108 +    fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a ,       \
  61.109 +            __saved_errno, strerror(__saved_errno));            \
  61.110 +    errno = __saved_errno;                                      \
  61.111 +} while (0)
  61.112 +
  61.113 +
  61.114 +struct domain_setup_info
  61.115 +{
  61.116 +    unsigned long v_start;
  61.117 +    unsigned long v_end;
  61.118 +    unsigned long v_kernstart;
  61.119 +    unsigned long v_kernend;
  61.120 +    unsigned long v_kernentry;
  61.121 +
  61.122 +    unsigned int  load_symtab;
  61.123 +    unsigned int  pae_kernel;
  61.124 +    unsigned long symtab_addr;
  61.125 +    unsigned long symtab_len;
  61.126 +};
  61.127 +
  61.128 +typedef int (*parseimagefunc)(char *image, unsigned long image_size,
  61.129 +			      struct domain_setup_info *dsi);
  61.130 +typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
  61.131 +			     u32 dom, unsigned long *parray,
  61.132 +			     struct domain_setup_info *dsi);
  61.133 +
  61.134 +struct load_funcs
  61.135 +{
  61.136 +    parseimagefunc parseimage;
  61.137 +    loadimagefunc loadimage;
  61.138 +};
  61.139 +
  61.140 +#define mfn_mapper_queue_size 128
  61.141 +
  61.142 +typedef struct mfn_mapper {
  61.143 +    int xc_handle;
  61.144 +    int size;
  61.145 +    int prot;
  61.146 +    int error;
  61.147 +    int max_queue_size;
  61.148 +    void * addr;
  61.149 +    privcmd_mmap_t ioctl; 
  61.150 +    
  61.151 +} mfn_mapper_t;
  61.152 +
  61.153 +unsigned long xc_get_m2p_start_mfn (int xc_handle);
  61.154 +
  61.155 +int xc_copy_to_domain_page(int xc_handle, u32 domid,
  61.156 +                            unsigned long dst_pfn, void *src_page);
  61.157 +
  61.158 +unsigned long xc_get_filesz(int fd);
  61.159 +
  61.160 +void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
  61.161 +                   int xch, u32 dom, unsigned long *parray,
  61.162 +                   unsigned long vstart);
  61.163 +
  61.164 +int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
  61.165 +	      domid_t dom);
  61.166 +
  61.167 +/* image loading */
  61.168 +int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
  61.169 +int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
  61.170 +int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
  61.171 +
  61.172 +#endif
  61.173 +
    62.1 --- a/tools/misc/Makefile	Wed Aug 24 22:24:10 2005 +0000
    62.2 +++ b/tools/misc/Makefile	Thu Aug 25 00:55:20 2005 +0000
    62.3 @@ -50,4 +50,4 @@ clean:
    62.4  	$(CC) -c $(CFLAGS) -o $@ $<
    62.5  
    62.6  $(TARGETS): %: %.o Makefile
    62.7 -	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
    62.8 +	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
    63.1 --- a/tools/misc/cpuperf/Makefile	Wed Aug 24 22:24:10 2005 +0000
    63.2 +++ b/tools/misc/cpuperf/Makefile	Thu Aug 25 00:55:20 2005 +0000
    63.3 @@ -37,7 +37,7 @@ clean:
    63.4  	$(CC) $(CFLAGS) -o $@ $<
    63.5  
    63.6  cpuperf-xen: cpuperf.c $(HDRS) Makefile
    63.7 -	$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxc -DXENO -o $@ $<
    63.8 +	$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxenctrl -DXENO -o $@ $<
    63.9  
   63.10  cpuperf-perfcntr: cpuperf.c $(HDRS) Makefile
   63.11  	$(CC) $(CFLAGS) -DPERFCNTR -o $@ $<
    64.1 --- a/tools/misc/cpuperf/cpuperf_xeno.h	Wed Aug 24 22:24:10 2005 +0000
    64.2 +++ b/tools/misc/cpuperf/cpuperf_xeno.h	Thu Aug 25 00:55:20 2005 +0000
    64.3 @@ -9,7 +9,7 @@
    64.4   *
    64.5   */
    64.6  
    64.7 -#include <xc.h>
    64.8 +#include <xenctrl.h>
    64.9  
   64.10  static int xc_handle;
   64.11  
    65.1 --- a/tools/misc/xc_shadow.c	Wed Aug 24 22:24:10 2005 +0000
    65.2 +++ b/tools/misc/xc_shadow.c	Thu Aug 25 00:55:20 2005 +0000
    65.3 @@ -11,7 +11,7 @@
    65.4   */
    65.5  
    65.6  
    65.7 -#include <xc.h>
    65.8 +#include <xenctrl.h>
    65.9  #include <stdio.h>
   65.10  #include <stdlib.h>
   65.11  #include <sys/mman.h>
    66.1 --- a/tools/misc/xenperf.c	Wed Aug 24 22:24:10 2005 +0000
    66.2 +++ b/tools/misc/xenperf.c	Thu Aug 25 00:55:20 2005 +0000
    66.3 @@ -11,7 +11,7 @@
    66.4   */
    66.5  
    66.6  
    66.7 -#include <xc.h>
    66.8 +#include <xenctrl.h>
    66.9  #include <stdio.h>
   66.10  #include <stdlib.h>
   66.11  #include <sys/mman.h>
    67.1 --- a/tools/python/setup.py	Wed Aug 24 22:24:10 2005 +0000
    67.2 +++ b/tools/python/setup.py	Thu Aug 25 00:55:20 2005 +0000
    67.3 @@ -17,7 +17,7 @@ library_dirs = [ XEN_ROOT + "/tools/libx
    67.4                   XEN_ROOT + "/tools/xenstore",
    67.5                   ]
    67.6  
    67.7 -libraries = [ "xc", "xenstore" ]
    67.8 +libraries = [ "xenctrl", "xenguest", "xenstore" ]
    67.9  
   67.10  xc = Extension("xc",
   67.11                 extra_compile_args = extra_compile_args,
   67.12 @@ -41,7 +41,7 @@ xs = Extension("xs",
   67.13                 sources            = [ "xen/lowlevel/xs/xs.c" ])
   67.14  
   67.15  setup(name            = 'xen',
   67.16 -      version         = '2.0',
   67.17 +      version         = '3.0',
   67.18        description     = 'Xen',
   67.19        packages        = ['xen',
   67.20                           'xen.lowlevel',
    68.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Wed Aug 24 22:24:10 2005 +0000
    68.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Aug 25 00:55:20 2005 +0000
    68.3 @@ -5,7 +5,8 @@
    68.4   */
    68.5  
    68.6  #include <Python.h>
    68.7 -#include <xc.h>
    68.8 +#include <xenctrl.h>
    68.9 +#include <xenguest.h>
   68.10  #include <zlib.h>
   68.11  #include <fcntl.h>
   68.12  #include <netinet/in.h>
    69.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Wed Aug 24 22:24:10 2005 +0000
    69.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Thu Aug 25 00:55:20 2005 +0000
    69.3 @@ -21,7 +21,7 @@
    69.4  #include <unistd.h>
    69.5  #include <errno.h>
    69.6  #include <signal.h>
    69.7 -#include <xc.h>
    69.8 +#include <xenctrl.h>
    69.9  
   69.10  #include <xen/xen.h>
   69.11  #include <xen/io/domain_controller.h>
    72.1 --- a/tools/xcs/Makefile	Wed Aug 24 22:24:10 2005 +0000
    72.2 +++ b/tools/xcs/Makefile	Thu Aug 25 00:55:20 2005 +0000
    72.3 @@ -34,10 +34,10 @@ clean:
    72.4  
    72.5  xcsdump: xcsdump.c dump.c
    72.6  	$(CC) $(CFLAGS) -o xcsdump xcsdump.c -L$(XEN_LIBXC) \
    72.7 -              ctrl_interface.c evtchn.c dump.c -lxc
    72.8 +              ctrl_interface.c evtchn.c dump.c -lxenctrl
    72.9  
   72.10  $(BIN): $(OBJS)
   72.11 -	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxc 
   72.12 +	$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxenctrl 
   72.13  
   72.14  $(OBJS): $(HDRS)
   72.15  
    73.1 --- a/tools/xcs/dump.h	Wed Aug 24 22:24:10 2005 +0000
    73.2 +++ b/tools/xcs/dump.h	Thu Aug 25 00:55:20 2005 +0000
    73.3 @@ -20,7 +20,7 @@
    73.4  #define XENCTLD_ERROR_H
    73.5  
    73.6  #include <stdint.h>
    73.7 -#include <xc.h>
    73.8 +#include <xenctrl.h>
    73.9  #include <xen/io/domain_controller.h>
   73.10  
   73.11  void dump_msg(const control_msg_t *msg, uint64_t flags);
    74.1 --- a/tools/xcs/xcs.h	Wed Aug 24 22:24:10 2005 +0000
    74.2 +++ b/tools/xcs/xcs.h	Thu Aug 25 00:55:20 2005 +0000
    74.3 @@ -11,7 +11,7 @@
    74.4  #define __XCS_H__
    74.5  
    74.6  #include <pthread.h>
    74.7 -#include <xc.h>
    74.8 +#include <xenctrl.h>
    74.9  #include <xen/xen.h>
   74.10  #include <xen/io/domain_controller.h>
   74.11  #include <xen/linux/privcmd.h>
    75.1 --- a/tools/xcs/xcsdump.c	Wed Aug 24 22:24:10 2005 +0000
    75.2 +++ b/tools/xcs/xcsdump.c	Thu Aug 25 00:55:20 2005 +0000
    75.3 @@ -16,7 +16,7 @@
    75.4  #include <sys/socket.h>
    75.5  #include <sys/un.h>
    75.6  #include <ctype.h>
    75.7 -#include <xc.h>
    75.8 +#include <xenctrl.h>
    75.9  #include <xen/xen.h>
   75.10  #include <xen/io/domain_controller.h>
   75.11  #include <getopt.h>
    76.1 --- a/tools/xcutils/Makefile	Wed Aug 24 22:24:10 2005 +0000
    76.2 +++ b/tools/xcutils/Makefile	Thu Aug 25 00:55:20 2005 +0000
    76.3 @@ -30,7 +30,7 @@ PROG_DEP = .*.d
    76.4  
    76.5  PROGRAMS		= xc_restore xc_save
    76.6  
    76.7 -LDLIBS			= -L$(XEN_LIBXC) -lxc
    76.8 +LDLIBS			= -L$(XEN_LIBXC) -lxenguest -lxenctrl
    76.9  
   76.10  .PHONY: all
   76.11  all: build
    77.1 --- a/tools/xcutils/xc_restore.c	Wed Aug 24 22:24:10 2005 +0000
    77.2 +++ b/tools/xcutils/xc_restore.c	Thu Aug 25 00:55:20 2005 +0000
    77.3 @@ -7,11 +7,12 @@
    77.4   *
    77.5   */
    77.6  
    77.7 +#include <err.h>
    77.8  #include <stdlib.h>
    77.9 +#include <stdint.h>
   77.10  #include <stdio.h>
   77.11 -#include <err.h>
   77.12  
   77.13 -#include <xc.h>
   77.14 +#include <xenguest.h>
   77.15  
   77.16  int
   77.17  main(int argc, char **argv)
    78.1 --- a/tools/xcutils/xc_save.c	Wed Aug 24 22:24:10 2005 +0000
    78.2 +++ b/tools/xcutils/xc_save.c	Thu Aug 25 00:55:20 2005 +0000
    78.3 @@ -7,11 +7,12 @@
    78.4   *
    78.5   */
    78.6  
    78.7 +#include <err.h>
    78.8  #include <stdlib.h>
    78.9 +#include <stdint.h>
   78.10  #include <stdio.h>
   78.11 -#include <err.h>
   78.12  
   78.13 -#include <xc.h>
   78.14 +#include <xenguest.h>
   78.15  
   78.16  int
   78.17  main(int argc, char **argv)
    79.1 --- a/tools/xenstore/Makefile	Wed Aug 24 22:24:10 2005 +0000
    79.2 +++ b/tools/xenstore/Makefile	Thu Aug 25 00:55:20 2005 +0000
    79.3 @@ -32,7 +32,7 @@ xen:
    79.4  	ln -sf $(XEN_ROOT)/xen/include/public $@
    79.5  
    79.6  xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o
    79.7 -	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
    79.8 +	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
    79.9  
   79.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
   79.11  	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
   79.12 @@ -103,7 +103,7 @@ stresstest: xs_stress xenstored_test
   79.13  	export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
   79.14  
   79.15  xs_dom0_test: xs_dom0_test.o utils.o
   79.16 -	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
   79.17 +	$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
   79.18  
   79.19  TAGS:
   79.20  	etags `find . -name '*.[ch]'`
    80.1 --- a/tools/xenstore/xs_dom0_test.c	Wed Aug 24 22:24:10 2005 +0000
    80.2 +++ b/tools/xenstore/xs_dom0_test.c	Thu Aug 25 00:55:20 2005 +0000
    80.3 @@ -3,7 +3,7 @@
    80.4  #include <sys/ioctl.h>
    80.5  #include "xs.h"
    80.6  #include "utils.h"
    80.7 -#include <xc.h>
    80.8 +#include <xenctrl.h>
    80.9  #include <xen/linux/privcmd.h>
   80.10  #include <stdio.h>
   80.11  #include <unistd.h>
    81.1 --- a/tools/xenstore/xs_lib.h	Wed Aug 24 22:24:10 2005 +0000
    81.2 +++ b/tools/xenstore/xs_lib.h	Thu Aug 25 00:55:20 2005 +0000
    81.3 @@ -22,7 +22,7 @@
    81.4  
    81.5  #include <stdbool.h>
    81.6  #include <limits.h>
    81.7 -#include <xc.h>
    81.8 +#include <xenctrl.h>
    81.9  
   81.10  /* Bitmask of permissions. */
   81.11  enum xs_perm_type {
    82.1 --- a/tools/xentrace/Makefile	Wed Aug 24 22:24:10 2005 +0000
    82.2 +++ b/tools/xentrace/Makefile	Thu Aug 25 00:55:20 2005 +0000
    82.3 @@ -36,4 +36,4 @@ clean:
    82.4  	$(RM) *.a *.so *.o *.rpm $(BIN)
    82.5  
    82.6  %: %.c $(HDRS) Makefile
    82.7 -	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
    82.8 +	$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
    83.1 --- a/tools/xentrace/xenctx.c	Wed Aug 24 22:24:10 2005 +0000
    83.2 +++ b/tools/xentrace/xenctx.c	Thu Aug 25 00:55:20 2005 +0000
    83.3 @@ -21,7 +21,7 @@
    83.4  #include <argp.h>
    83.5  #include <signal.h>
    83.6  
    83.7 -#include "xc.h"
    83.8 +#include "xenctrl.h"
    83.9  
   83.10  #ifdef __i386__
   83.11  void print_ctx(vcpu_guest_context_t *ctx1)