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] Make domctl/sysctl interfaces 32-/64-bit

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Make domctl/sysctl interfaces 32-/64-bit invariant.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Jan 2007 08:55:35 -0800
Delivery-date: Thu, 25 Jan 2007 09:51:04 -0800
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 kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1169656399 0
# Node ID 30af6cfdb05c6e56b3024e8be4abb3a10fc41297
# Parent  a94363b85e192540bf94c4da60adcf4176ecbdd0
Make domctl/sysctl interfaces 32-/64-bit invariant.
This kills off a fair amount of unpleasant CONFIG_COMPAT shimming and
avoids needing to keep the compat paths in sync as these interfaces
continue to develop.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/x86_64/domctl.c             |  111 -----------------------
 xen/arch/x86/x86_64/sysctl.c             |   33 ------
 xen/common/compat/domctl.c               |  137 ----------------------------
 xen/common/compat/sysctl.c               |   95 -------------------
 tools/libxc/ia64/xc_ia64_stubs.c         |    8 +
 tools/libxc/powerpc64/utils.c            |    2 
 tools/libxc/xc_core.c                    |    8 -
 tools/libxc/xc_domain.c                  |    3 
 tools/libxc/xc_linux_save.c              |   12 +-
 tools/libxc/xc_private.c                 |   29 +-----
 tools/libxc/xc_ptrace.c                  |    8 -
 tools/libxc/xc_resume.c                  |    2 
 tools/libxc/xenctrl.h                    |    4 
 xen/arch/ia64/xen/dom0_ops.c             |    2 
 xen/arch/ia64/xen/domain.c               |   30 +++---
 xen/arch/powerpc/domctl.c                |    2 
 xen/arch/x86/domctl.c                    |   74 +++++----------
 xen/arch/x86/mm/shadow/common.c          |   13 +-
 xen/arch/x86/sysctl.c                    |    8 -
 xen/arch/x86/x86_64/Makefile             |    2 
 xen/arch/x86/x86_64/compat/entry.S       |    7 +
 xen/common/compat/Makefile               |    4 
 xen/common/domain.c                      |   72 --------------
 xen/common/domctl.c                      |  149 +++++++++++++------------------
 xen/common/sysctl.c                      |   15 +--
 xen/include/Makefile                     |    2 
 xen/include/public/arch-x86/xen-x86_32.h |   19 +++
 xen/include/public/arch-x86/xen.h        |   12 +-
 xen/include/public/domctl.h              |   67 ++++++-------
 xen/include/public/sysctl.h              |   18 +--
 xen/include/public/xen.h                 |   10 ++
 xen/include/xen/domain.h                 |    6 -
 xen/include/xen/sched.h                  |    7 -
 xen/include/xlat.lst                     |    7 -
 34 files changed, 234 insertions(+), 744 deletions(-)

diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c  Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/ia64/xc_ia64_stubs.c  Wed Jan 24 16:33:19 2007 +0000
@@ -74,10 +74,11 @@ xc_ia64_get_pfn_list(int xc_handle, uint
 }
 
 int
-xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
+xc_get_pfn_list(int xc_handle, uint32_t domid, uint64_t *pfn_buf,
                 unsigned long max_pfns)
 {
-    return xc_ia64_get_pfn_list (xc_handle, domid, pfn_buf, 0, max_pfns);
+    return xc_ia64_get_pfn_list(xc_handle, domid, (xen_pfn_t *)pfn_buf,
+                                0, max_pfns);
 }
 
 long
@@ -86,7 +87,8 @@ xc_get_max_pages(int xc_handle, uint32_t
     struct xen_domctl domctl;
     domctl.cmd = XEN_DOMCTL_getdomaininfo;
     domctl.domain = (domid_t)domid;
-    return (do_domctl(xc_handle, &domctl) < 0) ? -1 : 
domctl.u.getdomaininfo.max_pages;
+    return ((do_domctl(xc_handle, &domctl) < 0)
+            ? -1 : domctl.u.getdomaininfo.max_pages);
 }
 
 /*
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/powerpc64/utils.c
--- a/tools/libxc/powerpc64/utils.c     Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/powerpc64/utils.c     Wed Jan 24 16:33:19 2007 +0000
@@ -76,7 +76,7 @@ int get_rma_page_array(int xc_handle, in
     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, *page_array, 1);
+    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;
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_core.c     Wed Jan 24 16:33:19 2007 +0000
@@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h
                                 dumpcore_rtn_t dump_rtn)
 {
     unsigned long nr_pages;
-    xen_pfn_t *page_array = NULL;
+    uint64_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(xen_pfn_t)));
+                 (nr_pages * sizeof(*page_array)));
     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(xen_pfn_t))) == NULL )
+    if ( (page_array = malloc(nr_pages * sizeof(*page_array))) == NULL )
     {
         IPRINTF("Could not allocate memory\n");
         goto error_out;
@@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_h
         IPRINTF("Could not get the page frame list\n");
         goto error_out;
     }
-    sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t));
+    sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(*page_array));
     if ( sts != 0 )
         goto error_out;
 
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_domain.c   Wed Jan 24 16:33:19 2007 +0000
@@ -323,7 +323,8 @@ int xc_shadow_control(int xc_handle,
     domctl.u.shadow_op.pages  = pages;
     domctl.u.shadow_op.mb     = mb ? *mb : 0;
     domctl.u.shadow_op.mode   = mode;
-    set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap, dirty_bitmap);
+    set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap,
+                         (uint8_t *)dirty_bitmap);
 
     rc = do_domctl(xc_handle, &domctl);
 
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c       Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_linux_save.c       Wed Jan 24 16:33:19 2007 +0000
@@ -811,8 +811,8 @@ int xc_linux_save(int xc_handle, int io_
     analysis_phase(xc_handle, dom, max_pfn, to_skip, 0);
 
     /* We want zeroed memory so use calloc rather than malloc. */
-    pfn_type  = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type));
-    pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
+    pfn_type   = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type));
+    pfn_batch  = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch));
 
     if ((pfn_type == NULL) || (pfn_batch == NULL)) {
         ERROR("failed to alloc memory for pfn_type and/or pfn_batch arrays");
@@ -976,10 +976,16 @@ int xc_linux_save(int xc_handle, int io_
                 goto out;
             }
 
-            if (xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type)) {
+            for ( j = 0; j < batch; j++ )
+                ((uint32_t *)pfn_type)[i] = pfn_type[i];
+            if ( xc_get_pfn_type_batch(xc_handle, dom, batch,
+                                       (uint32_t *)pfn_type) )
+            {
                 ERROR("get_pfn_type_batch failed");
                 goto out;
             }
+            for ( j = batch-1; j >= 0; j-- )
+                pfn_type[i] = ((uint32_t *)pfn_type)[i];
 
             for ( j = 0; j < batch; j++ )
             {
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_private.c  Wed Jan 24 16:33:19 2007 +0000
@@ -102,7 +102,7 @@ void unlock_pages(void *addr, size_t len
 
 /* NB: arr must be locked */
 int xc_get_pfn_type_batch(int xc_handle,
-                          uint32_t dom, int num, unsigned long *arr)
+                          uint32_t dom, int num, uint32_t *arr)
 {
     DECLARE_DOMCTL;
     domctl.cmd = XEN_DOMCTL_getpageframeinfo2;
@@ -309,7 +309,7 @@ long long xc_domain_get_cpu_usage( int x
 #ifndef __ia64__
 int xc_get_pfn_list(int xc_handle,
                     uint32_t domid,
-                    xen_pfn_t *pfn_buf,
+                    uint64_t *pfn_buf,
                     unsigned long max_pfns)
 {
     DECLARE_DOMCTL;
@@ -320,10 +320,10 @@ int xc_get_pfn_list(int xc_handle,
     set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
 
 #ifdef VALGRIND
-    memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t));
-#endif
-
-    if ( lock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 )
+    memset(pfn_buf, 0, max_pfns * sizeof(*pfn_buf));
+#endif
+
+    if ( lock_pages(pfn_buf, max_pfns * sizeof(*pfn_buf)) != 0 )
     {
         PERROR("xc_get_pfn_list: pfn_buf lock failed");
         return -1;
@@ -331,22 +331,7 @@ int xc_get_pfn_list(int xc_handle,
 
     ret = do_domctl(xc_handle, &domctl);
 
-    unlock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t));
-
-#if 0
-#ifdef DEBUG
-    DPRINTF(("Ret for xc_get_pfn_list is %d\n", ret));
-    if (ret >= 0) {
-        int i, j;
-        for (i = 0; i < domctl.u.getmemlist.num_pfns; i += 16) {
-            DPRINTF("0x%x: ", i);
-            for (j = 0; j < 16; j++)
-                DPRINTF("0x%lx ", pfn_buf[i + j]);
-            DPRINTF("\n");
-        }
-    }
-#endif
-#endif
+    unlock_pages(pfn_buf, max_pfns * sizeof(*pfn_buf));
 
     return (ret < 0) ? -1 : domctl.u.getmemlist.num_pfns;
 }
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c   Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_ptrace.c   Wed Jan 24 16:33:19 2007 +0000
@@ -153,8 +153,8 @@ online_vcpus_changed(uint64_t cpumap)
 
 /* --------------------- */
 /* XXX application state */
-static long                     nr_pages = 0;
-static unsigned long           *page_array = NULL;
+static long      nr_pages = 0;
+static uint64_t *page_array = NULL;
 
 
 /*
@@ -170,7 +170,7 @@ to_ma(int cpu, uint64_t maddr)
 to_ma(int cpu, uint64_t maddr)
 {
     if ( current_is_hvm && paging_enabled(&ctxt[cpu]) )
-        maddr = (uint64_t)page_array[maddr >> PAGE_SHIFT] << PAGE_SHIFT;
+        maddr = page_array[maddr >> PAGE_SHIFT] << PAGE_SHIFT;
     return maddr;
 }
 
@@ -360,7 +360,7 @@ map_domain_va(
         if ( nr_pages > 0 )
             free(page_array);
         nr_pages = npgs;
-        if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL )
+        if ( (page_array = malloc(nr_pages * sizeof(*page_array))) == NULL )
         {
             IPRINTF("Could not allocate memory\n");
             return NULL;
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xc_resume.c
--- a/tools/libxc/xc_resume.c   Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xc_resume.c   Wed Jan 24 16:33:19 2007 +0000
@@ -58,7 +58,7 @@ static int xc_domain_resume_any(int xc_h
     if ( xc_domain_getinfo(xc_handle, domid, 1, &info) != 1 )
     {
         PERROR("Could not get domain info");
-        goto out;
+        return rc;
     }
 
     /*
diff -r a94363b85e19 -r 30af6cfdb05c tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Jan 24 15:59:09 2007 +0000
+++ b/tools/libxc/xenctrl.h     Wed Jan 24 16:33:19 2007 +0000
@@ -552,7 +552,7 @@ 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, xen_pfn_t *pfn_buf,
+int xc_get_pfn_list(int xc_handle, uint32_t domid, uint64_t *pfn_buf,
                     unsigned long max_pfns);
 
 unsigned long xc_ia64_fpsr_default(void);
@@ -575,7 +575,7 @@ int xc_memory_op(int xc_handle, int cmd,
 int xc_memory_op(int xc_handle, int cmd, void *arg);
 
 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom,
-                          int num, unsigned long *arr);
+                          int num, uint32_t *arr);
 
 
 /* Get current total pages allocated to a domain. */
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/ia64/xen/dom0_ops.c      Wed Jan 24 16:33:19 2007 +0000
@@ -43,7 +43,7 @@ long arch_do_domctl(xen_domctl_t *op, XE
         struct domain *d = find_domain_by_id(op->domain);
         unsigned long start_page = op->u.getmemlist.start_pfn;
         unsigned long nr_pages = op->u.getmemlist.max_pfns;
-        unsigned long mfn;
+        uint64_t mfn;
 
         if ( d == NULL ) {
             ret = -EINVAL;
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/ia64/xen/domain.c        Wed Jan 24 16:33:19 2007 +0000
@@ -717,7 +717,7 @@ domain_set_shared_info_va (unsigned long
 }
 
 /* Transfer and clear the shadow bitmap in 1kB chunks for L1 cache. */
-#define SHADOW_COPY_CHUNK (1024 / sizeof (unsigned long))
+#define SHADOW_COPY_CHUNK 1024
 
 int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc)
 {
@@ -785,7 +785,7 @@ int shadow_mode_control(struct domain *d
 
        case XEN_DOMCTL_SHADOW_OP_CLEAN:
          {
-               int nbr_longs;
+               int nbr_bytes;
 
                sc->stats.fault_count = 
atomic64_read(&d->arch.shadow_fault_count);
                sc->stats.dirty_count = 
atomic64_read(&d->arch.shadow_dirty_count);
@@ -802,21 +802,21 @@ int shadow_mode_control(struct domain *d
                if (sc->pages > d->arch.shadow_bitmap_size)
                        sc->pages = d->arch.shadow_bitmap_size; 
 
-               nbr_longs = (sc->pages + BITS_PER_LONG - 1) / BITS_PER_LONG;
-
-               for (i = 0; i < nbr_longs; i += SHADOW_COPY_CHUNK) {
-                       int size = (nbr_longs - i) > SHADOW_COPY_CHUNK ?
-                                  SHADOW_COPY_CHUNK : nbr_longs - i;
+               nbr_bytes = (sc->pages + 7) / 8;
+
+               for (i = 0; i < nbr_bytes; i += SHADOW_COPY_CHUNK) {
+                       int size = (nbr_bytes - i) > SHADOW_COPY_CHUNK ?
+                                  SHADOW_COPY_CHUNK : nbr_bytes - i;
      
-                       if (copy_to_guest_offset(sc->dirty_bitmap, i,
-                                                d->arch.shadow_bitmap + i,
-                                                size)) {
+                       if (copy_to_guest_offset(
+                            sc->dirty_bitmap, i,
+                            (uint8_t *)d->arch.shadow_bitmap + i,
+                            size)) {
                                rc = -EFAULT;
                                break;
                        }
 
-                       memset(d->arch.shadow_bitmap + i,
-                              0, size * sizeof(unsigned long));
+                       memset((uint8_t *)d->arch.shadow_bitmap + i, 0, size);
                }
                
                break;
@@ -838,9 +838,9 @@ int shadow_mode_control(struct domain *d
                if (sc->pages > d->arch.shadow_bitmap_size)
                        sc->pages = d->arch.shadow_bitmap_size; 
 
-               size = (sc->pages + BITS_PER_LONG - 1) / BITS_PER_LONG;
-               if (copy_to_guest(sc->dirty_bitmap, 
-                                 d->arch.shadow_bitmap, size)) {
+               size = (sc->pages + 7) / 8;
+               if (copy_to_guest(sc->dirty_bitmap,
+                                 (uint8_t *)d->arch.shadow_bitmap, size)) {
                        rc = -EFAULT;
                        break;
                }
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/powerpc/domctl.c Wed Jan 24 16:33:19 2007 +0000
@@ -49,7 +49,7 @@ long arch_do_domctl(struct xen_domctl *d
         int i;
         struct domain *d = find_domain_by_id(domctl->domain);
         unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
-        xen_pfn_t mfn;
+        uint64_t mfn;
         struct list_head *list_ent;
 
         ret = -EINVAL;
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c     Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/x86/domctl.c     Wed Jan 24 16:33:19 2007 +0000
@@ -24,21 +24,12 @@
 #include <asm/hvm/support.h>
 #include <asm/processor.h>
 #include <public/hvm/e820.h>
-#ifdef CONFIG_COMPAT
-#include <compat/xen.h>
-#endif
-
-#ifndef COMPAT
-#define _long                long
-#define copy_from_xxx_offset copy_from_guest_offset
-#define copy_to_xxx_offset   copy_to_guest_offset
-#endif
-
-_long arch_do_domctl(
+
+long arch_do_domctl(
     struct xen_domctl *domctl,
     XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
 {
-    _long ret = 0;
+    long ret = 0;
 
     switch ( domctl->cmd )
     {
@@ -135,12 +126,11 @@ _long arch_do_domctl(
 
     case XEN_DOMCTL_getpageframeinfo2:
     {
-#define GPF2_BATCH (PAGE_SIZE / sizeof(_long))
         int n,j;
         int num = domctl->u.getpageframeinfo2.num;
         domid_t dom = domctl->domain;
         struct domain *d;
-        unsigned _long *l_arr;
+        uint32_t *arr32;
         ret = -ESRCH;
 
         if ( unlikely((d = find_domain_by_id(dom)) == NULL) )
@@ -153,16 +143,18 @@ _long arch_do_domctl(
             break;
         }
 
-        l_arr = alloc_xenheap_page();
+        arr32 = alloc_xenheap_page();
  
         ret = 0;
         for ( n = 0; n < num; )
         {
-            int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n);
-
-            if ( copy_from_xxx_offset(l_arr,
-                                      domctl->u.getpageframeinfo2.array,
-                                      n, k) )
+            int k = PAGE_SIZE / 4;
+            if ( (num - n) < k )
+                k = num - n;
+
+            if ( copy_from_guest_offset(arr32,
+                                        domctl->u.getpageframeinfo2.array,
+                                        n, k) )
             {
                 ret = -EINVAL;
                 break;
@@ -171,13 +163,13 @@ _long arch_do_domctl(
             for ( j = 0; j < k; j++ )
             {      
                 struct page_info *page;
-                unsigned _long mfn = l_arr[j];
+                unsigned long mfn = arr32[j];
 
                 page = mfn_to_page(mfn);
 
                 if ( likely(mfn_valid(mfn) && get_page(page, d)) ) 
                 {
-                    unsigned _long type = 0;
+                    unsigned long type = 0;
 
                     switch( page->u.inuse.type_info & PGT_type_mask )
                     {
@@ -197,16 +189,16 @@ _long arch_do_domctl(
 
                     if ( page->u.inuse.type_info & PGT_pinned )
                         type |= XEN_DOMCTL_PFINFO_LPINTAB;
-                    l_arr[j] |= type;
+                    arr32[j] |= type;
                     put_page(page);
                 }
                 else
-                    l_arr[j] |= XEN_DOMCTL_PFINFO_XTAB;
-
-            }
-
-            if ( copy_to_xxx_offset(domctl->u.getpageframeinfo2.array,
-                                    n, l_arr, k) )
+                    arr32[j] |= XEN_DOMCTL_PFINFO_XTAB;
+
+            }
+
+            if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array,
+                                      n, arr32, k) )
             {
                 ret = -EINVAL;
                 break;
@@ -215,7 +207,7 @@ _long arch_do_domctl(
             n += k;
         }
 
-        free_xenheap_page(l_arr);
+        free_xenheap_page(arr32);
 
         put_domain(d);
     }
@@ -226,7 +218,7 @@ _long arch_do_domctl(
         int i;
         struct domain *d = find_domain_by_id(domctl->domain);
         unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
-        xen_pfn_t mfn;
+        uint64_t mfn;
         struct list_head *list_ent;
 
         ret = -EINVAL;
@@ -241,8 +233,8 @@ _long arch_do_domctl(
             {
                 mfn = page_to_mfn(list_entry(
                     list_ent, struct page_info, list));
-                if ( copy_to_xxx_offset(domctl->u.getmemlist.buffer,
-                                        i, &mfn, 1) )
+                if ( copy_to_guest_offset(domctl->u.getmemlist.buffer,
+                                          i, &mfn, 1) )
                 {
                     ret = -EFAULT;
                     break;
@@ -311,13 +303,7 @@ _long arch_do_domctl(
         
         ret = -EFAULT;
 
-#ifndef COMPAT
         if ( copy_from_guest(c, domctl->u.hvmcontext.ctxt, 1) != 0 )
-#else
-        if ( copy_from_guest(c,
-                             compat_handle_cast(domctl->u.hvmcontext.ctxt, 
void),
-                             1) != 0 )
-#endif
             goto sethvmcontext_out;
 
         ret = arch_sethvm_ctxt(v, c);
@@ -354,14 +340,8 @@ _long arch_do_domctl(
         if (arch_gethvm_ctxt(v, c) == -1)
             ret = -EFAULT;
 
-#ifndef COMPAT
         if ( copy_to_guest(domctl->u.hvmcontext.ctxt, c, 1) )
-#else
-        if ( copy_to_guest(compat_handle_cast(domctl->u.hvmcontext.ctxt,
-                                              void),
-                           c, 1) )
             ret = -EFAULT;
-#endif
 
         xfree(c);
 
@@ -382,7 +362,6 @@ _long arch_do_domctl(
     return ret;
 }
 
-#ifndef COMPAT
 void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 {
 #ifdef CONFIG_COMPAT
@@ -396,9 +375,7 @@ void arch_get_info_guest(struct vcpu *v,
         memcpy(c.nat, &v->arch.guest_context, sizeof(*c.nat));
 #ifdef CONFIG_COMPAT
     else
-    {
         XLAT_vcpu_guest_context(c.cmp, &v->arch.guest_context);
-    }
 #endif
 
     if ( is_hvm_vcpu(v) )
@@ -446,7 +423,6 @@ void arch_get_info_guest(struct vcpu *v,
     c(vm_assist = v->domain->vm_assist);
 #undef c
 }
-#endif
 
 /*
  * Local variables:
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Wed Jan 24 16:33:19 2007 +0000
@@ -3191,19 +3191,16 @@ static int shadow_log_dirty_op(
         if ( likely(peek) )
         {
             if ( copy_to_guest_offset(
-                     sc->dirty_bitmap,
-                     i/(8*sizeof(unsigned long)),
-                     d->arch.shadow.dirty_bitmap+(i/(8*sizeof(unsigned long))),
-                     (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) )
+                sc->dirty_bitmap, i/8,
+                (uint8_t *)d->arch.shadow.dirty_bitmap + (i/8), bytes) )
             {
-                    rv = -EFAULT;
-                    goto out;
+                rv = -EFAULT;
+                goto out;
             }
         }
 
         if ( clean )
-            memset(d->arch.shadow.dirty_bitmap + (i/(8*sizeof(unsigned long))),
-                   0, bytes);
+            memset((uint8_t *)d->arch.shadow.dirty_bitmap + (i/8), 0, bytes);
     }
 #undef CHUNK
 
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c     Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/x86/sysctl.c     Wed Jan 24 16:33:19 2007 +0000
@@ -25,14 +25,10 @@
 #include <asm/hvm/support.h>
 #include <asm/processor.h>
 
-#ifndef COMPAT
-typedef long ret_t;
-#endif
-
-ret_t arch_do_sysctl(
+long arch_do_sysctl(
     struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
 {
-    ret_t ret = 0;
+    long ret = 0;
 
     switch ( sysctl->cmd )
     {
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/x86_64/Makefile
--- a/xen/arch/x86/x86_64/Makefile      Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/x86/x86_64/Makefile      Wed Jan 24 16:33:19 2007 +0000
@@ -5,10 +5,8 @@ obj-y += traps.o
 
 obj-$(CONFIG_COMPAT) += compat.o
 obj-$(CONFIG_COMPAT) += domain.o
-obj-$(CONFIG_COMPAT) += domctl.o
 obj-$(CONFIG_COMPAT) += physdev.o
 obj-$(CONFIG_COMPAT) += platform_hypercall.o
-obj-$(CONFIG_COMPAT) += sysctl.o
 
 ifeq ($(CONFIG_COMPAT),y)
 # extra dependencies
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S        Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S        Wed Jan 24 16:33:19 2007 +0000
@@ -276,6 +276,9 @@ CFIX14:
         .quad CFLT14,CFIX14
 .previous
 
+compat_domctl:
+compat_sysctl:
+
 .section .rodata, "a", @progbits
 
 ENTRY(compat_hypercall_table)
@@ -314,8 +317,8 @@ ENTRY(compat_hypercall_table)
         .quad do_event_channel_op
         .quad compat_physdev_op
         .quad do_hvm_op
-        .quad compat_sysctl             /* 35 */
-        .quad compat_domctl
+        .quad do_sysctl                 /* 35 */
+        .quad do_domctl
         .quad compat_kexec_op
         .rept NR_hypercalls-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/x86_64/domctl.c
--- a/xen/arch/x86/x86_64/domctl.c      Wed Jan 24 15:59:09 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/******************************************************************************
- * Arch-specific compatibility domctl.c
- */
-
-#include <xen/config.h>
-#include <compat/domctl.h>
-#include <xen/guest_access.h>
-#include <asm/shadow.h>
-
-DEFINE_XEN_GUEST_HANDLE(compat_domctl_t);
-#define xen_domctl                     compat_domctl
-#define xen_domctl_t                   compat_domctl_t
-#define arch_do_domctl(x, h)           arch_compat_domctl(x, _##h)
-
-static int compat_shadow_domctl(struct domain *d,
-                                compat_domctl_shadow_op_t *csc,
-                                XEN_GUEST_HANDLE(void) u_domctl)
-{
-    xen_domctl_shadow_op_t nsc;
-    int rc, mode;
-
-#define XLAT_domctl_shadow_op_HNDL_dirty_bitmap(_d_, _s_) \
-    do \
-    { \
-        if ( (_s_)->op != XEN_DOMCTL_SHADOW_OP_CLEAN \
-             && (_s_)->op != XEN_DOMCTL_SHADOW_OP_PEEK ) \
-        { \
-            set_xen_guest_handle((_d_)->dirty_bitmap, NULL); \
-            mode = -1; \
-        } \
-        else if ( compat_handle_is_null((_s_)->dirty_bitmap) \
-                  || (((_s_)->pages - 1) \
-                      & (BITS_PER_LONG - COMPAT_BITS_PER_LONG)) \
-                     == BITS_PER_LONG - COMPAT_BITS_PER_LONG ) \
-        { \
-            XEN_GUEST_HANDLE(void) tmp; \
-            guest_from_compat_handle(tmp, (_s_)->dirty_bitmap); \
-            (_d_)->dirty_bitmap = guest_handle_cast(tmp, ulong); \
-            mode = 0; \
-        } \
-        else if ( (_s_)->pages > COMPAT_ARG_XLAT_SIZE * 8 ) \
-        { \
-            printk("Cannot translate compatibility mode 
XEN_DOMCTL_SHADOW_OP_{CLEAN,PEEK} (0x%lX)\n", \
-                   (_s_)->pages); \
-            return -E2BIG; \
-        } \
-        else \
-        { \
-            set_xen_guest_handle((_d_)->dirty_bitmap, \
-                                 (void 
*)COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id)); \
-            mode = 1; \
-        } \
-    } while (0)
-    XLAT_domctl_shadow_op(&nsc, csc);
-#undef XLAT_domctl_shadow_op_HNDL_dirty_bitmap
-    rc = shadow_domctl(d, &nsc, u_domctl);
-    if ( rc != __HYPERVISOR_domctl )
-    {
-        BUG_ON(rc > 0);
-#define XLAT_domctl_shadow_op_HNDL_dirty_bitmap(_d_, _s_) \
-        do \
-        { \
-            if ( rc == 0 \
-                 && mode > 0 \
-                 && copy_to_compat((_d_)->dirty_bitmap, \
-                                   (unsigned int *)(_s_)->dirty_bitmap.p, \
-                                   ((_s_)->pages + COMPAT_BITS_PER_LONG - 1) / 
COMPAT_BITS_PER_LONG) ) \
-                rc = -EFAULT; \
-        } while (0)
-        XLAT_domctl_shadow_op(csc, &nsc);
-#undef XLAT_domctl_shadow_op_HNDL_dirty_bitmap
-    }
-    return rc;
-}
-#define xen_domctl_shadow_op           compat_domctl_shadow_op
-#define xen_domctl_shadow_op_t         compat_domctl_shadow_op_t
-#define shadow_domctl(d, sc, u)        compat_shadow_domctl(d, sc, u)
-
-#define xen_domctl_ioport_permission   compat_domctl_ioport_permission
-#define xen_domctl_ioport_permission_t compat_domctl_ioport_permission_t
-
-#define xen_domctl_getpageframeinfo    compat_domctl_getpageframeinfo
-#define xen_domctl_getpageframeinfo_t  compat_domctl_getpageframeinfo_t
-
-#define xen_domctl_getpageframeinfo2   compat_domctl_getpageframeinfo2
-#define xen_domctl_getpageframeinfo2_t compat_domctl_getpageframeinfo2_t
-
-#define xen_domctl_getmemlist          compat_domctl_getmemlist
-#define xen_domctl_getmemlist_t        compat_domctl_getmemlist_t
-#define xen_pfn_t                      compat_pfn_t
-
-#define xen_domctl_hypercall_init      compat_domctl_hypercall_init
-#define xen_domctl_hypercall_init_t    compat_domctl_hypercall_init_t
-
-#define COMPAT
-#define _XEN_GUEST_HANDLE(t)           XEN_GUEST_HANDLE(t)
-#define _long                          int
-#define copy_from_xxx_offset           copy_from_compat_offset
-#define copy_to_xxx_offset             copy_to_compat_offset
-
-#include "../domctl.c"
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r a94363b85e19 -r 30af6cfdb05c xen/arch/x86/x86_64/sysctl.c
--- a/xen/arch/x86/x86_64/sysctl.c      Wed Jan 24 15:59:09 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/******************************************************************************
- * Arch-specific compatibility sysctl.c
- */
-
-#include <xen/config.h>
-#include <compat/sysctl.h>
-
-DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t);
-#define xen_sysctl                    compat_sysctl
-#define xen_sysctl_t                  compat_sysctl_t
-#define arch_do_sysctl(x, h)          arch_compat_sysctl(x, _##h)
-
-#define xen_sysctl_physinfo           compat_sysctl_physinfo
-#define xen_sysctl_physinfo_t         compat_sysctl_physinfo_t
-
-#define xen_sysctl_ioport_emulation   compat_sysctl_ioport_emulation
-#define xen_sysctl_ioport_emulation_t compat_sysctl_ioport_emulation_t
-
-#define COMPAT
-#define _XEN_GUEST_HANDLE(t)          XEN_GUEST_HANDLE(t)
-typedef int ret_t;
-
-#include "../sysctl.c"
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/compat/Makefile
--- a/xen/common/compat/Makefile        Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/common/compat/Makefile        Wed Jan 24 16:33:19 2007 +0000
@@ -1,13 +1,9 @@ obj-y += domain.o
 obj-y += domain.o
-obj-y += domctl.o
 obj-y += kernel.o
 obj-y += memory.o
 obj-y += multicall.o
-obj-y += sysctl.o
 obj-y += xlat.o
 
 # extra dependencies
-domctl.o:      ../domctl.c
 kernel.o:      ../kernel.c
 multicall.o:   ../multicall.c
-sysctl.o:      ../sysctl.c
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/compat/domctl.c
--- a/xen/common/compat/domctl.c        Wed Jan 24 15:59:09 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/******************************************************************************
- * compat/domctl.c
- */
-
-#include <xen/config.h>
-#include <compat/domctl.h>
-#include <xen/sched.h>
-#include <xen/cpumask.h>
-#include <asm/uaccess.h>
-
-DEFINE_XEN_GUEST_HANDLE(compat_domctl_t);
-#define xen_domctl                     compat_domctl
-#define xen_domctl_t                   compat_domctl_t
-#define do_domctl(h)                   compat_domctl(_##h)
-#define arch_do_domctl(x, h)           arch_compat_domctl(x, _##h)
-
-#define xen_domain_handle_t            compat_domain_handle_t
-
-#define xen_domctl_vcpucontext         compat_domctl_vcpucontext
-#define xen_domctl_vcpucontext_t       compat_domctl_vcpucontext_t
-
-#define xen_domctl_createdomain        compat_domctl_createdomain
-#define xen_domctl_createdomain_t      compat_domctl_createdomain_t
-
-#define xen_domctl_max_vcpus           compat_domctl_max_vcpus
-#define xen_domctl_max_vcpus_t         compat_domctl_max_vcpus_t
-
-static void cpumask_to_compat_ctl_cpumap(
-    struct compat_ctl_cpumap *cmpctl_cpumap, cpumask_t *cpumask)
-{
-    unsigned int guest_bytes, copy_bytes, i;
-    /*static const*/ uint8_t zero = 0;
-
-    if ( compat_handle_is_null(cmpctl_cpumap->bitmap) )
-        return;
-
-    guest_bytes = (cmpctl_cpumap->nr_cpus + 7) / 8;
-    copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
-
-    copy_to_compat(cmpctl_cpumap->bitmap,
-                   (uint8_t *)cpus_addr(*cpumask),
-                   copy_bytes);
-
-    for ( i = copy_bytes; i < guest_bytes; i++ )
-        copy_to_compat_offset(cmpctl_cpumap->bitmap, i, &zero, 1);
-}
-#define cpumask_to_xenctl_cpumap       cpumask_to_compat_ctl_cpumap
-
-void compat_ctl_cpumap_to_cpumask(
-    cpumask_t *cpumask, struct compat_ctl_cpumap *cmpctl_cpumap)
-{
-    unsigned int guest_bytes, copy_bytes;
-
-    guest_bytes = (cmpctl_cpumap->nr_cpus + 7) / 8;
-    copy_bytes  = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8);
-
-    cpus_clear(*cpumask);
-
-    if ( compat_handle_is_null(cmpctl_cpumap->bitmap) )
-        return;
-
-    copy_from_compat((uint8_t *)cpus_addr(*cpumask),
-                     cmpctl_cpumap->bitmap,
-                     copy_bytes);
-}
-#define xenctl_cpumap_to_cpumask       compat_ctl_cpumap_to_cpumask
-
-#define xen_domctl_vcpuaffinity        compat_domctl_vcpuaffinity
-#define xen_domctl_vcpuaffinity_t      compat_domctl_vcpuaffinity_t
-
-static int compat_sched_adjust(struct domain *d,
-                               struct compat_domctl_scheduler_op *cop)
-{
-    struct xen_domctl_scheduler_op nop;
-    int ret;
-    enum XLAT_domctl_scheduler_op_u u;
-
-    switch ( cop->sched_id )
-    {
-    case XEN_SCHEDULER_SEDF:   u = XLAT_domctl_scheduler_op_u_sedf;   break;
-    case XEN_SCHEDULER_CREDIT: u = XLAT_domctl_scheduler_op_u_credit; break;
-    default: return -EINVAL;
-    }
-    XLAT_domctl_scheduler_op(&nop, cop);
-    ret = sched_adjust(d, &nop);
-    XLAT_domctl_scheduler_op(cop, &nop);
-
-    return ret;
-}
-#define sched_adjust(d, op)            compat_sched_adjust(d, op)
-#define xen_domctl_scheduler_op        compat_domctl_scheduler_op
-#define xen_domctl_scheduler_op_t      compat_domctl_scheduler_op_t
-
-#define xen_domctl_getdomaininfo       compat_domctl_getdomaininfo
-#define xen_domctl_getdomaininfo_t     compat_domctl_getdomaininfo_t
-#define getdomaininfo(d, i)            compat_getdomaininfo(d, i)
-
-#define xen_domctl_getvcpuinfo         compat_domctl_getvcpuinfo
-#define xen_domctl_getvcpuinfo_t       compat_domctl_getvcpuinfo_t
-
-#define xen_domctl_max_mem             compat_domctl_max_mem
-#define xen_domctl_max_mem_t           compat_domctl_max_mem_t
-
-#define xen_domctl_setdomainhandle     compat_domctl_setdomainhandle
-#define xen_domctl_setdomainhandle_t   compat_domctl_setdomainhandle_t
-
-#define xen_domctl_setdebugging        compat_domctl_setdebugging
-#define xen_domctl_setdebugging_t      compat_domctl_setdebugging_t
-
-#define xen_domctl_irq_permission      compat_domctl_irq_permission
-#define xen_domctl_irq_permission_t    compat_domctl_irq_permission_t
-
-#define xen_domctl_iomem_permission    compat_domctl_iomem_permission
-#define xen_domctl_iomem_permission_t  compat_domctl_iomem_permission_t
-
-#define xen_domctl_settimeoffset       compat_domctl_settimeoffset
-#define xen_domctl_settimeoffset_t     compat_domctl_settimeoffset_t
-
-#define COMPAT
-#define _XEN_GUEST_HANDLE(t)           XEN_GUEST_HANDLE(t)
-#define _u_domctl                      u_domctl
-//#undef guest_handle_cast
-//#define guest_handle_cast              compat_handle_cast
-//#define copy_to_xxx_offset             copy_to_compat_offset
-typedef int ret_t;
-
-#include "../domctl.c"
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/compat/sysctl.c
--- a/xen/common/compat/sysctl.c        Wed Jan 24 15:59:09 2007 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/******************************************************************************
- * compat/sysctl.c
- */
-
-#include <xen/config.h>
-#include <compat/sysctl.h>
-#include <xen/domain.h>
-#include <xen/guest_access.h>
-#include <xen/perfc.h>
-#include <xen/trace.h>
-
-DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t);
-#define xen_sysctl                     compat_sysctl
-#define xen_sysctl_t                   compat_sysctl_t
-#define do_sysctl(h)                   compat_sysctl(_##h)
-#define arch_do_sysctl(x, h)           arch_compat_sysctl(x, _##h)
-
-#define xen_sysctl_readconsole         compat_sysctl_readconsole
-#define xen_sysctl_readconsole_t       compat_sysctl_readconsole_t
-
-static int compat_tb_control(struct compat_sysctl_tbuf_op *cmp_tbc)
-{
-    struct xen_sysctl_tbuf_op nat_tbc;
-    int ret;
-
-#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) \
-    guest_from_compat_handle((_d_)->bitmap, (_s_)->bitmap)
-    XLAT_sysctl_tbuf_op(&nat_tbc, cmp_tbc);
-#undef XLAT_ctl_cpumap_HNDL_bitmap
-    ret = tb_control(&nat_tbc);
-#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) ((void)0)
-    XLAT_sysctl_tbuf_op(cmp_tbc, &nat_tbc);
-#undef XLAT_ctl_cpumap_HNDL_bitmap
-    return ret;
-}
-#define xen_sysctl_tbuf_op             compat_sysctl_tbuf_op
-#define xen_sysctl_tbuf_op_t           compat_sysctl_tbuf_op_t
-#define tb_control(p)                  compat_tb_control(p)
-
-#define xen_sysctl_sched_id            compat_sysctl_sched_id
-#define xen_sysctl_sched_id_t          compat_sysctl_sched_id_t
-
-#define xen_sysctl_getdomaininfolist   compat_sysctl_getdomaininfolist
-#define xen_sysctl_getdomaininfolist_t compat_sysctl_getdomaininfolist_t
-#define xen_domctl_getdomaininfo       compat_domctl_getdomaininfo
-#define xen_domctl_getdomaininfo_t     compat_domctl_getdomaininfo_t
-#define getdomaininfo(d, i)            compat_getdomaininfo(d, i)
-
-#ifdef PERF_COUNTERS
-static int compat_perfc_control(struct compat_sysctl_perfc_op *cmp_pc)
-{
-    CHECK_sysctl_perfc_desc;
-    CHECK_TYPE(sysctl_perfc_val);
-    struct xen_sysctl_perfc_op nat_pc;
-    int ret;
-
-#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_) \
-    guest_from_compat_handle((_d_)->desc, (_s_)->desc)
-#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_) \
-    guest_from_compat_handle((_d_)->val, (_s_)->val)
-    XLAT_sysctl_perfc_op(&nat_pc, cmp_pc);
-#undef XLAT_sysctl_perfc_op_HNDL_val
-#undef XLAT_sysctl_perfc_op_HNDL_desc
-    ret = perfc_control(&nat_pc);
-#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_)
-#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_)
-    XLAT_sysctl_perfc_op(cmp_pc, &nat_pc);
-#undef XLAT_sysctl_perfc_op_HNDL_val
-#undef XLAT_sysctl_perfc_op_HNDL_desc
-    return ret;
-}
-#define xen_sysctl_perfc_op            compat_sysctl_perfc_op
-#define xen_sysctl_perfc_op_t          compat_sysctl_perfc_op_t
-#define perfc_control(p)               compat_perfc_control(p)
-#endif
-
-#define COMPAT
-#define _XEN_GUEST_HANDLE(t)           XEN_GUEST_HANDLE(t)
-#define _u_sysctl                      u_sysctl
-#undef guest_handle_cast
-#define guest_handle_cast              compat_handle_cast
-#define copy_to_xxx_offset             copy_to_compat_offset
-typedef int ret_t;
-
-#include "../sysctl.c"
-
-/*
- * Local variables:
- * mode: C
- * c-set-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/domain.c
--- a/xen/common/domain.c       Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/common/domain.c       Wed Jan 24 16:33:19 2007 +0000
@@ -27,9 +27,6 @@
 #include <asm/debugger.h>
 #include <public/sched.h>
 #include <public/vcpu.h>
-#ifdef CONFIG_COMPAT
-#include <compat/domctl.h>
-#endif
 
 /* Both these structures are protected by the domlist_lock. */
 DEFINE_RWLOCK(domlist_lock);
@@ -451,75 +448,6 @@ void domain_unpause_by_systemcontroller(
     }
 }
 
-
-/*
- * set_info_guest is used for final setup, launching, and state modification 
- * of domains other than domain 0. ie. the domains that are being built by 
- * the userspace dom0 domain builder.
- */
-int set_info_guest(struct domain *d,
-                   xen_domctl_vcpucontext_u vcpucontext)
-{
-    int rc = 0;
-    vcpu_guest_context_u c;
-#ifdef CONFIG_COMPAT
-    CHECK_FIELD(domctl_vcpucontext, vcpu);
-#endif
-    unsigned long vcpu = vcpucontext.nat->vcpu;
-    struct vcpu *v;
-
-    if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) )
-        return -EINVAL;
-
-    if ( IS_COMPAT(v->domain)
-         ? compat_handle_is_null(vcpucontext.cmp->ctxt)
-         : guest_handle_is_null(vcpucontext.nat->ctxt) )
-        return vcpu_reset(v);
-
-#ifdef CONFIG_COMPAT
-    BUILD_BUG_ON(sizeof(struct vcpu_guest_context)
-                 < sizeof(struct compat_vcpu_guest_context));
-#endif
-    if ( (c.nat = xmalloc(struct vcpu_guest_context)) == NULL )
-        return -ENOMEM;
-
-    domain_pause(d);
-
-    if ( !IS_COMPAT(v->domain) )
-    {
-        if ( !IS_COMPAT(current->domain)
-             ? copy_from_guest(c.nat, vcpucontext.nat->ctxt, 1)
-#ifndef CONFIG_COMPAT
-             : 0 )
-#else
-             : copy_from_guest(c.nat,
-                               compat_handle_cast(vcpucontext.cmp->ctxt,
-                                                  void),
-                               1) )
-#endif
-            rc = -EFAULT;
-    }
-#ifdef CONFIG_COMPAT
-    else
-    {
-        if ( !IS_COMPAT(current->domain)
-             ? copy_from_guest(c.cmp,
-                               guest_handle_cast(vcpucontext.nat->ctxt, void),
-                               1)
-             : copy_from_compat(c.cmp, vcpucontext.cmp->ctxt, 1) )
-            rc = -EFAULT;
-    }
-#endif
-
-    if ( rc == 0 )
-        rc = arch_set_info_guest(v, c);
-
-    domain_unpause(d);
-
-    xfree(c.nat);
-    return rc;
-}
-
 int boot_vcpu(struct domain *d, int vcpuid, vcpu_guest_context_u ctxt)
 {
     struct vcpu *v = d->vcpu[vcpuid];
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/domctl.c
--- a/xen/common/domctl.c       Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/common/domctl.c       Wed Jan 24 16:33:19 2007 +0000
@@ -19,22 +19,12 @@
 #include <xen/iocap.h>
 #include <xen/guest_access.h>
 #include <xen/bitmap.h>
-#ifdef CONFIG_COMPAT
-#include <xen/compat.h>
-#endif
 #include <asm/current.h>
 #include <public/domctl.h>
 #include <acm/acm_hooks.h>
 
-#ifndef COMPAT
-typedef long ret_t;
-#define copy_to_xxx_offset copy_to_guest_offset
-#endif
-
-extern ret_t arch_do_domctl(
+extern long arch_do_domctl(
     struct xen_domctl *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
-
-#ifndef COMPAT
 
 void cpumask_to_xenctl_cpumap(
     struct xenctl_cpumap *xenctl_cpumap, cpumask_t *cpumask)
@@ -75,8 +65,6 @@ void xenctl_cpumap_to_cpumask(
 
     bitmap_byte_to_long(cpus_addr(*cpumask), bytemap, NR_CPUS);
 }
-
-#endif /* COMPAT */
 
 static inline int is_free_domid(domid_t dom)
 {
@@ -182,9 +170,9 @@ static unsigned int default_vcpu0_locati
     return cpu;
 }
 
-ret_t do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
+long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
 {
-    ret_t ret = 0;
+    long ret = 0;
     struct xen_domctl curop, *op = &curop;
     void *ssid = NULL; /* save security ptr between pre and post/fail hooks */
     static DEFINE_SPINLOCK(domctl_lock);
@@ -209,12 +197,52 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
     case XEN_DOMCTL_setvcpucontext:
     {
         struct domain *d = find_domain_by_id(op->domain);
-        ret = -ESRCH;
-        if ( d != NULL )
-        {
-            ret = set_info_guest(d, &op->u.vcpucontext);
-            put_domain(d);
-        }
+        vcpu_guest_context_u c = { .nat = NULL };
+        unsigned int vcpu = op->u.vcpucontext.vcpu;
+        struct vcpu *v;
+
+        ret = -ESRCH;
+        if ( d == NULL )
+            break;
+
+        ret = -EINVAL;
+        if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) )
+            goto svc_out;
+
+        if ( guest_handle_is_null(op->u.vcpucontext.ctxt) )
+        {
+            ret = vcpu_reset(v);
+            goto svc_out;
+        }
+
+#ifdef CONFIG_COMPAT
+        BUILD_BUG_ON(sizeof(struct vcpu_guest_context)
+                     < sizeof(struct compat_vcpu_guest_context));
+#endif
+        ret = -ENOMEM;
+        if ( (c.nat = xmalloc(struct vcpu_guest_context)) == NULL )
+            goto svc_out;
+
+        if ( !IS_COMPAT(v->domain) )
+            ret = copy_from_guest(c.nat, op->u.vcpucontext.ctxt, 1);
+#ifdef CONFIG_COMPAT
+        else
+            ret = copy_from_guest(c.cmp,
+                                  guest_handle_cast(op->u.vcpucontext.ctxt,
+                                                    void), 1);
+#endif
+        ret = ret ? -EFAULT : 0;
+
+        if ( ret == 0 )
+        {
+            domain_pause(d);
+            ret = arch_set_info_guest(v, c);
+            domain_unpause(d);
+        }
+
+    svc_out:
+        xfree(c.nat);
+        put_domain(d);
     }
     break;
 
@@ -313,32 +341,12 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
         if ( (d = domain_create(dom, domcr_flags)) == NULL )
             break;
 
+#ifdef CONFIG_COMPAT
+        if ( IS_COMPAT(current->domain) && ((ret = switch_compat(d)) != 0) )
+            break;
+#endif
+
         ret = 0;
-        switch ( (op->u.createdomain.flags >> XEN_DOMCTL_CDF_WORDSIZE_SHIFT)
-                 & XEN_DOMCTL_CDF_WORDSIZE_MASK )
-        {
-        case 0:
-            if ( !IS_COMPAT(current->domain) )
-                op->u.createdomain.flags |= BITS_PER_LONG
-                                            << XEN_DOMCTL_CDF_WORDSIZE_SHIFT;
-#ifdef CONFIG_COMPAT
-            else
-            {
-                op->u.createdomain.flags |= COMPAT_BITS_PER_LONG
-                                            << XEN_DOMCTL_CDF_WORDSIZE_SHIFT;
-        case COMPAT_BITS_PER_LONG:
-                ret = switch_compat(d);
-            }
-#endif
-            break;
-        case BITS_PER_LONG:
-            break;
-        default:
-            ret = -EINVAL;
-            break;
-        }
-        if ( ret )
-            break;
 
         memcpy(d->handle, op->u.createdomain.handle,
                sizeof(xen_domain_handle_t));
@@ -501,9 +509,9 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
 
     case XEN_DOMCTL_getvcpucontext:
     { 
-        vcpu_guest_context_u       c;
-        struct domain             *d;
-        struct vcpu               *v;
+        vcpu_guest_context_u c = { .nat = NULL };
+        struct domain       *d;
+        struct vcpu         *v;
 
         ret = -ESRCH;
         if ( (d = find_domain_by_id(op->domain)) == NULL )
@@ -539,35 +547,18 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
             vcpu_unpause(v);
 
         if ( !IS_COMPAT(v->domain) )
-        {
-#ifndef COMPAT
-            if ( copy_to_guest(op->u.vcpucontext.ctxt, c.nat, 1) )
-#else
-            if ( copy_to_guest(compat_handle_cast(op->u.vcpucontext.ctxt,
-                                                  void),
-                               c.nat, 1) )
-#endif
-                ret = -EFAULT;
-        }
+            ret = copy_to_guest(op->u.vcpucontext.ctxt, c.nat, 1);
 #ifdef CONFIG_COMPAT
         else
-        {
-#ifndef COMPAT
-            if ( copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt, void),
-                               c.cmp, 1) )
-#else
-            if ( copy_to_compat(op->u.vcpucontext.ctxt, c.cmp, 1) )
+            ret = copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt,
+                                                  void), c.cmp, 1);
 #endif
-                ret = -EFAULT;
-        }
-#endif
-
+
+        if ( copy_to_guest(u_domctl, op, 1) || ret )
+            ret = -EFAULT;
+
+    getvcpucontext_out:
         xfree(c.nat);
-
-        if ( copy_to_guest(u_domctl, op, 1) )
-            ret = -EFAULT;
-
-    getvcpucontext_out:
         put_domain(d);
     }
     break;
@@ -725,16 +716,6 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom
         }
     }
     break;
-
-#ifdef CONFIG_COMPAT
-    case XEN_DOMCTL_set_compat:
-        ret = switch_compat(find_domain_by_id(op->domain));
-        break;
-
-    case XEN_DOMCTL_set_native:
-        ret = switch_native(find_domain_by_id(op->domain));
-        break;
-#endif
 
     default:
         ret = arch_do_domctl(op, u_domctl);
diff -r a94363b85e19 -r 30af6cfdb05c xen/common/sysctl.c
--- a/xen/common/sysctl.c       Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/common/sysctl.c       Wed Jan 24 16:33:19 2007 +0000
@@ -21,17 +21,12 @@
 #include <asm/current.h>
 #include <public/sysctl.h>
 
-#ifndef COMPAT
-typedef long ret_t;
-#define copy_to_xxx_offset copy_to_guest_offset
-#endif
-
-extern ret_t arch_do_sysctl(
+extern long arch_do_sysctl(
     struct xen_sysctl *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
 
-ret_t do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
+long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
 {
-    ret_t ret = 0;
+    long ret = 0;
     struct xen_sysctl curop, *op = &curop;
     static DEFINE_SPINLOCK(sysctl_lock);
 
@@ -101,8 +96,8 @@ ret_t do_sysctl(XEN_GUEST_HANDLE(xen_sys
 
             put_domain(d);
 
-            if ( copy_to_xxx_offset(op->u.getdomaininfolist.buffer,
-                                    num_domains, &info, 1) )
+            if ( copy_to_guest_offset(op->u.getdomaininfolist.buffer,
+                                      num_domains, &info, 1) )
             {
                 ret = -EFAULT;
                 break;
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/Makefile
--- a/xen/include/Makefile      Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/Makefile      Wed Jan 24 16:33:19 2007 +0000
@@ -6,7 +6,6 @@ headers-y := \
     compat/acm.h \
     compat/acm_ops.h \
     compat/callback.h \
-    compat/domctl.h \
     compat/elfnote.h \
     compat/event_channel.h \
     compat/features.h \
@@ -17,7 +16,6 @@ headers-y := \
     compat/physdev.h \
     compat/platform.h \
     compat/sched.h \
-    compat/sysctl.h \
     compat/trace.h \
     compat/vcpu.h \
     compat/version.h \
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/public/arch-x86/xen-x86_32.h
--- a/xen/include/public/arch-x86/xen-x86_32.h  Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/public/arch-x86/xen-x86_32.h  Wed Jan 24 16:33:19 2007 +0000
@@ -21,7 +21,7 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  *
- * Copyright (c) 2004-2006, K A Fraser
+ * Copyright (c) 2004-2007, K A Fraser
  */
 
 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__
@@ -89,6 +89,23 @@
 #define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
 #endif
 
+/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#undef __DEFINE_XEN_GUEST_HANDLE
+#define __DEFINE_XEN_GUEST_HANDLE(name, type)                   \
+    typedef struct { type *p; }                                 \
+        __guest_handle_ ## name;                                \
+    typedef struct { union { type *p; uint64_aligned_t q; }; }  \
+        __guest_handle_64_ ## name
+#undef set_xen_guest_handle
+#define set_xen_guest_handle(hnd, val)                      \
+    do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0;   \
+         (hnd).p = val;                                     \
+    } while ( 0 )
+#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
+#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
+#endif
+
 #ifndef __ASSEMBLY__
 
 struct cpu_user_regs {
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/public/arch-x86/xen.h
--- a/xen/include/public/arch-x86/xen.h Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/public/arch-x86/xen.h Wed Jan 24 16:33:19 2007 +0000
@@ -43,6 +43,12 @@
 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
 #endif
 
+#if defined(__i386__)
+#include "xen-x86_32.h"
+#elif defined(__x86_64__)
+#include "xen-x86_64.h"
+#endif
+
 #ifndef __ASSEMBLY__
 /* Guest handles for primitive C types. */
 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
@@ -55,12 +61,6 @@ DEFINE_XEN_GUEST_HANDLE(void);
 
 typedef unsigned long xen_pfn_t;
 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
-#endif
-
-#if defined(__i386__)
-#include "xen-x86_32.h"
-#elif defined(__x86_64__)
-#include "xen-x86_64.h"
 #endif
 
 /*
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/public/domctl.h
--- a/xen/include/public/domctl.h       Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/public/domctl.h       Wed Jan 24 16:33:19 2007 +0000
@@ -34,10 +34,10 @@
 
 #include "xen.h"
 
-#define XEN_DOMCTL_INTERFACE_VERSION 0x00000004
+#define XEN_DOMCTL_INTERFACE_VERSION 0x00000005
 
 struct xenctl_cpumap {
-    XEN_GUEST_HANDLE(uint8_t) bitmap;
+    XEN_GUEST_HANDLE_64(uint8_t) bitmap;
     uint32_t nr_cpus;
 };
 
@@ -53,8 +53,6 @@ struct xen_domctl_createdomain {
  /* Is this an HVM guest (as opposed to a PV guest)? */
 #define _XEN_DOMCTL_CDF_hvm_guest 0
 #define XEN_DOMCTL_CDF_hvm_guest  (1U<<_XEN_DOMCTL_CDF_hvm_guest)
-#define XEN_DOMCTL_CDF_WORDSIZE_MASK 255
-#define XEN_DOMCTL_CDF_WORDSIZE_SHIFT 24
     uint32_t flags;
 };
 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t;
@@ -94,10 +92,10 @@ struct xen_domctl_getdomaininfo {
 #define XEN_DOMINF_shutdownmask 255
 #define XEN_DOMINF_shutdownshift 16
     uint32_t flags;              /* XEN_DOMINF_* */
-    uint64_t tot_pages;
-    uint64_t max_pages;
-    uint64_t shared_info_frame;  /* GMFN of shared_info struct */
-    uint64_t cpu_time;
+    uint64_aligned_t tot_pages;
+    uint64_aligned_t max_pages;
+    uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */
+    uint64_aligned_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. */
     uint32_t ssidref;
@@ -111,12 +109,12 @@ struct xen_domctl_getmemlist {
 struct xen_domctl_getmemlist {
     /* IN variables. */
     /* Max entries to write to output buffer. */
-    uint64_t max_pfns;
+    uint64_aligned_t max_pfns;
     /* Start index in guest's page list. */
-    uint64_t start_pfn;
-    XEN_GUEST_HANDLE(xen_pfn_t) buffer;
+    uint64_aligned_t start_pfn;
+    XEN_GUEST_HANDLE_64(uint64_t) buffer;
     /* OUT variables. */
-    uint64_t num_pfns;
+    uint64_aligned_t num_pfns;
 };
 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t);
@@ -137,7 +135,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getme
 
 struct xen_domctl_getpageframeinfo {
     /* IN variables. */
-    uint64_t gmfn;        /* GMFN to query */
+    uint64_aligned_t gmfn; /* GMFN to query */
     /* OUT variables. */
     /* Is the page PINNED to a type? */
     uint32_t type;         /* see above type defs */
@@ -149,9 +147,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpa
 #define XEN_DOMCTL_getpageframeinfo2  8
 struct xen_domctl_getpageframeinfo2 {
     /* IN variables. */
-    uint64_t num;
+    uint64_aligned_t num;
     /* IN/OUT variables. */
-    XEN_GUEST_HANDLE(ulong) array;
+    XEN_GUEST_HANDLE_64(uint32_t) array;
 };
 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t);
@@ -225,8 +223,8 @@ struct xen_domctl_shadow_op {
     uint32_t       mb;       /* Shadow memory allocation in MB */
 
     /* OP_PEEK / OP_CLEAN */
-    XEN_GUEST_HANDLE(ulong) dirty_bitmap;
-    uint64_t       pages;    /* Size of buffer. Updated with actual size. */
+    XEN_GUEST_HANDLE_64(uint8_t) dirty_bitmap;
+    uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */
     struct xen_domctl_shadow_op_stats stats;
 };
 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t;
@@ -236,7 +234,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_shado
 #define XEN_DOMCTL_max_mem           11
 struct xen_domctl_max_mem {
     /* IN variables. */
-    uint64_t max_memkb;
+    uint64_aligned_t max_memkb;
 };
 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t);
@@ -246,7 +244,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_m
 #define XEN_DOMCTL_getvcpucontext    13
 struct xen_domctl_vcpucontext {
     uint32_t              vcpu;                  /* IN */
-    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; /* IN/OUT */
+    XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */
 };
 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t);
@@ -260,7 +258,7 @@ struct xen_domctl_getvcpuinfo {
     uint8_t  online;                  /* currently online (not hotplugged)? */
     uint8_t  blocked;                 /* blocked waiting for an event? */
     uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
+    uint64_aligned_t cpu_time;        /* total cpu time consumed (ns) */
     uint32_t cpu;                     /* current mapping   */
 };
 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t;
@@ -298,9 +296,9 @@ struct xen_domctl_scheduler_op {
     uint32_t cmd;       /* XEN_DOMCTL_SCHEDOP_* */
     union {
         struct xen_domctl_sched_sedf {
-            uint64_t period;
-            uint64_t slice;
-            uint64_t latency;
+            uint64_aligned_t period;
+            uint64_aligned_t slice;
+            uint64_aligned_t latency;
             uint32_t extratime;
             uint32_t weight;
         } sedf;
@@ -341,9 +339,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_p
 
 #define XEN_DOMCTL_iomem_permission  20
 struct xen_domctl_iomem_permission {
-    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? */
+    uint64_aligned_t first_mfn;/* first page (physical page number) in range */
+    uint64_aligned_t nr_mfns;  /* number of pages in range (>0) */
+    uint8_t  allow_access;     /* allow (!0) or deny (0) access to range? */
 };
 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t);
@@ -360,7 +358,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_iopor
 
 #define XEN_DOMCTL_hypercall_init    22
 struct xen_domctl_hypercall_init {
-    uint64_t  gmfn;            /* GMFN to be initialised */
+    uint64_aligned_t  gmfn;           /* GMFN to be initialised */
 };
 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t);
@@ -371,12 +369,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_hyper
 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save)  */
 #define XEN_DOMAINSETUP_query  (1UL<<_XEN_DOMAINSETUP_query)
 typedef struct xen_domctl_arch_setup {
-    uint64_t flags;      /* XEN_DOMAINSETUP_* */
+    uint64_aligned_t flags;  /* XEN_DOMAINSETUP_* */
 #ifdef __ia64__
-    uint64_t bp;            /* mpaddr of boot param area */
-    uint64_t maxmem;        /* Highest memory address for MDT.  */
-    uint64_t xsi_va;        /* Xen shared_info area virtual address.  */
-    uint32_t hypercall_imm; /* Break imm for Xen hypercalls.  */
+    uint64_aligned_t bp;     /* mpaddr of boot param area */
+    uint64_aligned_t maxmem; /* Highest memory address for MDT.  */
+    uint64_aligned_t xsi_va; /* Xen shared_info area virtual address.  */
+    uint32_t hypercall_imm;  /* Break imm for Xen hypercalls.  */
 #endif
 } xen_domctl_arch_setup_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t);
@@ -399,7 +397,7 @@ DEFINE_XEN_GUEST_HANDLE(hvm_domain_conte
 #define XEN_DOMCTL_gethvmcontext   33
 #define XEN_DOMCTL_sethvmcontext   34
 typedef struct xen_domctl_hvmcontext {
-    XEN_GUEST_HANDLE(hvm_domain_context_t) ctxt;  /* IN/OUT */
+    XEN_GUEST_HANDLE_64(hvm_domain_context_t) ctxt;  /* IN/OUT */
 } xen_domctl_hvmcontext_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t);
 
@@ -409,9 +407,6 @@ struct xen_domctl_real_mode_area {
 };
 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t);
-
-#define XEN_DOMCTL_set_compat        42
-#define XEN_DOMCTL_set_native        43
 
 struct xen_domctl {
     uint32_t cmd;
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/public/sysctl.h       Wed Jan 24 16:33:19 2007 +0000
@@ -34,7 +34,7 @@
 #include "xen.h"
 #include "domctl.h"
 
-#define XEN_SYSCTL_INTERFACE_VERSION 0x00000002
+#define XEN_SYSCTL_INTERFACE_VERSION 0x00000003
 
 /*
  * Read console content from Xen buffer ring.
@@ -43,7 +43,7 @@ struct xen_sysctl_readconsole {
 struct xen_sysctl_readconsole {
     /* IN variables. */
     uint32_t clear;                /* Non-zero -> clear after reading. */
-    XEN_GUEST_HANDLE(char) buffer; /* Buffer start */
+    XEN_GUEST_HANDLE_64(char) buffer; /* Buffer start */
     /* IN/OUT variables. */
     uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
 };
@@ -65,7 +65,7 @@ struct xen_sysctl_tbuf_op {
     struct xenctl_cpumap cpu_mask;
     uint32_t             evt_mask;
     /* OUT variables */
-    uint64_t buffer_mfn;
+    uint64_aligned_t buffer_mfn;
     uint32_t size;
 };
 typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t;
@@ -81,9 +81,9 @@ struct xen_sysctl_physinfo {
     uint32_t sockets_per_node;
     uint32_t nr_nodes;
     uint32_t cpu_khz;
-    uint64_t total_pages;
-    uint64_t free_pages;
-    uint64_t scrub_pages;
+    uint64_aligned_t total_pages;
+    uint64_aligned_t free_pages;
+    uint64_aligned_t scrub_pages;
     uint32_t hw_cap[8];
 };
 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t;
@@ -121,9 +121,9 @@ struct xen_sysctl_perfc_op {
     uint32_t       nr_counters;       /*  number of counters description  */
     uint32_t       nr_vals;           /*  number of values  */
     /* counter information (or NULL) */
-    XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc;
+    XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc;
     /* counter values (or NULL) */
-    XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val;
+    XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val;
 };
 typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t);
@@ -133,7 +133,7 @@ struct xen_sysctl_getdomaininfolist {
     /* IN variables. */
     domid_t               first_domain;
     uint32_t              max_domains;
-    XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t) buffer;
+    XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer;
     /* OUT variables. */
     uint32_t              num_domains;
 };
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/public/xen.h
--- a/xen/include/public/xen.h  Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/public/xen.h  Wed Jan 24 16:33:19 2007 +0000
@@ -588,6 +588,16 @@ DEFINE_XEN_GUEST_HANDLE(uint64_t);
 
 #endif /* !__ASSEMBLY__ */
 
+/* Default definitions for macros used by domctl/sysctl. */
+#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#ifndef uint64_aligned_t
+#define uint64_aligned_t uint64_t
+#endif
+#ifndef XEN_GUEST_HANDLE_64
+#define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name)
+#endif
+#endif
+
 #endif /* __XEN_PUBLIC_XEN_H__ */
 
 /*
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/xen/domain.h
--- a/xen/include/xen/domain.h  Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/xen/domain.h  Wed Jan 24 16:33:19 2007 +0000
@@ -18,11 +18,7 @@ void free_domain(struct domain *d);
 void free_domain(struct domain *d);
 
 struct xen_domctl_getdomaininfo;
-void getdomaininfo(
-    struct domain *d, struct xen_domctl_getdomaininfo *info);
-struct compat_domctl_getdomaininfo;
-void compat_getdomaininfo(
-    struct domain *d, struct compat_domctl_getdomaininfo *info);
+void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info);
 
 /*
  * Arch-specifics.
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/xen/sched.h   Wed Jan 24 16:33:19 2007 +0000
@@ -275,13 +275,6 @@ int construct_dom0(
     unsigned long image_start, unsigned long image_len, 
     unsigned long initrd_start, unsigned long initrd_len,
     char *cmdline);
-
-typedef union {
-    struct xen_domctl_vcpucontext *nat;
-    struct compat_domctl_vcpucontext *cmp;
-} xen_domctl_vcpucontext_u __attribute__((__transparent_union__));
-
-int set_info_guest(struct domain *d, xen_domctl_vcpucontext_u);
 
 struct domain *find_domain_by_id(domid_t dom);
 void domain_destroy(struct domain *d);
diff -r a94363b85e19 -r 30af6cfdb05c xen/include/xlat.lst
--- a/xen/include/xlat.lst      Wed Jan 24 15:59:09 2007 +0000
+++ b/xen/include/xlat.lst      Wed Jan 24 16:33:19 2007 +0000
@@ -10,10 +10,6 @@
 !      trap_info                       arch-x86/xen.h
 !      vcpu_guest_context              arch-x86/xen.h
 ?      acm_getdecision                 acm_ops.h
-!      ctl_cpumap                      domctl.h
-!      domctl_scheduler_op             domctl.h
-!      domctl_shadow_op                domctl.h
-!      domctl_shadow_op_stats          domctl.h
 ?      evtchn_alloc_unbound            event_channel.h
 ?      evtchn_bind_interdomain         event_channel.h
 ?      evtchn_bind_ipi                 event_channel.h
@@ -43,9 +39,6 @@
 !      sched_poll                      sched.h
 ?      sched_remote_shutdown           sched.h
 ?      sched_shutdown                  sched.h
-?      sysctl_perfc_desc               sysctl.h
-!      sysctl_perfc_op                 sysctl.h
-!      sysctl_tbuf_op                  sysctl.h
 ?      t_buf                           trace.h
 !      vcpu_runstate_info              vcpu.h
 ?      xenoprof_init                   xenoprof.h

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Make domctl/sysctl interfaces 32-/64-bit invariant., Xen patchbot-unstable <=