mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
merge?
This commit is contained in:
commit
bef12f2bbd
61 files changed
+594
-493
No files matched your search
@@ -7,7 +7,7 @@
|
||||
#ifndef __BLKTAPLIB_H__
|
||||
#define __BLKTAPLIB_H__
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <sys/user.h>
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/blkif.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define _BLOCKASYNC_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include "vdi.h"
|
||||
|
||||
struct io_ret
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#define __BLOCKSTORE_H__
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
#define BLOCK_SIZE 4096
|
||||
#define BLOCK_SHIFT 12
|
||||
|
||||
@@ -26,11 +26,11 @@ clean:
|
||||
|
||||
xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
|
||||
$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
|
||||
-lxc -lxenstore
|
||||
-lxenctrl -lxenstore
|
||||
|
||||
xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
|
||||
$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -L$(XEN_XENSTORE) \
|
||||
-lxc -lxenstore
|
||||
-lxenctrl -lxenstore
|
||||
|
||||
install: $(BIN)
|
||||
$(INSTALL_DIR) -p $(DESTDIR)/$(DAEMON_INSTALL_DIR)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <errno.h>
|
||||
#include <pty.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include "xs.h"
|
||||
|
||||
#define ESCAPE_CHARACTER 0x1d
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "utils.h"
|
||||
#include "io.h"
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include "xs.h"
|
||||
#include "xen/io/domain_controller.h"
|
||||
#include "xcs_proto.h"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include "xen/io/domain_controller.h"
|
||||
#include "xcs_proto.h"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <sys/un.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include "xen/io/domain_controller.h"
|
||||
#include "xcs_proto.h"
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */
|
||||
long (*myptrace)(enum __ptrace_request, pid_t, long, long);
|
||||
int (*myxcwait)(int domain, int *status, int options) ;
|
||||
|
||||
@@ -20,7 +20,7 @@ CFLAGS += $(INCLUDES) -I. -I$(XEN_ROOT)/tools/libxc
|
||||
CFLAGS += -Wp,-MD,.$(@F).d
|
||||
DEPS = .*.d
|
||||
|
||||
LDFLAGS += -L$(XEN_ROOT)/tools/libxc -lxc
|
||||
LDFLAGS += -L$(XEN_ROOT)/tools/libxc -lxenctrl
|
||||
|
||||
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include "list.h"
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#ifndef _XENDEBUG_H_DEFINED
|
||||
#define _XENDEBUG_H_DEFINED
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
int xendebug_attach(int xc_handle,
|
||||
u32 domid,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* PDB's OCaml interface library for debugging domains
|
||||
*/
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xendebug.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* PDB's OCaml interface library for event channels
|
||||
*/
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <caml/memory.h>
|
||||
#include <caml/mlvalues.h>
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
#include <xen/linux/privcmd.h>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* PDB's OCaml interface library for debugging domains
|
||||
*/
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xendebug.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* PDB interface library for accessing Xen
|
||||
*/
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#ifndef _ACPI_2_0_H_
|
||||
#define _ACPI_2_0_H_
|
||||
|
||||
#include "xc.h" // for u8, u16, u32, u64 definition
|
||||
#include "xenctrl.h" // for u8, u16, u32, u64 definition
|
||||
|
||||
#pragma pack (1)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "vl.h"
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include <io/ioreq.h>
|
||||
|
||||
//#define DEBUG_PIT
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "vl.h"
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include <io/ioreq.h>
|
||||
|
||||
/* debug PIC */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#ifndef __IOAPIC_H
|
||||
#define __IOAPIC_H
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include <io/ioreq.h>
|
||||
#include <io/vmx_vlapic.h>
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ endif
|
||||
#########################################################
|
||||
|
||||
DEFINES+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DAPIC_SUPPORT
|
||||
LIBS+=-lm -L../../libxc -lxc
|
||||
LIBS+=-lm -L../../libxc -lxenctrl
|
||||
ifndef CONFIG_USER_ONLY
|
||||
LIBS+=-lz
|
||||
endif
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include <io/ioreq.h>
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@
|
||||
#endif
|
||||
#endif /* CONFIG_SDL */
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
#include "exec-all.h"
|
||||
|
||||
//#define DO_TB_FLUSH
|
||||
|
||||
+61
-33
@@ -12,28 +12,32 @@ CC = gcc
|
||||
XEN_ROOT = ../..
|
||||
include $(XEN_ROOT)/tools/Rules.mk
|
||||
|
||||
SRCS :=
|
||||
SRCS += xc_sedf.c
|
||||
SRCS += xc_bvtsched.c
|
||||
SRCS += xc_core.c
|
||||
SRCS += xc_domain.c
|
||||
SRCS += xc_evtchn.c
|
||||
SRCS += xc_gnttab.c
|
||||
SRCS += xc_load_bin.c
|
||||
SRCS += xc_load_elf.c
|
||||
SRCS += xc_linux_build.c
|
||||
SRCS += xc_misc.c
|
||||
SRCS += xc_physdev.c
|
||||
SRCS += xc_private.c
|
||||
SRCS :=
|
||||
BUILD_SRCS :=
|
||||
SRCS += xc_bvtsched.c
|
||||
SRCS += xc_core.c
|
||||
SRCS += xc_domain.c
|
||||
SRCS += xc_evtchn.c
|
||||
SRCS += xc_gnttab.c
|
||||
SRCS += xc_misc.c
|
||||
SRCS += xc_physdev.c
|
||||
SRCS += xc_private.c
|
||||
SRCS += xc_sedf.c
|
||||
|
||||
ifeq ($(XEN_TARGET_ARCH),ia64)
|
||||
SRCS += xc_ia64_stubs.c
|
||||
BUILD_SRCS += xc_ia64_stubs.c
|
||||
else
|
||||
SRCS += xc_load_aout9.c
|
||||
SRCS += xc_linux_restore.c
|
||||
SRCS += xc_linux_save.c
|
||||
SRCS += xc_vmx_build.c
|
||||
SRCS += xc_ptrace.c
|
||||
SRCS += xc_ptrace_core.c
|
||||
SRCS += xc_ptrace.c
|
||||
SRCS += xc_ptrace_core.c
|
||||
|
||||
BUILD_SRCS := xc_load_aout9.c
|
||||
BUILD_SRCS += xc_load_bin.c
|
||||
BUILD_SRCS += xc_load_elf.c
|
||||
BUILD_SRCS += xc_linux_build.c
|
||||
BUILD_SRCS += xc_linux_restore.c
|
||||
BUILD_SRCS += xc_linux_save.c
|
||||
BUILD_SRCS += xc_vmx_build.c
|
||||
BUILD_SRCS += xg_private.c
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall
|
||||
@@ -43,13 +47,20 @@ CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += $(INCLUDES) -I.
|
||||
# Get gcc to generate the dependencies for us.
|
||||
CFLAGS += -Wp,-MD,.$(@F).d
|
||||
LDFLAGS += -L.
|
||||
DEPS = .*.d
|
||||
|
||||
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
|
||||
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
|
||||
|
||||
LIB := libxc.a libxc-pic.a
|
||||
LIB += libxc.so libxc.so.$(MAJOR) libxc.so.$(MAJOR).$(MINOR)
|
||||
LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS))
|
||||
PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS))
|
||||
|
||||
LIB := libxenctrl.a
|
||||
LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR)
|
||||
|
||||
LIB += libxenguest.a
|
||||
LIB += libxenguest.so libxenguest.so.$(MAJOR) libxenguest.so.$(MAJOR).$(MINOR)
|
||||
|
||||
all: build
|
||||
build: check-for-zlib mk-symlinks
|
||||
@@ -77,11 +88,16 @@ mk-symlinks:
|
||||
install: build
|
||||
[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
|
||||
[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
|
||||
$(INSTALL_PROG) libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
|
||||
$(INSTALL_DATA) libxc.a $(DESTDIR)/usr/$(LIBDIR)
|
||||
ln -sf libxc.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so.$(MAJOR)
|
||||
ln -sf libxc.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxc.so
|
||||
$(INSTALL_DATA) xc.h $(DESTDIR)/usr/include
|
||||
$(INSTALL_PROG) libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
|
||||
$(INSTALL_DATA) libxenctrl.a $(DESTDIR)/usr/$(LIBDIR)
|
||||
ln -sf libxenctrl.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so.$(MAJOR)
|
||||
ln -sf libxenctrl.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenctrl.so
|
||||
$(INSTALL_DATA) xenctrl.h $(DESTDIR)/usr/include/xen
|
||||
|
||||
$(INSTALL_PROG) libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
|
||||
$(INSTALL_DATA) libxenguest.a $(DESTDIR)/usr/$(LIBDIR)
|
||||
ln -sf libxenguest.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so.$(MAJOR)
|
||||
ln -sf libxenguest.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxenguest.so
|
||||
|
||||
.PHONY: TAGS clean rpm install all
|
||||
|
||||
@@ -100,18 +116,30 @@ rpm: build
|
||||
mv staging/i386/*.rpm .
|
||||
rm -rf staging
|
||||
|
||||
libxc.a: $(LIB_OBJS)
|
||||
# libxenctrl
|
||||
|
||||
libxenctrl.a: $(LIB_OBJS)
|
||||
$(AR) rc $@ $^
|
||||
|
||||
libxc-pic.a: $(PIC_OBJS)
|
||||
libxenctrl.so: libxenctrl.so.$(MAJOR)
|
||||
ln -sf $< $@
|
||||
libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR)
|
||||
ln -sf $< $@
|
||||
|
||||
libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^
|
||||
|
||||
# libxenguest
|
||||
|
||||
libxenguest.a: $(LIB_BUILD_OBJS)
|
||||
$(AR) rc $@ $^
|
||||
|
||||
libxc.so: libxc.so.$(MAJOR)
|
||||
libxenguest.so: libxenguest.so.$(MAJOR)
|
||||
ln -sf $< $@
|
||||
libxc.so.$(MAJOR): libxc.so.$(MAJOR).$(MINOR)
|
||||
libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR)
|
||||
ln -sf $< $@
|
||||
|
||||
libxc.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxc.so.$(MAJOR) -shared -o $@ $^ -lz
|
||||
libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl
|
||||
|
||||
-include $(DEPS)
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
#define ELFSIZE 32
|
||||
#include "xc_elf.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -266,7 +266,7 @@ int xc_domain_memory_increase_reservation(int xc_handle,
|
||||
int err;
|
||||
unsigned int npages = mem_kb / (PAGE_SIZE/1024);
|
||||
|
||||
err = do_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
|
||||
err = xc_dom_mem_op(xc_handle, MEMOP_increase_reservation, NULL,
|
||||
npages, 0, domid);
|
||||
if (err == npages)
|
||||
return 0;
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
* xc_linux_build.c
|
||||
*/
|
||||
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
#include <xenctrl.h>
|
||||
|
||||
#if defined(__i386__)
|
||||
#define ELFSIZE 32
|
||||
@@ -340,7 +341,7 @@ static int setup_guest(int xc_handle,
|
||||
unsigned long count, i;
|
||||
start_info_t *start_info;
|
||||
shared_info_t *shared_info;
|
||||
mmu_t *mmu = NULL;
|
||||
xc_mmu_t *mmu = NULL;
|
||||
int rc;
|
||||
|
||||
unsigned long nr_pt_pages;
|
||||
@@ -490,7 +491,7 @@ static int setup_guest(int xc_handle,
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
|
||||
if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
|
||||
goto error_out;
|
||||
|
||||
/* setup page tables */
|
||||
@@ -520,9 +521,9 @@ static int setup_guest(int xc_handle,
|
||||
page_array[physmap_pfn++]);
|
||||
for ( count = 0; count < nr_pages; count++ )
|
||||
{
|
||||
if ( add_mmu_update(xc_handle, mmu,
|
||||
(page_array[count] << PAGE_SHIFT) |
|
||||
MMU_MACHPHYS_UPDATE, count) )
|
||||
if ( xc_add_mmu_update(xc_handle, mmu,
|
||||
(page_array[count] << PAGE_SHIFT) |
|
||||
MMU_MACHPHYS_UPDATE, count) )
|
||||
{
|
||||
munmap(physmap, PAGE_SIZE);
|
||||
goto error_out;
|
||||
@@ -602,7 +603,7 @@ static int setup_guest(int xc_handle,
|
||||
munmap(shared_info, PAGE_SIZE);
|
||||
|
||||
/* Send the page update requests down to the hypervisor. */
|
||||
if ( finish_mmu_updates(xc_handle, mmu) )
|
||||
if ( xc_finish_mmu_updates(xc_handle, mmu) )
|
||||
goto error_out;
|
||||
|
||||
free(mmu);
|
||||
@@ -676,7 +677,7 @@ int xc_linux_build(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
||||
if ( (xc_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u16)op.u.getdomaininfo.domain != domid) )
|
||||
{
|
||||
PERROR("Could not get info on domain");
|
||||
@@ -793,7 +794,7 @@ int xc_linux_build(int xc_handle,
|
||||
launch_op.u.setdomaininfo.ctxt = ctxt;
|
||||
|
||||
launch_op.cmd = DOM0_SETDOMAININFO;
|
||||
rc = do_dom0_op(xc_handle, &launch_op);
|
||||
rc = xc_dom0_op(xc_handle, &launch_op);
|
||||
|
||||
return rc;
|
||||
|
||||
|
||||
@@ -6,7 +6,12 @@
|
||||
* Copyright (c) 2003, K A Fraser.
|
||||
*/
|
||||
|
||||
#include "xc_private.h"
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "xg_private.h"
|
||||
#include <xenctrl.h>
|
||||
|
||||
#include <xen/linux/suspend.h>
|
||||
|
||||
#define MAX_BATCH_SIZE 1024
|
||||
@@ -89,7 +94,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
|
||||
char *region_base;
|
||||
|
||||
mmu_t *mmu = NULL;
|
||||
xc_mmu_t *mmu = NULL;
|
||||
|
||||
/* used by debug verify code */
|
||||
unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
|
||||
@@ -132,7 +137,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
/* Get the domain's shared-info frame. */
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)dom;
|
||||
if (do_dom0_op(xc_handle, &op) < 0) {
|
||||
if (xc_dom0_op(xc_handle, &op) < 0) {
|
||||
ERR("Could not get information on new domain");
|
||||
goto out;
|
||||
}
|
||||
@@ -158,7 +163,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
goto out;
|
||||
}
|
||||
|
||||
mmu = init_mmu_updates(xc_handle, dom);
|
||||
mmu = xc_init_mmu_updates(xc_handle, dom);
|
||||
if (mmu == NULL) {
|
||||
ERR("Could not initialise for MMU updates");
|
||||
goto out;
|
||||
@@ -355,8 +360,9 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
}
|
||||
}
|
||||
|
||||
if ( add_mmu_update(xc_handle, mmu,
|
||||
(mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) )
|
||||
if ( xc_add_mmu_update(xc_handle, mmu,
|
||||
(mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE,
|
||||
pfn) )
|
||||
{
|
||||
printf("machpys mfn=%ld pfn=%ld\n",mfn,pfn);
|
||||
goto out;
|
||||
@@ -370,7 +376,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
|
||||
DPRINTF("Received all pages\n");
|
||||
|
||||
if ( finish_mmu_updates(xc_handle, mmu) )
|
||||
if ( xc_finish_mmu_updates(xc_handle, mmu) )
|
||||
goto out;
|
||||
|
||||
/*
|
||||
@@ -388,14 +394,14 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
pin[nr_pins].mfn = pfn_to_mfn_table[i];
|
||||
if ( ++nr_pins == MAX_PIN_BATCH )
|
||||
{
|
||||
if ( do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
|
||||
if ( xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0 )
|
||||
goto out;
|
||||
nr_pins = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (nr_pins != 0) &&
|
||||
(do_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
|
||||
(xc_mmuext_op(xc_handle, pin, nr_pins, dom) < 0) )
|
||||
goto out;
|
||||
|
||||
DPRINTF("\b\b\b\b100%%\n");
|
||||
@@ -435,7 +441,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
|
||||
if ( count > 0 )
|
||||
{
|
||||
if ( (rc = do_dom_mem_op( xc_handle,
|
||||
if ( (rc = xc_dom_mem_op( xc_handle,
|
||||
MEMOP_decrease_reservation,
|
||||
pfntab, count, 0, dom )) <0 )
|
||||
{
|
||||
@@ -586,7 +592,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
op.u.setdomaininfo.domain = (domid_t)dom;
|
||||
op.u.setdomaininfo.vcpu = 0;
|
||||
op.u.setdomaininfo.ctxt = &ctxt;
|
||||
rc = do_dom0_op(xc_handle, &op);
|
||||
rc = xc_dom0_op(xc_handle, &op);
|
||||
|
||||
if ( rc != 0 )
|
||||
{
|
||||
@@ -597,7 +603,7 @@ int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
DPRINTF("Domain ready to be unpaused\n");
|
||||
op.cmd = DOM0_UNPAUSEDOMAIN;
|
||||
op.u.unpausedomain.domain = (domid_t)dom;
|
||||
rc = do_dom0_op(xc_handle, &op);
|
||||
rc = xc_dom0_op(xc_handle, &op);
|
||||
if (rc == 0) {
|
||||
/* Success: print the domain id. */
|
||||
DPRINTF("DOM=%u\n", dom);
|
||||
|
||||
@@ -7,11 +7,15 @@
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#include "xc_private.h"
|
||||
|
||||
#include "xg_private.h"
|
||||
|
||||
#include <xen/linux/suspend.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
#include <time.h>
|
||||
|
||||
#define BATCH_SIZE 1024 /* 1024 pages (4MB) at a time */
|
||||
|
||||
@@ -772,7 +776,7 @@ int xc_linux_save(int xc_handle, int io_fd, u32 dom)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
|
||||
if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) ){
|
||||
ERR("get_pfn_type_batch failed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
#include "xc_aout9.h"
|
||||
|
||||
#if defined(__i386__)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
* Free Software Foundation, Inc.
|
||||
*/
|
||||
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* xc_elf_load.c
|
||||
*/
|
||||
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
|
||||
#if defined(__i386__)
|
||||
#define ELFSIZE 32
|
||||
|
||||
+73
-81
@@ -64,8 +64,8 @@ void *xc_map_foreign_range(int xc_handle, u32 dom,
|
||||
/*******************/
|
||||
|
||||
/* NB: arr must be mlock'ed */
|
||||
int get_pfn_type_batch(int xc_handle,
|
||||
u32 dom, int num, unsigned long *arr)
|
||||
int xc_get_pfn_type_batch(int xc_handle,
|
||||
u32 dom, int num, unsigned long *arr)
|
||||
{
|
||||
dom0_op_t op;
|
||||
op.cmd = DOM0_GETPAGEFRAMEINFO2;
|
||||
@@ -92,25 +92,40 @@ unsigned int get_pfn_type(int xc_handle,
|
||||
return op.u.getpageframeinfo.type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************/
|
||||
|
||||
int pin_table(
|
||||
int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
|
||||
int xc_mmuext_op(
|
||||
int xc_handle,
|
||||
struct mmuext_op *op,
|
||||
unsigned int nr_ops,
|
||||
domid_t dom)
|
||||
{
|
||||
struct mmuext_op op;
|
||||
privcmd_hypercall_t hypercall;
|
||||
long ret = -EINVAL;
|
||||
|
||||
op.cmd = type;
|
||||
op.mfn = mfn;
|
||||
hypercall.op = __HYPERVISOR_mmuext_op;
|
||||
hypercall.arg[0] = (unsigned long)op;
|
||||
hypercall.arg[1] = (unsigned long)nr_ops;
|
||||
hypercall.arg[2] = (unsigned long)0;
|
||||
hypercall.arg[3] = (unsigned long)dom;
|
||||
|
||||
if ( do_mmuext_op(xc_handle, &op, 1, dom) < 0 )
|
||||
return 1;
|
||||
if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
|
||||
{
|
||||
PERROR("Could not lock memory for Xen hypercall");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
|
||||
" rebuild the user-space tool set?\n",ret,errno);
|
||||
}
|
||||
|
||||
static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
|
||||
safe_munlock(op, nr_ops*sizeof(*op));
|
||||
|
||||
out1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int flush_mmu_updates(int xc_handle, xc_mmu_t *mmu)
|
||||
{
|
||||
int err = 0;
|
||||
privcmd_hypercall_t hypercall;
|
||||
@@ -145,9 +160,9 @@ static int flush_mmu_updates(int xc_handle, mmu_t *mmu)
|
||||
return err;
|
||||
}
|
||||
|
||||
mmu_t *init_mmu_updates(int xc_handle, domid_t dom)
|
||||
xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom)
|
||||
{
|
||||
mmu_t *mmu = malloc(sizeof(mmu_t));
|
||||
xc_mmu_t *mmu = malloc(sizeof(xc_mmu_t));
|
||||
if ( mmu == NULL )
|
||||
return mmu;
|
||||
mmu->idx = 0;
|
||||
@@ -155,8 +170,8 @@ mmu_t *init_mmu_updates(int xc_handle, domid_t dom)
|
||||
return mmu;
|
||||
}
|
||||
|
||||
int add_mmu_update(int xc_handle, mmu_t *mmu,
|
||||
unsigned long ptr, unsigned long val)
|
||||
int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
|
||||
unsigned long ptr, unsigned long val)
|
||||
{
|
||||
mmu->updates[mmu->idx].ptr = ptr;
|
||||
mmu->updates[mmu->idx].val = val;
|
||||
@@ -167,11 +182,48 @@ int add_mmu_update(int xc_handle, mmu_t *mmu,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int finish_mmu_updates(int xc_handle, mmu_t *mmu)
|
||||
int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu)
|
||||
{
|
||||
return flush_mmu_updates(xc_handle, mmu);
|
||||
}
|
||||
|
||||
int xc_dom_mem_op(int xc_handle,
|
||||
unsigned int memop,
|
||||
unsigned int *extent_list,
|
||||
unsigned int nr_extents,
|
||||
unsigned int extent_order,
|
||||
domid_t domid)
|
||||
{
|
||||
privcmd_hypercall_t hypercall;
|
||||
long ret = -EINVAL;
|
||||
|
||||
hypercall.op = __HYPERVISOR_dom_mem_op;
|
||||
hypercall.arg[0] = (unsigned long)memop;
|
||||
hypercall.arg[1] = (unsigned long)extent_list;
|
||||
hypercall.arg[2] = (unsigned long)nr_extents;
|
||||
hypercall.arg[3] = (unsigned long)extent_order;
|
||||
hypercall.arg[4] = (unsigned long)domid;
|
||||
|
||||
if ( (extent_list != NULL) &&
|
||||
(mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
|
||||
{
|
||||
PERROR("Could not lock memory for Xen hypercall");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
|
||||
" rebuild the user-space tool set?\n",ret,errno);
|
||||
}
|
||||
|
||||
if ( extent_list != NULL )
|
||||
safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
|
||||
|
||||
out1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
|
||||
{
|
||||
@@ -190,19 +242,6 @@ long long xc_domain_get_cpu_usage( int xc_handle, domid_t domid, int vcpu )
|
||||
}
|
||||
|
||||
|
||||
/* This is shared between save and restore, and may generally be useful. */
|
||||
unsigned long csum_page (void * page)
|
||||
{
|
||||
int i;
|
||||
unsigned long *p = page;
|
||||
unsigned long long sum=0;
|
||||
|
||||
for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
|
||||
sum += p[i];
|
||||
|
||||
return sum ^ (sum>>32);
|
||||
}
|
||||
|
||||
unsigned long xc_get_m2p_start_mfn ( int xc_handle )
|
||||
{
|
||||
unsigned long mfn;
|
||||
@@ -332,53 +371,6 @@ unsigned long xc_get_filesz(int fd)
|
||||
return sz;
|
||||
}
|
||||
|
||||
char *xc_read_kernel_image(const char *filename, unsigned long *size)
|
||||
{
|
||||
int kernel_fd = -1;
|
||||
gzFile kernel_gfd = NULL;
|
||||
char *image = NULL;
|
||||
unsigned int bytes;
|
||||
|
||||
if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
|
||||
{
|
||||
PERROR("Could not open kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
|
||||
{
|
||||
PERROR("Could not read kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
|
||||
{
|
||||
PERROR("Could not allocate decompression state for state file");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (image = malloc(*size)) == NULL )
|
||||
{
|
||||
PERROR("Could not allocate memory for kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
|
||||
{
|
||||
PERROR("Error reading kernel image, could not"
|
||||
" read the whole image (%d != %ld).", bytes, *size);
|
||||
free(image);
|
||||
image = NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
if ( kernel_gfd != NULL )
|
||||
gzclose(kernel_gfd);
|
||||
else if ( kernel_fd >= 0 )
|
||||
close(kernel_fd);
|
||||
return image;
|
||||
}
|
||||
|
||||
void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
|
||||
int xch, u32 dom, unsigned long *parray,
|
||||
unsigned long vstart)
|
||||
|
||||
+4
-227
@@ -1,124 +1,26 @@
|
||||
|
||||
#ifndef __XC_PRIVATE_H__
|
||||
#define __XC_PRIVATE_H__
|
||||
#ifndef XC_PRIVATE_H
|
||||
#define XC_PRIVATE_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
|
||||
#include <xen/linux/privcmd.h>
|
||||
|
||||
#define _PAGE_PRESENT 0x001
|
||||
#define _PAGE_RW 0x002
|
||||
#define _PAGE_USER 0x004
|
||||
#define _PAGE_PWT 0x008
|
||||
#define _PAGE_PCD 0x010
|
||||
#define _PAGE_ACCESSED 0x020
|
||||
#define _PAGE_DIRTY 0x040
|
||||
#define _PAGE_PAT 0x080
|
||||
#define _PAGE_PSE 0x080
|
||||
#define _PAGE_GLOBAL 0x100
|
||||
|
||||
#if defined(__i386__)
|
||||
#define L1_PAGETABLE_SHIFT 12
|
||||
#define L2_PAGETABLE_SHIFT 22
|
||||
#define L1_PAGETABLE_SHIFT_PAE 12
|
||||
#define L2_PAGETABLE_SHIFT_PAE 21
|
||||
#define L3_PAGETABLE_SHIFT_PAE 30
|
||||
#elif defined(__x86_64__)
|
||||
#define L1_PAGETABLE_SHIFT 12
|
||||
#define L2_PAGETABLE_SHIFT 21
|
||||
#define L3_PAGETABLE_SHIFT 30
|
||||
#define L4_PAGETABLE_SHIFT 39
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define ENTRIES_PER_L1_PAGETABLE 1024
|
||||
#define ENTRIES_PER_L2_PAGETABLE 1024
|
||||
#define L1_PAGETABLE_ENTRIES_PAE 512
|
||||
#define L2_PAGETABLE_ENTRIES_PAE 512
|
||||
#define L3_PAGETABLE_ENTRIES_PAE 4
|
||||
#elif defined(__x86_64__)
|
||||
#define L1_PAGETABLE_ENTRIES 512
|
||||
#define L2_PAGETABLE_ENTRIES 512
|
||||
#define L3_PAGETABLE_ENTRIES 512
|
||||
#define L4_PAGETABLE_ENTRIES 512
|
||||
#endif
|
||||
|
||||
#define PAGE_SHIFT XC_PAGE_SHIFT
|
||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
|
||||
typedef u32 l1_pgentry_32_t;
|
||||
typedef u32 l2_pgentry_32_t;
|
||||
typedef u64 l1_pgentry_64_t;
|
||||
typedef u64 l2_pgentry_64_t;
|
||||
typedef u64 l3_pgentry_64_t;
|
||||
typedef unsigned long l1_pgentry_t;
|
||||
typedef unsigned long l2_pgentry_t;
|
||||
#if defined(__x86_64__)
|
||||
typedef unsigned long l3_pgentry_t;
|
||||
typedef unsigned long l4_pgentry_t;
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define l1_table_offset(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
|
||||
#define l2_table_offset(_a) \
|
||||
((_a) >> L2_PAGETABLE_SHIFT)
|
||||
#define l1_table_offset_pae(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#define l2_table_offset_pae(_a) \
|
||||
(((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#define l3_table_offset_pae(_a) \
|
||||
(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#elif defined(__x86_64__)
|
||||
#define l1_table_offset(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
|
||||
#define l2_table_offset(_a) \
|
||||
(((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
|
||||
#define l3_table_offset(_a) \
|
||||
(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
|
||||
#define l4_table_offset(_a) \
|
||||
(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
|
||||
#endif
|
||||
|
||||
struct domain_setup_info
|
||||
{
|
||||
unsigned long v_start;
|
||||
unsigned long v_end;
|
||||
unsigned long v_kernstart;
|
||||
unsigned long v_kernend;
|
||||
unsigned long v_kernentry;
|
||||
|
||||
unsigned int load_symtab;
|
||||
unsigned int pae_kernel;
|
||||
unsigned long symtab_addr;
|
||||
unsigned long symtab_len;
|
||||
};
|
||||
|
||||
typedef int (*parseimagefunc)(char *image, unsigned long image_size,
|
||||
struct domain_setup_info *dsi);
|
||||
typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
|
||||
u32 dom, unsigned long *parray,
|
||||
struct domain_setup_info *dsi);
|
||||
|
||||
struct load_funcs
|
||||
{
|
||||
parseimagefunc parseimage;
|
||||
loadimagefunc loadimage;
|
||||
};
|
||||
|
||||
#define ERROR(_m, _a...) \
|
||||
do { \
|
||||
int __saved_errno = errno; \
|
||||
@@ -186,97 +88,6 @@ static inline int do_dom0_op(int xc_handle, dom0_op_t *op)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int do_dom_mem_op(int xc_handle,
|
||||
unsigned int memop,
|
||||
unsigned int *extent_list,
|
||||
unsigned int nr_extents,
|
||||
unsigned int extent_order,
|
||||
domid_t domid)
|
||||
{
|
||||
privcmd_hypercall_t hypercall;
|
||||
long ret = -EINVAL;
|
||||
|
||||
hypercall.op = __HYPERVISOR_dom_mem_op;
|
||||
hypercall.arg[0] = (unsigned long)memop;
|
||||
hypercall.arg[1] = (unsigned long)extent_list;
|
||||
hypercall.arg[2] = (unsigned long)nr_extents;
|
||||
hypercall.arg[3] = (unsigned long)extent_order;
|
||||
hypercall.arg[4] = (unsigned long)domid;
|
||||
|
||||
if ( (extent_list != NULL) &&
|
||||
(mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0) )
|
||||
{
|
||||
PERROR("Could not lock memory for Xen hypercall");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
|
||||
" rebuild the user-space tool set?\n",ret,errno);
|
||||
}
|
||||
|
||||
if ( extent_list != NULL )
|
||||
safe_munlock(extent_list, nr_extents*sizeof(unsigned long));
|
||||
|
||||
out1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int do_mmuext_op(
|
||||
int xc_handle,
|
||||
struct mmuext_op *op,
|
||||
unsigned int nr_ops,
|
||||
domid_t dom)
|
||||
{
|
||||
privcmd_hypercall_t hypercall;
|
||||
long ret = -EINVAL;
|
||||
|
||||
hypercall.op = __HYPERVISOR_mmuext_op;
|
||||
hypercall.arg[0] = (unsigned long)op;
|
||||
hypercall.arg[1] = (unsigned long)nr_ops;
|
||||
hypercall.arg[2] = (unsigned long)0;
|
||||
hypercall.arg[3] = (unsigned long)dom;
|
||||
|
||||
if ( mlock(op, nr_ops*sizeof(*op)) != 0 )
|
||||
{
|
||||
PERROR("Could not lock memory for Xen hypercall");
|
||||
goto out1;
|
||||
}
|
||||
|
||||
if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
|
||||
{
|
||||
fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
|
||||
" rebuild the user-space tool set?\n",ret,errno);
|
||||
}
|
||||
|
||||
safe_munlock(op, nr_ops*sizeof(*op));
|
||||
|
||||
out1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PFN mapping.
|
||||
*/
|
||||
int get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
|
||||
unsigned long csum_page (void * page);
|
||||
|
||||
/*
|
||||
* MMU updates.
|
||||
*/
|
||||
#define MAX_MMU_UPDATES 1024
|
||||
typedef struct {
|
||||
mmu_update_t updates[MAX_MMU_UPDATES];
|
||||
int idx;
|
||||
domid_t subject;
|
||||
} mmu_t;
|
||||
mmu_t *init_mmu_updates(int xc_handle, domid_t dom);
|
||||
int add_mmu_update(int xc_handle, mmu_t *mmu,
|
||||
unsigned long ptr, unsigned long val);
|
||||
int finish_mmu_updates(int xc_handle, mmu_t *mmu);
|
||||
|
||||
|
||||
/*
|
||||
* ioctl-based mfn mapping interface
|
||||
@@ -296,38 +107,4 @@ typedef struct privcmd_mmap {
|
||||
} privcmd_mmap_t;
|
||||
*/
|
||||
|
||||
#define mfn_mapper_queue_size 128
|
||||
|
||||
typedef struct mfn_mapper {
|
||||
int xc_handle;
|
||||
int size;
|
||||
int prot;
|
||||
int error;
|
||||
int max_queue_size;
|
||||
void * addr;
|
||||
privcmd_mmap_t ioctl;
|
||||
|
||||
} mfn_mapper_t;
|
||||
|
||||
unsigned long xc_get_m2p_start_mfn (int xc_handle);
|
||||
|
||||
int xc_copy_to_domain_page(int xc_handle, u32 domid,
|
||||
unsigned long dst_pfn, void *src_page);
|
||||
|
||||
unsigned long xc_get_filesz(int fd);
|
||||
|
||||
char *xc_read_kernel_image(const char *filename, unsigned long *size);
|
||||
|
||||
void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
|
||||
int xch, u32 dom, unsigned long *parray,
|
||||
unsigned long vstart);
|
||||
|
||||
int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
|
||||
domid_t dom);
|
||||
|
||||
/* image loading */
|
||||
int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
|
||||
#endif /* __XC_PRIVATE_H__ */
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "xc_private.h"
|
||||
#include "xg_private.h"
|
||||
#define ELFSIZE 32
|
||||
#include "xc_elf.h"
|
||||
#include <stdlib.h>
|
||||
@@ -243,7 +243,7 @@ static int setup_guest(int xc_handle,
|
||||
shared_info_t *shared_info;
|
||||
struct linux_boot_params * boot_paramsp;
|
||||
__u16 * boot_gdtp;
|
||||
mmu_t *mmu = NULL;
|
||||
xc_mmu_t *mmu = NULL;
|
||||
int rc;
|
||||
|
||||
unsigned long nr_pt_pages;
|
||||
@@ -358,7 +358,7 @@ static int setup_guest(int xc_handle,
|
||||
}
|
||||
}
|
||||
|
||||
if ( (mmu = init_mmu_updates(xc_handle, dom)) == NULL )
|
||||
if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL )
|
||||
goto error_out;
|
||||
|
||||
#ifdef __i386__
|
||||
@@ -459,9 +459,9 @@ static int setup_guest(int xc_handle,
|
||||
/* Write the machine->phys table entries. */
|
||||
for ( count = 0; count < nr_pages; count++ )
|
||||
{
|
||||
if ( add_mmu_update(xc_handle, mmu,
|
||||
(page_array[count] << PAGE_SHIFT) |
|
||||
MMU_MACHPHYS_UPDATE, count) )
|
||||
if ( xc_add_mmu_update(xc_handle, mmu,
|
||||
(page_array[count] << PAGE_SHIFT) |
|
||||
MMU_MACHPHYS_UPDATE, count) )
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ static int setup_guest(int xc_handle,
|
||||
#endif
|
||||
|
||||
/* Send the page update requests down to the hypervisor. */
|
||||
if ( finish_mmu_updates(xc_handle, mmu) )
|
||||
if ( xc_finish_mmu_updates(xc_handle, mmu) )
|
||||
goto error_out;
|
||||
|
||||
free(mmu);
|
||||
@@ -708,7 +708,7 @@ int xc_vmx_build(int xc_handle,
|
||||
|
||||
op.cmd = DOM0_GETDOMAININFO;
|
||||
op.u.getdomaininfo.domain = (domid_t)domid;
|
||||
if ( (do_dom0_op(xc_handle, &op) < 0) ||
|
||||
if ( (xc_dom0_op(xc_handle, &op) < 0) ||
|
||||
((u16)op.u.getdomaininfo.domain != domid) )
|
||||
{
|
||||
PERROR("Could not get info on domain");
|
||||
@@ -789,7 +789,7 @@ int xc_vmx_build(int xc_handle,
|
||||
launch_op.u.setdomaininfo.ctxt = ctxt;
|
||||
|
||||
launch_op.cmd = DOM0_SETDOMAININFO;
|
||||
rc = do_dom0_op(xc_handle, &launch_op);
|
||||
rc = xc_dom0_op(xc_handle, &launch_op);
|
||||
|
||||
return rc;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/******************************************************************************
|
||||
* xc.h
|
||||
* xenctrl.h
|
||||
*
|
||||
* A library for low-level access to the Xen control interfaces.
|
||||
*
|
||||
* Copyright (c) 2003-2004, K A Fraser.
|
||||
*/
|
||||
|
||||
#ifndef __XC_H__
|
||||
#define __XC_H__
|
||||
#ifndef XENCTRL_H
|
||||
#define XENCTRL_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -254,63 +254,6 @@ int xc_shadow_control(int xc_handle,
|
||||
unsigned long pages,
|
||||
xc_shadow_control_stats_t *stats);
|
||||
|
||||
|
||||
#define XCFLAGS_VERBOSE 1
|
||||
#define XCFLAGS_LIVE 2
|
||||
#define XCFLAGS_DEBUG 4
|
||||
#define XCFLAGS_CONFIGURE 8
|
||||
|
||||
struct XcIOContext;
|
||||
|
||||
/**
|
||||
* This function will save a domain running Linux.
|
||||
*
|
||||
* @parm xc_handle a handle to an open hypervisor interface
|
||||
* @parm fd the file descriptor to save a domain to
|
||||
* @parm dom the id of the domain
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int xc_linux_save(int xc_handle, int fd, u32 dom);
|
||||
|
||||
/**
|
||||
* This function will restore a saved domain running Linux.
|
||||
*
|
||||
* @parm xc_handle a handle to an open hypervisor interface
|
||||
* @parm fd the file descriptor to restore a domain from
|
||||
* @parm dom the id of the domain
|
||||
* @parm nr_pfns the number of pages
|
||||
* @parm store_evtchn the store event channel for this domain to use
|
||||
* @parm store_mfn returned with the mfn of the store page
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int xc_linux_restore(int xc_handle, int io_fd, u32 dom, unsigned long nr_pfns,
|
||||
unsigned int store_evtchn, unsigned long *store_mfn);
|
||||
|
||||
int xc_linux_build(int xc_handle,
|
||||
u32 domid,
|
||||
const char *image_name,
|
||||
const char *ramdisk_name,
|
||||
const char *cmdline,
|
||||
unsigned int control_evtchn,
|
||||
unsigned long flags,
|
||||
unsigned int vcpus,
|
||||
unsigned int store_evtchn,
|
||||
unsigned long *store_mfn);
|
||||
|
||||
struct mem_map;
|
||||
int xc_vmx_build(int xc_handle,
|
||||
u32 domid,
|
||||
int memsize,
|
||||
const char *image_name,
|
||||
struct mem_map *memmap,
|
||||
const char *ramdisk_name,
|
||||
const char *cmdline,
|
||||
unsigned int control_evtchn,
|
||||
unsigned long flags,
|
||||
unsigned int vcpus,
|
||||
unsigned int store_evtchn,
|
||||
unsigned long *store_mfn);
|
||||
|
||||
int xc_bvtsched_global_set(int xc_handle,
|
||||
unsigned long ctx_allow);
|
||||
|
||||
@@ -484,6 +427,16 @@ int xc_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf,
|
||||
int xc_ia64_get_pfn_list(int xc_handle, u32 domid, unsigned long *pfn_buf,
|
||||
unsigned int start_page, unsigned int nr_pages);
|
||||
|
||||
int xc_mmuext_op(int xc_handle, struct mmuext_op *op, unsigned int nr_ops,
|
||||
domid_t dom);
|
||||
|
||||
int xc_dom_mem_op(int xc_handle, unsigned int memop, unsigned int *extent_list,
|
||||
unsigned int nr_extents, unsigned int extent_order,
|
||||
domid_t domid);
|
||||
|
||||
int xc_get_pfn_type_batch(int xc_handle, u32 dom, int num, unsigned long *arr);
|
||||
|
||||
|
||||
/*\
|
||||
* GRANT TABLE FUNCTIONS
|
||||
\*/
|
||||
@@ -555,4 +508,19 @@ int xc_dom0_op(int xc_handle, dom0_op_t *op);
|
||||
*/
|
||||
long xc_init_store(int xc_handle, int remote_port);
|
||||
|
||||
#endif /* __XC_H__ */
|
||||
/*
|
||||
* MMU updates.
|
||||
*/
|
||||
#define MAX_MMU_UPDATES 1024
|
||||
struct xc_mmu {
|
||||
mmu_update_t updates[MAX_MMU_UPDATES];
|
||||
int idx;
|
||||
domid_t subject;
|
||||
};
|
||||
typedef struct xc_mmu xc_mmu_t;
|
||||
xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
|
||||
int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
|
||||
unsigned long ptr, unsigned long val);
|
||||
int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/******************************************************************************
|
||||
* xenguest.h
|
||||
*
|
||||
* A library for guest domain management in Xen.
|
||||
*
|
||||
* Copyright (c) 2003-2004, K A Fraser.
|
||||
*/
|
||||
|
||||
#ifndef XENBUILD_H
|
||||
#define XENBUILD_H
|
||||
|
||||
#define XCFLAGS_VERBOSE 1
|
||||
#define XCFLAGS_LIVE 2
|
||||
#define XCFLAGS_DEBUG 4
|
||||
#define XCFLAGS_CONFIGURE 8
|
||||
|
||||
/**
|
||||
* This function will save a domain running Linux.
|
||||
*
|
||||
* @parm xc_handle a handle to an open hypervisor interface
|
||||
* @parm fd the file descriptor to save a domain to
|
||||
* @parm dom the id of the domain
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int xc_linux_save(int xc_handle, int fd, uint32_t dom);
|
||||
|
||||
/**
|
||||
* This function will restore a saved domain running Linux.
|
||||
*
|
||||
* @parm xc_handle a handle to an open hypervisor interface
|
||||
* @parm fd the file descriptor to restore a domain from
|
||||
* @parm dom the id of the domain
|
||||
* @parm nr_pfns the number of pages
|
||||
* @parm store_evtchn the store event channel for this domain to use
|
||||
* @parm store_mfn returned with the mfn of the store page
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
int xc_linux_restore(int xc_handle, int io_fd, uint32_t dom, unsigned long nr_pfns,
|
||||
unsigned int store_evtchn, unsigned long *store_mfn);
|
||||
|
||||
int xc_linux_build(int xc_handle,
|
||||
uint32_t domid,
|
||||
const char *image_name,
|
||||
const char *ramdisk_name,
|
||||
const char *cmdline,
|
||||
unsigned int control_evtchn,
|
||||
unsigned long flags,
|
||||
unsigned int vcpus,
|
||||
unsigned int store_evtchn,
|
||||
unsigned long *store_mfn);
|
||||
|
||||
struct mem_map;
|
||||
int xc_vmx_build(int xc_handle,
|
||||
uint32_t domid,
|
||||
int memsize,
|
||||
const char *image_name,
|
||||
struct mem_map *memmap,
|
||||
const char *ramdisk_name,
|
||||
const char *cmdline,
|
||||
unsigned int control_evtchn,
|
||||
unsigned long flags,
|
||||
unsigned int vcpus,
|
||||
unsigned int store_evtchn,
|
||||
unsigned long *store_mfn);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/******************************************************************************
|
||||
* xg_private.c
|
||||
*
|
||||
* Helper functions for the rest of the library.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "xg_private.h"
|
||||
|
||||
char *xc_read_kernel_image(const char *filename, unsigned long *size)
|
||||
{
|
||||
int kernel_fd = -1;
|
||||
gzFile kernel_gfd = NULL;
|
||||
char *image = NULL;
|
||||
unsigned int bytes;
|
||||
|
||||
if ( (kernel_fd = open(filename, O_RDONLY)) < 0 )
|
||||
{
|
||||
PERROR("Could not open kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (*size = xc_get_filesz(kernel_fd)) == 0 )
|
||||
{
|
||||
PERROR("Could not read kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (kernel_gfd = gzdopen(kernel_fd, "rb")) == NULL )
|
||||
{
|
||||
PERROR("Could not allocate decompression state for state file");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (image = malloc(*size)) == NULL )
|
||||
{
|
||||
PERROR("Could not allocate memory for kernel image");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ( (bytes = gzread(kernel_gfd, image, *size)) != *size )
|
||||
{
|
||||
PERROR("Error reading kernel image, could not"
|
||||
" read the whole image (%d != %ld).", bytes, *size);
|
||||
free(image);
|
||||
image = NULL;
|
||||
}
|
||||
|
||||
out:
|
||||
if ( kernel_gfd != NULL )
|
||||
gzclose(kernel_gfd);
|
||||
else if ( kernel_fd >= 0 )
|
||||
close(kernel_fd);
|
||||
return image;
|
||||
}
|
||||
|
||||
/*******************/
|
||||
|
||||
int pin_table(
|
||||
int xc_handle, unsigned int type, unsigned long mfn, domid_t dom)
|
||||
{
|
||||
struct mmuext_op op;
|
||||
|
||||
op.cmd = type;
|
||||
op.mfn = mfn;
|
||||
|
||||
if ( xc_mmuext_op(xc_handle, &op, 1, dom) < 0 )
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This is shared between save and restore, and may generally be useful. */
|
||||
unsigned long csum_page (void * page)
|
||||
{
|
||||
int i;
|
||||
unsigned long *p = page;
|
||||
unsigned long long sum=0;
|
||||
|
||||
for ( i = 0; i < (PAGE_SIZE/sizeof(unsigned long)); i++ )
|
||||
sum += p[i];
|
||||
|
||||
return sum ^ (sum>>32);
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
#ifndef XG_PRIVATE_H
|
||||
#define XG_PRIVATE_H
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "xenctrl.h"
|
||||
|
||||
#include <xen/linux/privcmd.h>
|
||||
|
||||
char *xc_read_kernel_image(const char *filename, unsigned long *size);
|
||||
unsigned long csum_page (void * page);
|
||||
|
||||
#define _PAGE_PRESENT 0x001
|
||||
#define _PAGE_RW 0x002
|
||||
#define _PAGE_USER 0x004
|
||||
#define _PAGE_PWT 0x008
|
||||
#define _PAGE_PCD 0x010
|
||||
#define _PAGE_ACCESSED 0x020
|
||||
#define _PAGE_DIRTY 0x040
|
||||
#define _PAGE_PAT 0x080
|
||||
#define _PAGE_PSE 0x080
|
||||
#define _PAGE_GLOBAL 0x100
|
||||
|
||||
#if defined(__i386__)
|
||||
#define L1_PAGETABLE_SHIFT 12
|
||||
#define L2_PAGETABLE_SHIFT 22
|
||||
#define L1_PAGETABLE_SHIFT_PAE 12
|
||||
#define L2_PAGETABLE_SHIFT_PAE 21
|
||||
#define L3_PAGETABLE_SHIFT_PAE 30
|
||||
#elif defined(__x86_64__)
|
||||
#define L1_PAGETABLE_SHIFT 12
|
||||
#define L2_PAGETABLE_SHIFT 21
|
||||
#define L3_PAGETABLE_SHIFT 30
|
||||
#define L4_PAGETABLE_SHIFT 39
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define ENTRIES_PER_L1_PAGETABLE 1024
|
||||
#define ENTRIES_PER_L2_PAGETABLE 1024
|
||||
#define L1_PAGETABLE_ENTRIES_PAE 512
|
||||
#define L2_PAGETABLE_ENTRIES_PAE 512
|
||||
#define L3_PAGETABLE_ENTRIES_PAE 4
|
||||
#elif defined(__x86_64__)
|
||||
#define L1_PAGETABLE_ENTRIES 512
|
||||
#define L2_PAGETABLE_ENTRIES 512
|
||||
#define L3_PAGETABLE_ENTRIES 512
|
||||
#define L4_PAGETABLE_ENTRIES 512
|
||||
#endif
|
||||
|
||||
#define PAGE_SHIFT XC_PAGE_SHIFT
|
||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
|
||||
typedef u32 l1_pgentry_32_t;
|
||||
typedef u32 l2_pgentry_32_t;
|
||||
typedef u64 l1_pgentry_64_t;
|
||||
typedef u64 l2_pgentry_64_t;
|
||||
typedef u64 l3_pgentry_64_t;
|
||||
typedef unsigned long l1_pgentry_t;
|
||||
typedef unsigned long l2_pgentry_t;
|
||||
#if defined(__x86_64__)
|
||||
typedef unsigned long l3_pgentry_t;
|
||||
typedef unsigned long l4_pgentry_t;
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
#define l1_table_offset(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT) & (ENTRIES_PER_L1_PAGETABLE - 1))
|
||||
#define l2_table_offset(_a) \
|
||||
((_a) >> L2_PAGETABLE_SHIFT)
|
||||
#define l1_table_offset_pae(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT_PAE) & (L1_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#define l2_table_offset_pae(_a) \
|
||||
(((_a) >> L2_PAGETABLE_SHIFT_PAE) & (L2_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#define l3_table_offset_pae(_a) \
|
||||
(((_a) >> L3_PAGETABLE_SHIFT_PAE) & (L3_PAGETABLE_ENTRIES_PAE - 1))
|
||||
#elif defined(__x86_64__)
|
||||
#define l1_table_offset(_a) \
|
||||
(((_a) >> L1_PAGETABLE_SHIFT) & (L1_PAGETABLE_ENTRIES - 1))
|
||||
#define l2_table_offset(_a) \
|
||||
(((_a) >> L2_PAGETABLE_SHIFT) & (L2_PAGETABLE_ENTRIES - 1))
|
||||
#define l3_table_offset(_a) \
|
||||
(((_a) >> L3_PAGETABLE_SHIFT) & (L3_PAGETABLE_ENTRIES - 1))
|
||||
#define l4_table_offset(_a) \
|
||||
(((_a) >> L4_PAGETABLE_SHIFT) & (L4_PAGETABLE_ENTRIES - 1))
|
||||
#endif
|
||||
|
||||
#define ERROR(_m, _a...) \
|
||||
do { \
|
||||
int __saved_errno = errno; \
|
||||
fprintf(stderr, "ERROR: " _m "\n" , ## _a ); \
|
||||
errno = __saved_errno; \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define PERROR(_m, _a...) \
|
||||
do { \
|
||||
int __saved_errno = errno; \
|
||||
fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \
|
||||
__saved_errno, strerror(__saved_errno)); \
|
||||
errno = __saved_errno; \
|
||||
} while (0)
|
||||
|
||||
|
||||
struct domain_setup_info
|
||||
{
|
||||
unsigned long v_start;
|
||||
unsigned long v_end;
|
||||
unsigned long v_kernstart;
|
||||
unsigned long v_kernend;
|
||||
unsigned long v_kernentry;
|
||||
|
||||
unsigned int load_symtab;
|
||||
unsigned int pae_kernel;
|
||||
unsigned long symtab_addr;
|
||||
unsigned long symtab_len;
|
||||
};
|
||||
|
||||
typedef int (*parseimagefunc)(char *image, unsigned long image_size,
|
||||
struct domain_setup_info *dsi);
|
||||
typedef int (*loadimagefunc)(char *image, unsigned long image_size, int xch,
|
||||
u32 dom, unsigned long *parray,
|
||||
struct domain_setup_info *dsi);
|
||||
|
||||
struct load_funcs
|
||||
{
|
||||
parseimagefunc parseimage;
|
||||
loadimagefunc loadimage;
|
||||
};
|
||||
|
||||
#define mfn_mapper_queue_size 128
|
||||
|
||||
typedef struct mfn_mapper {
|
||||
int xc_handle;
|
||||
int size;
|
||||
int prot;
|
||||
int error;
|
||||
int max_queue_size;
|
||||
void * addr;
|
||||
privcmd_mmap_t ioctl;
|
||||
|
||||
} mfn_mapper_t;
|
||||
|
||||
unsigned long xc_get_m2p_start_mfn (int xc_handle);
|
||||
|
||||
int xc_copy_to_domain_page(int xc_handle, u32 domid,
|
||||
unsigned long dst_pfn, void *src_page);
|
||||
|
||||
unsigned long xc_get_filesz(int fd);
|
||||
|
||||
void xc_map_memcpy(unsigned long dst, char *src, unsigned long size,
|
||||
int xch, u32 dom, unsigned long *parray,
|
||||
unsigned long vstart);
|
||||
|
||||
int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
|
||||
domid_t dom);
|
||||
|
||||
/* image loading */
|
||||
int probe_elf(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
int probe_bin(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
int probe_aout9(char *image, unsigned long image_size, struct load_funcs *funcs);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -50,4 +50,4 @@ clean:
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(TARGETS): %: %.o Makefile
|
||||
$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
|
||||
$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
|
||||
@@ -37,7 +37,7 @@ clean:
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
cpuperf-xen: cpuperf.c $(HDRS) Makefile
|
||||
$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxc -DXENO -o $@ $<
|
||||
$(CC) $(CFLAGS) -I $(XEN_LIBXC) -L$(XEN_LIBXC) -lxenctrl -DXENO -o $@ $<
|
||||
|
||||
cpuperf-perfcntr: cpuperf.c $(HDRS) Makefile
|
||||
$(CC) $(CFLAGS) -DPERFCNTR -o $@ $<
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
static int xc_handle;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
@@ -17,7 +17,7 @@ library_dirs = [ XEN_ROOT + "/tools/libxc",
|
||||
XEN_ROOT + "/tools/xenstore",
|
||||
]
|
||||
|
||||
libraries = [ "xc", "xenstore" ]
|
||||
libraries = [ "xenctrl", "xenguest", "xenstore" ]
|
||||
|
||||
xc = Extension("xc",
|
||||
extra_compile_args = extra_compile_args,
|
||||
@@ -41,7 +41,7 @@ xs = Extension("xs",
|
||||
sources = [ "xen/lowlevel/xs/xs.c" ])
|
||||
|
||||
setup(name = 'xen',
|
||||
version = '2.0',
|
||||
version = '3.0',
|
||||
description = 'Xen',
|
||||
packages = ['xen',
|
||||
'xen.lowlevel',
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
*/
|
||||
|
||||
#include <Python.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xenguest.h>
|
||||
#include <zlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
|
||||
+2
-2
@@ -34,10 +34,10 @@ clean:
|
||||
|
||||
xcsdump: xcsdump.c dump.c
|
||||
$(CC) $(CFLAGS) -o xcsdump xcsdump.c -L$(XEN_LIBXC) \
|
||||
ctrl_interface.c evtchn.c dump.c -lxc
|
||||
ctrl_interface.c evtchn.c dump.c -lxenctrl
|
||||
|
||||
$(BIN): $(OBJS)
|
||||
$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxc
|
||||
$(CC) $(CFLAGS) $^ -o $@ -L$(XEN_LIBXC) -lxenctrl
|
||||
|
||||
$(OBJS): $(HDRS)
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
#define XENCTLD_ERROR_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
|
||||
void dump_msg(const control_msg_t *msg, uint64_t flags);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#define __XCS_H__
|
||||
|
||||
#include <pthread.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
#include <xen/linux/privcmd.h>
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <ctype.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xen/xen.h>
|
||||
#include <xen/io/domain_controller.h>
|
||||
#include <getopt.h>
|
||||
|
||||
@@ -30,7 +30,7 @@ PROG_DEP = .*.d
|
||||
|
||||
PROGRAMS = xc_restore xc_save
|
||||
|
||||
LDLIBS = -L$(XEN_LIBXC) -lxc
|
||||
LDLIBS = -L$(XEN_LIBXC) -lxenguest -lxenctrl
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenguest.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <err.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <xc.h>
|
||||
#include <xenguest.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
|
||||
@@ -32,7 +32,7 @@ xen:
|
||||
ln -sf $(XEN_ROOT)/xen/include/public $@
|
||||
|
||||
xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
|
||||
|
||||
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
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
|
||||
@@ -103,7 +103,7 @@ stresstest: xs_stress xenstored_test
|
||||
export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
|
||||
|
||||
xs_dom0_test: xs_dom0_test.o utils.o
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxc -o $@
|
||||
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
|
||||
|
||||
TAGS:
|
||||
etags `find . -name '*.[ch]'`
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include "xs.h"
|
||||
#include "utils.h"
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
#include <xen/linux/privcmd.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include <xc.h>
|
||||
#include <xenctrl.h>
|
||||
|
||||
/* Bitmask of permissions. */
|
||||
enum xs_perm_type {
|
||||
|
||||
@@ -36,4 +36,4 @@ clean:
|
||||
$(RM) *.a *.so *.o *.rpm $(BIN)
|
||||
|
||||
%: %.c $(HDRS) Makefile
|
||||
$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxc
|
||||
$(CC) $(CFLAGS) -o $@ $< -L$(XEN_LIBXC) -lxenctrl
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <argp.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "xc.h"
|
||||
#include "xenctrl.h"
|
||||
|
||||
#ifdef __i386__
|
||||
void print_ctx(vcpu_guest_context_t *ctx1)
|
||||
|
||||