* [patch] [1/3] global build configuration file [not found] <1148509900.26460.22.camel@basalt.austin.ibm.com> @ 2006-05-24 23:08 ` Hollis Blanchard 2006-05-25 16:28 ` [XenPPC] " Hollis Blanchard [not found] ` <1148511175.26460.35.camel@basalt.austin.ibm.com> 1 sibling, 1 reply; 17+ messages in thread From: Hollis Blanchard @ 2006-05-24 23:08 UTC (permalink / raw) To: xen-devel; +Cc: John Levon, xen-ppc-devel [-- Attachment #1.1: Type: text/plain, Size: 10176 bytes --] Use a global build configuration file, and rework libxc Makefile to work on PowerPC. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> diff -r ad33b3882867 Config.mk --- a/Config.mk Wed May 24 19:41:47 2006 +0100 +++ b/Config.mk Wed May 24 17:37:19 2006 -0500 @@ -39,19 +39,7 @@ CFLAGS += -g 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 -LIBDIR = lib -endif +include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include diff -r ad33b3882867 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/extras/mini-os/Makefile Wed May 24 17:37:19 2006 -0500 @@ -1,7 +1,8 @@ debug ?= y debug ?= y pae ?= n -include $(CURDIR)/../../Config.mk +XEN_ROOT = ../.. +include $(XEN_ROOT)/Config.mk # Set TARGET_ARCH override TARGET_ARCH := $(XEN_TARGET_ARCH) diff -r ad33b3882867 tools/Makefile --- a/tools/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/Makefile Wed May 24 17:37:19 2006 -0500 @@ -1,39 +1,38 @@ XEN_ROOT = ../ XEN_ROOT = ../ include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS := -SUBDIRS += libxc -SUBDIRS += xenstore -SUBDIRS += misc -SUBDIRS += examples -SUBDIRS += xentrace -SUBDIRS += xcutils -SUBDIRS += firmware -SUBDIRS += security -SUBDIRS += console -SUBDIRS += xenmon -SUBDIRS += guest-headers -ifeq ($(VTPM_TOOLS),y) -SUBDIRS += vtpm_manager -SUBDIRS += vtpm -endif -SUBDIRS += xenstat +SUBDIRS-y := +SUBDIRS-y += libxc +SUBDIRS-y += xenstore +SUBDIRS-y += misc +SUBDIRS-y += examples +SUBDIRS-y += xentrace +SUBDIRS-$(CONFIG_X86) += xcutils +SUBDIRS-y += firmware +SUBDIRS-y += security +SUBDIRS-y += console +SUBDIRS-y += xenmon +SUBDIRS-y += guest-headers +SUBDIRS-$(VTPM_TOOLS) += vtpm_manager +SUBDIRS-$(VTPM_TOOLS) += vtpm +SUBDIRS-y += xenstat + # These don't cross-compile ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH)) -SUBDIRS += python -SUBDIRS += pygrub +SUBDIRS-y += python +SUBDIRS-y += pygrub endif .PHONY: all all: check - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemu .PHONY: install install: check - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemuinstall @@ -41,7 +40,7 @@ install: check .PHONY: clean clean: check_clean - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemuclean @@ -55,7 +54,7 @@ check_clean: $(MAKE) -C check clean .PHONY: ioemu ioemuinstall ioemuclean -ifndef XEN_NO_IOEMU +ifdef CONFIG_IOEMU ioemu ioemuinstall ioemuclean: [ -f ioemu/config-host.h ] || \ (cd ioemu; ./configure --prefix=usr) diff -r ad33b3882867 tools/Rules.mk --- a/tools/Rules.mk Wed May 24 19:41:47 2006 +0100 +++ b/tools/Rules.mk Wed May 24 17:37:19 2006 -0500 @@ -4,6 +4,8 @@ all: all: include $(XEN_ROOT)/Config.mk + +CONFIG_$(shell uname -s) := y XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc XEN_LIBXC = $(XEN_ROOT)/tools/libxc diff -r ad33b3882867 tools/libxc/Makefile --- a/tools/libxc/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/Makefile Wed May 24 17:37:19 2006 -0500 @@ -10,42 +10,29 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SRCS := -SRCS += xc_bvtsched.c -SRCS += xc_core.c -SRCS += xc_domain.c -SRCS += xc_evtchn.c -SRCS += xc_misc.c -SRCS += xc_acm.c -SRCS += xc_physdev.c -SRCS += xc_private.c -SRCS += xc_sedf.c -SRCS += xc_tbuf.c +CTRL_SRCS-y := +CTRL_SRCS-y += xc_bvtsched.c +CTRL_SRCS-y += xc_core.c +CTRL_SRCS-y += xc_domain.c +CTRL_SRCS-y += xc_evtchn.c +CTRL_SRCS-y += xc_misc.c +CTRL_SRCS-y += xc_acm.c +CTRL_SRCS-y += xc_physdev.c +CTRL_SRCS-y += xc_private.c +CTRL_SRCS-y += xc_sedf.c +CTRL_SRCS-y += xc_tbuf.c +CTRL_SRCS-$(CONFIG_X86) += xc_ptrace.c xc_ptrace_core.c xc_pagetab.c +CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c -ifeq ($(patsubst x86%,x86,$(XEN_TARGET_ARCH)),x86) -SRCS += xc_ptrace.c -SRCS += xc_ptrace_core.c -SRCS += xc_pagetab.c -endif - -SRCS_Linux += xc_linux.c - -SRCS += $(SRCS_Linux) - -BUILD_SRCS := -BUILD_SRCS += xc_linux_build.c -BUILD_SRCS += xc_load_bin.c -BUILD_SRCS += xc_load_elf.c -BUILD_SRCS += xg_private.c - -ifeq ($(XEN_TARGET_ARCH),ia64) -BUILD_SRCS += xc_ia64_stubs.c -else -BUILD_SRCS += xc_load_aout9.c -BUILD_SRCS += xc_linux_restore.c -BUILD_SRCS += xc_linux_save.c -BUILD_SRCS += xc_hvm_build.c -endif +GUEST_SRCS-y := +GUEST_SRCS-y += xc_linux_build.c +GUEST_SRCS-y += xc_load_bin.c +GUEST_SRCS-y += xc_load_elf.c +GUEST_SRCS-y += xg_private.c +GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c +GUEST_SRCS-$(CONFIG_PLAN9) += xc_load_aout9.c +GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c +GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c CFLAGS += -Werror CFLAGS += -fno-strict-aliasing @@ -60,11 +47,11 @@ LDFLAGS += -L. LDFLAGS += -L. DEPS = .*.d -LIB_OBJS := $(patsubst %.c,%.o,$(SRCS)) -PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS)) +CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y)) +CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y)) -LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS)) -PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS)) +GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y)) +GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y)) LIB := libxenctrl.a LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR) @@ -124,7 +111,7 @@ rpm: build # libxenctrl -libxenctrl.a: $(LIB_OBJS) +libxenctrl.a: $(CTRL_LIB_OBJS) $(AR) rc $@ $^ libxenctrl.so: libxenctrl.so.$(MAJOR) @@ -132,12 +119,12 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$( libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR) ln -sf $< $@ -libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS) +libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^ # libxenguest -libxenguest.a: $(LIB_BUILD_OBJS) +libxenguest.a: $(GUEST_LIB_OBJS) $(AR) rc $@ $^ libxenguest.so: libxenguest.so.$(MAJOR) @@ -145,7 +132,7 @@ libxenguest.so.$(MAJOR): libxenguest.so. libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR) ln -sf $< $@ -libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) libxenctrl.so +libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl -include $(DEPS) diff -r ad33b3882867 tools/libxc/xc_core.c --- a/tools/libxc/xc_core.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_core.c Wed May 24 17:37:19 2006 -0500 @@ -1,6 +1,4 @@ #include "xg_private.h" -#define ELFSIZE 32 -#include "xc_elf.h" #include <stdlib.h> #include <unistd.h> diff -r ad33b3882867 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_linux_build.c Wed May 24 17:37:19 2006 -0500 @@ -5,14 +5,6 @@ #include "xg_private.h" #include "xc_private.h" #include <xenctrl.h> - -#if defined(__i386__) -#define ELFSIZE 32 -#endif - -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif #include "xc_elf.h" #include "xc_aout9.h" diff -r ad33b3882867 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_load_elf.c Wed May 24 17:37:19 2006 -0500 @@ -3,14 +3,6 @@ */ #include "xg_private.h" - -#if defined(__i386__) -#define ELFSIZE 32 -#endif -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif - #include "xc_elf.h" #include <stdlib.h> diff -r ad33b3882867 tools/misc/Makefile --- a/tools/misc/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/misc/Makefile Wed May 24 17:37:19 2006 -0500 @@ -25,7 +25,7 @@ build: $(TARGETS) build: $(TARGETS) $(MAKE) -C miniterm $(MAKE) -C cpuperf -ifneq ($(XEN_TARGET_ARCH),ia64) +ifeq ($(CONFIG_MBOOTPACK),y) $(MAKE) -C mbootpack endif $(MAKE) -C lomount diff -r ad33b3882867 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Wed May 24 17:37:19 2006 -0500 @@ -359,6 +359,7 @@ static PyObject *pyxc_linux_build(XcObje "console_mfn", console_mfn); } +#ifdef CONFIG_HVM static PyObject *pyxc_hvm_build(XcObject *self, PyObject *args, PyObject *kwds) @@ -387,6 +388,7 @@ static PyObject *pyxc_hvm_build(XcObject return Py_BuildValue("{s:i}", "store_mfn", store_mfn); } +#endif static PyObject *pyxc_bvtsched_global_set(XcObject *self, PyObject *args) { @@ -969,6 +971,7 @@ static PyMethodDef pyxc_methods[] = { " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#ifdef CONFIG_HVM { "hvm_build", (PyCFunction)pyxc_hvm_build, METH_VARARGS | METH_KEYWORDS, "\n" @@ -977,6 +980,7 @@ static PyMethodDef pyxc_methods[] = { " image [str]: Name of HVM loader image file.\n" " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#endif { "bvtsched_global_set", (PyCFunction)pyxc_bvtsched_global_set, diff -r ad33b3882867 xen/tools/Makefile --- a/xen/tools/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/xen/tools/Makefile Wed May 24 17:37:19 2006 -0500 @@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk .PHONY: default default: diff -r ad33b3882867 xen/tools/figlet/Makefile --- a/xen/tools/figlet/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/xen/tools/figlet/Makefile Wed May 24 17:37:19 2006 -0500 @@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk figlet: figlet.c $(HOSTCC) -o $@ $< [-- Attachment #1.2: Type: text/html, Size: 12331 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [XenPPC] [patch] [1/3] global build configuration file 2006-05-24 23:08 ` [patch] [1/3] global build configuration file Hollis Blanchard @ 2006-05-25 16:28 ` Hollis Blanchard 0 siblings, 0 replies; 17+ messages in thread From: Hollis Blanchard @ 2006-05-25 16:28 UTC (permalink / raw) To: xen-devel; +Cc: xen-ppc-devel, John Levon (John pointed out I had missed an "hg add". This patch includes the missing config/*.mk files.) Use a global build configuration file, and rework libxc Makefile to work on PowerPC. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> diff -r ad33b3882867 Config.mk --- a/Config.mk Wed May 24 19:41:47 2006 +0100 +++ b/Config.mk Thu May 25 11:25:40 2006 -0500 @@ -39,19 +39,7 @@ CFLAGS += -g 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 -LIBDIR = lib -endif +include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk ifneq ($(EXTRA_PREFIX),) EXTRA_INCLUDES += $(EXTRA_PREFIX)/include diff -r ad33b3882867 extras/mini-os/Makefile --- a/extras/mini-os/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/extras/mini-os/Makefile Thu May 25 11:25:40 2006 -0500 @@ -1,7 +1,8 @@ debug ?= y debug ?= y pae ?= n -include $(CURDIR)/../../Config.mk +XEN_ROOT = ../.. +include $(XEN_ROOT)/Config.mk # Set TARGET_ARCH override TARGET_ARCH := $(XEN_TARGET_ARCH) diff -r ad33b3882867 tools/Makefile --- a/tools/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/Makefile Thu May 25 11:25:40 2006 -0500 @@ -1,39 +1,38 @@ XEN_ROOT = ../ XEN_ROOT = ../ include $(XEN_ROOT)/tools/Rules.mk -SUBDIRS := -SUBDIRS += libxc -SUBDIRS += xenstore -SUBDIRS += misc -SUBDIRS += examples -SUBDIRS += xentrace -SUBDIRS += xcutils -SUBDIRS += firmware -SUBDIRS += security -SUBDIRS += console -SUBDIRS += xenmon -SUBDIRS += guest-headers -ifeq ($(VTPM_TOOLS),y) -SUBDIRS += vtpm_manager -SUBDIRS += vtpm -endif -SUBDIRS += xenstat +SUBDIRS-y := +SUBDIRS-y += libxc +SUBDIRS-y += xenstore +SUBDIRS-y += misc +SUBDIRS-y += examples +SUBDIRS-y += xentrace +SUBDIRS-$(CONFIG_X86) += xcutils +SUBDIRS-y += firmware +SUBDIRS-y += security +SUBDIRS-y += console +SUBDIRS-y += xenmon +SUBDIRS-y += guest-headers +SUBDIRS-$(VTPM_TOOLS) += vtpm_manager +SUBDIRS-$(VTPM_TOOLS) += vtpm +SUBDIRS-y += xenstat + # These don't cross-compile ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH)) -SUBDIRS += python -SUBDIRS += pygrub +SUBDIRS-y += python +SUBDIRS-y += pygrub endif .PHONY: all all: check - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemu .PHONY: install install: check - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemuinstall @@ -41,7 +40,7 @@ install: check .PHONY: clean clean: check_clean - @set -e; for subdir in $(SUBDIRS); do \ + @set -e; for subdir in $(SUBDIRS-y); do \ $(MAKE) -C $$subdir $@; \ done $(MAKE) ioemuclean @@ -55,7 +54,7 @@ check_clean: $(MAKE) -C check clean .PHONY: ioemu ioemuinstall ioemuclean -ifndef XEN_NO_IOEMU +ifdef CONFIG_IOEMU ioemu ioemuinstall ioemuclean: [ -f ioemu/config-host.h ] || \ (cd ioemu; ./configure --prefix=usr) diff -r ad33b3882867 tools/Rules.mk --- a/tools/Rules.mk Wed May 24 19:41:47 2006 +0100 +++ b/tools/Rules.mk Thu May 25 11:25:40 2006 -0500 @@ -4,6 +4,8 @@ all: all: include $(XEN_ROOT)/Config.mk + +CONFIG_$(shell uname -s) := y XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc XEN_LIBXC = $(XEN_ROOT)/tools/libxc diff -r ad33b3882867 tools/libxc/Makefile --- a/tools/libxc/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/Makefile Thu May 25 11:25:40 2006 -0500 @@ -10,42 +10,29 @@ XEN_ROOT = ../.. XEN_ROOT = ../.. include $(XEN_ROOT)/tools/Rules.mk -SRCS := -SRCS += xc_bvtsched.c -SRCS += xc_core.c -SRCS += xc_domain.c -SRCS += xc_evtchn.c -SRCS += xc_misc.c -SRCS += xc_acm.c -SRCS += xc_physdev.c -SRCS += xc_private.c -SRCS += xc_sedf.c -SRCS += xc_tbuf.c +CTRL_SRCS-y := +CTRL_SRCS-y += xc_bvtsched.c +CTRL_SRCS-y += xc_core.c +CTRL_SRCS-y += xc_domain.c +CTRL_SRCS-y += xc_evtchn.c +CTRL_SRCS-y += xc_misc.c +CTRL_SRCS-y += xc_acm.c +CTRL_SRCS-y += xc_physdev.c +CTRL_SRCS-y += xc_private.c +CTRL_SRCS-y += xc_sedf.c +CTRL_SRCS-y += xc_tbuf.c +CTRL_SRCS-$(CONFIG_X86) += xc_ptrace.c xc_ptrace_core.c xc_pagetab.c +CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c -ifeq ($(patsubst x86%,x86,$(XEN_TARGET_ARCH)),x86) -SRCS += xc_ptrace.c -SRCS += xc_ptrace_core.c -SRCS += xc_pagetab.c -endif - -SRCS_Linux += xc_linux.c - -SRCS += $(SRCS_Linux) - -BUILD_SRCS := -BUILD_SRCS += xc_linux_build.c -BUILD_SRCS += xc_load_bin.c -BUILD_SRCS += xc_load_elf.c -BUILD_SRCS += xg_private.c - -ifeq ($(XEN_TARGET_ARCH),ia64) -BUILD_SRCS += xc_ia64_stubs.c -else -BUILD_SRCS += xc_load_aout9.c -BUILD_SRCS += xc_linux_restore.c -BUILD_SRCS += xc_linux_save.c -BUILD_SRCS += xc_hvm_build.c -endif +GUEST_SRCS-y := +GUEST_SRCS-y += xc_linux_build.c +GUEST_SRCS-y += xc_load_bin.c +GUEST_SRCS-y += xc_load_elf.c +GUEST_SRCS-y += xg_private.c +GUEST_SRCS-$(CONFIG_IA64) += xc_ia64_stubs.c +GUEST_SRCS-$(CONFIG_PLAN9) += xc_load_aout9.c +GUEST_SRCS-$(CONFIG_MIGRATE) += xc_linux_restore.c xc_linux_save.c +GUEST_SRCS-$(CONFIG_HVM) += xc_hvm_build.c CFLAGS += -Werror CFLAGS += -fno-strict-aliasing @@ -60,11 +47,11 @@ LDFLAGS += -L. LDFLAGS += -L. DEPS = .*.d -LIB_OBJS := $(patsubst %.c,%.o,$(SRCS)) -PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS)) +CTRL_LIB_OBJS := $(patsubst %.c,%.o,$(CTRL_SRCS-y)) +CTRL_PIC_OBJS := $(patsubst %.c,%.opic,$(CTRL_SRCS-y)) -LIB_BUILD_OBJS := $(patsubst %.c,%.o,$(BUILD_SRCS)) -PIC_BUILD_OBJS := $(patsubst %.c,%.opic,$(BUILD_SRCS)) +GUEST_LIB_OBJS := $(patsubst %.c,%.o,$(GUEST_SRCS-y)) +GUEST_PIC_OBJS := $(patsubst %.c,%.opic,$(GUEST_SRCS-y)) LIB := libxenctrl.a LIB += libxenctrl.so libxenctrl.so.$(MAJOR) libxenctrl.so.$(MAJOR).$(MINOR) @@ -124,7 +111,7 @@ rpm: build # libxenctrl -libxenctrl.a: $(LIB_OBJS) +libxenctrl.a: $(CTRL_LIB_OBJS) $(AR) rc $@ $^ libxenctrl.so: libxenctrl.so.$(MAJOR) @@ -132,12 +119,12 @@ libxenctrl.so.$(MAJOR): libxenctrl.so.$( libxenctrl.so.$(MAJOR): libxenctrl.so.$(MAJOR).$(MINOR) ln -sf $< $@ -libxenctrl.so.$(MAJOR).$(MINOR): $(PIC_OBJS) +libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS) $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenctrl.so.$(MAJOR) -shared -o $@ $^ # libxenguest -libxenguest.a: $(LIB_BUILD_OBJS) +libxenguest.a: $(GUEST_LIB_OBJS) $(AR) rc $@ $^ libxenguest.so: libxenguest.so.$(MAJOR) @@ -145,7 +132,7 @@ libxenguest.so.$(MAJOR): libxenguest.so. libxenguest.so.$(MAJOR): libxenguest.so.$(MAJOR).$(MINOR) ln -sf $< $@ -libxenguest.so.$(MAJOR).$(MINOR): $(PIC_BUILD_OBJS) libxenctrl.so +libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenguest.so.$(MAJOR) -shared -o $@ $^ -lz -lxenctrl -include $(DEPS) diff -r ad33b3882867 tools/libxc/xc_core.c --- a/tools/libxc/xc_core.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_core.c Thu May 25 11:25:40 2006 -0500 @@ -1,6 +1,4 @@ #include "xg_private.h" -#define ELFSIZE 32 -#include "xc_elf.h" #include <stdlib.h> #include <unistd.h> diff -r ad33b3882867 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_linux_build.c Thu May 25 11:25:40 2006 -0500 @@ -5,14 +5,6 @@ #include "xg_private.h" #include "xc_private.h" #include <xenctrl.h> - -#if defined(__i386__) -#define ELFSIZE 32 -#endif - -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif #include "xc_elf.h" #include "xc_aout9.h" diff -r ad33b3882867 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/libxc/xc_load_elf.c Thu May 25 11:25:40 2006 -0500 @@ -3,14 +3,6 @@ */ #include "xg_private.h" - -#if defined(__i386__) -#define ELFSIZE 32 -#endif -#if defined(__x86_64__) || defined(__ia64__) -#define ELFSIZE 64 -#endif - #include "xc_elf.h" #include <stdlib.h> diff -r ad33b3882867 tools/misc/Makefile --- a/tools/misc/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/tools/misc/Makefile Thu May 25 11:25:40 2006 -0500 @@ -25,7 +25,7 @@ build: $(TARGETS) build: $(TARGETS) $(MAKE) -C miniterm $(MAKE) -C cpuperf -ifneq ($(XEN_TARGET_ARCH),ia64) +ifeq ($(CONFIG_MBOOTPACK),y) $(MAKE) -C mbootpack endif $(MAKE) -C lomount diff -r ad33b3882867 tools/python/xen/lowlevel/xc/xc.c --- a/tools/python/xen/lowlevel/xc/xc.c Wed May 24 19:41:47 2006 +0100 +++ b/tools/python/xen/lowlevel/xc/xc.c Thu May 25 11:25:40 2006 -0500 @@ -359,6 +359,7 @@ static PyObject *pyxc_linux_build(XcObje "console_mfn", console_mfn); } +#ifdef CONFIG_HVM static PyObject *pyxc_hvm_build(XcObject *self, PyObject *args, PyObject *kwds) @@ -387,6 +388,7 @@ static PyObject *pyxc_hvm_build(XcObject return Py_BuildValue("{s:i}", "store_mfn", store_mfn); } +#endif static PyObject *pyxc_bvtsched_global_set(XcObject *self, PyObject *args) { @@ -969,6 +971,7 @@ static PyMethodDef pyxc_methods[] = { " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#ifdef CONFIG_HVM { "hvm_build", (PyCFunction)pyxc_hvm_build, METH_VARARGS | METH_KEYWORDS, "\n" @@ -977,6 +980,7 @@ static PyMethodDef pyxc_methods[] = { " image [str]: Name of HVM loader image file.\n" " vcpus [int, 1]: Number of Virtual CPUS in domain.\n\n" "Returns: [int] 0 on success; -1 on error.\n" }, +#endif { "bvtsched_global_set", (PyCFunction)pyxc_bvtsched_global_set, diff -r ad33b3882867 xen/tools/Makefile --- a/xen/tools/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/xen/tools/Makefile Thu May 25 11:25:40 2006 -0500 @@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk .PHONY: default default: diff -r ad33b3882867 xen/tools/figlet/Makefile --- a/xen/tools/figlet/Makefile Wed May 24 19:41:47 2006 +0100 +++ b/xen/tools/figlet/Makefile Thu May 25 11:25:40 2006 -0500 @@ -1,5 +1,6 @@ -include $(BASEDIR)/../Config.mk +XEN_ROOT = $(BASEDIR)/.. +include $(XEN_ROOT)/Config.mk figlet: figlet.c $(HOSTCC) -o $@ $< diff -r ad33b3882867 config/ia64.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/ia64.mk Thu May 25 11:25:40 2006 -0500 @@ -0,0 +1,5 @@ +CONFIG_IA64 := y +CONFIG_IOEMU := y + +CFLAGS += -DELFSIZE=64 -DCONFIG_HVM +LIBDIR := lib diff -r ad33b3882867 config/x86_32.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/x86_32.mk Thu May 25 11:25:40 2006 -0500 @@ -0,0 +1,9 @@ +CONFIG_X86 := y +CONFIG_PLAN9 := y +CONFIG_HVM := y +CONFIG_MIGRATE := y +CONFIG_IOEMU := y +CONFIG_MBOOTPACK := y + +CFLAGS += -m32 -march=i686 -DELFSIZE=32 -DCONFIG_HVM +LIBDIR := lib diff -r ad33b3882867 config/x86_64.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/x86_64.mk Thu May 25 11:25:40 2006 -0500 @@ -0,0 +1,9 @@ +CONFIG_X86 := y +CONFIG_PLAN9 := y +CONFIG_HVM := y +CONFIG_MIGRATE := y +CONFIG_IOEMU := y +CONFIG_MBOOTPACK := y + +CFLAGS += -m64 -DELFSIZE=64 -DCONFIG_HVM +LIBDIR = lib64 ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <1148511175.26460.35.camel@basalt.austin.ibm.com>]
[parent not found: <1148511400.26460.39.camel@basalt.austin.ibm.com>]
* [patch] [3/3] dom0_ops explicitly sized types [not found] ` <1148511400.26460.39.camel@basalt.austin.ibm.com> @ 2006-05-24 23:04 ` Hollis Blanchard 2006-05-25 15:39 ` Muli Ben-Yehuda 0 siblings, 1 reply; 17+ messages in thread From: Hollis Blanchard @ 2006-05-24 23:04 UTC (permalink / raw) To: xen-devel; +Cc: John Levon, xen-ppc-devel [-- Attachment #1.1: Type: text/plain, Size: 6759 bytes --] Replace 'long' in the dom0_ops and privcmd structures with uint64_t. As discussed previously, the these operations are not performance-sensitive, so the additional cache footprint shouldn't be an issue. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> diff -r c1434b779f36 linux-2.6-xen-sparse/include/xen/public/privcmd.h --- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed May 24 17:45:02 2006 -0500 +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed May 24 18:03:19 2006 -0500 @@ -39,14 +39,14 @@ typedef struct privcmd_hypercall { - unsigned long op; - unsigned long arg[5]; + uint64_t op; + uint64_t arg[5]; } privcmd_hypercall_t; typedef struct privcmd_mmap_entry { - unsigned long va; - unsigned long mfn; - unsigned long npages; + uint64_t va; + uint64_t mfn; + uint64_t npages; } privcmd_mmap_entry_t; typedef struct privcmd_mmap { @@ -58,7 +58,7 @@ typedef struct privcmd_mmapbatch { typedef struct privcmd_mmapbatch { int num; /* number of pages to populate */ domid_t dom; /* target domain */ - unsigned long addr; /* virtual address */ + uint64_t addr; /* virtual address */ xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */ } privcmd_mmapbatch_t; diff -r c1434b779f36 xen/include/public/dom0_ops.h --- a/xen/include/public/dom0_ops.h Wed May 24 17:45:02 2006 -0500 +++ b/xen/include/public/dom0_ops.h Wed May 24 18:03:19 2006 -0500 @@ -19,18 +19,18 @@ * This makes sure that old versions of dom0 tools will stop working in a * well-defined way (rather than crashing the machine, for instance). */ -#define DOM0_INTERFACE_VERSION 0x03000000 +#define DOM0_INTERFACE_VERSION 0x03000001 /************************************************************************/ #define DOM0_GETMEMLIST 2 struct dom0_getmemlist { /* IN variables. */ - domid_t domain; - unsigned long max_pfns; + domid_t domain; + uint64_t max_pfns; XEN_GUEST_HANDLE(xen_pfn_t) buffer; /* OUT variables. */ - unsigned long num_pfns; + uint64_t num_pfns; }; typedef struct dom0_getmemlist dom0_getmemlist_t; DEFINE_XEN_GUEST_HANDLE(dom0_getmemlist_t); @@ -96,9 +96,9 @@ struct dom0_getdomaininfo { #define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code. */ #define DOMFLAGS_SHUTDOWNSHIFT 16 uint32_t flags; - unsigned long tot_pages; - unsigned long max_pages; - unsigned long shared_info_frame; /* MFN of shared_info struct */ + uint64_t tot_pages; + uint64_t max_pages; + uint64_t shared_info_frame; /* MFN of shared_info struct */ uint64_t cpu_time; uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ @@ -162,7 +162,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_settime_t); struct dom0_getpageframeinfo { /* IN variables. */ - unsigned long mfn; /* Machine page frame number to query. */ + uint64_t mfn; /* Machine page frame number to query. */ domid_t domain; /* To which domain does the frame belong? */ /* OUT variables. */ /* Is the page PINNED to a type? */ @@ -213,7 +213,7 @@ struct dom0_tbufcontrol { cpumap_t cpu_mask; uint32_t evt_mask; /* OUT variables */ - unsigned long buffer_mfn; + uint64_t buffer_mfn; uint32_t size; }; typedef struct dom0_tbufcontrol dom0_tbufcontrol_t; @@ -229,8 +229,8 @@ struct dom0_physinfo { uint32_t sockets_per_node; uint32_t nr_nodes; uint32_t cpu_khz; - unsigned long total_pages; - unsigned long free_pages; + uint64_t total_pages; + uint64_t free_pages; uint32_t hw_cap[8]; }; typedef struct dom0_physinfo dom0_physinfo_t; @@ -276,7 +276,7 @@ struct dom0_shadow_control { uint32_t op; XEN_GUEST_HANDLE(ulong) dirty_bitmap; /* IN/OUT variables. */ - unsigned long pages; /* size of buffer, updated with actual size */ + uint64_t pages; /* size of buffer, updated with actual size */ /* OUT variables. */ struct dom0_shadow_control_stats stats; }; @@ -286,8 +286,8 @@ DEFINE_XEN_GUEST_HANDLE(dom0_shadow_cont #define DOM0_SETDOMAINMAXMEM 28 struct dom0_setdomainmaxmem { /* IN variables. */ - domid_t domain; - unsigned long max_memkb; + domid_t domain; + uint64_t max_memkb; }; typedef struct dom0_setdomainmaxmem dom0_setdomainmaxmem_t; DEFINE_XEN_GUEST_HANDLE(dom0_setdomainmaxmem_t); @@ -295,8 +295,8 @@ DEFINE_XEN_GUEST_HANDLE(dom0_setdomainma #define DOM0_GETPAGEFRAMEINFO2 29 /* batched interface */ struct dom0_getpageframeinfo2 { /* IN variables. */ - domid_t domain; - unsigned long num; + domid_t domain; + uint64_t num; /* IN/OUT variables. */ XEN_GUEST_HANDLE(ulong) array; }; @@ -313,12 +313,12 @@ DEFINE_XEN_GUEST_HANDLE(dom0_getpagefram #define DOM0_ADD_MEMTYPE 31 struct dom0_add_memtype { /* IN variables. */ - unsigned long mfn; - unsigned long nr_mfns; - uint32_t type; - /* OUT variables. */ - uint32_t handle; - uint32_t reg; + uint64_t mfn; + uint64_t nr_mfns; + uint32_t type; + /* OUT variables. */ + uint32_t handle; + uint32_t reg; }; typedef struct dom0_add_memtype dom0_add_memtype_t; DEFINE_XEN_GUEST_HANDLE(dom0_add_memtype_t); @@ -345,8 +345,8 @@ struct dom0_read_memtype { /* IN variables. */ uint32_t reg; /* OUT variables. */ - unsigned long mfn; - unsigned long nr_mfns; + uint64_t mfn; + uint64_t nr_mfns; uint32_t type; }; typedef struct dom0_read_memtype dom0_read_memtype_t; @@ -499,8 +499,8 @@ DEFINE_XEN_GUEST_HANDLE(dom0_irq_permiss #define DOM0_IOMEM_PERMISSION 47 struct dom0_iomem_permission { domid_t domain; /* domain to be affected */ - unsigned long first_mfn; /* first page (physical page number) in range */ - unsigned long nr_mfns; /* number of pages in range (>0) */ + uint64_t first_mfn; /* first page (physical page number) in range */ + uint64_t nr_mfns; /* number of pages in range (>0) */ uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ }; typedef struct dom0_iomem_permission dom0_iomem_permission_t; @@ -509,7 +509,7 @@ DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permi #define DOM0_HYPERCALL_INIT 48 struct dom0_hypercall_init { domid_t domain; /* domain to be affected */ - unsigned long mfn; /* machine frame to be initialised */ + uint64_t mfn; /* machine frame to be initialised */ }; typedef struct dom0_hypercall_init dom0_hypercall_init_t; DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t); [-- Attachment #1.2: Type: text/html, Size: 9971 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-24 23:04 ` [patch] [3/3] dom0_ops explicitly sized types Hollis Blanchard @ 2006-05-25 15:39 ` Muli Ben-Yehuda 2006-05-25 19:02 ` Hollis Blanchard 0 siblings, 1 reply; 17+ messages in thread From: Muli Ben-Yehuda @ 2006-05-25 15:39 UTC (permalink / raw) To: Hollis Blanchard; +Cc: xen-ppc-devel, xen-devel, John Levon On Wed, May 24, 2006 at 06:04:34PM -0500, Hollis Blanchard wrote: > Replace 'long' in the dom0_ops and privcmd structures with uint64_t. I am all in favor of identifying interfaces using explicitly sized types. The standard kernel style is to use u64 not uint64_t though. Cheers, Muli ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-25 15:39 ` Muli Ben-Yehuda @ 2006-05-25 19:02 ` Hollis Blanchard 2006-05-26 13:32 ` Muli Ben-Yehuda 0 siblings, 1 reply; 17+ messages in thread From: Hollis Blanchard @ 2006-05-25 19:02 UTC (permalink / raw) To: Muli Ben-Yehuda; +Cc: xen-ppc-devel, xen-devel, John Levon On Thu, 2006-05-25 at 18:39 +0300, Muli Ben-Yehuda wrote: > On Wed, May 24, 2006 at 06:04:34PM -0500, Hollis Blanchard wrote: > > > Replace 'long' in the dom0_ops and privcmd structures with uint64_t. > > I am all in favor of identifying interfaces using explicitly sized > types. The standard kernel style is to use u64 not uint64_t though. (There is plenty of uint.._t in Linux.) I assume you're referring specifically to the privcmd structure change, which is the only Linux-specific part of the patch. The privcmd structure is shared between userspace and the kernel. Since "u64" is a kernel type, we need to use "uint64_t", which has meaning in userspace. -- Hollis Blanchard IBM Linux Technology Center ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-25 19:02 ` Hollis Blanchard @ 2006-05-26 13:32 ` Muli Ben-Yehuda 2006-05-26 14:28 ` Ian Campbell 0 siblings, 1 reply; 17+ messages in thread From: Muli Ben-Yehuda @ 2006-05-26 13:32 UTC (permalink / raw) To: Hollis Blanchard; +Cc: xen-ppc-devel, xen-devel, John Levon On Thu, May 25, 2006 at 02:02:10PM -0500, Hollis Blanchard wrote: > On Thu, 2006-05-25 at 18:39 +0300, Muli Ben-Yehuda wrote: > > On Wed, May 24, 2006 at 06:04:34PM -0500, Hollis Blanchard wrote: > > > > > Replace 'long' in the dom0_ops and privcmd structures with uint64_t. > > > > I am all in favor of identifying interfaces using explicitly sized > > types. The standard kernel style is to use u64 not uint64_t though. > > (There is plenty of uint.._t in Linux.) Yeah... but. That's not the Officially Sanctioned Way, except in headers that are shared with userspace, and in a perfect world no headers would be shared with userspace. > I assume you're referring specifically to the privcmd structure change, > which is the only Linux-specific part of the patch. The privcmd > structure is shared between userspace and the kernel. Since "u64" is a > kernel type, we need to use "uint64_t", which has meaning in > userspace. Oh well, I didn't realize it was shared with userspace... sorry for the false alarm. Cheers, Muli ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 13:32 ` Muli Ben-Yehuda @ 2006-05-26 14:28 ` Ian Campbell 2006-05-26 15:30 ` Hollis Blanchard 0 siblings, 1 reply; 17+ messages in thread From: Ian Campbell @ 2006-05-26 14:28 UTC (permalink / raw) To: Muli Ben-Yehuda; +Cc: John Levon, xen-devel, Hollis Blanchard, xen-ppc-devel On Fri, 2006-05-26 at 16:32 +0300, Muli Ben-Yehuda wrote: > > I assume you're referring specifically to the privcmd structure change, > > which is the only Linux-specific part of the patch. The privcmd > > structure is shared between userspace and the kernel. Since "u64" is a > > kernel type, we need to use "uint64_t", which has meaning in > > userspace. > > Oh well, I didn't realize it was shared with userspace... sorry for > the false alarm. I think Linus' opinion[0] is that kernel headers which are shared with userspace cannot assume that stdint.h has been included so you need to use __u64 and friends. Ian. [0] http://www.ussg.iu.edu/hypermail/linux/kernel/0412.1/1456.html. There's been plenty of other traffic in lkml about it too. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 14:28 ` Ian Campbell @ 2006-05-26 15:30 ` Hollis Blanchard 2006-05-26 16:27 ` Ian Campbell 0 siblings, 1 reply; 17+ messages in thread From: Hollis Blanchard @ 2006-05-26 15:30 UTC (permalink / raw) To: Ian Campbell; +Cc: Muli Ben-Yehuda, John Levon, xen-devel, xen-ppc-devel On Fri, 2006-05-26 at 15:28 +0100, Ian Campbell wrote: > On Fri, 2006-05-26 at 16:32 +0300, Muli Ben-Yehuda wrote: > > > I assume you're referring specifically to the privcmd structure change, > > > which is the only Linux-specific part of the patch. The privcmd > > > structure is shared between userspace and the kernel. Since "u64" is a > > > kernel type, we need to use "uint64_t", which has meaning in > > > userspace. > > > > Oh well, I didn't realize it was shared with userspace... sorry for > > the false alarm. > > I think Linus' opinion[0] is that kernel headers which are shared with > userspace cannot assume that stdint.h has been included so you need to > use __u64 and friends. > > Ian. > > [0] http://www.ussg.iu.edu/hypermail/linux/kernel/0412.1/1456.html. > There's been plenty of other traffic in lkml about it too. There certainly has been plenty of traffic, but I have seen no clear statements (other than "THIS IS BAD" with little explanation). In fact there was just a thread about it this month (http://www.ussg.iu.edu/hypermail/linux/kernel/0605.0/0146.html), and I still don't understand the objections. If you use __u64, you'd need to include some header defining what __u64 is, so you're requiring another header anyways. You might as well use the standard stdint.h rather than inventing your own. -- Hollis Blanchard IBM Linux Technology Center ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 15:30 ` Hollis Blanchard @ 2006-05-26 16:27 ` Ian Campbell 2006-05-26 17:32 ` Anthony Liguori 2006-05-26 17:37 ` Hollis Blanchard 0 siblings, 2 replies; 17+ messages in thread From: Ian Campbell @ 2006-05-26 16:27 UTC (permalink / raw) To: Hollis Blanchard; +Cc: Muli Ben-Yehuda, John Levon, xen-devel, xen-ppc-devel On Fri, 2006-05-26 at 10:30 -0500, Hollis Blanchard wrote: > On Fri, 2006-05-26 at 15:28 +0100, Ian Campbell wrote: > > On Fri, 2006-05-26 at 16:32 +0300, Muli Ben-Yehuda wrote: > > > > I assume you're referring specifically to the privcmd structure change, > > > > which is the only Linux-specific part of the patch. The privcmd > > > > structure is shared between userspace and the kernel. Since "u64" is a > > > > kernel type, we need to use "uint64_t", which has meaning in > > > > userspace. > > > > > > Oh well, I didn't realize it was shared with userspace... sorry for > > > the false alarm. > > > > I think Linus' opinion[0] is that kernel headers which are shared with > > userspace cannot assume that stdint.h has been included so you need to > > use __u64 and friends. > > > > Ian. > > > > [0] http://www.ussg.iu.edu/hypermail/linux/kernel/0412.1/1456.html. > > There's been plenty of other traffic in lkml about it too. > > There certainly has been plenty of traffic, but I have seen no clear > statements (other than "THIS IS BAD" with little explanation). In fact > there was just a thread about it this month > (http://www.ussg.iu.edu/hypermail/linux/kernel/0605.0/0146.html), and I > still don't understand the objections. > > If you use __u64, you'd need to include some header defining what __u64 > is, so you're requiring another header anyways. You might as well use > the standard stdint.h rather than inventing your own. As I understand it the issue is that the C spec makes the __* namespace available for the kernel to pollute and reserves the non-prefixed namespace for application usage. (Single underscore is for compiler or libc internals or something). An application which has not included stdint.h itself can expect to use uint64_t however it wishes, including making it a struct, a function or even something as gross as a 32 bit signed int etc. Exporting some other idea of what uint64_t should be via the kernel headers breaks this. I guess this is more of a problem when a kernel header gets indirectly included -- presumably an app which includes a kernel header directly knows what it is doing. Anyway, regardless of any opinion expressed here the Linux gatekeepers will no doubt insist on __uN. We might as well do it now as change it later. Ian. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 16:27 ` Ian Campbell @ 2006-05-26 17:32 ` Anthony Liguori 2006-05-26 18:21 ` Markus Armbruster 2006-05-26 17:37 ` Hollis Blanchard 1 sibling, 1 reply; 17+ messages in thread From: Anthony Liguori @ 2006-05-26 17:32 UTC (permalink / raw) To: Ian Campbell Cc: Muli Ben-Yehuda, xen-devel, xen-ppc-devel, Hollis Blanchard, John Levon Ian Campbell wrote: >> If you use __u64, you'd need to include some header defining what __u64 >> is, so you're requiring another header anyways. You might as well use >> the standard stdint.h rather than inventing your own. >> > > As I understand it the issue is that the C spec makes the __* namespace > available for the kernel to pollute and reserves the non-prefixed > namespace for application usage. (Single underscore is for compiler or > libc internals or something). > The relevant portions of the spec are: 7.1.3 Reserved identifiers [#1] Each header declares or defines all identifiers listed in its associated subclause, and optionally declares or defines identifiers listed in its associated future library directions subclause and identifiers which are always reserved either for any use or for use as file scope identifiers. - All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. - All identifiers that begin with an underscore are always reserved for use as macros and as identifiers with file scope in both the ordinary and tag name spaces. - Each macro name in any of the following subclauses (including the future library directions) is reserved for use as specified if any of its associated headers is included; unless explicitly stated otherwise (see 7.1.8 <http://www.vmunix.com/%7Egabor/c/draft.html#7.1.8>). - All identifiers with external linkage in any of the following subclauses (including the future library directions) are always reserved for use as identifiers with external linkage.133 - Each identifier with file scope listed in any of the following subclauses (including the future library directions) is reserved for use as macro and as an identifier with file scope in the same name space if any of its associated headers is included. [#2] No other identifiers are reserved. If the program declares or defines an identifier that is reserved in that context (other than as allowed by 7.1.8 <http://www.vmunix.com/%7Egabor/c/draft.html#7.1.8>), the behavior is undefined.134 It's pretty clear that __* names are reserved. The kernel is wrong here. The best explanation I've gotten is "egocentrism" :-) Regards, Anthony Liguori > An application which has not included stdint.h itself can expect to use > uint64_t however it wishes, including making it a struct, a function or > even something as gross as a 32 bit signed int etc. Exporting some other > idea of what uint64_t should be via the kernel headers breaks this. I > guess this is more of a problem when a kernel header gets indirectly > included -- presumably an app which includes a kernel header directly > knows what it is doing. > > Anyway, regardless of any opinion expressed here the Linux gatekeepers > will no doubt insist on __uN. We might as well do it now as change it > later. > > Ian. > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 17:32 ` Anthony Liguori @ 2006-05-26 18:21 ` Markus Armbruster 0 siblings, 0 replies; 17+ messages in thread From: Markus Armbruster @ 2006-05-26 18:21 UTC (permalink / raw) To: Anthony Liguori Cc: Muli Ben-Yehuda, xen-devel, Hollis Blanchard, Ian Campbell, John Levon, xen-ppc-devel Anthony Liguori <aliguori@us.ibm.com> writes: > Ian Campbell wrote: >>> If you use __u64, you'd need to include some header defining what __u64 >>> is, so you're requiring another header anyways. You might as well use >>> the standard stdint.h rather than inventing your own. >>> >> >> As I understand it the issue is that the C spec makes the __* namespace >> available for the kernel to pollute and reserves the non-prefixed >> namespace for application usage. (Single underscore is for compiler or >> libc internals or something). >> > > The relevant portions of the spec are: [...] > It's pretty clear that __* names are reserved. The kernel is wrong > here. The best explanation I've gotten is "egocentrism" :-) Reserved for what? The `implementation'. Which is the combination of compiler, libc and whatever kernel headers libc lets through. How these guys divvy up their reserved name space is up to them, and we better play by their rules. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 16:27 ` Ian Campbell 2006-05-26 17:32 ` Anthony Liguori @ 2006-05-26 17:37 ` Hollis Blanchard 2006-05-26 18:57 ` Chris Wright 1 sibling, 1 reply; 17+ messages in thread From: Hollis Blanchard @ 2006-05-26 17:37 UTC (permalink / raw) To: Ian Campbell; +Cc: Muli Ben-Yehuda, John Levon, xen-devel, xen-ppc-devel On Fri, 2006-05-26 at 17:27 +0100, Ian Campbell wrote: > > Anyway, regardless of any opinion expressed here the Linux gatekeepers > will no doubt insist on __uN. We might as well do it now as change it > later. And where will userspace, e.g. tools/libxc/xc_linux.c, find the definition of __u64? -- Hollis Blanchard IBM Linux Technology Center ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 17:37 ` Hollis Blanchard @ 2006-05-26 18:57 ` Chris Wright 2006-05-26 19:38 ` John Levon 0 siblings, 1 reply; 17+ messages in thread From: Chris Wright @ 2006-05-26 18:57 UTC (permalink / raw) To: Hollis Blanchard Cc: Muli Ben-Yehuda, John Levon, xen-ppc-devel, xen-devel, Ian Campbell * Hollis Blanchard (hollisb@us.ibm.com) wrote: > On Fri, 2006-05-26 at 17:27 +0100, Ian Campbell wrote: > > > > Anyway, regardless of any opinion expressed here the Linux gatekeepers > > will no doubt insist on __uN. We might as well do it now as change it > > later. > > And where will userspace, e.g. tools/libxc/xc_linux.c, find the > definition of __u64? Same place they do for the rest of shared headers (glib-kernheaders, for example). Please use the proper form (u64 internal to kernel, and __u64 for header visisble to userspace). I'm going to have to clean it up anyway. thanks, -chris ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 18:57 ` Chris Wright @ 2006-05-26 19:38 ` John Levon 2006-05-26 19:57 ` Chris Wright 0 siblings, 1 reply; 17+ messages in thread From: John Levon @ 2006-05-26 19:38 UTC (permalink / raw) To: Chris Wright Cc: Muli Ben-Yehuda, xen-devel, Ian Campbell, Hollis Blanchard, xen-ppc-devel On Fri, May 26, 2006 at 11:57:46AM -0700, Chris Wright wrote: > > > Anyway, regardless of any opinion expressed here the Linux gatekeepers > > > will no doubt insist on __uN. We might as well do it now as change it > > > later. > > > > And where will userspace, e.g. tools/libxc/xc_linux.c, find the > > definition of __u64? > > Same place they do for the rest of shared headers (glib-kernheaders, > for example). Please use the proper form (u64 internal to kernel, and > __u64 for header visisble to userspace). I'm going to have to clean it > up anyway. This won't work on platforms that don't provide __u64. Xen needs to define them somewhere for the userspace. regards john ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 19:38 ` John Levon @ 2006-05-26 19:57 ` Chris Wright 2006-05-27 0:42 ` John Levon 0 siblings, 1 reply; 17+ messages in thread From: Chris Wright @ 2006-05-26 19:57 UTC (permalink / raw) To: John Levon Cc: Muli Ben-Yehuda, xen-devel, Hollis Blanchard, Ian Campbell, Chris Wright, xen-ppc-devel * John Levon (levon@movementarian.org) wrote: > This won't work on platforms that don't provide __u64. Xen needs to > define them somewhere for the userspace. +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h That's specifically the part I'm talking about. WRT Xen's public headers, that's a different issue, however there's still some of the same namespace concerns. Of course, I'd be thrilled to make it all __u64 in public headers w/ appropriate types.h involved. And realisitically, platforms will all need some santized version of the headers anyway. thanks, -chris ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [patch] [3/3] dom0_ops explicitly sized types 2006-05-26 19:57 ` Chris Wright @ 2006-05-27 0:42 ` John Levon 0 siblings, 0 replies; 17+ messages in thread From: John Levon @ 2006-05-27 0:42 UTC (permalink / raw) To: Chris Wright Cc: Muli Ben-Yehuda, xen-devel, xen-ppc-devel, Hollis Blanchard, Ian Campbell On Fri, May 26, 2006 at 12:57:30PM -0700, Chris Wright wrote: > > This won't work on platforms that don't provide __u64. Xen needs to > > define them somewhere for the userspace. > > +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h > > That's specifically the part I'm talking about. > > WRT Xen's public headers, that's a different issue, however there's > still some of the same namespace concerns. Of course, I'd be thrilled > to make it all __u64 in public headers w/ appropriate types.h involved. > And realisitically, platforms will all need some santized version of the > headers anyway. Yes, but hopefully it will be possible to provide the structure definitions in some generic form, possibly by including another header that has the platform-specific parts (such as ioctl numbers, __u64 definitions on Solaris, etc.) It would be a shame if we had to duplicate the structure definitions 3 or more times. regards john ^ permalink raw reply [flat|nested] 17+ messages in thread
* [patch] [2/3] use new 'xen_pfn_t' type to represent PFNs in the Xen ABI [not found] ` <1148511175.26460.35.camel@basalt.austin.ibm.com> [not found] ` <1148511400.26460.39.camel@basalt.austin.ibm.com> @ 2006-05-24 23:09 ` Hollis Blanchard 1 sibling, 0 replies; 17+ messages in thread From: Hollis Blanchard @ 2006-05-24 23:09 UTC (permalink / raw) To: xen-devel; +Cc: John Levon, xen-ppc-devel [-- Attachment #1.1: Type: text/plain, Size: 42028 bytes --] Represent PFNs with their own type, rather than 'unsigned long', since 'long' changes size and alignment between 32- and 64-bit ABIs. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> diff -r 2212e54a95b5 linux-2.6-xen-sparse/include/xen/public/privcmd.h --- a/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed May 24 17:37:41 2006 -0500 +++ b/linux-2.6-xen-sparse/include/xen/public/privcmd.h Wed May 24 17:55:33 2006 -0500 @@ -59,7 +59,7 @@ typedef struct privcmd_mmapbatch { int num; /* number of pages to populate */ domid_t dom; /* target domain */ unsigned long addr; /* virtual address */ - unsigned long __user *arr; /* array of mfns - top nibble set on err */ + xen_pfn_t __user *arr; /* array of mfns - top nibble set on err */ } privcmd_mmapbatch_t; /* diff -r 2212e54a95b5 tools/debugger/libxendebug/xendebug.c --- a/tools/debugger/libxendebug/xendebug.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/debugger/libxendebug/xendebug.c Wed May 24 17:55:33 2006 -0500 @@ -57,7 +57,7 @@ typedef struct domain_context vcpu_guest_context_t context[MAX_VIRT_CPUS]; long total_pages; - unsigned long *page_array; + xen_pfn_t *page_array; unsigned long cr3_phys[MAX_VIRT_CPUS]; unsigned long *cr3_virt[MAX_VIRT_CPUS]; diff -r 2212e54a95b5 tools/ioemu/hw/cirrus_vga.c --- a/tools/ioemu/hw/cirrus_vga.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/ioemu/hw/cirrus_vga.c Wed May 24 17:55:33 2006 -0500 @@ -2463,7 +2463,7 @@ extern FILE *logfile; #if defined(__i386__) || defined (__x86_64__) static void * set_vram_mapping(unsigned long begin, unsigned long end) { - unsigned long * extent_start = NULL; + xen_pfn_t *extent_start = NULL; unsigned long nr_extents; void *vram_pointer = NULL; int i; @@ -2474,14 +2474,14 @@ static void * set_vram_mapping(unsigned end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK; nr_extents = (end - begin) >> TARGET_PAGE_BITS; - extent_start = malloc(sizeof(unsigned long) * nr_extents ); + extent_start = malloc(sizeof(xen_pfn_t) * nr_extents ); if (extent_start == NULL) { fprintf(stderr, "Failed malloc on set_vram_mapping\n"); return NULL; } - memset(extent_start, 0, sizeof(unsigned long) * nr_extents); + memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents); for (i = 0; i < nr_extents; i++) { @@ -2509,7 +2509,7 @@ static void * set_vram_mapping(unsigned static int unset_vram_mapping(unsigned long begin, unsigned long end) { - unsigned long * extent_start = NULL; + xen_pfn_t *extent_start = NULL; unsigned long nr_extents; int i; @@ -2520,7 +2520,7 @@ static int unset_vram_mapping(unsigned l end = (end + TARGET_PAGE_SIZE -1 ) & TARGET_PAGE_MASK; nr_extents = (end - begin) >> TARGET_PAGE_BITS; - extent_start = malloc(sizeof(unsigned long) * nr_extents ); + extent_start = malloc(sizeof(xen_pfn_t) * nr_extents ); if (extent_start == NULL) { @@ -2528,7 +2528,7 @@ static int unset_vram_mapping(unsigned l return -1; } - memset(extent_start, 0, sizeof(unsigned long) * nr_extents); + memset(extent_start, 0, sizeof(xen_pfn_t) * nr_extents); for (i = 0; i < nr_extents; i++) extent_start[i] = (begin + (i * TARGET_PAGE_SIZE)) >> TARGET_PAGE_BITS; diff -r 2212e54a95b5 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/ioemu/vl.c Wed May 24 17:55:33 2006 -0500 @@ -2457,7 +2457,7 @@ int unset_mm_mapping(int xc_handle, uint32_t domid, unsigned long nr_pages, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err = 0; xc_dominfo_t info; @@ -2490,7 +2490,7 @@ int set_mm_mapping(int xc_handle, uint32_t domid, unsigned long nr_pages, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { xc_dominfo_t info; int err = 0; @@ -2556,7 +2556,8 @@ int main(int argc, char **argv) int serial_device_index; char qemu_dm_logfilename[64]; const char *loadvm = NULL; - unsigned long nr_pages, *page_array; + unsigned long nr_pages; + xen_pfn_t *page_array; extern void *shared_page; #if !defined(CONFIG_SOFTMMU) @@ -3022,8 +3023,8 @@ int main(int argc, char **argv) xc_handle = xc_interface_open(); - if ( (page_array = (unsigned long *) - malloc(nr_pages * sizeof(unsigned long))) == NULL) + if ( (page_array = (xen_pfn_t *) + malloc(nr_pages * sizeof(xen_pfn_t))) == NULL) { fprintf(logfile, "malloc returned error %d\n", errno); exit(-1); @@ -3078,8 +3079,8 @@ int main(int argc, char **argv) page_array[0]); #endif - fprintf(logfile, "shared page at pfn:%lx, mfn: %lx\n", (nr_pages-1), - (page_array[nr_pages - 1])); + fprintf(logfile, "shared page at pfn:%lx, mfn: %"PRIx64"\n", (nr_pages-1), + (uint64_t)(page_array[nr_pages - 1])); /* we always create the cdrom drive, even if no disk is there */ bdrv_init(); diff -r 2212e54a95b5 tools/libxc/xc_core.c --- a/tools/libxc/xc_core.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_core.c Wed May 24 17:55:33 2006 -0500 @@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h dumpcore_rtn_t dump_rtn) { unsigned long nr_pages; - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL; xc_dominfo_t info; int i, nr_vcpus = 0; char *dump_mem, *dump_mem_start = NULL; @@ -70,7 +70,7 @@ xc_domain_dumpcore_via_callback(int xc_h sizeof(vcpu_guest_context_t)*nr_vcpus; dummy_len = (sizeof(struct xc_core_header) + (sizeof(vcpu_guest_context_t) * nr_vcpus) + - (nr_pages * sizeof(unsigned long))); + (nr_pages * sizeof(xen_pfn_t))); header.xch_pages_offset = round_pgup(dummy_len); sts = dump_rtn(args, (char *)&header, sizeof(struct xc_core_header)); @@ -81,7 +81,7 @@ xc_domain_dumpcore_via_callback(int xc_h if ( sts != 0 ) goto error_out; - if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ) + if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ) { printf("Could not allocate memory\n"); goto error_out; @@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_h printf("Could not get the page frame list\n"); goto error_out; } - sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(unsigned long)); + sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t)); if ( sts != 0 ) goto error_out; diff -r 2212e54a95b5 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_domain.c Wed May 24 17:55:33 2006 -0500 @@ -291,7 +291,7 @@ int xc_domain_memory_increase_reservatio unsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = { @@ -324,7 +324,7 @@ int xc_domain_memory_decrease_reservatio uint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = { @@ -363,7 +363,7 @@ int xc_domain_memory_populate_physmap(in unsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start) + xen_pfn_t *extent_start) { int err; struct xen_memory_reservation reservation = { @@ -392,8 +392,8 @@ int xc_domain_translate_gpfn_list(int xc int xc_domain_translate_gpfn_list(int xc_handle, uint32_t domid, unsigned long nr_gpfns, - unsigned long *gpfn_list, - unsigned long *mfn_list) + xen_pfn_t *gpfn_list, + xen_pfn_t *mfn_list) { struct xen_translate_gpfn_list op = { .domid = domid, diff -r 2212e54a95b5 tools/libxc/xc_hvm_build.c --- a/tools/libxc/xc_hvm_build.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_hvm_build.c Wed May 24 17:55:33 2006 -0500 @@ -135,7 +135,7 @@ static void set_hvm_info_checksum(struct * hvmloader will use this info to set BIOS accordingly */ static int set_hvm_info(int xc_handle, uint32_t dom, - unsigned long *pfn_list, unsigned int vcpus, + xen_pfn_t *pfn_list, unsigned int vcpus, unsigned int pae, unsigned int acpi, unsigned int apic) { char *va_map; @@ -178,7 +178,7 @@ static int setup_guest(int xc_handle, unsigned int store_evtchn, unsigned long *store_mfn) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL; unsigned long count, i; unsigned long long ptr; xc_mmu_t *mmu = NULL; @@ -223,7 +223,7 @@ static int setup_guest(int xc_handle, goto error_out; } - if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ) + if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ) { PERROR("Could not allocate memory.\n"); goto error_out; diff -r 2212e54a95b5 tools/libxc/xc_ia64_stubs.c --- a/tools/libxc/xc_ia64_stubs.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_ia64_stubs.c Wed May 24 17:55:33 2006 -0500 @@ -57,7 +57,7 @@ xc_plan9_build(int xc_handle, int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, - unsigned long *pfn_buf, + xen_pfn_t *pfn_buf, unsigned int start_page, unsigned int nr_pages) { @@ -65,7 +65,7 @@ int xc_ia64_get_pfn_list(int xc_handle, int num_pfns,ret; unsigned int __start_page, __nr_pages; unsigned long max_pfns; - unsigned long *__pfn_buf; + xen_pfn_t *__pfn_buf; __start_page = start_page; __nr_pages = nr_pages; @@ -80,7 +80,7 @@ int xc_ia64_get_pfn_list(int xc_handle, set_xen_guest_handle(op.u.getmemlist.buffer, __pfn_buf); if ( (max_pfns != -1UL) - && mlock(__pfn_buf, __nr_pages * sizeof(unsigned long)) != 0 ) + && mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0 ) { PERROR("Could not lock pfn list buffer"); return -1; @@ -89,7 +89,7 @@ int xc_ia64_get_pfn_list(int xc_handle, ret = do_dom0_op(xc_handle, &op); if (max_pfns != -1UL) - (void)munlock(__pfn_buf, __nr_pages * sizeof(unsigned long)); + (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)); if (max_pfns == -1UL) return 0; @@ -122,10 +122,10 @@ int xc_ia64_copy_to_domain_pages(int xc_ { // N.B. gva should be page aligned - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL; int i; - if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ){ + if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ){ PERROR("Could not allocate memory"); goto error_out; } diff -r 2212e54a95b5 tools/libxc/xc_linux.c --- a/tools/libxc/xc_linux.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_linux.c Wed May 24 17:55:33 2006 -0500 @@ -28,7 +28,7 @@ int xc_interface_close(int xc_handle) } void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot, - unsigned long *arr, int num) + xen_pfn_t *arr, int num) { privcmd_mmapbatch_t ioctlx; void *addr; diff -r 2212e54a95b5 tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_linux_build.c Wed May 24 17:55:33 2006 -0500 @@ -10,6 +10,7 @@ #include "xc_aout9.h" #include <stdlib.h> #include <unistd.h> +#include <inttypes.h> #include <zlib.h> #if defined(__i386__) @@ -136,7 +137,7 @@ int load_initrd(int xc_handle, domid_t d int load_initrd(int xc_handle, domid_t dom, struct initrd_info *initrd, unsigned long physbase, - unsigned long *phys_to_mach) + xen_pfn_t *phys_to_mach) { char page[PAGE_SIZE]; unsigned long pfn_start, pfn, nr_pages; @@ -189,7 +190,7 @@ static int setup_pg_tables(int xc_handle vcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, unsigned shadow_mode_enabled) @@ -251,7 +252,7 @@ static int setup_pg_tables_pae(int xc_ha vcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, unsigned shadow_mode_enabled) @@ -351,7 +352,7 @@ static int setup_pg_tables_64(int xc_han vcpu_guest_context_t *ctxt, unsigned long dsi_v_start, unsigned long v_end, - unsigned long *page_array, + xen_pfn_t *page_array, unsigned long vpt_start, unsigned long vpt_end, int shadow_mode_enabled) @@ -462,7 +463,7 @@ static int setup_guest(int xc_handle, unsigned int console_evtchn, unsigned long *console_mfn, uint32_t required_features[XENFEAT_NR_SUBMAPS]) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL; struct load_funcs load_funcs; struct domain_setup_info dsi; unsigned long vinitrd_start; @@ -489,7 +490,7 @@ static int setup_guest(int xc_handle, start_page = dsi.v_start >> PAGE_SHIFT; pgnr = (v_end - dsi.v_start) >> PAGE_SHIFT; - if ( (page_array = malloc(pgnr * sizeof(unsigned long))) == NULL ) + if ( (page_array = malloc(pgnr * sizeof(xen_pfn_t))) == NULL ) { PERROR("Could not allocate memory"); goto error_out; @@ -617,7 +618,7 @@ static int setup_guest(int xc_handle, unsigned int console_evtchn, unsigned long *console_mfn, uint32_t required_features[XENFEAT_NR_SUBMAPS]) { - unsigned long *page_array = NULL; + xen_pfn_t *page_array = NULL; unsigned long count, i, hypercall_pfn; start_info_t *start_info; shared_info_t *shared_info; @@ -628,7 +629,7 @@ static int setup_guest(int xc_handle, unsigned long nr_pt_pages; unsigned long physmap_pfn; - unsigned long *physmap, *physmap_e; + xen_pfn_t *physmap, *physmap_e; struct load_funcs load_funcs; struct domain_setup_info dsi; @@ -876,8 +877,8 @@ static int setup_guest(int xc_handle, ((uint64_t)page_array[count] << PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, count) ) { - fprintf(stderr,"m2p update failure p=%lx m=%lx\n", - count, page_array[count]); + fprintf(stderr,"m2p update failure p=%lx m=%"PRIx64"\n", + count, (uint64_t)page_array[count]); munmap(physmap, PAGE_SIZE); goto error_out; } diff -r 2212e54a95b5 tools/libxc/xc_linux_restore.c --- a/tools/libxc/xc_linux_restore.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_linux_restore.c Wed May 24 17:55:33 2006 -0500 @@ -25,10 +25,10 @@ static unsigned long max_pfn; static unsigned long max_pfn; /* Live mapping of the table mapping each PFN to its current MFN. */ -static unsigned long *live_p2m = NULL; +static xen_pfn_t *live_p2m = NULL; /* A table mapping each PFN to its new MFN. */ -static unsigned long *p2m = NULL; +static xen_pfn_t *p2m = NULL; static ssize_t @@ -126,7 +126,7 @@ int xc_linux_restore(int xc_handle, int unsigned long *pfn_type = NULL; /* A table of MFNs to map in the current region */ - unsigned long *region_mfn = NULL; + xen_pfn_t *region_mfn = NULL; /* Types of the pfns in the current region */ unsigned long region_pfn_type[MAX_BATCH_SIZE]; @@ -135,7 +135,7 @@ int xc_linux_restore(int xc_handle, int unsigned long *page = NULL; /* A copy of the pfn-to-mfn table frame list. */ - unsigned long *p2m_frame_list = NULL; + xen_pfn_t *p2m_frame_list = NULL; /* A temporary mapping of the guest's start_info page. */ start_info_t *start_info; @@ -183,9 +183,9 @@ int xc_linux_restore(int xc_handle, int /* We want zeroed memory so use calloc rather than malloc. */ - p2m = calloc(max_pfn, sizeof(unsigned long)); + p2m = calloc(max_pfn, sizeof(xen_pfn_t)); pfn_type = calloc(max_pfn, sizeof(unsigned long)); - region_mfn = calloc(MAX_BATCH_SIZE, sizeof(unsigned long)); + region_mfn = calloc(MAX_BATCH_SIZE, sizeof(xen_pfn_t)); if ((p2m == NULL) || (pfn_type == NULL) || (region_mfn == NULL)) { ERR("memory alloc failed"); @@ -193,7 +193,7 @@ int xc_linux_restore(int xc_handle, int goto out; } - if (mlock(region_mfn, sizeof(unsigned long) * MAX_BATCH_SIZE)) { + if (mlock(region_mfn, sizeof(xen_pfn_t) * MAX_BATCH_SIZE)) { ERR("Could not mlock region_mfn"); goto out; } diff -r 2212e54a95b5 tools/libxc/xc_linux_save.c --- a/tools/libxc/xc_linux_save.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_linux_save.c Wed May 24 17:55:33 2006 -0500 @@ -40,10 +40,10 @@ static unsigned long max_pfn; static unsigned long max_pfn; /* Live mapping of the table mapping each PFN to its current MFN. */ -static unsigned long *live_p2m = NULL; +static xen_pfn_t *live_p2m = NULL; /* Live mapping of system MFN to PFN table. */ -static unsigned long *live_m2p = NULL; +static xen_pfn_t *live_m2p = NULL; /* grep fodder: machine_to_phys */ @@ -501,22 +501,22 @@ void canonicalize_pagetable(unsigned lon -static unsigned long *xc_map_m2p(int xc_handle, +static xen_pfn_t *xc_map_m2p(int xc_handle, unsigned long max_mfn, int prot) { struct xen_machphys_mfn_list xmml; privcmd_mmap_entry_t *entries; unsigned long m2p_chunks, m2p_size; - unsigned long *m2p; - unsigned long *extent_start; + xen_pfn_t *m2p; + xen_pfn_t *extent_start; int i, rc; m2p_size = M2P_SIZE(max_mfn); m2p_chunks = M2P_CHUNKS(max_mfn); xmml.max_extents = m2p_chunks; - if (!(extent_start = malloc(m2p_chunks * sizeof(unsigned long)))) { + if (!(extent_start = malloc(m2p_chunks * sizeof(xen_pfn_t)))) { ERR("failed to allocate space for m2p mfns"); return NULL; } @@ -583,11 +583,11 @@ int xc_linux_save(int xc_handle, int io_ char page[PAGE_SIZE]; /* Double and single indirect references to the live P2M table */ - unsigned long *live_p2m_frame_list_list = NULL; - unsigned long *live_p2m_frame_list = NULL; + xen_pfn_t *live_p2m_frame_list_list = NULL; + xen_pfn_t *live_p2m_frame_list = NULL; /* A copy of the pfn-to-mfn table frame list. */ - unsigned long *p2m_frame_list = NULL; + xen_pfn_t *p2m_frame_list = NULL; /* Live mapping of shared info structure */ shared_info_t *live_shinfo = NULL; @@ -712,11 +712,11 @@ int xc_linux_save(int xc_handle, int io_ memcpy(p2m_frame_list, live_p2m_frame_list, P2M_FL_SIZE); /* Canonicalise the pfn-to-mfn table frame-number list. */ - for (i = 0; i < max_pfn; i += ulpp) { - if (!translate_mfn_to_pfn(&p2m_frame_list[i/ulpp])) { + for (i = 0; i < max_pfn; i += fpp) { + if (!translate_mfn_to_pfn(&p2m_frame_list[i/fpp])) { ERR("Frame# in pfn-to-mfn frame list is not in pseudophys"); - ERR("entry %d: p2m_frame_list[%ld] is 0x%lx", i, i/ulpp, - p2m_frame_list[i/ulpp]); + ERR("entry %d: p2m_frame_list[%ld] is 0x%"PRIx64, i, i/fpp, + (uint64_t)p2m_frame_list[i/fpp]); goto out; } } @@ -818,7 +818,7 @@ int xc_linux_save(int xc_handle, int io_ /* Start writing out the saved-domain record. */ - if(!write_exact(io_fd, &max_pfn, sizeof(unsigned long))) { + if(!write_exact(io_fd, &max_pfn, sizeof(xen_pfn_t))) { ERR("write: max_pfn"); goto out; } diff -r 2212e54a95b5 tools/libxc/xc_load_aout9.c --- a/tools/libxc/xc_load_aout9.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_load_aout9.c Wed May 24 17:55:33 2006 -0500 @@ -17,7 +17,7 @@ #define KOFFSET(_p) ((_p)&~KZERO) static int parseaout9image(const char *, unsigned long, struct domain_setup_info *); -static int loadaout9image(const char *, unsigned long, int, uint32_t, unsigned long *, struct domain_setup_info *); +static int loadaout9image(const char *, unsigned long, int, uint32_t, xen_pfn_t *, struct domain_setup_info *); static void copyout(int, uint32_t, unsigned long *, unsigned long, const char *, int); struct Exec *get_header(const char *, unsigned long, struct Exec *); @@ -79,7 +79,7 @@ loadaout9image( const char *image, unsigned long image_size, int xch, uint32_t dom, - unsigned long *parray, + xen_pfn_t *parray, struct domain_setup_info *dsi) { struct Exec ehdr; diff -r 2212e54a95b5 tools/libxc/xc_load_bin.c --- a/tools/libxc/xc_load_bin.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_load_bin.c Wed May 24 17:55:33 2006 -0500 @@ -107,7 +107,7 @@ static int static int loadbinimage( const char *image, unsigned long image_size, int xch, uint32_t dom, - unsigned long *parray, struct domain_setup_info *dsi); + xen_pfn_t *parray, struct domain_setup_info *dsi); int probe_bin(const char *image, unsigned long image_size, @@ -235,7 +235,7 @@ static int static int loadbinimage( const char *image, unsigned long image_size, int xch, uint32_t dom, - unsigned long *parray, struct domain_setup_info *dsi) + xen_pfn_t *parray, struct domain_setup_info *dsi) { unsigned long size; char *va; diff -r 2212e54a95b5 tools/libxc/xc_load_elf.c --- a/tools/libxc/xc_load_elf.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_load_elf.c Wed May 24 17:55:33 2006 -0500 @@ -16,10 +16,10 @@ static int static int loadelfimage( const char *image, unsigned long image_size, int xch, uint32_t dom, - unsigned long *parray, struct domain_setup_info *dsi); + xen_pfn_t *parray, struct domain_setup_info *dsi); static int loadelfsymtab( - const char *image, int xch, uint32_t dom, unsigned long *parray, + const char *image, int xch, uint32_t dom, xen_pfn_t *parray, struct domain_setup_info *dsi); int probe_elf(const char *image, @@ -204,7 +204,7 @@ static int static int loadelfimage( const char *image, unsigned long elfsize, int xch, uint32_t dom, - unsigned long *parray, struct domain_setup_info *dsi) + xen_pfn_t *parray, struct domain_setup_info *dsi) { Elf_Ehdr *ehdr = (Elf_Ehdr *)image; Elf_Phdr *phdr; @@ -258,7 +258,7 @@ loadelfimage( static int loadelfsymtab( - const char *image, int xch, uint32_t dom, unsigned long *parray, + const char *image, int xch, uint32_t dom, xen_pfn_t *parray, struct domain_setup_info *dsi) { Elf_Ehdr *ehdr = (Elf_Ehdr *)image, *sym_ehdr; diff -r 2212e54a95b5 tools/libxc/xc_private.c --- a/tools/libxc/xc_private.c Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xc_private.c Wed May 24 17:55:33 2006 -0500 @@ -4,6 +4,7 @@ * Helper functions for the rest of the library. */ +#include <inttypes.h> #include "xc_private.h" /* NB: arr must be mlock'ed */ @@ -134,9 +135,9 @@ int xc_memory_op(int xc_handle, struct xen_memory_reservation *reservation = arg; struct xen_machphys_mfn_list *xmml = arg; struct xen_translate_gpfn_list *trans = arg; - unsigned long *extent_start; - unsigned long *gpfn_list; - unsigned long *mfn_list; + xen_pfn_t *extent_start; + xen_pfn_t *gpfn_list; + xen_pfn_t *mfn_list; long ret = -EINVAL; hypercall.op = __HYPERVISOR_memory_op; @@ -156,7 +157,7 @@ int xc_memory_op(int xc_handle, get_xen_guest_handle(extent_start, reservation->extent_start); if ( (extent_start != NULL) && (mlock(extent_start, - reservation->nr_extents * sizeof(unsigned long)) != 0) ) + reservation->nr_extents * sizeof(xen_pfn_t)) != 0) ) { PERROR("Could not mlock"); safe_munlock(reservation, sizeof(*reservation)); @@ -171,7 +172,7 @@ int xc_memory_op(int xc_handle, } get_xen_guest_handle(extent_start, xmml->extent_start); if ( mlock(extent_start, - xmml->max_extents * sizeof(unsigned long)) != 0 ) + xmml->max_extents * sizeof(xen_pfn_t)) != 0 ) { PERROR("Could not mlock"); safe_munlock(xmml, sizeof(*xmml)); @@ -192,17 +193,17 @@ int xc_memory_op(int xc_handle, goto out1; } get_xen_guest_handle(gpfn_list, trans->gpfn_list); - if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) + if ( mlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 ) { PERROR("Could not mlock"); safe_munlock(trans, sizeof(*trans)); goto out1; } get_xen_guest_handle(mfn_list, trans->mfn_list); - if ( mlock(mfn_list, trans->nr_gpfns * sizeof(long)) != 0 ) - { - PERROR("Could not mlock"); - safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long)); + if ( mlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)) != 0 ) + { + PERROR("Could not mlock"); + safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)); safe_munlock(trans, sizeof(*trans)); goto out1; } @@ -220,22 +221,22 @@ int xc_memory_op(int xc_handle, get_xen_guest_handle(extent_start, reservation->extent_start); if ( extent_start != NULL ) safe_munlock(extent_start, - reservation->nr_extents * sizeof(unsigned long)); + reservation->nr_extents * sizeof(xen_pfn_t)); break; case XENMEM_machphys_mfn_list: safe_munlock(xmml, sizeof(*xmml)); get_xen_guest_handle(extent_start, xmml->extent_start); safe_munlock(extent_start, - xmml->max_extents * sizeof(unsigned long)); + xmml->max_extents * sizeof(xen_pfn_t)); break; case XENMEM_add_to_physmap: safe_munlock(arg, sizeof(struct xen_add_to_physmap)); break; case XENMEM_translate_gpfn_list: get_xen_guest_handle(mfn_list, trans->mfn_list); - safe_munlock(mfn_list, trans->nr_gpfns * sizeof(long)); + safe_munlock(mfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)); get_xen_guest_handle(gpfn_list, trans->gpfn_list); - safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(long)); + safe_munlock(gpfn_list, trans->nr_gpfns * sizeof(xen_pfn_t)); safe_munlock(trans, sizeof(*trans)); break; } @@ -263,7 +264,7 @@ long long xc_domain_get_cpu_usage( int x int xc_get_pfn_list(int xc_handle, uint32_t domid, - unsigned long *pfn_buf, + xen_pfn_t *pfn_buf, unsigned long max_pfns) { DECLARE_DOM0_OP; @@ -274,10 +275,10 @@ int xc_get_pfn_list(int xc_handle, set_xen_guest_handle(op.u.getmemlist.buffer, pfn_buf); #ifdef VALGRIND - memset(pfn_buf, 0, max_pfns * sizeof(unsigned long)); + memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t)); #endif - if ( mlock(pfn_buf, max_pfns * sizeof(unsigned long)) != 0 ) + if ( mlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 ) { PERROR("xc_get_pfn_list: pfn_buf mlock failed"); return -1; @@ -285,7 +286,7 @@ int xc_get_pfn_list(int xc_handle, ret = do_dom0_op(xc_handle, &op); - safe_munlock(pfn_buf, max_pfns * sizeof(unsigned long)); + safe_munlock(pfn_buf, max_pfns * sizeof(xen_pfn_t)); #if 0 #ifdef DEBUG @@ -364,7 +365,7 @@ unsigned long xc_get_filesz(int fd) } void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size, - int xch, uint32_t dom, unsigned long *parray, + int xch, uint32_t dom, xen_pfn_t *parray, unsigned long vstart) { char *va; @@ -433,19 +434,22 @@ unsigned long xc_make_page_below_4G( unsigned long xc_make_page_below_4G( int xc_handle, uint32_t domid, unsigned long mfn) { - unsigned long new_mfn; + xen_pfn_t old_mfn = mfn; + xen_pfn_t new_mfn; if ( xc_domain_memory_decrease_reservation( - xc_handle, domid, 1, 0, &mfn) != 0 ) - { - fprintf(stderr,"xc_make_page_below_4G decrease failed. mfn=%lx\n",mfn); + xc_handle, domid, 1, 0, &old_mfn) != 0 ) + { + fprintf(stderr, "%s decrease failed. mfn=%"PRIx64"\n", + __func__, (uint64_t)old_mfn); return 0; } if ( xc_domain_memory_increase_reservation( xc_handle, domid, 1, 0, 32, &new_mfn) != 0 ) { - fprintf(stderr,"xc_make_page_below_4G increase failed. mfn=%lx\n",mfn); + fprintf(stderr, "%s increase failed. mfn=%"PRIx64"\n", + __func__, (uint64_t)new_mfn); return 0; } diff -r 2212e54a95b5 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xenctrl.h Wed May 24 17:55:33 2006 -0500 @@ -407,26 +407,26 @@ int xc_domain_memory_increase_reservatio unsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start); + xen_pfn_t *extent_start); int xc_domain_memory_decrease_reservation(int xc_handle, uint32_t domid, unsigned long nr_extents, unsigned int extent_order, - unsigned long *extent_start); + xen_pfn_t *extent_start); int xc_domain_memory_populate_physmap(int xc_handle, uint32_t domid, unsigned long nr_extents, unsigned int extent_order, unsigned int address_bits, - unsigned long *extent_start); + xen_pfn_t *extent_start); int xc_domain_translate_gpfn_list(int xc_handle, uint32_t domid, unsigned long nr_gpfns, - unsigned long *gpfn_list, - unsigned long *mfn_list); + xen_pfn_t *gpfn_list, + xen_pfn_t *mfn_list); int xc_domain_ioport_permission(int xc_handle, uint32_t domid, @@ -479,7 +479,7 @@ void *xc_map_foreign_range(int xc_handle unsigned long mfn ); void *xc_map_foreign_batch(int xc_handle, uint32_t dom, int prot, - unsigned long *arr, int num ); + xen_pfn_t *arr, int num ); /** * Translates a virtual address in the context of a given domain and @@ -494,11 +494,11 @@ unsigned long xc_translate_foreign_addre unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom, int vcpu, unsigned long long virt); -int xc_get_pfn_list(int xc_handle, uint32_t domid, unsigned long *pfn_buf, +int xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, unsigned long max_pfns); int xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, - unsigned long *pfn_buf, + xen_pfn_t *pfn_buf, unsigned int start_page, unsigned int nr_pages); int xc_copy_to_domain_page(int xc_handle, uint32_t domid, diff -r 2212e54a95b5 tools/libxc/xg_private.h --- a/tools/libxc/xg_private.h Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xg_private.h Wed May 24 17:55:33 2006 -0500 @@ -162,7 +162,7 @@ typedef int (*parseimagefunc)(const char struct domain_setup_info *dsi); typedef int (*loadimagefunc)(const char *image, unsigned long image_size, int xch, - uint32_t dom, unsigned long *parray, + uint32_t dom, xen_pfn_t *parray, struct domain_setup_info *dsi); struct load_funcs @@ -190,7 +190,7 @@ unsigned long xc_get_filesz(int fd); unsigned long xc_get_filesz(int fd); void xc_map_memcpy(unsigned long dst, const char *src, unsigned long size, - int xch, uint32_t dom, unsigned long *parray, + int xch, uint32_t dom, xen_pfn_t *parray, unsigned long vstart); int pin_table(int xc_handle, unsigned int type, unsigned long mfn, diff -r 2212e54a95b5 tools/libxc/xg_save_restore.h --- a/tools/libxc/xg_save_restore.h Wed May 24 17:37:41 2006 -0500 +++ b/tools/libxc/xg_save_restore.h Wed May 24 17:55:33 2006 -0500 @@ -105,23 +105,23 @@ static int get_platform_info(int xc_hand */ #define M2P_SHIFT L2_PAGETABLE_SHIFT_PAE #define M2P_CHUNK_SIZE (1 << M2P_SHIFT) -#define M2P_SIZE(_m) ROUNDUP(((_m) * sizeof(unsigned long)), M2P_SHIFT) +#define M2P_SIZE(_m) ROUNDUP(((_m) * sizeof(xen_pfn_t)), M2P_SHIFT) #define M2P_CHUNKS(_m) (M2P_SIZE((_m)) >> M2P_SHIFT) /* Size in bytes of the P2M (rounded up to the nearest PAGE_SIZE bytes) */ -#define P2M_SIZE ROUNDUP((max_pfn * sizeof(unsigned long)), PAGE_SHIFT) +#define P2M_SIZE ROUNDUP((max_pfn * sizeof(xen_pfn_t)), PAGE_SHIFT) -/* Number of unsigned longs in a page */ -#define ulpp (PAGE_SIZE/sizeof(unsigned long)) +/* Number of xen_pfn_t in a page */ +#define fpp (PAGE_SIZE/sizeof(xen_pfn_t)) /* Number of entries in the pfn_to_mfn_frame_list */ -#define P2M_FL_ENTRIES (((max_pfn)+ulpp-1)/ulpp) +#define P2M_FL_ENTRIES (((max_pfn)+fpp-1)/fpp) /* Size in bytes of the pfn_to_mfn_frame_list */ #define P2M_FL_SIZE ((P2M_FL_ENTRIES)*sizeof(unsigned long)) /* Number of entries in the pfn_to_mfn_frame_list_list */ -#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp)) +#define P2M_FLL_ENTRIES (((max_pfn)+(fpp*fpp)-1)/(fpp*fpp)) /* Current guests allow 8MB 'slack' in their P2M */ #define NR_SLACK_ENTRIES ((8 * 1024 * 1024) / PAGE_SIZE) diff -r 2212e54a95b5 xen/common/memory.c --- a/xen/common/memory.c Wed May 24 17:37:41 2006 -0500 +++ b/xen/common/memory.c Wed May 24 17:55:33 2006 -0500 @@ -31,14 +31,15 @@ static long static long increase_reservation( struct domain *d, - XEN_GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(xen_pfn_t) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, int *preempted) { struct page_info *page; - unsigned long i, mfn; + unsigned long i; + xen_pfn_t mfn; if ( !guest_handle_is_null(extent_list) && !guest_handle_okay(extent_list, nr_extents) ) @@ -80,14 +81,16 @@ static long static long populate_physmap( struct domain *d, - XEN_GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(xen_pfn_t) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, int *preempted) { struct page_info *page; - unsigned long i, j, gpfn, mfn; + unsigned long i, j; + xen_pfn_t gpfn; + xen_pfn_t mfn; if ( !guest_handle_okay(extent_list, nr_extents) ) return 0; @@ -177,13 +180,14 @@ static long static long decrease_reservation( struct domain *d, - XEN_GUEST_HANDLE(ulong) extent_list, + XEN_GUEST_HANDLE(xen_pfn_t) extent_list, unsigned int nr_extents, unsigned int extent_order, unsigned int flags, int *preempted) { - unsigned long i, j, gmfn; + unsigned long i, j; + xen_pfn_t gmfn; if ( !guest_handle_okay(extent_list, nr_extents) ) return 0; @@ -214,7 +218,9 @@ translate_gpfn_list( XEN_GUEST_HANDLE(xen_translate_gpfn_list_t) uop, unsigned long *progress) { struct xen_translate_gpfn_list op; - unsigned long i, gpfn, mfn; + unsigned long i; + xen_pfn_t gpfn; + xen_pfn_t mfn; struct domain *d; if ( copy_from_guest(&op, uop, 1) ) diff -r 2212e54a95b5 xen/include/public/arch-ia64.h --- a/xen/include/public/arch-ia64.h Wed May 24 17:37:41 2006 -0500 +++ b/xen/include/public/arch-ia64.h Wed May 24 17:55:33 2006 -0500 @@ -26,6 +26,9 @@ DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(long); DEFINE_XEN_GUEST_HANDLE(void); + +typedef unsigned long xen_pfn_t; +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #endif /* Arch specific VIRQs definition */ diff -r 2212e54a95b5 xen/include/public/arch-x86_32.h --- a/xen/include/public/arch-x86_32.h Wed May 24 17:37:41 2006 -0500 +++ b/xen/include/public/arch-x86_32.h Wed May 24 17:55:33 2006 -0500 @@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(long); DEFINE_XEN_GUEST_HANDLE(void); + +typedef unsigned long xen_pfn_t; +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #endif /* diff -r 2212e54a95b5 xen/include/public/arch-x86_64.h --- a/xen/include/public/arch-x86_64.h Wed May 24 17:37:41 2006 -0500 +++ b/xen/include/public/arch-x86_64.h Wed May 24 17:55:33 2006 -0500 @@ -28,6 +28,9 @@ DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(int); DEFINE_XEN_GUEST_HANDLE(long); DEFINE_XEN_GUEST_HANDLE(void); + +typedef unsigned long xen_pfn_t; +DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); #endif /* diff -r 2212e54a95b5 xen/include/public/dom0_ops.h --- a/xen/include/public/dom0_ops.h Wed May 24 17:37:41 2006 -0500 +++ b/xen/include/public/dom0_ops.h Wed May 24 17:55:33 2006 -0500 @@ -28,7 +28,7 @@ struct dom0_getmemlist { /* IN variables. */ domid_t domain; unsigned long max_pfns; - XEN_GUEST_HANDLE(ulong) buffer; + XEN_GUEST_HANDLE(xen_pfn_t) buffer; /* OUT variables. */ unsigned long num_pfns; }; diff -r 2212e54a95b5 xen/include/public/memory.h --- a/xen/include/public/memory.h Wed May 24 17:37:41 2006 -0500 +++ b/xen/include/public/memory.h Wed May 24 17:55:33 2006 -0500 @@ -29,7 +29,7 @@ struct xen_memory_reservation { * OUT: GMFN bases of extents that were allocated * (NB. This command also updates the mach_to_phys translation table) */ - XEN_GUEST_HANDLE(ulong) extent_start; + XEN_GUEST_HANDLE(xen_pfn_t) extent_start; /* Number of extents, and size/alignment of each (2^extent_order pages). */ unsigned long nr_extents; @@ -87,7 +87,7 @@ struct xen_machphys_mfn_list { * any large discontiguities in the machine address space, 2MB gaps in * the machphys table will be represented by an MFN base of zero. */ - XEN_GUEST_HANDLE(ulong) extent_start; + XEN_GUEST_HANDLE(xen_pfn_t) extent_start; /* * Number of extents written to the above array. This will be smaller @@ -135,13 +135,13 @@ struct xen_translate_gpfn_list { unsigned long nr_gpfns; /* List of GPFNs to translate. */ - XEN_GUEST_HANDLE(ulong) gpfn_list; + XEN_GUEST_HANDLE(xen_pfn_t) gpfn_list; /* * Output list to contain MFN translations. May be the same as the input * list (in which case each input GPFN is overwritten with the output MFN). */ - XEN_GUEST_HANDLE(ulong) mfn_list; + XEN_GUEST_HANDLE(xen_pfn_t) mfn_list; }; typedef struct xen_translate_gpfn_list xen_translate_gpfn_list_t; DEFINE_XEN_GUEST_HANDLE(xen_translate_gpfn_list_t); [-- Attachment #1.2: Type: text/html, Size: 76326 bytes --] [-- Attachment #2: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2006-05-27 0:42 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1148509900.26460.22.camel@basalt.austin.ibm.com>
2006-05-24 23:08 ` [patch] [1/3] global build configuration file Hollis Blanchard
2006-05-25 16:28 ` [XenPPC] " Hollis Blanchard
[not found] ` <1148511175.26460.35.camel@basalt.austin.ibm.com>
[not found] ` <1148511400.26460.39.camel@basalt.austin.ibm.com>
2006-05-24 23:04 ` [patch] [3/3] dom0_ops explicitly sized types Hollis Blanchard
2006-05-25 15:39 ` Muli Ben-Yehuda
2006-05-25 19:02 ` Hollis Blanchard
2006-05-26 13:32 ` Muli Ben-Yehuda
2006-05-26 14:28 ` Ian Campbell
2006-05-26 15:30 ` Hollis Blanchard
2006-05-26 16:27 ` Ian Campbell
2006-05-26 17:32 ` Anthony Liguori
2006-05-26 18:21 ` Markus Armbruster
2006-05-26 17:37 ` Hollis Blanchard
2006-05-26 18:57 ` Chris Wright
2006-05-26 19:38 ` John Levon
2006-05-26 19:57 ` Chris Wright
2006-05-27 0:42 ` John Levon
2006-05-24 23:09 ` [patch] [2/3] use new 'xen_pfn_t' type to represent PFNs in the Xen ABI Hollis Blanchard
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.