WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] merge with xen-unstable.hg

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 23 Mar 2007 05:30:45 -0700
Delivery-date: Fri, 23 Mar 2007 06:22:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User awilliam@xxxxxxxxxxxx
# Date 1174577454 21600
# Node ID be1017157768e8d6d5d5552cf0008d81d611b1bb
# Parent  93e11f6d6791de15cfdcc5f0ddbf9a0660f325ed
# Parent  6519867be0fe862ce97eeb66d43edfb7bab35aaa
merge with xen-unstable.hg
---
 tools/libxc/powerpc64/utils.c                        |  188 ----------
 tools/libxc/powerpc64/utils.h                        |   37 --
 tools/libxc/powerpc64/xc_linux_build.c               |  336 -------------------
 tools/libxc/powerpc64/xc_prose_build.c               |  215 ------------
 linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c |    8 
 tools/libxc/Makefile                                 |    9 
 tools/libxc/powerpc64/Makefile                       |    3 
 tools/libxc/powerpc64/mk_flatdevtree.c               |   58 +--
 tools/libxc/powerpc64/mk_flatdevtree.h               |   14 
 tools/libxc/xc_core.h                                |    2 
 tools/libxc/xc_core_powerpc.c                        |   79 ++++
 tools/libxc/xc_core_powerpc.h                        |   57 +++
 tools/libxc/xc_dom.h                                 |    6 
 tools/libxc/xc_dom_boot.c                            |  295 ----------------
 tools/libxc/xc_dom_compat_linux.c                    |   11 
 tools/libxc/xc_dom_core.c                            |    6 
 tools/libxc/xc_dom_ia64.c                            |   57 +++
 tools/libxc/xc_dom_powerpc.c                         |  236 +++++++++++++
 tools/libxc/xc_dom_x86.c                             |  183 ++++++++++
 tools/python/xen/lowlevel/xc/xc.c                    |   51 --
 tools/python/xen/xend/XendAPI.py                     |   11 
 tools/python/xen/xend/XendDmesg.py                   |    3 
 tools/python/xen/xend/image.py                       |   30 -
 tools/python/xen/xm/main.py                          |   19 -
 xen/arch/powerpc/backtrace.c                         |    3 
 xen/arch/powerpc/mm.c                                |   10 
 xen/arch/powerpc/setup.c                             |    9 
 xen/arch/powerpc/smp-tbsync.c                        |   17 
 xen/arch/x86/mm/shadow/types.h                       |    2 
 29 files changed, 712 insertions(+), 1243 deletions(-)

diff -r 93e11f6d6791 -r be1017157768 
linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c      Thu Mar 22 
09:28:05 2007 -0600
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head64-xen.c      Thu Mar 22 
09:30:54 2007 -0600
@@ -105,13 +105,11 @@ void __init x86_64_start_kernel(char * r
        int i;
 
        xen_start_info = (struct start_info *)real_mode_data;
-       if (!xen_feature(XENFEAT_auto_translated_physmap)) {
+       if (!xen_feature(XENFEAT_auto_translated_physmap))
                phys_to_machine_mapping =
                        (unsigned long *)xen_start_info->mfn_list;
-               start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) +
-                       xen_start_info->nr_pt_frames;
-       }
-
+       start_pfn = (__pa(xen_start_info->pt_base) >> PAGE_SHIFT) +
+               xen_start_info->nr_pt_frames;
 
        machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
        machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/Makefile
--- a/tools/libxc/Makefile      Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/Makefile      Thu Mar 22 09:30:54 2007 -0600
@@ -8,6 +8,7 @@ CTRL_SRCS-y       += xc_core.c
 CTRL_SRCS-y       += xc_core.c
 CTRL_SRCS-$(CONFIG_X86) += xc_core_x86.c
 CTRL_SRCS-$(CONFIG_IA64) += xc_core_ia64.c
+CTRL_SRCS-$(CONFIG_POWERPC) += xc_core_powerpc.c
 CTRL_SRCS-y       += xc_domain.c
 CTRL_SRCS-y       += xc_evtchn.c
 CTRL_SRCS-y       += xc_misc.c
@@ -47,11 +48,11 @@ GUEST_SRCS-y += xc_dom_core.c xc_dom_boo
 GUEST_SRCS-y += xc_dom_core.c xc_dom_boot.c
 GUEST_SRCS-y += xc_dom_elfloader.c
 GUEST_SRCS-y += xc_dom_binloader.c
-GUEST_SRCS-y += xc_dom_x86.c
-GUEST_SRCS-y += xc_dom_ia64.c
+GUEST_SRCS-y += xc_dom_compat_linux.c
 
-GUEST_SRCS-$(CONFIG_X86)     += xc_dom_compat_linux.c
-GUEST_SRCS-$(CONFIG_IA64)    += xc_dom_compat_linux.c
+GUEST_SRCS-$(CONFIG_X86)     += xc_dom_x86.c
+GUEST_SRCS-$(CONFIG_IA64)    += xc_dom_ia64.c
+GUEST_SRCS-$(CONFIG_POWERPC) += xc_dom_powerpc.c
 
 -include $(XEN_TARGET_ARCH)/Makefile
 
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/Makefile
--- a/tools/libxc/powerpc64/Makefile    Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/powerpc64/Makefile    Thu Mar 22 09:30:54 2007 -0600
@@ -1,7 +1,4 @@ GUEST_SRCS-y += powerpc64/flatdevtree.c
 GUEST_SRCS-y += powerpc64/flatdevtree.c
 GUEST_SRCS-y += powerpc64/mk_flatdevtree.c
-GUEST_SRCS-y += powerpc64/xc_linux_build.c
-GUEST_SRCS-y += powerpc64/xc_prose_build.c
-GUEST_SRCS-y += powerpc64/utils.c
 
 CTRL_SRCS-y += powerpc64/xc_memory.c
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/mk_flatdevtree.c
--- a/tools/libxc/powerpc64/mk_flatdevtree.c    Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/powerpc64/mk_flatdevtree.c    Thu Mar 22 09:30:54 2007 -0600
@@ -34,6 +34,7 @@
 #include <sys/param.h>
 
 #include <xc_private.h> /* for PERROR() */
+#include <xc_dom.h>
 
 #include "mk_flatdevtree.h"
 
@@ -310,24 +311,19 @@ void free_devtree(struct ft_cxt *root)
 }
 
 int make_devtree(struct ft_cxt *root,
-                 uint32_t domid, 
-                 uint32_t mem_mb,
-                 unsigned long rma_bytes,
-                 unsigned long shadow_mb,
-                 unsigned long initrd_base,
-                 unsigned long initrd_len,
-                 const char *bootargs,
-                 uint64_t shared_info_paddr,
-                 unsigned long console_evtchn,
-                 uint64_t console_paddr,
-                 unsigned long store_evtchn,
-                 uint64_t store_paddr)
+                 struct xc_dom_image *dom,
+                 unsigned long shadow_mb)
 {
     struct boot_param_header *bph = NULL;
     uint64_t val[2];
     uint32_t val32[2];
-    unsigned long remaining;
-    unsigned long initrd_end = initrd_base + initrd_len;
+    uint64_t shared_info_paddr = dom->shared_info_pfn << PAGE_SHIFT;
+    uint64_t xenstore_paddr = dom->xenstore_pfn << PAGE_SHIFT;
+    uint64_t console_paddr = dom->console_pfn << PAGE_SHIFT;
+    long remaining;
+    unsigned long ramdisk_start;
+    unsigned long ramdisk_size;
+    unsigned long rma_bytes = 1 << dom->realmodearea_log;
     int64_t shadow_mb_log;
     uint64_t pft_size;
     char cpupath[MAX_PATH];
@@ -370,16 +366,18 @@ int make_devtree(struct ft_cxt *root,
     }
 
     /* reserve xen store page for domU */
-    if (store_paddr) {
-        val[0] = cpu_to_be64((u64) store_paddr);
+    if (xenstore_paddr) {
+        val[0] = cpu_to_be64((u64) xenstore_paddr);
         val[1] = cpu_to_be64((u64) PAGE_SIZE);
         ft_add_rsvmap(root, val[0], val[1]);
     }
 
     /* reserve space for initrd if needed */
-    if ( initrd_len > 0 )  {
-        val[0] = cpu_to_be64((u64) initrd_base);
-        val[1] = cpu_to_be64((u64) initrd_len);
+    ramdisk_start = dom->ramdisk_seg.pfn << PAGE_SHIFT;
+    ramdisk_size = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart;
+    if (ramdisk_size > 0) {
+        val[0] = cpu_to_be64((u64) ramdisk_start);
+        val[1] = cpu_to_be64((u64) ramdisk_size);
         ft_add_rsvmap(root, val[0], val[1]);
     }
 
@@ -422,13 +420,13 @@ int make_devtree(struct ft_cxt *root,
     ft_prop_int(root, "interrupt-controller", xen_phandle);
 
     /* chosen.addprop('bootargs', imghandler.cmdline + '\0') */
-    if ( bootargs != NULL )
-        ft_prop_str(root, "bootargs", bootargs);
+    if (dom->cmdline != NULL)
+        ft_prop_str(root, "bootargs", dom->cmdline);
 
     /* mark where the initrd is, if present */
-    if ( initrd_len > 0 ) {
-        val[0] = cpu_to_be64((u64) initrd_base);
-        val[1] = cpu_to_be64((u64) initrd_end);
+    if (ramdisk_size > 0) {
+        val[0] = cpu_to_be64((u64) ramdisk_start);
+        val[1] = cpu_to_be64((u64) ramdisk_start + ramdisk_size);
         ft_prop(root, "linux,initrd-start", &(val[0]), sizeof(val[0]));
         ft_prop(root, "linux,initrd-end", &(val[1]), sizeof(val[1]));
     }
@@ -443,7 +441,7 @@ int make_devtree(struct ft_cxt *root,
     ft_prop_str(root, "compatible", "Xen-3.0-unstable");
 
     /* xen.addprop('reg', long(imghandler.vm.domid), long(0)) */
-    val[0] = cpu_to_be64((u64) domid);
+    val[0] = cpu_to_be64((u64) dom->guest_domid);
     val[1] = cpu_to_be64((u64) 0);
     ft_prop(root, "reg", val, sizeof(val));
 
@@ -469,7 +467,7 @@ int make_devtree(struct ft_cxt *root,
         ft_prop(root, "reg", val, sizeof(val));
 
         /* xencons.addprop('interrupts', console_evtchn, 0) */
-        val32[0] = cpu_to_be32((u32) console_evtchn);
+        val32[0] = cpu_to_be32((u32) dom->console_evtchn);
         val32[1] = cpu_to_be32((u32) 0);
         ft_prop(root, "interrupts", val32, sizeof(val32));
 
@@ -477,17 +475,17 @@ int make_devtree(struct ft_cxt *root,
         ft_end_node(root);
     }
 
-    if (store_paddr != 0) {
+    if (xenstore_paddr != 0) {
         /* start store node */
         ft_begin_node(root, "store");
 
         /* store paddr */
-        val[0] = cpu_to_be64((u64) store_paddr);
+        val[0] = cpu_to_be64((u64) xenstore_paddr);
         val[1] = cpu_to_be64((u64) PAGE_SIZE);
         ft_prop(root, "reg", val, sizeof(val));
 
         /* store event channel */
-        val32[0] = cpu_to_be32((u32) store_evtchn);
+        val32[0] = cpu_to_be32((u32) dom->xenstore_evtchn);
         val32[1] = cpu_to_be32((u32) 0);
         ft_prop(root, "interrupts", val32, sizeof(val32));
 
@@ -516,7 +514,7 @@ int make_devtree(struct ft_cxt *root,
     ft_end_node(root);
 
     /* calculate remaining bytes from total - rma size */
-    remaining = (mem_mb * 1024 * 1024) - rma_bytes;
+    remaining = (dom->total_pages << PAGE_SHIFT) - rma_bytes;
 
     /* memory@<rma_bytes> is all remaining memory after RMA */
     if (remaining > 0)
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/mk_flatdevtree.h
--- a/tools/libxc/powerpc64/mk_flatdevtree.h    Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/powerpc64/mk_flatdevtree.h    Thu Mar 22 09:30:54 2007 -0600
@@ -26,18 +26,8 @@
 
 extern void free_devtree(struct ft_cxt *root);
 extern int make_devtree(struct ft_cxt *root,
-                        uint32_t domid, 
-                        uint32_t mem_mb,
-                        unsigned long rma_bytes,
-                        unsigned long shadow_mb,
-                        unsigned long initrd_base,
-                        unsigned long initrd_len,
-                        const char *bootargs,
-                        uint64_t shared_info_paddr,
-                        unsigned long console_evtchn,
-                        uint64_t console_paddr,
-                        unsigned long store_evtchn,
-                        uint64_t store_paddr);
+                        struct xc_dom_image *dom,
+                        unsigned long shadow_mb);
 
 #define MAX_PATH 200
 #define BUFSIZE 1024
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/utils.c
--- a/tools/libxc/powerpc64/utils.c     Thu Mar 22 09:28:05 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include <xen/xen.h>
-#include <xen/memory.h>
-#include <xc_private.h>
-#include <xg_private.h>
-#include <xenctrl.h>
-
-#include "flatdevtree_env.h"
-#include "flatdevtree.h"
-#include "utils.h"
-
-int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array,
-                      unsigned long nr_pages)
-{
-    int rc;
-    int i;
-    xen_pfn_t *p;
-
-    *page_array = malloc(nr_pages * sizeof(xen_pfn_t));
-    if (*page_array == NULL) {
-        perror("malloc");
-        return -1;
-    }
-
-    DPRINTF("xc_get_pfn_list\n");
-    /* We know that the RMA is machine contiguous so lets just get the
-     * first MFN and fill the rest in ourselves */
-    rc = xc_get_pfn_list(xc_handle, domid, (uint64_t *)*page_array, 1);
-    if (rc == -1) {
-        perror("Could not get the page frame list");
-        return -1;
-    }
-    p = *page_array;
-    for (i = 1; i < nr_pages; i++)
-        p[i] = p[i - 1] + 1;
-    return 0;
-}
-
-int install_image(
-        int xc_handle,
-        int domid,
-        xen_pfn_t *page_array,
-        void *image,
-        unsigned long paddr,
-        unsigned long size)
-{
-    uint8_t *img = image;
-    int i;
-    int rc = 0;
-
-    if (paddr & ~PAGE_MASK) {
-        printf("*** unaligned address\n");
-        return -1;
-    }
-
-    for (i = 0; i < size; i += PAGE_SIZE) {
-        void *page = img + i;
-        xen_pfn_t pfn = (paddr + i) >> PAGE_SHIFT;
-        xen_pfn_t mfn = page_array[pfn];
-
-        rc = xc_copy_to_domain_page(xc_handle, domid, mfn, page);
-        if (rc < 0) {
-            perror("xc_copy_to_domain_page");
-            break;
-        }
-    }
-    return rc;
-}
-
-void *load_file(const char *path, unsigned long *filesize)
-{
-    void *img;
-    ssize_t size;
-    int fd;
-
-    DPRINTF("load_file(%s)\n", path);
-
-    fd = open(path, O_RDONLY);
-    if (fd < 0) {
-        perror(path);
-        return NULL;
-    }
-
-    size = lseek(fd, 0, SEEK_END);
-    if (size < 0) {
-        perror(path);
-        close(fd);
-        return NULL;
-    }
-    lseek(fd, 0, SEEK_SET);
-
-    img = malloc(size);
-    if (img == NULL) {
-        perror(path);
-        close(fd);
-        return NULL;
-    }
-
-    size = read(fd, img, size);
-    if (size <= 0) {
-        perror(path);
-        close(fd);
-        free(img);
-        return NULL;
-    }
-
-    if (filesize)
-        *filesize = size;
-    close(fd);
-    return img;
-}
-
-int load_elf_kernel(
-    int xc_handle,
-    int domid,
-    const char *kernel_path,
-    struct domain_setup_info *dsi,
-    xen_pfn_t *page_array)
-{
-    struct load_funcs load_funcs;
-    char *kernel_img;
-    unsigned long kernel_size;
-    int rc;
-
-    /* load the kernel ELF file */
-    kernel_img = load_file(kernel_path, &kernel_size);
-    if (kernel_img == NULL) {
-        rc = -1;
-        goto out;
-    }
-
-    DPRINTF("probe_elf\n");
-    rc = probe_elf(kernel_img, kernel_size, &load_funcs);
-    if (rc < 0) {
-        rc = -1;
-        printf("%s is not an ELF file\n", kernel_path);
-        goto out;
-    }
-
-    DPRINTF("parseimage\n");
-    rc = (load_funcs.parseimage)(kernel_img, kernel_size, dsi);
-    if (rc < 0) {
-        rc = -1;
-        goto out;
-    }
-
-    DPRINTF("loadimage\n");
-    (load_funcs.loadimage)(kernel_img, kernel_size, xc_handle, domid,
-            page_array, dsi);
-
-    DPRINTF("  v_start     %016"PRIx64"\n", dsi->v_start);
-    DPRINTF("  v_end       %016"PRIx64"\n", dsi->v_end);
-    DPRINTF("  v_kernstart %016"PRIx64"\n", dsi->v_kernstart);
-    DPRINTF("  v_kernend   %016"PRIx64"\n", dsi->v_kernend);
-    DPRINTF("  v_kernentry %016"PRIx64"\n", dsi->v_kernentry);
-
-out:
-    free(kernel_img);
-    return rc;
-}
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/utils.h
--- a/tools/libxc/powerpc64/utils.h     Thu Mar 22 09:28:05 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
- */
-
-extern int get_rma_page_array(int xc_handle, int domid, xen_pfn_t **page_array,
-                             unsigned long nr_pages);
-extern int install_image(int xc_handle, int domid, xen_pfn_t *page_array,
-                        void *image, unsigned long paddr, unsigned long size);
-extern void *load_file(const char *path, unsigned long *filesize);
-extern int load_elf_kernel(int xc_handle, int domid,  const char *kernel_path,
-                          struct domain_setup_info *dsi,
-                          xen_pfn_t *page_array);
-
-#define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
-
-#define max(x,y) ({ \
-        const typeof(x) _x = (x);       \
-        const typeof(y) _y = (y);       \
-        (void) (&_x == &_y);            \
-        _x > _y ? _x : _y; })
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/xc_linux_build.c
--- a/tools/libxc/powerpc64/xc_linux_build.c    Thu Mar 22 09:28:05 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,336 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include <xen/xen.h>
-#include <xen/memory.h>
-#include <xc_private.h>
-#include <xg_private.h>
-#include <xenctrl.h>
-
-#include "flatdevtree_env.h"
-#include "flatdevtree.h"
-#include "utils.h"
-#include "mk_flatdevtree.h"
-
-/* Use 16MB extents to match PowerPC's large page size. */
-#define EXTENT_SHIFT 24
-#define EXTENT_ORDER (EXTENT_SHIFT - PAGE_SHIFT)
-
-#define INITRD_ADDR (24UL << 20)
-#define DEVTREE_ADDR (16UL << 20)
-
-static int init_boot_vcpu(
-    int xc_handle,
-    int domid,
-    struct domain_setup_info *dsi,
-    unsigned long devtree_addr,
-    unsigned long kern_addr)
-{
-    vcpu_guest_context_t ctxt;
-    int rc;
-
-    memset(&ctxt.user_regs, 0x55, sizeof(ctxt.user_regs));
-    ctxt.user_regs.pc = dsi->v_kernentry;
-    ctxt.user_regs.msr = 0;
-    ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */
-    ctxt.user_regs.gprs[3] = devtree_addr;
-    ctxt.user_regs.gprs[4] = kern_addr;
-    ctxt.user_regs.gprs[5] = 0;
-    /* There is a buggy kernel that does not zero the "local_paca", so
-     * we must make sure this register is 0 */
-    ctxt.user_regs.gprs[13] = 0;
-
-    DPRINTF("xc_vcpu_setvcpucontext:\n"
-                 "  pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n"
-                 "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64
-                 " %016"PRIx64"\n",
-                 ctxt.user_regs.pc, ctxt.user_regs.msr,
-                 ctxt.user_regs.gprs[1],
-                 ctxt.user_regs.gprs[2],
-                 ctxt.user_regs.gprs[3],
-                 ctxt.user_regs.gprs[4],
-                 ctxt.user_regs.gprs[5]);
-    rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt);
-    if (rc < 0)
-        perror("setdomaininfo");
-
-    return rc;
-}
-
-static int load_initrd(
-    int xc_handle,
-    int domid,
-    xen_pfn_t *page_array,
-    const char *initrd_path,
-    unsigned long *base,
-    unsigned long *len)
-{
-    uint8_t *initrd_img;
-    int rc = -1;
-
-    /* load the initrd file */
-    initrd_img = load_file(initrd_path, len);
-    if (initrd_img == NULL)
-        return -1;
-
-    DPRINTF("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len);
-    if (install_image(xc_handle, domid, page_array, initrd_img, INITRD_ADDR,
-                *len))
-        goto out;
-
-    *base = INITRD_ADDR;
-    rc = 0;
-
-out:
-    free(initrd_img);
-    return rc;
-}
-
-static void free_page_array(xen_pfn_t *page_array)
-{
-    free(page_array);
-}
-
-static int check_memory_config(int rma_log, unsigned int mem_mb)
-{
-    u64 mem_kb = (mem_mb << 10);
-    u64 rma_kb = (1 << rma_log) >> 10;
-
-    switch(rma_log)
-    {
-        case 26:
-        case 27:
-        case 28:
-        case 30:
-        case 34:
-        case 38:
-            if (mem_kb < rma_kb) {
-                DPRINTF("Domain memory must be at least %dMB\n", 
-                        (1 << rma_log)>>20);
-                break;
-            }
-
-            if (mem_kb % (16 << 10)) {
-                DPRINTF("Domain memory %dMB must be a multiple of 16MB\n",
-                        mem_mb);
-                       
-                break;
-            }
-
-            /* rma_log and mem_mb OK */
-            return 0;
-
-        default:
-            DPRINTF("Invalid rma_log (%d)\n", rma_log);
-    }
-
-    return 1;
-}
-
-static int alloc_memory(int xc_handle, domid_t domid, ulong nr_pages,
-                        ulong rma_pages)
-{
-    xen_pfn_t *extent_pfn_arry;
-    ulong nr_extents;
-    ulong start_pfn = rma_pages;
-    int i;
-    int j;
-    int rc = 0;
-
-    nr_extents = (nr_pages - rma_pages) >> EXTENT_ORDER;
-    DPRINTF("allocating memory in %lu chunks of %luMB\n", nr_extents,
-            1UL >> (20 - EXTENT_ORDER));
-
-    /* populate_physmap requires an array of PFNs that determine where the
-     * guest mapping of the new MFNs. */
-    extent_pfn_arry = malloc((1<<EXTENT_ORDER) * sizeof(xen_pfn_t));
-    if (extent_pfn_arry == NULL) {
-        PERROR("Couldn't allocate extent PFN array.\n");
-        return -ENOMEM;
-    }
-
-    /* Now allocate the remaining memory as large-order extents. */
-    for (i = 0; i < nr_extents; i++) {
-        /* Initialize the extent PFN array. */
-        for (j = 0; j < (1 << EXTENT_ORDER); j++)
-            extent_pfn_arry[j] = start_pfn++;
-
-        DPRINTF("populate_physmap(Dom%u, order %u, starting_pfn %llx)\n",
-                domid, EXTENT_ORDER, extent_pfn_arry[0]);
-
-        if (xc_domain_memory_populate_physmap(xc_handle, domid, 1, 
EXTENT_ORDER,
-                                               0, extent_pfn_arry))
-        {
-            PERROR("Could not allocate extents\n");
-            rc = -1;
-            break;
-        }
-    }
-
-    free(extent_pfn_arry);
-    return rc;
-}
-
-int xc_linux_build(int xc_handle,
-                   uint32_t domid,
-                   unsigned int mem_mb,
-                   const char *image_name,
-                   const char *initrd_name,
-                   const char *cmdline,
-                   const char *features,
-                   unsigned long flags,
-                   unsigned int store_evtchn,
-                   unsigned long *store_mfn,
-                   unsigned int console_evtchn,
-                   unsigned long *console_mfn)
-{
-    struct domain_setup_info dsi;
-    xen_pfn_t *page_array = NULL;
-    unsigned long nr_pages;
-    unsigned long devtree_addr = 0;
-    unsigned long kern_addr;
-    unsigned long initrd_base = 0;
-    unsigned long initrd_len = 0;
-    unsigned long rma_pages;
-    unsigned long shadow_mb;
-    u64 shared_info_paddr;
-    u64 store_paddr;
-    u64 console_paddr;
-    int rma_log = 26;  /* 64MB RMA */
-    int rc = 0;
-    int op;
-    struct ft_cxt devtree;
-
-    DPRINTF("%s\n", __func__);
-
-    nr_pages = mem_mb << (20 - PAGE_SHIFT);
-    DPRINTF("nr_pages 0x%lx\n", nr_pages);
-
-    rma_pages = (1 << rma_log) >> PAGE_SHIFT;
-    if (rma_pages == 0) {
-        rc = -1;
-        goto out;
-    }
-
-    /* validate rma_log and domain memory config */
-    if (check_memory_config(rma_log, mem_mb)) {
-        rc = -1;
-        goto out;
-    }
-    
-    /* Allocate the RMA. */
-    DPRINTF("RMA: 0x%lx pages\n", rma_pages);
-    if (xc_alloc_real_mode_area(xc_handle, domid, rma_log)) {
-        rc = -1;
-        goto out;
-    }
-
-    /* Get the MFN mapping (for RMA only -- we only load data into the RMA). */
-    if (get_rma_page_array(xc_handle, domid, &page_array, rma_pages)) {
-        rc = -1;
-        goto out;
-    }
-
-    /* Allocate the non-RMA memory. */
-    rc = alloc_memory(xc_handle, domid, nr_pages, rma_pages);
-    if (rc) {
-        goto out;
-    }
-
-    /* Load kernel. */
-    DPRINTF("loading image '%s'\n", image_name);
-    if (load_elf_kernel(xc_handle, domid, image_name, &dsi, page_array)) {
-        rc = -1;
-        goto out;
-    }
-    kern_addr = 0;
-
-    /* Load initrd. */
-    if (initrd_name && initrd_name[0] != '\0') {
-        DPRINTF("loading initrd '%s'\n", initrd_name);
-        if (load_initrd(xc_handle, domid, page_array, initrd_name,
-                &initrd_base, &initrd_len)) {
-            rc = -1;
-            goto out;
-        }
-    }
-
-    /* fetch the current shadow_memory value for this domain */
-    op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
-    if (xc_shadow_control(xc_handle, domid, op, NULL, 0, 
-                          &shadow_mb, 0, NULL) < 0) {
-        rc = -1;
-        goto out;
-    }
-
-    /* determine shared_info, console, and store paddr */
-    shared_info_paddr = (rma_pages << PAGE_SHIFT) - PAGE_SIZE;
-    console_paddr = shared_info_paddr - PAGE_SIZE;
-    store_paddr = console_paddr - PAGE_SIZE;
-
-    /* map paddrs to mfns */
-    *store_mfn = page_array[(xen_pfn_t)(store_paddr >> PAGE_SHIFT)];
-    *console_mfn = page_array[(xen_pfn_t)(console_paddr >> PAGE_SHIFT)];
-    DPRINTF("console_mfn->%08lx store_mfn->%08lx\n", *console_mfn,
-            *store_mfn);
-
-    /* build the devtree here */
-    DPRINTF("constructing devtree\n");
-    if (make_devtree(&devtree, domid, mem_mb, (rma_pages << PAGE_SHIFT),
-                     shadow_mb, initrd_base, initrd_len, cmdline, 
-                     shared_info_paddr, console_evtchn, console_paddr,
-                     store_evtchn, store_paddr) < 0) {
-        DPRINTF("failed to create flattened device tree\n");
-        rc = -1;
-        goto out;
-    }
-
-    devtree_addr = DEVTREE_ADDR;
-    DPRINTF("loading flattened device tree to 0x%lx[0x%x]\n",
-            devtree_addr, devtree.bph->totalsize);
-
-    if (install_image(xc_handle, domid, page_array, (void *)devtree.bph,
-                      devtree_addr, devtree.bph->totalsize)) {
-        DPRINTF("couldn't load flattened device tree.\n");
-        rc = -1;
-        goto out2;
-    }
-
-    if (init_boot_vcpu(xc_handle, domid, &dsi, devtree_addr, kern_addr)) {
-        rc = -1;
-        goto out2;
-    }
-
-out2:
-    free_devtree(&devtree);
-out:
-    free_page_array(page_array);
-    return rc;
-}
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/powerpc64/xc_prose_build.c
--- a/tools/libxc/powerpc64/xc_prose_build.c    Thu Mar 22 09:28:05 2007 -0600
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,215 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * Copyright IBM Corporation 2006, 2007
- *
- * Authors: Hollis Blanchard <hollisb@xxxxxxxxxx>
- *          Jonathan Appavoo <jappavoo@xxxxxxxxxx>
- */
-
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <inttypes.h>
-
-#include <xen/xen.h>
-#include <xen/memory.h>
-#include <xc_private.h>
-#include <xg_private.h>
-#include <xenctrl.h>
-
-#include "utils.h"
-
-#define INITRD_ADDR (24UL << 20)
-
-static int init_boot_vcpu(
-    int xc_handle,
-    int domid,
-    struct domain_setup_info *dsi,
-    unsigned long kern_addr)
-{
-    vcpu_guest_context_t ctxt;
-    int rc;
-
-    memset(&ctxt.user_regs, 0x55, sizeof(ctxt.user_regs));
-    ctxt.user_regs.pc = dsi->v_kernentry;
-    ctxt.user_regs.msr = 0;
-    ctxt.user_regs.gprs[1] = 0; /* Linux uses its own stack */
-    ctxt.user_regs.gprs[3] = 0;
-    ctxt.user_regs.gprs[4] = kern_addr;
-    ctxt.user_regs.gprs[5] = 0; /* reserved for specifying OF handler */
-    /* There is a buggy kernel that does not zero the "local_paca", so
-     * we must make sure this register is 0 */
-    ctxt.user_regs.gprs[13] = 0;
-
-    DPRINTF("xc_vcpu_setvcpucontext:\n"
-                 "  pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n"
-                 "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64
-                 " %016"PRIx64"\n",
-                 ctxt.user_regs.pc, ctxt.user_regs.msr,
-                 ctxt.user_regs.gprs[1],
-                 ctxt.user_regs.gprs[2],
-                 ctxt.user_regs.gprs[3],
-                 ctxt.user_regs.gprs[4],
-                 ctxt.user_regs.gprs[5]);
-    rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt);
-    if (rc < 0)
-        perror("setdomaininfo");
-
-    return rc;
-}
-
-static int load_initrd(
-    int xc_handle,
-    int domid,
-    xen_pfn_t *page_array,
-    const char *initrd_path,
-    unsigned long *base,
-    unsigned long *len)
-{
-    uint8_t *initrd_img;
-    int rc = -1;
-
-    /* load the initrd file */
-    initrd_img = load_file(initrd_path, len);
-    if (initrd_img == NULL)
-        return -1;
-
-    DPRINTF("copying initrd to 0x%lx[0x%lx]\n", INITRD_ADDR, *len);
-    if (install_image(xc_handle, domid, page_array, initrd_img, INITRD_ADDR,
-                *len))
-        goto out;
-
-    *base = INITRD_ADDR;
-    rc = 0;
-
-out:
-    free(initrd_img);
-    return rc;
-}
-
-static unsigned long create_start_info(
-       start_info_t *start_info,
-        unsigned int console_evtchn, unsigned int store_evtchn,
-       unsigned long nr_pages, unsigned long rma_pages, const char *cmdline)
-{
-    unsigned long start_info_addr;
-    uint64_t rma_top;
-
-    memset(start_info, 0, sizeof(*start_info));
-    snprintf(start_info->magic, sizeof(start_info->magic),
-             "xen-%d.%d-powerpc64HV", 3, 0);
-
-    rma_top = rma_pages << PAGE_SHIFT;
-    DPRINTF("RMA top = 0x%"PRIX64"\n", rma_top);
-
-    start_info->nr_pages = nr_pages;
-    start_info->shared_info = rma_top - PAGE_SIZE;
-    start_info->store_mfn = (rma_top >> PAGE_SHIFT) - 2;
-    start_info->store_evtchn = store_evtchn;
-    start_info->console.domU.mfn = (rma_top >> PAGE_SHIFT) - 3;
-    start_info->console.domU.evtchn = console_evtchn;
-    strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE);
-    /* just in case we truncated cmdline with strncpy add 0 at the end */
-    start_info->cmd_line[MAX_GUEST_CMDLINE-1]=0;
-    start_info_addr = rma_top - 4*PAGE_SIZE;
-
-    return start_info_addr;
-}
-
-static void free_page_array(xen_pfn_t *page_array)
-{
-    free(page_array);
-}
-
-int xc_prose_build(int xc_handle,
-                   uint32_t domid,
-                   unsigned int mem_mb,
-                   const char *image_name,
-                   const char *initrd_name,
-                   const char *cmdline,
-                   const char *features,
-                   unsigned long flags,
-                   unsigned int store_evtchn,
-                   unsigned long *store_mfn,
-                   unsigned int console_evtchn,
-                   unsigned long *console_mfn)
-{
-    start_info_t start_info;
-    struct domain_setup_info dsi;
-    xen_pfn_t *page_array = NULL;
-    unsigned long nr_pages;
-    unsigned long kern_addr;
-    unsigned long initrd_base = 0;
-    unsigned long initrd_len = 0;
-    unsigned long start_info_addr;
-    unsigned long rma_pages;
-    int rc = 0;
-
-    DPRINTF("%s\n", __func__);
-
-    DPRINTF("cmdline=%s\n", cmdline);
-
-    nr_pages = mem_mb << (20 - PAGE_SHIFT);
-    DPRINTF("nr_pages 0x%lx\n", nr_pages);
-
-    rma_pages = (1 << 26) >> PAGE_SHIFT; /* 64 MB */
-
-    if (get_rma_page_array(xc_handle, domid, &page_array, rma_pages)) {
-        rc = -1;
-        goto out;
-    }
-
-    DPRINTF("loading image '%s'\n", image_name);
-    if (load_elf_kernel(xc_handle, domid, image_name, &dsi, page_array)) {
-        rc = -1;
-        goto out;
-    }
-    kern_addr = 0;
-
-    if (initrd_name && initrd_name[0] != '\0') {
-        DPRINTF("loading initrd '%s'\n", initrd_name);
-        if (load_initrd(xc_handle, domid, page_array, initrd_name,
-                &initrd_base, &initrd_len)) {
-            rc = -1;
-            goto out;
-        }
-    }
-
-    /* start_info stuff: about to be removed  */
-    start_info_addr = create_start_info(&start_info, console_evtchn,
-                                        store_evtchn, nr_pages,
-                                        rma_pages, cmdline);
-    *console_mfn = page_array[start_info.console.domU.mfn];
-    *store_mfn = page_array[start_info.store_mfn];
-    if (install_image(xc_handle, domid, page_array, &start_info,
-                      start_info_addr, sizeof(start_info_t))) {
-        rc = -1;
-        goto out;
-    }
-
-    if (init_boot_vcpu(xc_handle, domid, &dsi, kern_addr)) {
-        rc = -1;
-        goto out;
-    }
-
-out:
-    free_page_array(page_array);
-    return rc;
-}
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_core.h
--- a/tools/libxc/xc_core.h     Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_core.h     Thu Mar 22 09:30:54 2007 -0600
@@ -144,6 +144,8 @@ int xc_core_arch_map_p2m(int xc_handle, 
 # include "xc_core_x86.h"
 #elif defined (__ia64__)
 # include "xc_core_ia64.h"
+#elif defined (__powerpc__)
+# include "xc_core_powerpc.h"
 #else
 # error "unsupported architecture"
 #endif
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_core_powerpc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_core_powerpc.c     Thu Mar 22 09:30:54 2007 -0600
@@ -0,0 +1,79 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Isaku Yamahata <yamahata at valinux co jp>
+ *          Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *
+ */
+
+#include "xg_private.h"
+#include "xc_core.h"
+
+int
+xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
+{
+       /* All PowerPC domU are autotranslated. */
+       return 1;
+}
+
+int
+xc_core_arch_map_p2m(int xc_handle, xc_dominfo_t *info,
+                     shared_info_t *live_shinfo, xen_pfn_t **live_p2m,
+                     unsigned long *pfnp)
+{
+       /* All PowerPC domU are autotranslated. */
+    errno = ENOSYS;
+    return -1;
+}
+
+int
+xc_core_arch_memory_map_get(int xc_handle, xc_dominfo_t *info,
+                            shared_info_t *live_shinfo,
+                            xc_core_memory_map_t **mapp,
+                            unsigned int *nr_entries)
+{
+    xc_core_memory_map_t *map = NULL;
+
+    map = malloc(sizeof(*map));
+    if (!map) {
+        PERROR("Could not allocate memory");
+        goto out;
+    }
+
+    map->addr = 0;
+    map->size = info->max_memkb * 1024;
+
+    *mapp = map;
+    *nr_entries = 1;
+    return 0;
+
+out:
+    free(map);
+    return -1;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_core_powerpc.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_core_powerpc.h     Thu Mar 22 09:30:54 2007 -0600
@@ -0,0 +1,57 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ */
+
+#ifndef XC_CORE_POWERPC_H
+#define XC_CORE_POWERPC_H
+
+#define ELF_ARCH_DATA           ELFDATA2MSB
+#define ELF_ARCH_MACHINE        EM_PPC64
+
+struct xc_core_arch_context {
+    /* nothing */
+};
+
+#define xc_core_arch_context_init(arch_ctxt)            do {} while (0)
+#define xc_core_arch_context_free(arch_ctxt)            do {} while (0)
+#define xc_core_arch_context_get(arch_ctxt, ctxt, xc_handle, domid) \
+                                                                (0)
+#define xc_core_arch_context_dump(arch_ctxt, args, dump_rtn)    (0)
+
+static inline int
+xc_core_arch_context_get_shdr(struct xc_core_arch_context *arch_ctxt, 
+                              struct xc_core_section_headers *sheaders,
+                              struct xc_core_strtab *strtab,
+                              uint64_t *filesz, uint64_t offset)
+{
+    *filesz = 0;
+    return 0;
+}
+
+#endif /* XC_CORE_POWERPC_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h      Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom.h      Thu Mar 22 09:30:54 2007 -0600
@@ -49,6 +49,7 @@ struct xc_dom_image {
     struct xc_dom_seg ramdisk_seg;
     struct xc_dom_seg p2m_seg;
     struct xc_dom_seg pgtables_seg;
+    struct xc_dom_seg devicetree_seg;
     xen_pfn_t start_info_pfn;
     xen_pfn_t console_pfn;
     xen_pfn_t xenstore_pfn;
@@ -75,6 +76,7 @@ struct xc_dom_image {
     /* physical memory */
     xen_pfn_t total_pages;
     struct xc_dom_phys *phys_pages;
+    int realmodearea_log;
 
     /* malloc memory pool */
     struct xc_dom_mem *memblocks;
@@ -253,6 +255,10 @@ static inline xen_pfn_t xc_dom_p2m_guest
 
 /* --- arch bits --------------------------------------------------- */
 
+int arch_setup_meminit(struct xc_dom_image *dom);
+int arch_setup_bootearly(struct xc_dom_image *dom);
+int arch_setup_bootlate(struct xc_dom_image *dom);
+
 /*
  * Local variables:
  * mode: C
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom_boot.c Thu Mar 22 09:30:54 2007 -0600
@@ -83,293 +83,6 @@ static int clear_page(struct xc_dom_imag
     return rc;
 }
 
-/* ------------------------------------------------------------------------ */
-/* arch stuff: x86 bits                                                     */
-
-#if defined(__i386__) || defined(__x86_64__)
-
-
-static int x86_compat(int xc, domid_t domid, char *guest_type)
-{
-    static const struct {
-        char           *guest;
-        uint32_t        size;
-    } types[] = {
-        { "xen-3.0-x86_32p", 32 },
-        { "xen-3.0-x86_64",  64 },
-    };
-    DECLARE_DOMCTL;
-    int i,rc;
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.domain = domid;
-    domctl.cmd    = XEN_DOMCTL_set_address_size;
-    for ( i = 0; i < sizeof(types)/sizeof(types[0]); i++ )
-        if ( !strcmp(types[i].guest, guest_type) )
-            domctl.u.address_size.size = types[i].size;
-    if ( domctl.u.address_size.size == 0 )
-        /* nothing to do */
-        return 0;
-
-    xc_dom_printf("%s: guest %s, address size %" PRId32 "\n", __FUNCTION__,
-                  guest_type, domctl.u.address_size.size);
-    rc = do_domctl(xc, &domctl);
-    if ( rc != 0 )
-        xc_dom_printf("%s: warning: failed (rc=%d)\n",
-                      __FUNCTION__, rc);
-    return rc;
-}
-
-
-static int x86_shadow(int xc, domid_t domid)
-{
-    int rc, mode;
-
-    xc_dom_printf("%s: called\n", __FUNCTION__);
-
-    mode = XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT |
-        XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE;
-
-    rc = xc_shadow_control(xc, domid,
-                           XEN_DOMCTL_SHADOW_OP_ENABLE,
-                           NULL, 0, NULL, mode, NULL);
-    if ( rc != 0 )
-    {
-        xc_dom_panic(XC_INTERNAL_ERROR,
-                     "%s: SHADOW_OP_ENABLE (mode=0x%x) failed (rc=%d)\n",
-                     __FUNCTION__, mode, rc);
-        return rc;
-    }
-    xc_dom_printf("%s: shadow enabled (mode=0x%x)\n", __FUNCTION__, mode);
-    return rc;
-}
-
-static int arch_setup_meminit(struct xc_dom_image *dom)
-{
-    int rc = 0;
-
-    x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
-    if ( xc_dom_feature_translated(dom) )
-    {
-        dom->shadow_enabled = 1;
-        rc = x86_shadow(dom->guest_xc, dom->guest_domid);
-    }
-    return rc;
-}
-
-static int arch_setup_bootearly(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootlate(struct xc_dom_image *dom)
-{
-    static const struct {
-        char *guest;
-        unsigned long pgd_type;
-    } types[] = {
-        { "xen-3.0-x86_32",  MMUEXT_PIN_L2_TABLE},
-        { "xen-3.0-x86_32p", MMUEXT_PIN_L3_TABLE},
-        { "xen-3.0-x86_64",  MMUEXT_PIN_L4_TABLE},
-    };
-    unsigned long pgd_type = 0;
-    shared_info_t *shared_info;
-    xen_pfn_t shinfo;
-    int i, rc;
-
-    for ( i = 0; i < sizeof(types) / sizeof(types[0]); i++ )
-        if ( !strcmp(types[i].guest, dom->guest_type) )
-            pgd_type = types[i].pgd_type;
-
-    if ( !xc_dom_feature_translated(dom) )
-    {
-        /* paravirtualized guest */
-        xc_dom_unmap_one(dom, dom->pgtables_seg.pfn);
-        rc = pin_table(dom->guest_xc, pgd_type,
-                       xc_dom_p2m_host(dom, dom->pgtables_seg.pfn),
-                       dom->guest_domid);
-        if ( rc != 0 )
-        {
-            xc_dom_panic(XC_INTERNAL_ERROR,
-                         "%s: pin_table failed (pfn 0x%" PRIpfn ", rc=%d)\n",
-                         __FUNCTION__, dom->pgtables_seg.pfn, rc);
-            return rc;
-        }
-        shinfo = dom->shared_info_mfn;
-    }
-    else
-    {
-        /* paravirtualized guest with auto-translation */
-        struct xen_add_to_physmap xatp;
-        int i;
-
-        /* Map shared info frame into guest physmap. */
-        xatp.domid = dom->guest_domid;
-        xatp.space = XENMAPSPACE_shared_info;
-        xatp.idx = 0;
-        xatp.gpfn = dom->shared_info_pfn;
-        rc = xc_memory_op(dom->guest_xc, XENMEM_add_to_physmap, &xatp);
-        if ( rc != 0 )
-        {
-            xc_dom_panic(XC_INTERNAL_ERROR, "%s: mapping shared_info failed "
-                         "(pfn=0x%" PRIpfn ", rc=%d)\n",
-                         __FUNCTION__, xatp.gpfn, rc);
-            return rc;
-        }
-
-        /* Map grant table frames into guest physmap. */
-        for ( i = 0; ; i++ )
-        {
-            xatp.domid = dom->guest_domid;
-            xatp.space = XENMAPSPACE_grant_table;
-            xatp.idx = i;
-            xatp.gpfn = dom->total_pages + i;
-            rc = xc_memory_op(dom->guest_xc, XENMEM_add_to_physmap, &xatp);
-            if ( rc != 0 )
-            {
-                if ( (i > 0) && (errno == EINVAL) )
-                {
-                    xc_dom_printf("%s: %d grant tables mapped\n", __FUNCTION__,
-                                  i);
-                    break;
-                }
-                xc_dom_panic(XC_INTERNAL_ERROR,
-                             "%s: mapping grant tables failed " "(pfn=0x%"
-                             PRIpfn ", rc=%d)\n", __FUNCTION__, xatp.gpfn, rc);
-                return rc;
-            }
-        }
-        shinfo = dom->shared_info_pfn;
-    }
-
-    /* setup shared_info page */
-    xc_dom_printf("%s: shared_info: pfn 0x%" PRIpfn ", mfn 0x%" PRIpfn "\n",
-                  __FUNCTION__, dom->shared_info_pfn, dom->shared_info_mfn);
-    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
-                                       PAGE_SIZE_X86,
-                                       PROT_READ | PROT_WRITE,
-                                       shinfo);
-    if ( shared_info == NULL )
-        return -1;
-    dom->arch_hooks->shared_info(dom, shared_info);
-    munmap(shared_info, PAGE_SIZE_X86);
-
-    return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* arch stuff: ia64                                                         */
-
-#elif defined(__ia64__)
-
-static int arch_setup_meminit(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootearly(struct xc_dom_image *dom)
-{
-    DECLARE_DOMCTL;
-    int rc;
-
-    xc_dom_printf("%s: setup firmware\n", __FUNCTION__);
-
-    memset(&domctl, 0, sizeof(domctl));
-    domctl.cmd = XEN_DOMCTL_arch_setup;
-    domctl.domain = dom->guest_domid;
-    domctl.u.arch_setup.flags = 0;
-
-    domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
-        + sizeof(start_info_t);
-    /* 3 = start info page, xenstore page and console page */
-    domctl.u.arch_setup.maxmem = (dom->total_pages - 3) << PAGE_SHIFT;
-    rc = do_domctl(dom->guest_xc, &domctl);
-    return rc;
-}
-
-static int arch_setup_bootlate(struct xc_dom_image *dom)
-{
-    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
-    shared_info_t *shared_info;
-
-    /* setup shared_info page */
-    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
-                  __FUNCTION__, dom->shared_info_mfn);
-    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
-                                       page_size,
-                                       PROT_READ | PROT_WRITE,
-                                       dom->shared_info_mfn);
-    if ( shared_info == NULL )
-        return -1;
-    dom->arch_hooks->shared_info(dom, shared_info);
-    munmap(shared_info, page_size);
-    return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* arch stuff: powerpc                                                      */
-
-#elif defined(__powerpc64__)
-
-static int arch_setup_meminit(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootearly(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootlate(struct xc_dom_image *dom)
-{
-    start_info_t *si =
-        xc_dom_pfn_to_ptr(dom, dom->start_info_pfn, 1);
-
-    xc_dom_printf("%s: TODO: setup devtree\n", __FUNCTION__);
-
-#if 0
-    load_devtree(dom->guest_xc,
-                 dom->guest_domid,
-                 dom->p2m_host,
-                 devtree,           // FIXME
-                 devtree_addr,      // FIXME
-                 dom->ramdisk_seg.vstart,
-                 dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart,
-                 si,
-                 dom->start_info_pfn << PAGE_SHIFT);
-#endif
-    return rc;
-}
-
-/* ------------------------------------------------------------------------ */
-/* arch stuff: other                                                        */
-
-#else
-
-static int arch_setup_meminit(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootearly(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-static int arch_setup_bootlate(struct xc_dom_image *dom)
-{
-    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
-    return 0;
-}
-
-#endif /* arch stuff */
 
 /* ------------------------------------------------------------------------ */
 
@@ -420,13 +133,7 @@ int xc_dom_boot_mem_init(struct xc_dom_i
 
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
-    if ( (rc = arch_setup_meminit(dom)) != 0 )
-        return rc;
-
-    /* allocate guest memory */
-    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
-                                           dom->total_pages, 0, 0,
-                                           dom->p2m_host);
+    rc = arch_setup_meminit(dom);
     if ( rc != 0 )
     {
         xc_dom_panic(XC_OUT_OF_MEMORY,
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_compat_linux.c
--- a/tools/libxc/xc_dom_compat_linux.c Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom_compat_linux.c Thu Mar 22 09:30:54 2007 -0600
@@ -32,6 +32,10 @@ static int xc_linux_build_internal(struc
 {
     int rc;
 
+    dom->flags = flags;
+    dom->console_evtchn = console_evtchn;
+    dom->xenstore_evtchn = store_evtchn;
+
     if ( (rc = xc_dom_boot_xen_init(dom, xc_handle, domid)) != 0 )
         goto out;
     if ( (rc = xc_dom_parse_image(dom)) != 0 )
@@ -42,12 +46,7 @@ static int xc_linux_build_internal(struc
         goto out;
     if ( (rc = xc_dom_build_image(dom)) != 0 )
         goto out;
-
-    dom->flags = flags;
-    dom->console_evtchn = console_evtchn;
-    dom->xenstore_evtchn = store_evtchn;
-    rc = xc_dom_boot_image(dom);
-    if ( rc != 0 )
+    if ( (rc = xc_dom_boot_image(dom)) != 0 )
         goto out;
 
     *console_mfn = xc_dom_p2m_host(dom, dom->console_pfn);
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_core.c
--- a/tools/libxc/xc_dom_core.c Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom_core.c Thu Mar 22 09:30:54 2007 -0600
@@ -639,7 +639,7 @@ int xc_dom_mem_init(struct xc_dom_image 
 int xc_dom_mem_init(struct xc_dom_image *dom, unsigned int mem_mb)
 {
     unsigned int page_shift;
-    xen_pfn_t nr_pages, pfn;
+    xen_pfn_t nr_pages;
 
     dom->arch_hooks = xc_dom_find_arch_hooks(dom->guest_type);
     if ( dom->arch_hooks == NULL )
@@ -659,10 +659,6 @@ int xc_dom_mem_init(struct xc_dom_image 
     xc_dom_printf("%s: 0x%" PRIpfn " pages\n",
                   __FUNCTION__, dom->total_pages);
 
-    /* setup initial p2m */
-    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
-    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
-        dom->p2m_host[pfn] = pfn;
     return 0;
 }
 
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom_ia64.c Thu Mar 22 09:30:54 2007 -0600
@@ -18,6 +18,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "xenctrl.h"
 
 /* ------------------------------------------------------------------------ */
 
@@ -128,6 +129,62 @@ static void __init register_arch_hooks(v
     xc_dom_register_arch_hooks(&xc_dom_arch_ia64be);
 }
 
+int arch_setup_meminit(struct xc_dom_image *dom)
+{
+    xen_pfn_t pfn;
+    int rc;
+
+    /* setup initial p2m */
+    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
+        dom->p2m_host[pfn] = pfn;
+
+    /* allocate guest memory */
+    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+                                           dom->total_pages, 0, 0,
+                                           dom->p2m_host);
+    return rc;
+}
+
+int arch_setup_bootearly(struct xc_dom_image *dom)
+{
+    DECLARE_DOMCTL;
+    int rc;
+
+    xc_dom_printf("%s: setup firmware\n", __FUNCTION__);
+
+    memset(&domctl, 0, sizeof(domctl));
+    domctl.cmd = XEN_DOMCTL_arch_setup;
+    domctl.domain = dom->guest_domid;
+    domctl.u.arch_setup.flags = 0;
+
+    domctl.u.arch_setup.bp = (dom->start_info_pfn << PAGE_SHIFT)
+        + sizeof(start_info_t);
+    /* 3 = start info page, xenstore page and console page */
+    domctl.u.arch_setup.maxmem = (dom->total_pages - 3) << PAGE_SHIFT;
+    rc = do_domctl(dom->guest_xc, &domctl);
+    return rc;
+}
+
+int arch_setup_bootlate(struct xc_dom_image *dom)
+{
+    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
+    shared_info_t *shared_info;
+
+    /* setup shared_info page */
+    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
+                  __FUNCTION__, dom->shared_info_mfn);
+    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+                                       page_size,
+                                       PROT_READ | PROT_WRITE,
+                                       dom->shared_info_mfn);
+    if ( shared_info == NULL )
+        return -1;
+    dom->arch_hooks->shared_info(dom, shared_info);
+    munmap(shared_info, page_size);
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_powerpc.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxc/xc_dom_powerpc.c      Thu Mar 22 09:30:54 2007 -0600
@@ -0,0 +1,236 @@
+/*
+ * Xen domain builder -- powerpc bits.
+ *
+ * Most architecture-specific code for powerpc goes here.
+ *
+ * This code is licenced under the GPL.
+ * written 2006 by Gerd Hoffmann <kraxel@xxxxxxx>.
+ *
+ * Copyright IBM Corp. 2007
+ *
+ * Authors: Gerd Hoffmann <kraxel@xxxxxxx>
+ *          Hollis Blanchard <hollisb@xxxxxxxxxx>
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include <xen/xen.h>
+
+#include "xg_private.h"
+#include "xc_dom.h"
+#include "powerpc64/flatdevtree.h"
+#include "powerpc64/mk_flatdevtree.h"
+
+#define RMA_LOG 26 /* 64 MB */
+#define EXTENT_LOG 24 /* 16 MB */
+#define EXTENT_ORDER (EXTENT_LOG - PAGE_SHIFT)
+
+/* ------------------------------------------------------------------------ */
+
+static int alloc_magic_pages(struct xc_dom_image *dom)
+{
+    struct ft_cxt devtree;
+    void *guest_devtree;
+    unsigned long shadow_mb;
+    int rma_pages;
+    int rc;
+
+    /* Allocate special pages from the end of the RMA. */
+    rma_pages = 1 << (dom->realmodearea_log - PAGE_SHIFT);
+    dom->shared_info_pfn = --rma_pages;
+    dom->console_pfn = --rma_pages;
+    dom->xenstore_pfn = --rma_pages;
+
+    /* Gather shadow allocation info for the device tree. */
+    rc = xc_shadow_control(dom->guest_xc, dom->guest_domid,
+                           XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION, NULL, 0, 
+                           &shadow_mb, 0, NULL);
+    if (rc < 0 || shadow_mb == 0) {
+        xc_dom_printf("Couldn't get shadow allocation size or it was 0.\n");
+        return rc;
+    }
+
+    /* Build device tree. */
+    rc = make_devtree(&devtree, dom, shadow_mb);
+    if (rc < 0) {
+        xc_dom_printf("Failed to create flattened device tree.\n");
+        return rc;
+    }
+
+    /* Find a spot for it. */
+    rc = xc_dom_alloc_segment(dom, &dom->devicetree_seg, "devtree", 0,
+                              devtree.bph->totalsize);
+    if (rc)
+        goto out;
+
+    /* Copy the device tree into place. */
+    guest_devtree = xc_dom_seg_to_ptr(dom, &dom->devicetree_seg);
+    if (!guest_devtree) {
+        xc_dom_printf("Couldn't map guest memory for device tree.\n");
+        rc = -1;
+        goto out;
+    }
+    memcpy(guest_devtree, devtree.bph, devtree.bph->totalsize);
+
+out:
+    free_devtree(&devtree);
+    return rc;
+}
+
+static int shared_info(struct xc_dom_image *dom, void *ptr)
+{
+    shared_info_t *shared_info = ptr;
+
+    xc_dom_printf("%s: called\n", __FUNCTION__);
+
+    memset(shared_info, 0, sizeof(*shared_info));
+    return 0;
+}
+
+static int vcpu(struct xc_dom_image *dom, void *ptr)
+{
+    vcpu_guest_context_t *ctxt = ptr;
+
+    memset(ctxt, 0x55, sizeof(*ctxt));
+    ctxt->user_regs.pc = dom->parms.virt_entry;
+    ctxt->user_regs.msr = 0;
+    ctxt->user_regs.gprs[1] = 0; /* Linux uses its own stack */
+    ctxt->user_regs.gprs[3] = dom->devicetree_seg.pfn << PAGE_SHIFT;
+    ctxt->user_regs.gprs[4] = dom->kernel_seg.pfn << PAGE_SHIFT;
+    ctxt->user_regs.gprs[5] = 0;
+
+    /* There is a buggy kernel that does not zero the "local_paca", so
+     * we must make sure this register is 0 */
+    ctxt->user_regs.gprs[13] = 0;
+
+    xc_dom_printf("%s: initial vcpu:\n", __FUNCTION__);
+    xc_dom_printf("  pc 0x%016"PRIx64", msr 0x%016"PRIx64"\n"
+                  "  r1-5 %016"PRIx64" %016"PRIx64" %016"PRIx64" %016"PRIx64
+                  " %016"PRIx64"\n",
+                  ctxt->user_regs.pc, ctxt->user_regs.msr,
+                  ctxt->user_regs.gprs[1],
+                  ctxt->user_regs.gprs[2],
+                  ctxt->user_regs.gprs[3],
+                  ctxt->user_regs.gprs[4],
+                  ctxt->user_regs.gprs[5]);
+
+    return 0;
+}
+
+/* ------------------------------------------------------------------------ */
+
+static struct xc_dom_arch xc_dom_arch = {
+    .guest_type = "xen-3.0-powerpc64",
+    .page_shift = PAGE_SHIFT,
+    .alloc_magic_pages = alloc_magic_pages,
+    .shared_info = shared_info,
+    .vcpu = vcpu,
+};
+
+static void __init register_arch_hooks(void)
+{
+    xc_dom_register_arch_hooks(&xc_dom_arch);
+}
+
+int arch_setup_meminit(struct xc_dom_image *dom)
+{
+    xen_pfn_t *extent_list;
+    unsigned long total_mem = dom->total_pages << PAGE_SHIFT;
+    unsigned long rma_bytes;
+    unsigned long rma_nr_pages;
+    unsigned long nr_extents;
+    int rc = 0;
+    int i;
+
+    /* XXX RMA size is processor-dependent. */
+    dom->realmodearea_log = RMA_LOG;
+    rma_bytes = 1 << dom->realmodearea_log;
+    rma_nr_pages = rma_bytes >> PAGE_SHIFT;
+
+    xc_dom_printf("dom%u memory: %lu MB RMA, %lu MB additional.\n",
+            dom->guest_domid, rma_bytes >> 20, (total_mem - rma_bytes) >> 20);
+
+    if (total_mem < rma_bytes) {
+        xc_dom_printf("Domain must have at least %lu MB\n", rma_bytes >> 20);
+        return -EINVAL;
+    }
+
+    /* Allocate the first chunk of memory. */
+    rc = xc_alloc_real_mode_area(dom->guest_xc, dom->guest_domid,
+                                 dom->realmodearea_log);
+    if (rc) {
+        xc_dom_printf("Failed to allocate real mode area.\n");
+        return rc;
+    }
+
+    /* Allocate p2m map. */
+    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+    if (dom->p2m_host == NULL) {
+        xc_dom_printf("Couldn't allocate p2m map.\n");
+        return -ENOMEM;
+    }
+
+    nr_extents = (dom->total_pages - rma_nr_pages) >> EXTENT_ORDER;
+    if (nr_extents) {
+        /* Allocate extent list for populate_physmap() call. */
+        extent_list = xc_dom_malloc(dom, sizeof(xen_pfn_t) * nr_extents);
+        if (extent_list == NULL) {
+            xc_dom_printf("Couldn't allocate extent list.\n");
+            return -ENOMEM;
+        }
+
+        /* Allocate the remaining (non-RMA) memory. */
+        for (i = 0; i < nr_extents; i++) {
+            /* Use PFNs above the RMA memory we already allocated. */
+            extent_list[i] = rma_nr_pages + i * (1<<EXTENT_ORDER);
+        }
+        rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+                                               nr_extents, EXTENT_ORDER, 0,
+                                               extent_list);
+        if (rc < 0) {
+            xc_dom_printf("populate_physmap(0x%lx extents order %u) -> 0x%x\n",
+                          nr_extents, EXTENT_ORDER, rc);
+            return rc;
+        }
+    }
+
+    /* Populate the p2m map. */
+    rc = xc_get_pfn_list(dom->guest_xc, dom->guest_domid, dom->p2m_host,
+                         dom->total_pages);
+    if (rc < 0) {
+        xc_dom_printf("Couldn't get p2m translation.\n");
+        return rc;
+    }
+
+    xc_dom_printf("%s: success\n", __func__);
+
+    return 0;
+}
+
+int arch_setup_bootearly(struct xc_dom_image *dom)
+{
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
+}
+
+int arch_setup_bootlate(struct xc_dom_image *dom)
+{
+    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
+    shared_info_t *shared_info;
+
+    /* setup shared_info page */
+    xc_dom_printf("%s: shared_info: mfn 0x%" PRIpfn "\n",
+                  __FUNCTION__, dom->shared_info_mfn);
+    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+                                       page_size,
+                                       PROT_READ | PROT_WRITE,
+                                       dom->shared_info_mfn);
+    if ( shared_info == NULL )
+        return -1;
+    dom->arch_hooks->shared_info(dom, shared_info);
+    munmap(shared_info, page_size);
+    return 0;
+}
diff -r 93e11f6d6791 -r be1017157768 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/libxc/xc_dom_x86.c  Thu Mar 22 09:30:54 2007 -0600
@@ -22,6 +22,7 @@
 
 #include "xg_private.h"
 #include "xc_dom.h"
+#include "xenctrl.h"
 
 /* ------------------------------------------------------------------------ */
 
@@ -547,6 +548,188 @@ static void __init register_arch_hooks(v
     xc_dom_register_arch_hooks(&xc_dom_64);
 }
 
+static int x86_compat(int xc, domid_t domid, char *guest_type)
+{
+    static const struct {
+        char           *guest;
+        uint32_t        size;
+    } types[] = {
+        { "xen-3.0-x86_32p", 32 },
+        { "xen-3.0-x86_64",  64 },
+    };
+    DECLARE_DOMCTL;
+    int i,rc;
+
+    memset(&domctl, 0, sizeof(domctl));
+    domctl.domain = domid;
+    domctl.cmd    = XEN_DOMCTL_set_address_size;
+    for ( i = 0; i < sizeof(types)/sizeof(types[0]); i++ )
+        if ( !strcmp(types[i].guest, guest_type) )
+            domctl.u.address_size.size = types[i].size;
+    if ( domctl.u.address_size.size == 0 )
+        /* nothing to do */
+        return 0;
+
+    xc_dom_printf("%s: guest %s, address size %" PRId32 "\n", __FUNCTION__,
+                  guest_type, domctl.u.address_size.size);
+    rc = do_domctl(xc, &domctl);
+    if ( rc != 0 )
+        xc_dom_printf("%s: warning: failed (rc=%d)\n",
+                      __FUNCTION__, rc);
+    return rc;
+}
+
+
+static int x86_shadow(int xc, domid_t domid)
+{
+    int rc, mode;
+
+    xc_dom_printf("%s: called\n", __FUNCTION__);
+
+    mode = XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT |
+        XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE;
+
+    rc = xc_shadow_control(xc, domid,
+                           XEN_DOMCTL_SHADOW_OP_ENABLE,
+                           NULL, 0, NULL, mode, NULL);
+    if ( rc != 0 )
+    {
+        xc_dom_panic(XC_INTERNAL_ERROR,
+                     "%s: SHADOW_OP_ENABLE (mode=0x%x) failed (rc=%d)\n",
+                     __FUNCTION__, mode, rc);
+        return rc;
+    }
+    xc_dom_printf("%s: shadow enabled (mode=0x%x)\n", __FUNCTION__, mode);
+    return rc;
+}
+
+int arch_setup_meminit(struct xc_dom_image *dom)
+{
+    int rc;
+    xen_pfn_t pfn;
+
+    x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
+    if ( xc_dom_feature_translated(dom) )
+    {
+        dom->shadow_enabled = 1;
+        rc = x86_shadow(dom->guest_xc, dom->guest_domid);
+        if ( rc )
+            return rc;
+    }
+
+    /* setup initial p2m */
+    dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
+    for ( pfn = 0; pfn < dom->total_pages; pfn++ )
+        dom->p2m_host[pfn] = pfn;
+
+    /* allocate guest memory */
+    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
+                                           dom->total_pages, 0, 0,
+                                           dom->p2m_host);
+    return rc;
+}
+
+int arch_setup_bootearly(struct xc_dom_image *dom)
+{
+    xc_dom_printf("%s: doing nothing\n", __FUNCTION__);
+    return 0;
+}
+
+int arch_setup_bootlate(struct xc_dom_image *dom)
+{
+    static const struct {
+        char *guest;
+        unsigned long pgd_type;
+    } types[] = {
+        { "xen-3.0-x86_32",  MMUEXT_PIN_L2_TABLE},
+        { "xen-3.0-x86_32p", MMUEXT_PIN_L3_TABLE},
+        { "xen-3.0-x86_64",  MMUEXT_PIN_L4_TABLE},
+    };
+    unsigned long pgd_type = 0;
+    shared_info_t *shared_info;
+    xen_pfn_t shinfo;
+    int i, rc;
+
+    for ( i = 0; i < sizeof(types) / sizeof(types[0]); i++ )
+        if ( !strcmp(types[i].guest, dom->guest_type) )
+            pgd_type = types[i].pgd_type;
+
+    if ( !xc_dom_feature_translated(dom) )
+    {
+        /* paravirtualized guest */
+        xc_dom_unmap_one(dom, dom->pgtables_seg.pfn);
+        rc = pin_table(dom->guest_xc, pgd_type,
+                       xc_dom_p2m_host(dom, dom->pgtables_seg.pfn),
+                       dom->guest_domid);
+        if ( rc != 0 )
+        {
+            xc_dom_panic(XC_INTERNAL_ERROR,
+                         "%s: pin_table failed (pfn 0x%" PRIpfn ", rc=%d)\n",
+                         __FUNCTION__, dom->pgtables_seg.pfn, rc);
+            return rc;
+        }
+        shinfo = dom->shared_info_mfn;
+    }
+    else
+    {
+        /* paravirtualized guest with auto-translation */
+        struct xen_add_to_physmap xatp;
+        int i;
+
+        /* Map shared info frame into guest physmap. */
+        xatp.domid = dom->guest_domid;
+        xatp.space = XENMAPSPACE_shared_info;
+        xatp.idx = 0;
+        xatp.gpfn = dom->shared_info_pfn;
+        rc = xc_memory_op(dom->guest_xc, XENMEM_add_to_physmap, &xatp);
+        if ( rc != 0 )
+        {
+            xc_dom_panic(XC_INTERNAL_ERROR, "%s: mapping shared_info failed "
+                         "(pfn=0x%" PRIpfn ", rc=%d)\n",
+                         __FUNCTION__, xatp.gpfn, rc);
+            return rc;
+        }
+
+        /* Map grant table frames into guest physmap. */
+        for ( i = 0; ; i++ )
+        {
+            xatp.domid = dom->guest_domid;
+            xatp.space = XENMAPSPACE_grant_table;
+            xatp.idx = i;
+            xatp.gpfn = dom->total_pages + i;
+            rc = xc_memory_op(dom->guest_xc, XENMEM_add_to_physmap, &xatp);
+            if ( rc != 0 )
+            {
+                if ( (i > 0) && (errno == EINVAL) )
+                {
+                    xc_dom_printf("%s: %d grant tables mapped\n", __FUNCTION__,
+                                  i);
+                    break;
+                }
+                xc_dom_panic(XC_INTERNAL_ERROR,
+                             "%s: mapping grant tables failed " "(pfn=0x%"
+                             PRIpfn ", rc=%d)\n", __FUNCTION__, xatp.gpfn, rc);
+                return rc;
+            }
+        }
+        shinfo = dom->shared_info_pfn;
+    }
+
+    /* setup shared_info page */
+    xc_dom_printf("%s: shared_info: pfn 0x%" PRIpfn ", mfn 0x%" PRIpfn "\n",
+                  __FUNCTION__, dom->shared_info_pfn, dom->shared_info_mfn);
+    shared_info = xc_map_foreign_range(dom->guest_xc, dom->guest_domid,
+                                       PAGE_SIZE_X86,
+                                       PROT_READ | PROT_WRITE,
+                                       shinfo);
+    if ( shared_info == NULL )
+        return -1;
+    dom->arch_hooks->shared_info(dom, shared_info);
+    munmap(shared_info, PAGE_SIZE_X86);
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r 93e11f6d6791 -r be1017157768 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Mar 22 09:30:54 2007 -0600
@@ -1072,46 +1072,6 @@ static PyObject *pyxc_alloc_real_mode_ar
     Py_INCREF(zero);
     return zero;
 }
-
-static PyObject *pyxc_prose_build(XcObject *self,
-                                  PyObject *args,
-                                  PyObject *kwds)
-{
-    uint32_t dom;
-    char *image, *ramdisk = NULL, *cmdline = "", *features = NULL;
-    int flags = 0;
-    int store_evtchn, console_evtchn;
-    unsigned int mem_mb;
-    unsigned long store_mfn = 0;
-    unsigned long console_mfn = 0;
-    int unused;
-
-    static char *kwd_list[] = { "dom", "store_evtchn",
-                                "console_evtchn", "image", "memsize",
-                                /* optional */
-                                "ramdisk", "cmdline", "flags",
-                                "features", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiis|ssis#", kwd_list,
-                                      &dom, &store_evtchn, &mem_mb,
-                                      &console_evtchn, &image,
-                                      /* optional */
-                                      &ramdisk, &cmdline, &flags,
-                                      &features, &unused) )
-        return NULL;
-
-    if ( xc_prose_build(self->xc_handle, dom, mem_mb, image,
-                        ramdisk, cmdline, features, flags,
-                        store_evtchn, &store_mfn,
-                        console_evtchn, &console_mfn) != 0 ) {
-        if (!errno)
-             errno = EINVAL;
-        return pyxc_error_to_exception();
-    }
-    return Py_BuildValue("{s:i,s:i}", 
-                         "store_mfn", store_mfn,
-                         "console_mfn", console_mfn);
-}
 #endif /* powerpc */
 
 static PyMethodDef pyxc_methods[] = {
@@ -1463,17 +1423,6 @@ static PyMethodDef pyxc_methods[] = {
       "Allocate a domain's real mode area.\n"
       " dom [int]: Identifier of domain.\n"
       " log [int]: Specifies the area's size.\n"
-      "Returns: [int] 0 on success; -1 on error.\n" },
-
-    { "arch_prose_build", 
-      (PyCFunction)pyxc_prose_build, 
-      METH_VARARGS | METH_KEYWORDS, "\n"
-      "Build a new Linux guest OS.\n"
-      " dom     [int]:      Identifier of domain to build into.\n"
-      " image   [str]:      Name of kernel image file. May be gzipped.\n"
-      " ramdisk [str, n/a]: Name of ramdisk file, if any.\n"
-      " cmdline [str, n/a]: Kernel parameters, if any.\n\n"
-      " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 #endif /* __powerpc */
 
diff -r 93e11f6d6791 -r be1017157768 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/python/xen/xend/XendAPI.py  Thu Mar 22 09:30:54 2007 -0600
@@ -665,6 +665,7 @@ class XendAPI(object):
                     ('add_to_other_config', None),
                     ('remove_from_other_config', None),
                     ('dmesg', 'String'),
+                    ('dmesg_clear', 'String'),
                     ('get_log', 'String'),
                     ('send_debug_keys', None)]
     
@@ -742,11 +743,11 @@ class XendAPI(object):
             return xen_api_error(XEND_ERROR_HOST_RUNNING)
         return xen_api_error(XEND_ERROR_UNSUPPORTED)        
 
-    def host_dmesg(self, session, host_ref, clear):
-        if clear:
-            return xen_api_success(XendDmesg.instance().clear())
-        else:
-            return xen_api_success(XendDmesg.instance().info())
+    def host_dmesg(self, session, host_ref):
+        return xen_api_success(XendDmesg.instance().info())
+
+    def host_dmesg_clear(self, session, host_ref):
+        return xen_api_success(XendDmesg.instance().clear())
 
     def host_get_log(self, session, host_ref):
         log_file = open(XendLogging.getLogFilename())
diff -r 93e11f6d6791 -r be1017157768 tools/python/xen/xend/XendDmesg.py
--- a/tools/python/xen/xend/XendDmesg.py        Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/python/xen/xend/XendDmesg.py        Thu Mar 22 09:30:54 2007 -0600
@@ -13,6 +13,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #============================================================================
 # Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
+# Copyright (C) 2007       XenSource Inc.
 #============================================================================
 
 """Get dmesg output for this node.
@@ -28,7 +29,7 @@ class XendDmesg:
         return self.xc.readconsolering()
 
     def clear(self):
-        self.xc.readconsolering(True)
+        return self.xc.readconsolering(True)
 
 def instance():
     global inst
diff -r 93e11f6d6791 -r be1017157768 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/python/xen/xend/image.py    Thu Mar 22 09:30:54 2007 -0600
@@ -227,35 +227,6 @@ class PPC_LinuxImageHandler(LinuxImageHa
         return max(maxmem_kb / 64, shadow_mem_kb)
 
 
-
-class PPC_ProseImageHandler(PPC_LinuxImageHandler):
-
-    ostype = "prose"
-
-    def buildDomain(self):
-        store_evtchn = self.vm.getStorePort()
-        console_evtchn = self.vm.getConsolePort()
-
-        mem_mb = self.getRequiredInitialReservation() / 1024
-
-        log.debug("dom            = %d", self.vm.getDomid())
-        log.debug("memsize        = %d", mem_mb)
-        log.debug("image          = %s", self.kernel)
-        log.debug("store_evtchn   = %d", store_evtchn)
-        log.debug("console_evtchn = %d", console_evtchn)
-        log.debug("cmdline        = %s", self.cmdline)
-        log.debug("ramdisk        = %s", self.ramdisk)
-        log.debug("vcpus          = %d", self.vm.getVCpuCount())
-        log.debug("features       = %s", self.vm.getFeatures())
-
-        return xc.arch_prose_build(dom            = self.vm.getDomid(),
-                                   memsize        = mem_mb,
-                                   image          = self.kernel,
-                                   store_evtchn   = store_evtchn,
-                                   console_evtchn = console_evtchn,
-                                   cmdline        = self.cmdline,
-                                   ramdisk        = self.ramdisk,
-                                   features       = self.vm.getFeatures())
 
 class HVMImageHandler(ImageHandler):
 
@@ -613,7 +584,6 @@ _handlers = {
 _handlers = {
     "powerpc": {
         "linux": PPC_LinuxImageHandler,
-        "prose": PPC_ProseImageHandler,
     },
     "ia64": {
         "linux": LinuxImageHandler,
diff -r 93e11f6d6791 -r be1017157768 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Thu Mar 22 09:28:05 2007 -0600
+++ b/tools/python/xen/xm/main.py       Thu Mar 22 09:30:54 2007 -0600
@@ -217,7 +217,7 @@ SUBCOMMAND_OPTIONS = {
        ('-q', '--quiet', 'Do not print an error message if the domain does not 
exist'),
     ),
     'dmesg': (
-       ('-c', '--clear', 'Clear dmesg buffer'),
+       ('-c', '--clear', 'Clear dmesg buffer as well as printing it'),
     ),
     'vnet-list': (
        ('-l', '--long', 'List Vnets as SXP'),
@@ -1587,17 +1587,16 @@ def xm_dmesg(args):
         usage('dmesg')
 
     if serverType == SERVER_XEN_API:
+        host = server.xenapi.session.get_this_host()
+        if use_clear:
+            print server.xenapi.host.dmesg_clear(host),
+        else:
+            print server.xenapi.host.dmesg(host),
+    else:
         if not use_clear:
-            print server.xenapi.host.dmesg(
-                server.xenapi.session.get_this_host(),0)
+            print server.xend.node.dmesg.info(),
         else:
-            server.xenapi.host.dmesg(
-                server.xenapi.session.get_this_host(),1)
-    else:
-        if not use_clear:
-            print server.xend.node.dmesg.info()
-        else:
-            server.xend.node.dmesg.clear()
+            print server.xend.node.dmesg.clear(),
 
 def xm_log(args):
     arg_check(args, "log", 0)
diff -r 93e11f6d6791 -r be1017157768 xen/arch/powerpc/backtrace.c
--- a/xen/arch/powerpc/backtrace.c      Thu Mar 22 09:28:05 2007 -0600
+++ b/xen/arch/powerpc/backtrace.c      Thu Mar 22 09:30:54 2007 -0600
@@ -222,8 +222,7 @@ void __warn(char *file, int line)
 
 void dump_execution_state(void)
 {
-    struct vcpu *v = current;
-    struct cpu_user_regs *regs = &v->arch.ctxt;
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
 
     show_registers(regs);
     if (regs->msr & MSR_HV) {
diff -r 93e11f6d6791 -r be1017157768 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Thu Mar 22 09:28:05 2007 -0600
+++ b/xen/arch/powerpc/mm.c     Thu Mar 22 09:30:54 2007 -0600
@@ -401,9 +401,13 @@ int allocate_rma(struct domain *d, unsig
 
 void free_rma_check(struct page_info *page)
 {
-    if (test_bit(_PGC_page_RMA, &page->count_info) &&
-        !test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags))
-        panic("Attempt to free an RMA page: 0x%lx\n", page_to_mfn(page));
+    if (test_bit(_PGC_page_RMA, &page->count_info)) {
+        if (!test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags)) {
+            panic("Attempt to free an RMA page: 0x%lx\n", page_to_mfn(page));
+        } else {
+            clear_bit(_PGC_page_RMA, &page->count_info);
+        }
+    }
 }
 
 ulong pfn2mfn(struct domain *d, ulong pfn, int *type)
diff -r 93e11f6d6791 -r be1017157768 xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c  Thu Mar 22 09:28:05 2007 -0600
+++ b/xen/arch/powerpc/setup.c  Thu Mar 22 09:30:54 2007 -0600
@@ -37,6 +37,7 @@
 #include <xen/keyhandler.h>
 #include <xen/numa.h>
 #include <xen/rcupdate.h>
+#include <xen/version.h>
 #include <acm/acm_hooks.h>
 #include <public/version.h>
 #include <asm/mpic.h>
@@ -450,6 +451,14 @@ extern void arch_get_xen_caps(xen_capabi
 extern void arch_get_xen_caps(xen_capabilities_info_t *info);
 void arch_get_xen_caps(xen_capabilities_info_t *info)
 {
+    int major = xen_major_version();
+    int minor = xen_minor_version();
+    char s[32];
+
+    (*info)[0] = '\0';
+
+    snprintf(s, sizeof(s), "xen-%d.%d-powerpc64 ", major, minor);
+    safe_strcat(*info, s);
 }
 
 
diff -r 93e11f6d6791 -r be1017157768 xen/arch/powerpc/smp-tbsync.c
--- a/xen/arch/powerpc/smp-tbsync.c     Thu Mar 22 09:28:05 2007 -0600
+++ b/xen/arch/powerpc/smp-tbsync.c     Thu Mar 22 09:30:54 2007 -0600
@@ -31,6 +31,13 @@
 #define local_irq_disable()
 
 #define NUM_ITER               300
+
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) printk(fmt)
+#else
+#define DBG(fmt...)
+#endif
 
 enum {
        kExit=0, kSetAndTest, kTest
@@ -128,7 +135,7 @@ void __devinit smp_generic_give_timebase
 {
        int i, score, score2, old, min=0, max=5000, offset=1000;
 
-       printk("Synchronizing timebase\n");
+       printk("Synchronizing timebase...\n");
 
        /* if this fails then this kernel won't work anyway... */
        tbsync = kmalloc( sizeof(*tbsync), GFP_KERNEL );
@@ -139,13 +146,13 @@ void __devinit smp_generic_give_timebase
        while (!tbsync->ack)
                barrier();
 
-       printk("Got ack\n");
+       DBG("Got ack\n");
 
        /* binary search */
        for (old = -1; old != offset ; offset = (min+max) / 2) {
                score = start_contest(kSetAndTest, offset, NUM_ITER);
 
-               printk("score %d, offset %d\n", score, offset );
+               DBG("score %d, offset %d\n", score, offset );
 
                if( score > 0 )
                        max = offset;
@@ -156,7 +163,7 @@ void __devinit smp_generic_give_timebase
        score = start_contest(kSetAndTest, min, NUM_ITER);
        score2 = start_contest(kSetAndTest, max, NUM_ITER);
 
-       printk("Min %d (score %d), Max %d (score %d)\n",
+       DBG("Min %d (score %d), Max %d (score %d)\n",
               min, score, max, score2);
        score = abs(score);
        score2 = abs(score2);
@@ -171,7 +178,7 @@ void __devinit smp_generic_give_timebase
                if (score2 <= score || score2 < 20)
                        break;
        }
-       printk("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER );
+       DBG("Final offset: %d (%d/%d)\n", offset, score2, NUM_ITER );
 
        /* exiting */
        tbsync->cmd = kExit;
diff -r 93e11f6d6791 -r be1017157768 xen/arch/x86/mm/shadow/types.h
--- a/xen/arch/x86/mm/shadow/types.h    Thu Mar 22 09:28:05 2007 -0600
+++ b/xen/arch/x86/mm/shadow/types.h    Thu Mar 22 09:30:54 2007 -0600
@@ -597,7 +597,7 @@ accumulate_guest_flags(struct vcpu *v, w
  * have reserved bits that we can use for this.
  */
 
-#define SH_L1E_MAGIC 0xffffffff00000000ULL
+#define SH_L1E_MAGIC 0xffffffff00000001ULL
 static inline int sh_l1e_is_magic(shadow_l1e_t sl1e)
 {
     return ((sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog