# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 90bac1d23a0c1c8e4105793a5b2aa76d2468bd89
# Parent 9c2c55ba22e5d86ca44512ec7ecc2919e948f262
# Parent 1f30a0ac30331c72a7e8e554e162d1a61262fea6
Merged.
diff -r 9c2c55ba22e5 -r 90bac1d23a0c Config.mk
--- a/Config.mk Sat Mar 11 10:19:11 2006
+++ b/Config.mk Sat Mar 11 10:20:32 2006
@@ -11,14 +11,6 @@
# Tools to run on system hosting the build
HOSTCC = gcc
HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
-
-ifneq ($(debug),y)
-# Optimisation flags are overridable
-CFLAGS ?= -O3 -fomit-frame-pointer
-CFLAGS += -DNDEBUG
-else
-CFLAGS += -g
-endif
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
@@ -38,6 +30,22 @@
INSTALL_DATA = $(INSTALL) -m0644
INSTALL_PROG = $(INSTALL) -m0755
+ifneq ($(debug),y)
+# Optimisation flags are overridable
+CFLAGS ?= -O2 -fomit-frame-pointer
+CFLAGS += -DNDEBUG
+else
+CFLAGS += -g
+endif
+
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+CFLAGS += -m32 -march=i686
+endif
+
+ifeq ($(XEN_TARGET_ARCH),x86_64)
+CFLAGS += -m64
+endif
+
ifeq ($(XEN_TARGET_ARCH),x86_64)
LIBDIR = lib64
else
@@ -51,7 +59,7 @@
test-gcc-flag = $(shell $(1) -v --help 2>&1 | grep -q " $(2) " && echo $(2))
-CFLAGS += -Wall
+CFLAGS += -Wall -Wstrict-prototypes
HOSTCFLAGS += $(call test-gcc-flag,$(HOSTCC),-Wdeclaration-after-statement)
CFLAGS += $(call test-gcc-flag,$(CC),-Wdeclaration-after-statement)
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
linux-2.6-xen-sparse/drivers/xen/core/gnttab.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Sat Mar 11 10:19:11 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/core/gnttab.c Sat Mar 11 10:20:32 2006
@@ -31,6 +31,8 @@
#include <linux/config.h>
#include <linux/module.h>
#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
#include <asm/pgtable.h>
#include <xen/interface/xen.h>
#include <asm/fixmap.h>
@@ -77,7 +79,7 @@
static grant_ref_t gnttab_free_head;
static spinlock_t gnttab_list_lock = SPIN_LOCK_UNLOCKED;
-static grant_entry_t *shared;
+static grant_entry_t *shared = NULL;
static struct gnttab_free_callback *gnttab_free_callback_list = NULL;
@@ -354,12 +356,35 @@
spin_unlock_irqrestore(&gnttab_list_lock, flags);
}
+#ifndef __ia64__
+static int map_pte_fn(pte_t *pte, struct page *pte_page,
+ unsigned long addr, void *data)
+{
+ unsigned long **frames = (unsigned long **)data;
+
+ set_pte_at(&init_mm, addr, pte, pfn_pte_ma((*frames)[0], PAGE_KERNEL));
+ (*frames)++;
+ return 0;
+}
+
+static int unmap_pte_fn(pte_t *pte, struct page *pte_page,
+ unsigned long addr, void *data)
+{
+
+ set_pte_at(&init_mm, addr, pte, __pte(0));
+ return 0;
+}
+#endif
+
int
gnttab_resume(void)
{
gnttab_setup_table_t setup;
- unsigned long frames[NR_GRANT_FRAMES];
- int i;
+ unsigned long frames[NR_GRANT_FRAMES];
+#ifndef __ia64__
+ void *pframes = frames;
+ struct vm_struct *area;
+#endif
setup.dom = DOMID_SELF;
setup.nr_frames = NR_GRANT_FRAMES;
@@ -368,12 +393,18 @@
BUG_ON(HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1));
BUG_ON(setup.status != 0);
-#ifdef __ia64__
+#ifndef __ia64__
+ if (shared == NULL) {
+ area = get_vm_area(PAGE_SIZE * NR_GRANT_FRAMES, VM_IOREMAP);
+ BUG_ON(area == NULL);
+ shared = area->addr;
+ }
+ BUG_ON(generic_page_range(&init_mm, (unsigned long)shared,
+ PAGE_SIZE * NR_GRANT_FRAMES,
+ map_pte_fn, &pframes));
+#else
shared = __va(frames[0] << PAGE_SHIFT);
printk("grant table at %p\n", shared);
-#else
- for (i = 0; i < NR_GRANT_FRAMES; i++)
- set_fixmap(FIX_GNTTAB_END - i, frames[i] << PAGE_SHIFT);
#endif
return 0;
@@ -382,10 +413,12 @@
int
gnttab_suspend(void)
{
- int i;
-
- for (i = 0; i < NR_GRANT_FRAMES; i++)
- clear_fixmap(FIX_GNTTAB_END - i);
+
+#ifndef __ia64__
+ generic_page_range(&init_mm, (unsigned long)shared,
+ PAGE_SIZE * NR_GRANT_FRAMES,
+ unmap_pte_fn, NULL);
+#endif
return 0;
}
@@ -399,10 +432,6 @@
return -ENODEV;
BUG_ON(gnttab_resume());
-
-#ifndef __ia64__
- shared = (grant_entry_t *)fix_to_virt(FIX_GNTTAB_END);
-#endif
for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
gnttab_list[i] = i + 1;
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Sat Mar 11
10:19:11 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Sat Mar 11
10:20:32 2006
@@ -310,7 +310,8 @@
goto abort_transaction;
}
- err = xenbus_switch_state(dev, xbt, XenbusStateInitialised);
+ err = xenbus_printf(xbt, dev->nodename,
+ "state", "%d", XenbusStateInitialised);
if (err) {
goto abort_transaction;
}
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h Sat Mar
11 10:19:11 2006
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/fixmap.h Sat Mar
11 10:20:32 2006
@@ -84,8 +84,6 @@
FIX_PCIE_MCFG,
#endif
FIX_SHARED_INFO,
- FIX_GNTTAB_BEGIN,
- FIX_GNTTAB_END = FIX_GNTTAB_BEGIN + NR_GRANT_FRAMES - 1,
#define NR_FIX_ISAMAPS 256
FIX_ISAMAP_END,
FIX_ISAMAP_BEGIN = FIX_ISAMAP_END + NR_FIX_ISAMAPS - 1,
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h Sat Mar
11 10:19:11 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/fixmap.h Sat Mar
11 10:20:32 2006
@@ -52,8 +52,6 @@
FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
#endif
FIX_SHARED_INFO,
- FIX_GNTTAB_BEGIN,
- FIX_GNTTAB_END = FIX_GNTTAB_BEGIN + NR_GRANT_FRAMES - 1,
#define NR_FIX_ISAMAPS 256
FIX_ISAMAP_END,
FIX_ISAMAP_BEGIN = FIX_ISAMAP_END + NR_FIX_ISAMAPS - 1,
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/Rules.mk
--- a/tools/Rules.mk Sat Mar 11 10:19:11 2006
+++ b/tools/Rules.mk Sat Mar 11 10:20:32 2006
@@ -9,16 +9,6 @@
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
XEN_XENSTORE = $(XEN_ROOT)/tools/xenstore
XEN_LIBXENSTAT = $(XEN_ROOT)/tools/xenstat/libxenstat/src
-
-ifeq ($(XEN_TARGET_ARCH),x86_32)
-CFLAGS += -m32 -march=i686
-LDFLAGS += -m32
-endif
-
-ifeq ($(XEN_TARGET_ARCH),x86_64)
-CFLAGS += -m64
-LDFLAGS += -m64
-endif
X11_LDPATH = -L/usr/X11R6/$(LIBDIR)
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/ioemu/monitor.c
--- a/tools/ioemu/monitor.c Sat Mar 11 10:19:11 2006
+++ b/tools/ioemu/monitor.c Sat Mar 11 10:20:32 2006
@@ -407,6 +407,7 @@
static void do_eject(int force, const char *filename)
{
+ char cmd[1024];
BlockDriverState *bs;
bs = bdrv_find(filename);
@@ -415,6 +416,9 @@
return;
}
eject_device(bs, force);
+ sprintf(cmd, "eject %s", filename);
+ system(cmd);
+
}
static void do_change(const char *device, const char *filename)
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/ioemu/target-i386-dm/Makefile
--- a/tools/ioemu/target-i386-dm/Makefile Sat Mar 11 10:19:11 2006
+++ b/tools/ioemu/target-i386-dm/Makefile Sat Mar 11 10:20:32 2006
@@ -235,7 +235,7 @@
all: $(PROGS)
$(QEMU_USER): $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
ifeq ($(ARCH),alpha)
# Mark as 32 bit binary, i. e. it will be mapped into the low 31 bit of
# the address space (31 bit so sign extending doesn't matter)
@@ -311,7 +311,7 @@
endif
$(QEMU_SYSTEM): $(VL_OBJS) libqemu.a
- $(CC) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS) $(VL_LIBS)
-lpthread
+ $(CC) $(CFLAGS) $(VL_LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS) $(VNC_LIBS)
$(VL_LIBS) -lpthread
vnc.o: vnc.c keyboard_rdesktop.c
$(CC) $(CFLAGS) $(DEFINES) $(VNC_CFLAGS) -c -o $@ $<
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/ioemu/vl.h
--- a/tools/ioemu/vl.h Sat Mar 11 10:19:11 2006
+++ b/tools/ioemu/vl.h Sat Mar 11 10:20:32 2006
@@ -697,7 +697,7 @@
void tcx_init(DisplayState *ds, uint32_t addr);
/* sched.c */
-void sched_init();
+void sched_init(uint32_t, uint32_t);
/* magic-load.c */
void magic_init(const char *kfn, int kloadaddr, uint32_t addr);
@@ -799,7 +799,7 @@
int gdbserver_start(int port);
void update_select_wakeup_events(void);
-void tun_receive_handler();
+void tun_receive_handler(fd_set *);
extern char domain_name[];
#endif /* VL_H */
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Sat Mar 11 10:19:11 2006
+++ b/tools/libxc/xc_linux_build.c Sat Mar 11 10:20:32 2006
@@ -863,8 +863,7 @@
if ( shadow_mode_enabled )
{
- struct xen_reserved_phys_area xrpa;
- struct xen_map_shared_info xmsi;
+ struct xen_add_to_physmap xatp;
/* Enable shadow translate mode */
if ( xc_shadow_control(xc_handle, dom,
@@ -875,25 +874,35 @@
goto error_out;
}
- /* Find the shared info frame. It's guaranteed to be at the
- start of the PFN hole. */
- xrpa.domid = dom;
- xrpa.idx = 0;
- rc = xc_memory_op(xc_handle, XENMEM_reserved_phys_area, &xrpa);
- if ( rc != 0 )
- {
- PERROR("Cannot find shared info pfn");
- goto error_out;
- }
-
guest_shared_info_mfn = (vsharedinfo_start-dsi.v_start) >> PAGE_SHIFT;
- xmsi.domid = dom;
- xmsi.pfn = guest_shared_info_mfn;
- rc = xc_memory_op(xc_handle, XENMEM_map_shared_info, &xmsi);
+
+ /* Map shared info frame into guest physmap. */
+ xatp.domid = dom;
+ xatp.space = XENMAPSPACE_shared_info;
+ xatp.idx = 0;
+ xatp.gpfn = guest_shared_info_mfn;
+ rc = xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp);
if ( rc != 0 )
{
PERROR("Cannot map shared info pfn");
goto error_out;
+ }
+
+ /* Map grant table frames into guest physmap. */
+ for ( i = 0; ; i++ )
+ {
+ xatp.domid = dom;
+ xatp.space = XENMAPSPACE_grant_table;
+ xatp.idx = i;
+ xatp.gpfn = nr_pages + i;
+ rc = xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp);
+ if ( rc != 0 )
+ {
+ if ( errno == EINVAL )
+ break; /* done all grant tables */
+ PERROR("Cannot map grant table pfn");
+ goto error_out;
+ }
}
}
else
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Sat Mar 11 10:19:11 2006
+++ b/tools/libxc/xc_private.c Sat Mar 11 10:20:32 2006
@@ -231,8 +231,8 @@
goto out1;
}
break;
- case XENMEM_reserved_phys_area:
- if ( mlock(arg, sizeof(struct xen_reserved_phys_area)) )
+ case XENMEM_add_to_physmap:
+ if ( mlock(arg, sizeof(struct xen_add_to_physmap)) )
{
PERROR("Could not mlock");
goto out1;
@@ -277,8 +277,8 @@
safe_munlock(xmml->extent_start,
xmml->max_extents * sizeof(unsigned long));
break;
- case XENMEM_reserved_phys_area:
- safe_munlock(arg, sizeof(struct xen_reserved_phys_area));
+ case XENMEM_add_to_physmap:
+ safe_munlock(arg, sizeof(struct xen_add_to_physmap));
break;
case XENMEM_translate_gpfn_list:
safe_munlock(trans->mfn_list, trans->nr_gpfns * sizeof(long));
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/misc/lomount/lomount.c
--- a/tools/misc/lomount/lomount.c Sat Mar 11 10:19:11 2006
+++ b/tools/misc/lomount/lomount.c Sat Mar 11 10:20:32 2006
@@ -195,7 +195,7 @@
return fail;
}
-void usage()
+void usage(void)
{
fprintf(stderr, "You must specify at least -diskimage and
-partition.\n");
fprintf(stderr, "All other arguments are passed through to 'mount'.\n");
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/misc/mbootpack/Makefile
--- a/tools/misc/mbootpack/Makefile Sat Mar 11 10:19:11 2006
+++ b/tools/misc/mbootpack/Makefile Sat Mar 11 10:20:32 2006
@@ -31,7 +31,7 @@
DEPS = .*.d
mbootpack: $(OBJS)
- $(HOSTCC) -o $@ $(filter-out %.a, $^) $(LDFLAGS)
+ $(HOSTCC) -o $@ $(filter-out %.a, $^)
clean:
$(RM) mbootpack *.o $(DEPS) bootsect setup bzimage_header.c bin2c
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/misc/xc_shadow.c
--- a/tools/misc/xc_shadow.c Sat Mar 11 10:19:11 2006
+++ b/tools/misc/xc_shadow.c Sat Mar 11 10:20:32 2006
@@ -18,7 +18,7 @@
#include <errno.h>
#include <string.h>
-void usage()
+void usage(void)
{
printf("xc_shadow: -[0|1|2]\n");
printf(" set shadow mode\n");
@@ -28,7 +28,7 @@
int main(int argc, char *argv[])
{
int xc_handle;
- int mode;
+ int mode = 0;
if ( argc > 1 )
{
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/vtpm_manager/manager/Makefile
--- a/tools/vtpm_manager/manager/Makefile Sat Mar 11 10:19:11 2006
+++ b/tools/vtpm_manager/manager/Makefile Sat Mar 11 10:20:32 2006
@@ -20,7 +20,7 @@
rm -f $(BIN) *~
$(BIN): $(OBJS)
- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
# libraries
LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c Sat Mar 11 10:19:11 2006
+++ b/tools/xenmon/xenbaked.c Sat Mar 11 10:20:32 2006
@@ -379,7 +379,7 @@
/**
* get_num_cpus - get the number of logical CPUs
*/
-unsigned int get_num_cpus()
+unsigned int get_num_cpus(void)
{
dom0_op_t op;
int xc_handle = xc_interface_open();
@@ -409,7 +409,7 @@
/**
* monitor_tbufs - monitor the contents of tbufs
*/
-int monitor_tbufs()
+int monitor_tbufs(void)
{
int i;
extern void process_record(int, struct t_rec *);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile Sat Mar 11 10:19:11 2006
+++ b/tools/xenstat/libxenstat/Makefile Sat Mar 11 10:20:32 2006
@@ -48,7 +48,7 @@
$(RANLIB) $@
$(SHLIB): $(OBJECTS)
- $(CC) $(LDFLAGS) $(SONAME_FLAGS) -shared -o $@ $(OBJECTS)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(SONAME_FLAGS) -shared -o $@ $(OBJECTS)
src/xenstat.o: src/xenstat.c src/xenstat.h src/xen-interface.h
$(CC) $(CFLAGS) $(WARN_FLAGS) -c -o $@ $<
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
tools/xenstat/libxenstat/src/xen-interface.c
--- a/tools/xenstat/libxenstat/src/xen-interface.c Sat Mar 11 10:19:11 2006
+++ b/tools/xenstat/libxenstat/src/xen-interface.c Sat Mar 11 10:20:32 2006
@@ -31,7 +31,7 @@
/* Initialize for xen-interface. Returns a handle to be used with subsequent
* calls to the xen-interface functions or NULL if an error occurs. */
-xi_handle *xi_init()
+xi_handle *xi_init(void)
{
xi_handle *handle;
diff -r 9c2c55ba22e5 -r 90bac1d23a0c
tools/xenstat/libxenstat/src/xen-interface.h
--- a/tools/xenstat/libxenstat/src/xen-interface.h Sat Mar 11 10:19:11 2006
+++ b/tools/xenstat/libxenstat/src/xen-interface.h Sat Mar 11 10:20:32 2006
@@ -26,7 +26,7 @@
/* Initialize for xen-interface. Returns a handle to be used with subsequent
* calls to the xen-interface functions or NULL if an error occurs. */
-xi_handle *xi_init();
+xi_handle *xi_init(void);
/* Release the handle to libxc, free resources, etc. */
void xi_uninit(xi_handle *handle);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xenstat/libxenstat/src/xenstat.c
--- a/tools/xenstat/libxenstat/src/xenstat.c Sat Mar 11 10:19:11 2006
+++ b/tools/xenstat/libxenstat/src/xenstat.c Sat Mar 11 10:20:32 2006
@@ -129,7 +129,7 @@
/*
* libxenstat API
*/
-xenstat_handle *xenstat_init()
+xenstat_handle *xenstat_init(void)
{
xenstat_handle *handle;
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xenstat/libxenstat/src/xenstat.h
--- a/tools/xenstat/libxenstat/src/xenstat.h Sat Mar 11 10:19:11 2006
+++ b/tools/xenstat/libxenstat/src/xenstat.h Sat Mar 11 10:20:32 2006
@@ -26,7 +26,7 @@
/* Initialize the xenstat library. Returns a handle to be used with
* subsequent calls to the xenstat library, or NULL if an error occurs. */
-xenstat_handle *xenstat_init();
+xenstat_handle *xenstat_init(void);
/* Release the handle to libxc, free resources, etc. */
void xenstat_uninit(xenstat_handle * handle);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c Sat Mar 11 10:19:11 2006
+++ b/tools/xenstore/xenstored_core.c Sat Mar 11 10:20:32 2006
@@ -66,7 +66,7 @@
static TDB_CONTEXT *tdb_ctx;
static void corrupt(struct connection *conn, const char *fmt, ...);
-static void check_store();
+static void check_store(void);
#define log(...) \
do { \
@@ -238,7 +238,7 @@
}
-static void reopen_log()
+static void reopen_log(void)
{
if (tracefile) {
if (tracefd > 0)
@@ -1612,7 +1612,7 @@
}
-static void check_store()
+static void check_store(void)
{
char * root = talloc_strdup(NULL, "/");
struct hashtable * reachable =
diff -r 9c2c55ba22e5 -r 90bac1d23a0c tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Sat Mar 11 10:19:11 2006
+++ b/tools/xentrace/xentrace.c Sat Mar 11 10:20:32 2006
@@ -258,7 +258,7 @@
/**
* get_num_cpus - get the number of logical CPUs
*/
-unsigned int get_num_cpus()
+unsigned int get_num_cpus(void)
{
dom0_op_t op;
int xc_handle = xc_interface_open();
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/Rules.mk
--- a/xen/arch/x86/Rules.mk Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/Rules.mk Sat Mar 11 10:20:32 2006
@@ -22,19 +22,20 @@
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector)
CFLAGS += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
-ifeq ($(TARGET_SUBARCH),x86_32)
-CFLAGS += -m32 -march=i686
-LDFLAGS += -m elf_i386
-ifeq ($(pae),y)
+ifeq ($(TARGET_SUBARCH)$(pae),x86_32y)
CFLAGS += -DCONFIG_X86_PAE=1
endif
-endif
+
ifeq ($(supervisor_mode_kernel),y)
CFLAGS += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
endif
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+LDFLAGS += -m elf_i386
+endif
+
ifeq ($(TARGET_SUBARCH),x86_64)
-CFLAGS += -m64 -mno-red-zone -fpic -fno-reorder-blocks
+CFLAGS += -mno-red-zone -fpic -fno-reorder-blocks
CFLAGS += -fno-asynchronous-unwind-tables
LDFLAGS += -m elf_x86_64
endif
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/audit.c
--- a/xen/arch/x86/audit.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/audit.c Sat Mar 11 10:20:32 2006
@@ -350,7 +350,7 @@
unmap_domain_page(pt);
}
- void adjust_shadow_tables()
+ void adjust_shadow_tables(void)
{
struct shadow_status *a;
unsigned long smfn, gmfn;
@@ -402,7 +402,7 @@
}
}
- void adjust_oos_list()
+ void adjust_oos_list(void)
{
struct out_of_sync_entry *oos;
@@ -426,7 +426,7 @@
}
}
- void adjust_for_pgtbase()
+ void adjust_for_pgtbase(void)
{
struct vcpu *v;
@@ -443,7 +443,7 @@
}
}
- void adjust_guest_pages()
+ void adjust_guest_pages(void)
{
struct list_head *list_ent = d->page_list.next;
struct page_info *page;
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/hvm.c Sat Mar 11 10:20:32 2006
@@ -205,12 +205,10 @@
}
}
-void pic_irq_request(int *interrupt_request, int level)
-{
- if (level)
- *interrupt_request = 1;
- else
- *interrupt_request = 0;
+void pic_irq_request(void *data, int level)
+{
+ int *interrupt_request = data;
+ *interrupt_request = level;
}
void hvm_pic_assist(struct vcpu *v)
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/i8259.c
--- a/xen/arch/x86/hvm/i8259.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/i8259.c Sat Mar 11 10:20:32 2006
@@ -407,7 +407,7 @@
pic_reset(s);
}
-void pic_init(struct hvm_virpic *s, void (*irq_request)(),
+void pic_init(struct hvm_virpic *s, void (*irq_request)(void *, int),
void *irq_request_opaque)
{
memset(s, 0, sizeof(*s));
@@ -422,7 +422,8 @@
return;
}
-void pic_set_alt_irq_func(struct hvm_virpic *s, void (*alt_irq_func)(),
+void pic_set_alt_irq_func(struct hvm_virpic *s,
+ void (*alt_irq_func)(void *, int, int),
void *alt_irq_opaque)
{
s->alt_irq_func = alt_irq_func;
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/svm/intr.c
--- a/xen/arch/x86/hvm/svm/intr.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/svm/intr.c Sat Mar 11 10:20:32 2006
@@ -187,7 +187,7 @@
}
/* let's inject this interrupt */
TRACE_3D(TRC_VMX_INT, v->domain->domain_id, intr_vector, 0);
- svm_inject_extint(v, intr_vector, VMX_INVALID_ERROR_CODE);
+ svm_inject_extint(v, intr_vector, VMX_DELIVER_NO_ERROR_CODE);
interrupt_post_injection(v, intr_vector, intr_type);
break;
case VLAPIC_DELIV_MODE_SMI:
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/vmx/io.c
--- a/xen/arch/x86/hvm/vmx/io.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/vmx/io.c Sat Mar 11 10:20:32 2006
@@ -165,7 +165,7 @@
case VLAPIC_DELIV_MODE_EXT:
case VLAPIC_DELIV_MODE_FIXED:
case VLAPIC_DELIV_MODE_LPRI:
- vmx_inject_extint(v, highest_vector, VMX_INVALID_ERROR_CODE);
+ vmx_inject_extint(v, highest_vector, VMX_DELIVER_NO_ERROR_CODE);
TRACE_3D(TRC_VMX_INT, v->domain->domain_id, highest_vector, 0);
break;
case VLAPIC_DELIV_MODE_SMI:
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/vmx/vmcs.c Sat Mar 11 10:20:32 2006
@@ -363,7 +363,7 @@
return error;
}
-static inline int construct_vmcs_host()
+static inline int construct_vmcs_host(void)
{
int error = 0;
#ifdef __x86_64__
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/hvm/vmx/vmx.c Sat Mar 11 10:20:32 2006
@@ -479,12 +479,13 @@
void do_nmi(struct cpu_user_regs *);
-static int check_vmx_controls(ctrls, msr)
+static int check_vmx_controls(u32 ctrls, u32 msr)
{
u32 vmx_msr_low, vmx_msr_high;
rdmsr(msr, vmx_msr_low, vmx_msr_high);
- if (ctrls < vmx_msr_low || ctrls > vmx_msr_high) {
+ if ( (ctrls < vmx_msr_low) || (ctrls > vmx_msr_high) )
+ {
printk("Insufficient VMX capability 0x%x, "
"msr=0x%x,low=0x%8x,high=0x%x\n",
ctrls, msr, vmx_msr_low, vmx_msr_high);
@@ -1916,7 +1917,7 @@
/* don't bother H/W interrutps */
if (exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT &&
exit_reason != EXIT_REASON_VMCALL &&
- exit_reason != EXIT_REASON_IO_INSTRUCTION)
+ exit_reason != EXIT_REASON_IO_INSTRUCTION)
HVM_DBG_LOG(DBG_LEVEL_0, "exit reason = %x", exit_reason);
if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
@@ -2051,6 +2052,7 @@
__update_guest_eip(inst_len);
break;
}
+#if 0 /* keep this for debugging */
case EXIT_REASON_VMCALL:
__get_instruction_length(inst_len);
__vmread(GUEST_RIP, &eip);
@@ -2059,6 +2061,7 @@
hvm_print_line(v, regs.eax); /* provides the current domain */
__update_guest_eip(inst_len);
break;
+#endif
case EXIT_REASON_CR_ACCESS:
{
__vmread(GUEST_RIP, &eip);
@@ -2099,6 +2102,21 @@
case EXIT_REASON_MWAIT_INSTRUCTION:
__hvm_bug(®s);
break;
+ case EXIT_REASON_VMCALL:
+ case EXIT_REASON_VMCLEAR:
+ case EXIT_REASON_VMLAUNCH:
+ case EXIT_REASON_VMPTRLD:
+ case EXIT_REASON_VMPTRST:
+ case EXIT_REASON_VMREAD:
+ case EXIT_REASON_VMRESUME:
+ case EXIT_REASON_VMWRITE:
+ case EXIT_REASON_VMOFF:
+ case EXIT_REASON_VMON:
+ /* Report invalid opcode exception when a VMX guest tries to execute
+ any of the VMX instructions */
+ vmx_inject_exception(v, TRAP_invalid_op, VMX_DELIVER_NO_ERROR_CODE);
+ break;
+
default:
__hvm_bug(®s); /* should not happen */
}
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Sat Mar 11 10:19:11 2006
+++ b/xen/arch/x86/mm.c Sat Mar 11 10:20:32 2006
@@ -234,6 +234,8 @@
if ( page_get_owner(page) == d )
return;
+ set_gpfn_from_mfn(page_to_mfn(page), INVALID_M2P_ENTRY);
+
spin_lock(&d->page_alloc_lock);
/* The incremented type count pins as writable or read-only. */
@@ -2817,81 +2819,54 @@
long arch_memory_op(int op, GUEST_HANDLE(void) arg)
{
- unsigned long pfn;
- struct domain *d;
- unsigned int i;
-
switch ( op )
{
- case XENMEM_reserved_phys_area: {
- struct xen_reserved_phys_area xrpa;
-
- if ( copy_from_guest(&xrpa, arg, 1) )
+ case XENMEM_add_to_physmap:
+ {
+ struct xen_add_to_physmap xatp;
+ unsigned long mfn = 0, gpfn;
+ struct domain *d;
+
+ if ( copy_from_guest(&xatp, arg, 1) )
return -EFAULT;
- /* No guest has more than one reserved area. */
- if ( xrpa.idx != 0 )
+ if ( (d = find_domain_by_id(xatp.domid)) == NULL )
return -ESRCH;
- if ( (d = find_domain_by_id(xrpa.domid)) == NULL )
- return -ESRCH;
-
- /* Only initialised translated guests have a reserved area. */
- if ( !shadow_mode_translate(d) || (d->max_pages == 0) )
- {
- put_domain(d);
- return -ESRCH;
- }
-
- LOCK_BIGLOCK(d);
- if ( d->arch.first_reserved_pfn == 0 )
- {
- d->arch.first_reserved_pfn = pfn = d->max_pages;
- for ( i = 0; i < NR_GRANT_FRAMES; i++ )
- guest_physmap_add_page(
- d, pfn + i, gnttab_shared_mfn(d, d->grant_table, i));
- }
- UNLOCK_BIGLOCK(d);
-
- xrpa.first_gpfn = d->arch.first_reserved_pfn;
- xrpa.nr_gpfns = NR_GRANT_FRAMES;
-
- put_domain(d);
-
- if ( copy_to_guest(arg, &xrpa, 1) )
- return -EFAULT;
-
- break;
- }
-
- case XENMEM_map_shared_info: {
- struct xen_map_shared_info xmsi;
-
- if ( copy_from_guest(&xmsi, arg, 1) )
- return -EFAULT;
-
- if ( (d = find_domain_by_id(xmsi.domid)) == NULL )
- return -ESRCH;
-
- /* Only initialised translated guests can set the shared_info
- * mapping. */
- if ( !shadow_mode_translate(d) || (d->max_pages == 0) )
- {
- put_domain(d);
- return -ESRCH;
- }
-
- if ( xmsi.pfn > d->max_pages ) {
+ switch ( xatp.space )
+ {
+ case XENMAPSPACE_shared_info:
+ if ( xatp.idx == 0 )
+ mfn = virt_to_mfn(d->shared_info);
+ break;
+ case XENMAPSPACE_grant_table:
+ if ( xatp.idx < NR_GRANT_FRAMES )
+ mfn = virt_to_mfn(d->grant_table->shared) + xatp.idx;
+ break;
+ default:
+ break;
+ }
+
+ if ( !shadow_mode_translate(d) || (mfn == 0) )
+ {
put_domain(d);
return -EINVAL;
}
LOCK_BIGLOCK(d);
+
/* Remove previously mapped page if it was present. */
- if ( mfn_valid(gmfn_to_mfn(d, xmsi.pfn)) )
- guest_remove_page(d, xmsi.pfn);
- guest_physmap_add_page(d, xmsi.pfn,
- virt_to_maddr(d->shared_info) >> PAGE_SHIFT);
+ if ( mfn_valid(gmfn_to_mfn(d, xatp.gpfn)) )
+ guest_remove_page(d, xatp.gpfn);
+
+ /* Unmap from old location, if any. */
+ gpfn = get_gpfn_from_mfn(mfn);
+ if ( gpfn != INVALID_M2P_ENTRY )
+ guest_physmap_remove_page(d, gpfn, mfn);
+
+ /* Map at new location. */
+ guest_physmap_add_page(d, xatp.gpfn, mfn);
+
UNLOCK_BIGLOCK(d);
put_domain(d);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/common/lib.c
--- a/xen/common/lib.c Sat Mar 11 10:19:11 2006
+++ b/xen/common/lib.c Sat Mar 11 10:20:32 2006
@@ -158,8 +158,7 @@
* leading zeros).
*/
u64
-__qdivrem(uq, vq, arq)
- u64 uq, vq, *arq;
+__qdivrem(u64 uq, u64 vq, u64 *arq)
{
union uu tmp;
digit *u, *v, *q;
@@ -382,8 +381,7 @@
* Divide two unsigned quads.
*/
u64
-__udivdi3(a, b)
- u64 a, b;
+__udivdi3(u64 a, u64 b)
{
return (__qdivrem(a, b, (u64 *)0));
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/grant_table.h
--- a/xen/include/asm-x86/grant_table.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/grant_table.h Sat Mar 11 10:20:32 2006
@@ -26,9 +26,6 @@
share_xen_page_with_guest( \
virt_to_page((char *)(t)->shared + ((i) * PAGE_SIZE)), \
(d), XENSHARE_writable); \
- set_gpfn_from_mfn( \
- (virt_to_maddr((t)->shared) >> PAGE_SHIFT) + (i), \
- INVALID_M2P_ENTRY); \
} while ( 0 )
#define gnttab_shared_mfn(d, t, i) \
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/hvm/io.h
--- a/xen/include/asm-x86/hvm/io.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/hvm/io.h Sat Mar 11 10:20:32 2006
@@ -151,7 +151,7 @@
extern void hvm_wait_io(void);
extern void hvm_safe_block(void);
extern void hvm_io_assist(struct vcpu *v);
-extern void pic_irq_request(int *interrupt_request, int level);
+extern void pic_irq_request(void *data, int level);
extern void hvm_pic_assist(struct vcpu *v);
extern int cpu_get_interrupt(struct vcpu *v, int *type);
extern int cpu_has_pending_irq(struct vcpu *v);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/hvm/support.h
--- a/xen/include/asm-x86/hvm/support.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/hvm/support.h Sat Mar 11 10:20:32 2006
@@ -99,7 +99,7 @@
#define PC_DEBUG_PORT 0x80
-#define VMX_INVALID_ERROR_CODE -1
+#define VMX_DELIVER_NO_ERROR_CODE -1
/*
* This works for both 32bit & 64bit eflags filteration
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/hvm/vmx/vmx.h
--- a/xen/include/asm-x86/hvm/vmx/vmx.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/hvm/vmx/vmx.h Sat Mar 11 10:20:32 2006
@@ -119,7 +119,15 @@
#define EXIT_REASON_RDPMC 15
#define EXIT_REASON_RDTSC 16
#define EXIT_REASON_VMCALL 18
-
+#define EXIT_REASON_VMCLEAR 19
+#define EXIT_REASON_VMLAUNCH 20
+#define EXIT_REASON_VMPTRLD 21
+#define EXIT_REASON_VMPTRST 22
+#define EXIT_REASON_VMREAD 23
+#define EXIT_REASON_VMRESUME 24
+#define EXIT_REASON_VMWRITE 25
+#define EXIT_REASON_VMOFF 26
+#define EXIT_REASON_VMON 27
#define EXIT_REASON_CR_ACCESS 28
#define EXIT_REASON_DR_ACCESS 29
#define EXIT_REASON_IO_INSTRUCTION 30
@@ -425,7 +433,7 @@
/* Reflect it back into the guest */
intr_fields = (INTR_INFO_VALID_MASK | type | trap);
- if (error_code != VMX_INVALID_ERROR_CODE) {
+ if (error_code != VMX_DELIVER_NO_ERROR_CODE) {
__vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, error_code);
intr_fields |= INTR_INFO_DELIEVER_CODE_MASK;
}
@@ -455,7 +463,7 @@
if (vector & INTR_INFO_DELIEVER_CODE_MASK)
__vmread(VM_EXIT_INTR_ERROR_CODE, &error_code);
else
- error_code = VMX_INVALID_ERROR_CODE;
+ error_code = VMX_DELIVER_NO_ERROR_CODE;
vector &= 0xff;
#ifndef NDEBUG
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/hvm/vpic.h
--- a/xen/include/asm-x86/hvm/vpic.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/hvm/vpic.h Sat Mar 11 10:20:32 2006
@@ -55,7 +55,7 @@
/* 0 is master pic, 1 is slave pic */
/* XXX: better separation between the two pics */
PicState pics[2];
- void (*irq_request)(int *opaque, int level);
+ void (*irq_request)(void *opaque, int level);
void *irq_request_opaque;
/* IOAPIC callback support */
void (*alt_irq_func)(void *opaque, int irq_num, int level);
@@ -66,10 +66,10 @@
void pic_set_irq(struct hvm_virpic *s, int irq, int level);
void pic_set_irq_new(void *opaque, int irq, int level);
void pic_init(struct hvm_virpic *s,
- void (*irq_request)(),
+ void (*irq_request)(void *, int),
void *irq_request_opaque);
void pic_set_alt_irq_func(struct hvm_virpic *s,
- void(*alt_irq_func)(),
+ void (*alt_irq_func)(void *, int, int),
void *alt_irq_opaque);
int pic_read_irq(struct hvm_virpic *s);
void pic_update_irq(struct hvm_virpic *s);
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/asm-x86/page.h
--- a/xen/include/asm-x86/page.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/asm-x86/page.h Sat Mar 11 10:20:32 2006
@@ -190,6 +190,10 @@
/* Shorthand versions of the above functions. */
#define __pa(x) (virt_to_maddr(x))
#define __va(x) (maddr_to_virt(x))
+
+/* Convert between Xen-heap virtual addresses and machine frame numbers. */
+#define virt_to_mfn(va) (virt_to_maddr(va) >> PAGE_SHIFT)
+#define mfn_to_virt(mfn) (maddr_to_virt(mfn << PAGE_SHIFT))
/* Convert between machine frame numbers and page-info structures. */
#define mfn_to_page(mfn) (frame_table + (mfn))
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/public/memory.h
--- a/xen/include/public/memory.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/public/memory.h Sat Mar 11 10:20:32 2006
@@ -97,25 +97,27 @@
DEFINE_GUEST_HANDLE(xen_machphys_mfn_list_t);
/*
- * Returns the base and size of the specified reserved 'RAM hole' in the
- * specified guest's pseudophysical address space.
- * arg == addr of xen_reserved_phys_area_t.
+ * Sets the GPFN at which a particular page appears in the specified guest's
+ * pseudophysical address space.
+ * arg == addr of xen_add_to_physmap_t.
*/
-#define XENMEM_reserved_phys_area 7
-typedef struct xen_reserved_phys_area {
- /* Which domain to report about? */
+#define XENMEM_add_to_physmap 7
+typedef struct xen_add_to_physmap {
+ /* Which domain to change the mapping for. */
domid_t domid;
- /*
- * Which reserved area to report? Out-of-range request reports
- * -ESRCH. Currently no architecture will have more than one reserved area.
- */
- unsigned int idx;
+ /* Source mapping space. */
+#define XENMAPSPACE_shared_info 0 /* shared info page */
+#define XENMAPSPACE_grant_table 1 /* grant table page */
+ unsigned int space;
- /* Base and size of the specified reserved area. */
- unsigned long first_gpfn, nr_gpfns;
-} xen_reserved_phys_area_t;
-DEFINE_GUEST_HANDLE(xen_reserved_phys_area_t);
+ /* Index into source mapping space. */
+ unsigned long idx;
+
+ /* GPFN where the source mapping page should appear. */
+ unsigned long gpfn;
+} xen_add_to_physmap_t;
+DEFINE_GUEST_HANDLE(xen_add_to_physmap_t);
/*
* Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error
@@ -140,21 +142,6 @@
} xen_translate_gpfn_list_t;
DEFINE_GUEST_HANDLE(xen_translate_gpfn_list_t);
-/*
- * Sets the GPFN at which the shared_info_page appears in the specified
- * guest's pseudophysical address space.
- * arg == addr of xen_map_shared_info_t.
- */
-#define XENMEM_map_shared_info 9
-typedef struct xen_map_shared_info {
- /* Which domain to change the mapping for. */
- domid_t domid;
-
- /* GPFN where the shared_info_page should appear. */
- unsigned long pfn;
-} xen_map_shared_info_t;
-DEFINE_GUEST_HANDLE(xen_map_shared_info_t);
-
#endif /* __XEN_PUBLIC_MEMORY_H__ */
/*
diff -r 9c2c55ba22e5 -r 90bac1d23a0c xen/include/xen/sched.h
--- a/xen/include/xen/sched.h Sat Mar 11 10:19:11 2006
+++ b/xen/include/xen/sched.h Sat Mar 11 10:20:32 2006
@@ -266,7 +266,7 @@
void sched_rem_domain(struct vcpu *);
long sched_ctl(struct sched_ctl_cmd *);
long sched_adjdom(struct sched_adjdom_cmd *);
-int sched_id();
+int sched_id(void);
void vcpu_wake(struct vcpu *d);
void vcpu_sleep_nosync(struct vcpu *d);
void vcpu_sleep_sync(struct vcpu *d);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|