debuggers.hg
changeset 13632:30af6cfdb05c
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@xensource.com>
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@xensource.com>
line diff
1.1 --- a/tools/libxc/ia64/xc_ia64_stubs.c Wed Jan 24 15:59:09 2007 +0000 1.2 +++ b/tools/libxc/ia64/xc_ia64_stubs.c Wed Jan 24 16:33:19 2007 +0000 1.3 @@ -74,10 +74,11 @@ xc_ia64_get_pfn_list(int xc_handle, uint 1.4 } 1.5 1.6 int 1.7 -xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, 1.8 +xc_get_pfn_list(int xc_handle, uint32_t domid, uint64_t *pfn_buf, 1.9 unsigned long max_pfns) 1.10 { 1.11 - return xc_ia64_get_pfn_list (xc_handle, domid, pfn_buf, 0, max_pfns); 1.12 + return xc_ia64_get_pfn_list(xc_handle, domid, (xen_pfn_t *)pfn_buf, 1.13 + 0, max_pfns); 1.14 } 1.15 1.16 long 1.17 @@ -86,7 +87,8 @@ xc_get_max_pages(int xc_handle, uint32_t 1.18 struct xen_domctl domctl; 1.19 domctl.cmd = XEN_DOMCTL_getdomaininfo; 1.20 domctl.domain = (domid_t)domid; 1.21 - return (do_domctl(xc_handle, &domctl) < 0) ? -1 : domctl.u.getdomaininfo.max_pages; 1.22 + return ((do_domctl(xc_handle, &domctl) < 0) 1.23 + ? -1 : domctl.u.getdomaininfo.max_pages); 1.24 } 1.25 1.26 /*
2.1 --- a/tools/libxc/powerpc64/utils.c Wed Jan 24 15:59:09 2007 +0000 2.2 +++ b/tools/libxc/powerpc64/utils.c Wed Jan 24 16:33:19 2007 +0000 2.3 @@ -76,7 +76,7 @@ int get_rma_page_array(int xc_handle, in 2.4 DPRINTF("xc_get_pfn_list\n"); 2.5 /* We know that the RMA is machine contiguous so lets just get the 2.6 * first MFN and fill the rest in ourselves */ 2.7 - rc = xc_get_pfn_list(xc_handle, domid, *page_array, 1); 2.8 + rc = xc_get_pfn_list(xc_handle, domid, (uint64_t *)*page_array, 1); 2.9 if (rc == -1) { 2.10 perror("Could not get the page frame list"); 2.11 return -1;
3.1 --- a/tools/libxc/xc_core.c Wed Jan 24 15:59:09 2007 +0000 3.2 +++ b/tools/libxc/xc_core.c Wed Jan 24 16:33:19 2007 +0000 3.3 @@ -28,7 +28,7 @@ xc_domain_dumpcore_via_callback(int xc_h 3.4 dumpcore_rtn_t dump_rtn) 3.5 { 3.6 unsigned long nr_pages; 3.7 - xen_pfn_t *page_array = NULL; 3.8 + uint64_t *page_array = NULL; 3.9 xc_dominfo_t info; 3.10 int i, nr_vcpus = 0; 3.11 char *dump_mem, *dump_mem_start = NULL; 3.12 @@ -70,7 +70,7 @@ xc_domain_dumpcore_via_callback(int xc_h 3.13 sizeof(vcpu_guest_context_t)*nr_vcpus; 3.14 dummy_len = (sizeof(struct xc_core_header) + 3.15 (sizeof(vcpu_guest_context_t) * nr_vcpus) + 3.16 - (nr_pages * sizeof(xen_pfn_t))); 3.17 + (nr_pages * sizeof(*page_array))); 3.18 header.xch_pages_offset = round_pgup(dummy_len); 3.19 3.20 sts = dump_rtn(args, (char *)&header, sizeof(struct xc_core_header)); 3.21 @@ -81,7 +81,7 @@ xc_domain_dumpcore_via_callback(int xc_h 3.22 if ( sts != 0 ) 3.23 goto error_out; 3.24 3.25 - if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL ) 3.26 + if ( (page_array = malloc(nr_pages * sizeof(*page_array))) == NULL ) 3.27 { 3.28 IPRINTF("Could not allocate memory\n"); 3.29 goto error_out; 3.30 @@ -91,7 +91,7 @@ xc_domain_dumpcore_via_callback(int xc_h 3.31 IPRINTF("Could not get the page frame list\n"); 3.32 goto error_out; 3.33 } 3.34 - sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(xen_pfn_t)); 3.35 + sts = dump_rtn(args, (char *)page_array, nr_pages * sizeof(*page_array)); 3.36 if ( sts != 0 ) 3.37 goto error_out; 3.38
4.1 --- a/tools/libxc/xc_domain.c Wed Jan 24 15:59:09 2007 +0000 4.2 +++ b/tools/libxc/xc_domain.c Wed Jan 24 16:33:19 2007 +0000 4.3 @@ -323,7 +323,8 @@ int xc_shadow_control(int xc_handle, 4.4 domctl.u.shadow_op.pages = pages; 4.5 domctl.u.shadow_op.mb = mb ? *mb : 0; 4.6 domctl.u.shadow_op.mode = mode; 4.7 - set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap, dirty_bitmap); 4.8 + set_xen_guest_handle(domctl.u.shadow_op.dirty_bitmap, 4.9 + (uint8_t *)dirty_bitmap); 4.10 4.11 rc = do_domctl(xc_handle, &domctl); 4.12
5.1 --- a/tools/libxc/xc_linux_save.c Wed Jan 24 15:59:09 2007 +0000 5.2 +++ b/tools/libxc/xc_linux_save.c Wed Jan 24 16:33:19 2007 +0000 5.3 @@ -811,8 +811,8 @@ int xc_linux_save(int xc_handle, int io_ 5.4 analysis_phase(xc_handle, dom, max_pfn, to_skip, 0); 5.5 5.6 /* We want zeroed memory so use calloc rather than malloc. */ 5.7 - pfn_type = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type)); 5.8 - pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch)); 5.9 + pfn_type = calloc(MAX_BATCH_SIZE, sizeof(*pfn_type)); 5.10 + pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(*pfn_batch)); 5.11 5.12 if ((pfn_type == NULL) || (pfn_batch == NULL)) { 5.13 ERROR("failed to alloc memory for pfn_type and/or pfn_batch arrays"); 5.14 @@ -976,10 +976,16 @@ int xc_linux_save(int xc_handle, int io_ 5.15 goto out; 5.16 } 5.17 5.18 - if (xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type)) { 5.19 + for ( j = 0; j < batch; j++ ) 5.20 + ((uint32_t *)pfn_type)[i] = pfn_type[i]; 5.21 + if ( xc_get_pfn_type_batch(xc_handle, dom, batch, 5.22 + (uint32_t *)pfn_type) ) 5.23 + { 5.24 ERROR("get_pfn_type_batch failed"); 5.25 goto out; 5.26 } 5.27 + for ( j = batch-1; j >= 0; j-- ) 5.28 + pfn_type[i] = ((uint32_t *)pfn_type)[i]; 5.29 5.30 for ( j = 0; j < batch; j++ ) 5.31 {
6.1 --- a/tools/libxc/xc_private.c Wed Jan 24 15:59:09 2007 +0000 6.2 +++ b/tools/libxc/xc_private.c Wed Jan 24 16:33:19 2007 +0000 6.3 @@ -102,7 +102,7 @@ void unlock_pages(void *addr, size_t len 6.4 6.5 /* NB: arr must be locked */ 6.6 int xc_get_pfn_type_batch(int xc_handle, 6.7 - uint32_t dom, int num, unsigned long *arr) 6.8 + uint32_t dom, int num, uint32_t *arr) 6.9 { 6.10 DECLARE_DOMCTL; 6.11 domctl.cmd = XEN_DOMCTL_getpageframeinfo2; 6.12 @@ -309,7 +309,7 @@ long long xc_domain_get_cpu_usage( int x 6.13 #ifndef __ia64__ 6.14 int xc_get_pfn_list(int xc_handle, 6.15 uint32_t domid, 6.16 - xen_pfn_t *pfn_buf, 6.17 + uint64_t *pfn_buf, 6.18 unsigned long max_pfns) 6.19 { 6.20 DECLARE_DOMCTL; 6.21 @@ -320,10 +320,10 @@ int xc_get_pfn_list(int xc_handle, 6.22 set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf); 6.23 6.24 #ifdef VALGRIND 6.25 - memset(pfn_buf, 0, max_pfns * sizeof(xen_pfn_t)); 6.26 + memset(pfn_buf, 0, max_pfns * sizeof(*pfn_buf)); 6.27 #endif 6.28 6.29 - if ( lock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t)) != 0 ) 6.30 + if ( lock_pages(pfn_buf, max_pfns * sizeof(*pfn_buf)) != 0 ) 6.31 { 6.32 PERROR("xc_get_pfn_list: pfn_buf lock failed"); 6.33 return -1; 6.34 @@ -331,22 +331,7 @@ int xc_get_pfn_list(int xc_handle, 6.35 6.36 ret = do_domctl(xc_handle, &domctl); 6.37 6.38 - unlock_pages(pfn_buf, max_pfns * sizeof(xen_pfn_t)); 6.39 - 6.40 -#if 0 6.41 -#ifdef DEBUG 6.42 - DPRINTF(("Ret for xc_get_pfn_list is %d\n", ret)); 6.43 - if (ret >= 0) { 6.44 - int i, j; 6.45 - for (i = 0; i < domctl.u.getmemlist.num_pfns; i += 16) { 6.46 - DPRINTF("0x%x: ", i); 6.47 - for (j = 0; j < 16; j++) 6.48 - DPRINTF("0x%lx ", pfn_buf[i + j]); 6.49 - DPRINTF("\n"); 6.50 - } 6.51 - } 6.52 -#endif 6.53 -#endif 6.54 + unlock_pages(pfn_buf, max_pfns * sizeof(*pfn_buf)); 6.55 6.56 return (ret < 0) ? -1 : domctl.u.getmemlist.num_pfns; 6.57 }
7.1 --- a/tools/libxc/xc_ptrace.c Wed Jan 24 15:59:09 2007 +0000 7.2 +++ b/tools/libxc/xc_ptrace.c Wed Jan 24 16:33:19 2007 +0000 7.3 @@ -153,8 +153,8 @@ online_vcpus_changed(uint64_t cpumap) 7.4 7.5 /* --------------------- */ 7.6 /* XXX application state */ 7.7 -static long nr_pages = 0; 7.8 -static unsigned long *page_array = NULL; 7.9 +static long nr_pages = 0; 7.10 +static uint64_t *page_array = NULL; 7.11 7.12 7.13 /* 7.14 @@ -170,7 +170,7 @@ static uint64_t 7.15 to_ma(int cpu, uint64_t maddr) 7.16 { 7.17 if ( current_is_hvm && paging_enabled(&ctxt[cpu]) ) 7.18 - maddr = (uint64_t)page_array[maddr >> PAGE_SHIFT] << PAGE_SHIFT; 7.19 + maddr = page_array[maddr >> PAGE_SHIFT] << PAGE_SHIFT; 7.20 return maddr; 7.21 } 7.22 7.23 @@ -360,7 +360,7 @@ map_domain_va( 7.24 if ( nr_pages > 0 ) 7.25 free(page_array); 7.26 nr_pages = npgs; 7.27 - if ( (page_array = malloc(nr_pages * sizeof(unsigned long))) == NULL ) 7.28 + if ( (page_array = malloc(nr_pages * sizeof(*page_array))) == NULL ) 7.29 { 7.30 IPRINTF("Could not allocate memory\n"); 7.31 return NULL;
8.1 --- a/tools/libxc/xc_resume.c Wed Jan 24 15:59:09 2007 +0000 8.2 +++ b/tools/libxc/xc_resume.c Wed Jan 24 16:33:19 2007 +0000 8.3 @@ -58,7 +58,7 @@ static int xc_domain_resume_any(int xc_h 8.4 if ( xc_domain_getinfo(xc_handle, domid, 1, &info) != 1 ) 8.5 { 8.6 PERROR("Could not get domain info"); 8.7 - goto out; 8.8 + return rc; 8.9 } 8.10 8.11 /*
9.1 --- a/tools/libxc/xenctrl.h Wed Jan 24 15:59:09 2007 +0000 9.2 +++ b/tools/libxc/xenctrl.h Wed Jan 24 16:33:19 2007 +0000 9.3 @@ -552,7 +552,7 @@ void *xc_map_foreign_batch(int xc_handle 9.4 unsigned long xc_translate_foreign_address(int xc_handle, uint32_t dom, 9.5 int vcpu, unsigned long long virt); 9.6 9.7 -int xc_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf, 9.8 +int xc_get_pfn_list(int xc_handle, uint32_t domid, uint64_t *pfn_buf, 9.9 unsigned long max_pfns); 9.10 9.11 unsigned long xc_ia64_fpsr_default(void); 9.12 @@ -575,7 +575,7 @@ int xc_mmuext_op(int xc_handle, struct m 9.13 int xc_memory_op(int xc_handle, int cmd, void *arg); 9.14 9.15 int xc_get_pfn_type_batch(int xc_handle, uint32_t dom, 9.16 - int num, unsigned long *arr); 9.17 + int num, uint32_t *arr); 9.18 9.19 9.20 /* Get current total pages allocated to a domain. */
10.1 --- a/xen/arch/ia64/xen/dom0_ops.c Wed Jan 24 15:59:09 2007 +0000 10.2 +++ b/xen/arch/ia64/xen/dom0_ops.c Wed Jan 24 16:33:19 2007 +0000 10.3 @@ -43,7 +43,7 @@ long arch_do_domctl(xen_domctl_t *op, XE 10.4 struct domain *d = find_domain_by_id(op->domain); 10.5 unsigned long start_page = op->u.getmemlist.start_pfn; 10.6 unsigned long nr_pages = op->u.getmemlist.max_pfns; 10.7 - unsigned long mfn; 10.8 + uint64_t mfn; 10.9 10.10 if ( d == NULL ) { 10.11 ret = -EINVAL;
11.1 --- a/xen/arch/ia64/xen/domain.c Wed Jan 24 15:59:09 2007 +0000 11.2 +++ b/xen/arch/ia64/xen/domain.c Wed Jan 24 16:33:19 2007 +0000 11.3 @@ -717,7 +717,7 @@ domain_set_shared_info_va (unsigned long 11.4 } 11.5 11.6 /* Transfer and clear the shadow bitmap in 1kB chunks for L1 cache. */ 11.7 -#define SHADOW_COPY_CHUNK (1024 / sizeof (unsigned long)) 11.8 +#define SHADOW_COPY_CHUNK 1024 11.9 11.10 int shadow_mode_control(struct domain *d, xen_domctl_shadow_op_t *sc) 11.11 { 11.12 @@ -785,7 +785,7 @@ int shadow_mode_control(struct domain *d 11.13 11.14 case XEN_DOMCTL_SHADOW_OP_CLEAN: 11.15 { 11.16 - int nbr_longs; 11.17 + int nbr_bytes; 11.18 11.19 sc->stats.fault_count = atomic64_read(&d->arch.shadow_fault_count); 11.20 sc->stats.dirty_count = atomic64_read(&d->arch.shadow_dirty_count); 11.21 @@ -802,21 +802,21 @@ int shadow_mode_control(struct domain *d 11.22 if (sc->pages > d->arch.shadow_bitmap_size) 11.23 sc->pages = d->arch.shadow_bitmap_size; 11.24 11.25 - nbr_longs = (sc->pages + BITS_PER_LONG - 1) / BITS_PER_LONG; 11.26 + nbr_bytes = (sc->pages + 7) / 8; 11.27 11.28 - for (i = 0; i < nbr_longs; i += SHADOW_COPY_CHUNK) { 11.29 - int size = (nbr_longs - i) > SHADOW_COPY_CHUNK ? 11.30 - SHADOW_COPY_CHUNK : nbr_longs - i; 11.31 + for (i = 0; i < nbr_bytes; i += SHADOW_COPY_CHUNK) { 11.32 + int size = (nbr_bytes - i) > SHADOW_COPY_CHUNK ? 11.33 + SHADOW_COPY_CHUNK : nbr_bytes - i; 11.34 11.35 - if (copy_to_guest_offset(sc->dirty_bitmap, i, 11.36 - d->arch.shadow_bitmap + i, 11.37 - size)) { 11.38 + if (copy_to_guest_offset( 11.39 + sc->dirty_bitmap, i, 11.40 + (uint8_t *)d->arch.shadow_bitmap + i, 11.41 + size)) { 11.42 rc = -EFAULT; 11.43 break; 11.44 } 11.45 11.46 - memset(d->arch.shadow_bitmap + i, 11.47 - 0, size * sizeof(unsigned long)); 11.48 + memset((uint8_t *)d->arch.shadow_bitmap + i, 0, size); 11.49 } 11.50 11.51 break; 11.52 @@ -838,9 +838,9 @@ int shadow_mode_control(struct domain *d 11.53 if (sc->pages > d->arch.shadow_bitmap_size) 11.54 sc->pages = d->arch.shadow_bitmap_size; 11.55 11.56 - size = (sc->pages + BITS_PER_LONG - 1) / BITS_PER_LONG; 11.57 - if (copy_to_guest(sc->dirty_bitmap, 11.58 - d->arch.shadow_bitmap, size)) { 11.59 + size = (sc->pages + 7) / 8; 11.60 + if (copy_to_guest(sc->dirty_bitmap, 11.61 + (uint8_t *)d->arch.shadow_bitmap, size)) { 11.62 rc = -EFAULT; 11.63 break; 11.64 }
12.1 --- a/xen/arch/powerpc/domctl.c Wed Jan 24 15:59:09 2007 +0000 12.2 +++ b/xen/arch/powerpc/domctl.c Wed Jan 24 16:33:19 2007 +0000 12.3 @@ -49,7 +49,7 @@ long arch_do_domctl(struct xen_domctl *d 12.4 int i; 12.5 struct domain *d = find_domain_by_id(domctl->domain); 12.6 unsigned long max_pfns = domctl->u.getmemlist.max_pfns; 12.7 - xen_pfn_t mfn; 12.8 + uint64_t mfn; 12.9 struct list_head *list_ent; 12.10 12.11 ret = -EINVAL;
13.1 --- a/xen/arch/x86/domctl.c Wed Jan 24 15:59:09 2007 +0000 13.2 +++ b/xen/arch/x86/domctl.c Wed Jan 24 16:33:19 2007 +0000 13.3 @@ -24,21 +24,12 @@ 13.4 #include <asm/hvm/support.h> 13.5 #include <asm/processor.h> 13.6 #include <public/hvm/e820.h> 13.7 -#ifdef CONFIG_COMPAT 13.8 -#include <compat/xen.h> 13.9 -#endif 13.10 13.11 -#ifndef COMPAT 13.12 -#define _long long 13.13 -#define copy_from_xxx_offset copy_from_guest_offset 13.14 -#define copy_to_xxx_offset copy_to_guest_offset 13.15 -#endif 13.16 - 13.17 -_long arch_do_domctl( 13.18 +long arch_do_domctl( 13.19 struct xen_domctl *domctl, 13.20 XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) 13.21 { 13.22 - _long ret = 0; 13.23 + long ret = 0; 13.24 13.25 switch ( domctl->cmd ) 13.26 { 13.27 @@ -135,12 +126,11 @@ 13.28 13.29 case XEN_DOMCTL_getpageframeinfo2: 13.30 { 13.31 -#define GPF2_BATCH (PAGE_SIZE / sizeof(_long)) 13.32 int n,j; 13.33 int num = domctl->u.getpageframeinfo2.num; 13.34 domid_t dom = domctl->domain; 13.35 struct domain *d; 13.36 - unsigned _long *l_arr; 13.37 + uint32_t *arr32; 13.38 ret = -ESRCH; 13.39 13.40 if ( unlikely((d = find_domain_by_id(dom)) == NULL) ) 13.41 @@ -153,16 +143,18 @@ 13.42 break; 13.43 } 13.44 13.45 - l_arr = alloc_xenheap_page(); 13.46 + arr32 = alloc_xenheap_page(); 13.47 13.48 ret = 0; 13.49 for ( n = 0; n < num; ) 13.50 { 13.51 - int k = ((num-n)>GPF2_BATCH)?GPF2_BATCH:(num-n); 13.52 + int k = PAGE_SIZE / 4; 13.53 + if ( (num - n) < k ) 13.54 + k = num - n; 13.55 13.56 - if ( copy_from_xxx_offset(l_arr, 13.57 - domctl->u.getpageframeinfo2.array, 13.58 - n, k) ) 13.59 + if ( copy_from_guest_offset(arr32, 13.60 + domctl->u.getpageframeinfo2.array, 13.61 + n, k) ) 13.62 { 13.63 ret = -EINVAL; 13.64 break; 13.65 @@ -171,13 +163,13 @@ 13.66 for ( j = 0; j < k; j++ ) 13.67 { 13.68 struct page_info *page; 13.69 - unsigned _long mfn = l_arr[j]; 13.70 + unsigned long mfn = arr32[j]; 13.71 13.72 page = mfn_to_page(mfn); 13.73 13.74 if ( likely(mfn_valid(mfn) && get_page(page, d)) ) 13.75 { 13.76 - unsigned _long type = 0; 13.77 + unsigned long type = 0; 13.78 13.79 switch( page->u.inuse.type_info & PGT_type_mask ) 13.80 { 13.81 @@ -197,16 +189,16 @@ 13.82 13.83 if ( page->u.inuse.type_info & PGT_pinned ) 13.84 type |= XEN_DOMCTL_PFINFO_LPINTAB; 13.85 - l_arr[j] |= type; 13.86 + arr32[j] |= type; 13.87 put_page(page); 13.88 } 13.89 else 13.90 - l_arr[j] |= XEN_DOMCTL_PFINFO_XTAB; 13.91 + arr32[j] |= XEN_DOMCTL_PFINFO_XTAB; 13.92 13.93 } 13.94 13.95 - if ( copy_to_xxx_offset(domctl->u.getpageframeinfo2.array, 13.96 - n, l_arr, k) ) 13.97 + if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array, 13.98 + n, arr32, k) ) 13.99 { 13.100 ret = -EINVAL; 13.101 break; 13.102 @@ -215,7 +207,7 @@ 13.103 n += k; 13.104 } 13.105 13.106 - free_xenheap_page(l_arr); 13.107 + free_xenheap_page(arr32); 13.108 13.109 put_domain(d); 13.110 } 13.111 @@ -226,7 +218,7 @@ 13.112 int i; 13.113 struct domain *d = find_domain_by_id(domctl->domain); 13.114 unsigned long max_pfns = domctl->u.getmemlist.max_pfns; 13.115 - xen_pfn_t mfn; 13.116 + uint64_t mfn; 13.117 struct list_head *list_ent; 13.118 13.119 ret = -EINVAL; 13.120 @@ -241,8 +233,8 @@ 13.121 { 13.122 mfn = page_to_mfn(list_entry( 13.123 list_ent, struct page_info, list)); 13.124 - if ( copy_to_xxx_offset(domctl->u.getmemlist.buffer, 13.125 - i, &mfn, 1) ) 13.126 + if ( copy_to_guest_offset(domctl->u.getmemlist.buffer, 13.127 + i, &mfn, 1) ) 13.128 { 13.129 ret = -EFAULT; 13.130 break; 13.131 @@ -311,13 +303,7 @@ 13.132 13.133 ret = -EFAULT; 13.134 13.135 -#ifndef COMPAT 13.136 if ( copy_from_guest(c, domctl->u.hvmcontext.ctxt, 1) != 0 ) 13.137 -#else 13.138 - if ( copy_from_guest(c, 13.139 - compat_handle_cast(domctl->u.hvmcontext.ctxt, void), 13.140 - 1) != 0 ) 13.141 -#endif 13.142 goto sethvmcontext_out; 13.143 13.144 ret = arch_sethvm_ctxt(v, c); 13.145 @@ -354,14 +340,8 @@ 13.146 if (arch_gethvm_ctxt(v, c) == -1) 13.147 ret = -EFAULT; 13.148 13.149 -#ifndef COMPAT 13.150 if ( copy_to_guest(domctl->u.hvmcontext.ctxt, c, 1) ) 13.151 -#else 13.152 - if ( copy_to_guest(compat_handle_cast(domctl->u.hvmcontext.ctxt, 13.153 - void), 13.154 - c, 1) ) 13.155 ret = -EFAULT; 13.156 -#endif 13.157 13.158 xfree(c); 13.159 13.160 @@ -382,7 +362,6 @@ 13.161 return ret; 13.162 } 13.163 13.164 -#ifndef COMPAT 13.165 void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) 13.166 { 13.167 #ifdef CONFIG_COMPAT 13.168 @@ -396,9 +375,7 @@ void arch_get_info_guest(struct vcpu *v, 13.169 memcpy(c.nat, &v->arch.guest_context, sizeof(*c.nat)); 13.170 #ifdef CONFIG_COMPAT 13.171 else 13.172 - { 13.173 XLAT_vcpu_guest_context(c.cmp, &v->arch.guest_context); 13.174 - } 13.175 #endif 13.176 13.177 if ( is_hvm_vcpu(v) ) 13.178 @@ -446,7 +423,6 @@ void arch_get_info_guest(struct vcpu *v, 13.179 c(vm_assist = v->domain->vm_assist); 13.180 #undef c 13.181 } 13.182 -#endif 13.183 13.184 /* 13.185 * Local variables:
14.1 --- a/xen/arch/x86/mm/shadow/common.c Wed Jan 24 15:59:09 2007 +0000 14.2 +++ b/xen/arch/x86/mm/shadow/common.c Wed Jan 24 16:33:19 2007 +0000 14.3 @@ -3191,19 +3191,16 @@ static int shadow_log_dirty_op( 14.4 if ( likely(peek) ) 14.5 { 14.6 if ( copy_to_guest_offset( 14.7 - sc->dirty_bitmap, 14.8 - i/(8*sizeof(unsigned long)), 14.9 - d->arch.shadow.dirty_bitmap+(i/(8*sizeof(unsigned long))), 14.10 - (bytes+sizeof(unsigned long)-1) / sizeof(unsigned long)) ) 14.11 + sc->dirty_bitmap, i/8, 14.12 + (uint8_t *)d->arch.shadow.dirty_bitmap + (i/8), bytes) ) 14.13 { 14.14 - rv = -EFAULT; 14.15 - goto out; 14.16 + rv = -EFAULT; 14.17 + goto out; 14.18 } 14.19 } 14.20 14.21 if ( clean ) 14.22 - memset(d->arch.shadow.dirty_bitmap + (i/(8*sizeof(unsigned long))), 14.23 - 0, bytes); 14.24 + memset((uint8_t *)d->arch.shadow.dirty_bitmap + (i/8), 0, bytes); 14.25 } 14.26 #undef CHUNK 14.27
15.1 --- a/xen/arch/x86/sysctl.c Wed Jan 24 15:59:09 2007 +0000 15.2 +++ b/xen/arch/x86/sysctl.c Wed Jan 24 16:33:19 2007 +0000 15.3 @@ -25,14 +25,10 @@ 15.4 #include <asm/hvm/support.h> 15.5 #include <asm/processor.h> 15.6 15.7 -#ifndef COMPAT 15.8 -typedef long ret_t; 15.9 -#endif 15.10 - 15.11 -ret_t arch_do_sysctl( 15.12 +long arch_do_sysctl( 15.13 struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) 15.14 { 15.15 - ret_t ret = 0; 15.16 + long ret = 0; 15.17 15.18 switch ( sysctl->cmd ) 15.19 {
16.1 --- a/xen/arch/x86/x86_64/Makefile Wed Jan 24 15:59:09 2007 +0000 16.2 +++ b/xen/arch/x86/x86_64/Makefile Wed Jan 24 16:33:19 2007 +0000 16.3 @@ -5,10 +5,8 @@ obj-y += traps.o 16.4 16.5 obj-$(CONFIG_COMPAT) += compat.o 16.6 obj-$(CONFIG_COMPAT) += domain.o 16.7 -obj-$(CONFIG_COMPAT) += domctl.o 16.8 obj-$(CONFIG_COMPAT) += physdev.o 16.9 obj-$(CONFIG_COMPAT) += platform_hypercall.o 16.10 -obj-$(CONFIG_COMPAT) += sysctl.o 16.11 16.12 ifeq ($(CONFIG_COMPAT),y) 16.13 # extra dependencies
17.1 --- a/xen/arch/x86/x86_64/compat/entry.S Wed Jan 24 15:59:09 2007 +0000 17.2 +++ b/xen/arch/x86/x86_64/compat/entry.S Wed Jan 24 16:33:19 2007 +0000 17.3 @@ -276,6 +276,9 @@ CFIX14: 17.4 .quad CFLT14,CFIX14 17.5 .previous 17.6 17.7 +compat_domctl: 17.8 +compat_sysctl: 17.9 + 17.10 .section .rodata, "a", @progbits 17.11 17.12 ENTRY(compat_hypercall_table) 17.13 @@ -314,8 +317,8 @@ ENTRY(compat_hypercall_table) 17.14 .quad do_event_channel_op 17.15 .quad compat_physdev_op 17.16 .quad do_hvm_op 17.17 - .quad compat_sysctl /* 35 */ 17.18 - .quad compat_domctl 17.19 + .quad do_sysctl /* 35 */ 17.20 + .quad do_domctl 17.21 .quad compat_kexec_op 17.22 .rept NR_hypercalls-((.-compat_hypercall_table)/8) 17.23 .quad compat_ni_hypercall
18.1 --- a/xen/arch/x86/x86_64/domctl.c Wed Jan 24 15:59:09 2007 +0000 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,111 +0,0 @@ 18.4 -/****************************************************************************** 18.5 - * Arch-specific compatibility domctl.c 18.6 - */ 18.7 - 18.8 -#include <xen/config.h> 18.9 -#include <compat/domctl.h> 18.10 -#include <xen/guest_access.h> 18.11 -#include <asm/shadow.h> 18.12 - 18.13 -DEFINE_XEN_GUEST_HANDLE(compat_domctl_t); 18.14 -#define xen_domctl compat_domctl 18.15 -#define xen_domctl_t compat_domctl_t 18.16 -#define arch_do_domctl(x, h) arch_compat_domctl(x, _##h) 18.17 - 18.18 -static int compat_shadow_domctl(struct domain *d, 18.19 - compat_domctl_shadow_op_t *csc, 18.20 - XEN_GUEST_HANDLE(void) u_domctl) 18.21 -{ 18.22 - xen_domctl_shadow_op_t nsc; 18.23 - int rc, mode; 18.24 - 18.25 -#define XLAT_domctl_shadow_op_HNDL_dirty_bitmap(_d_, _s_) \ 18.26 - do \ 18.27 - { \ 18.28 - if ( (_s_)->op != XEN_DOMCTL_SHADOW_OP_CLEAN \ 18.29 - && (_s_)->op != XEN_DOMCTL_SHADOW_OP_PEEK ) \ 18.30 - { \ 18.31 - set_xen_guest_handle((_d_)->dirty_bitmap, NULL); \ 18.32 - mode = -1; \ 18.33 - } \ 18.34 - else if ( compat_handle_is_null((_s_)->dirty_bitmap) \ 18.35 - || (((_s_)->pages - 1) \ 18.36 - & (BITS_PER_LONG - COMPAT_BITS_PER_LONG)) \ 18.37 - == BITS_PER_LONG - COMPAT_BITS_PER_LONG ) \ 18.38 - { \ 18.39 - XEN_GUEST_HANDLE(void) tmp; \ 18.40 - guest_from_compat_handle(tmp, (_s_)->dirty_bitmap); \ 18.41 - (_d_)->dirty_bitmap = guest_handle_cast(tmp, ulong); \ 18.42 - mode = 0; \ 18.43 - } \ 18.44 - else if ( (_s_)->pages > COMPAT_ARG_XLAT_SIZE * 8 ) \ 18.45 - { \ 18.46 - printk("Cannot translate compatibility mode XEN_DOMCTL_SHADOW_OP_{CLEAN,PEEK} (0x%lX)\n", \ 18.47 - (_s_)->pages); \ 18.48 - return -E2BIG; \ 18.49 - } \ 18.50 - else \ 18.51 - { \ 18.52 - set_xen_guest_handle((_d_)->dirty_bitmap, \ 18.53 - (void *)COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id)); \ 18.54 - mode = 1; \ 18.55 - } \ 18.56 - } while (0) 18.57 - XLAT_domctl_shadow_op(&nsc, csc); 18.58 -#undef XLAT_domctl_shadow_op_HNDL_dirty_bitmap 18.59 - rc = shadow_domctl(d, &nsc, u_domctl); 18.60 - if ( rc != __HYPERVISOR_domctl ) 18.61 - { 18.62 - BUG_ON(rc > 0); 18.63 -#define XLAT_domctl_shadow_op_HNDL_dirty_bitmap(_d_, _s_) \ 18.64 - do \ 18.65 - { \ 18.66 - if ( rc == 0 \ 18.67 - && mode > 0 \ 18.68 - && copy_to_compat((_d_)->dirty_bitmap, \ 18.69 - (unsigned int *)(_s_)->dirty_bitmap.p, \ 18.70 - ((_s_)->pages + COMPAT_BITS_PER_LONG - 1) / COMPAT_BITS_PER_LONG) ) \ 18.71 - rc = -EFAULT; \ 18.72 - } while (0) 18.73 - XLAT_domctl_shadow_op(csc, &nsc); 18.74 -#undef XLAT_domctl_shadow_op_HNDL_dirty_bitmap 18.75 - } 18.76 - return rc; 18.77 -} 18.78 -#define xen_domctl_shadow_op compat_domctl_shadow_op 18.79 -#define xen_domctl_shadow_op_t compat_domctl_shadow_op_t 18.80 -#define shadow_domctl(d, sc, u) compat_shadow_domctl(d, sc, u) 18.81 - 18.82 -#define xen_domctl_ioport_permission compat_domctl_ioport_permission 18.83 -#define xen_domctl_ioport_permission_t compat_domctl_ioport_permission_t 18.84 - 18.85 -#define xen_domctl_getpageframeinfo compat_domctl_getpageframeinfo 18.86 -#define xen_domctl_getpageframeinfo_t compat_domctl_getpageframeinfo_t 18.87 - 18.88 -#define xen_domctl_getpageframeinfo2 compat_domctl_getpageframeinfo2 18.89 -#define xen_domctl_getpageframeinfo2_t compat_domctl_getpageframeinfo2_t 18.90 - 18.91 -#define xen_domctl_getmemlist compat_domctl_getmemlist 18.92 -#define xen_domctl_getmemlist_t compat_domctl_getmemlist_t 18.93 -#define xen_pfn_t compat_pfn_t 18.94 - 18.95 -#define xen_domctl_hypercall_init compat_domctl_hypercall_init 18.96 -#define xen_domctl_hypercall_init_t compat_domctl_hypercall_init_t 18.97 - 18.98 -#define COMPAT 18.99 -#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) 18.100 -#define _long int 18.101 -#define copy_from_xxx_offset copy_from_compat_offset 18.102 -#define copy_to_xxx_offset copy_to_compat_offset 18.103 - 18.104 -#include "../domctl.c" 18.105 - 18.106 -/* 18.107 - * Local variables: 18.108 - * mode: C 18.109 - * c-set-style: "BSD" 18.110 - * c-basic-offset: 4 18.111 - * tab-width: 4 18.112 - * indent-tabs-mode: nil 18.113 - * End: 18.114 - */
19.1 --- a/xen/arch/x86/x86_64/sysctl.c Wed Jan 24 15:59:09 2007 +0000 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,33 +0,0 @@ 19.4 -/****************************************************************************** 19.5 - * Arch-specific compatibility sysctl.c 19.6 - */ 19.7 - 19.8 -#include <xen/config.h> 19.9 -#include <compat/sysctl.h> 19.10 - 19.11 -DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t); 19.12 -#define xen_sysctl compat_sysctl 19.13 -#define xen_sysctl_t compat_sysctl_t 19.14 -#define arch_do_sysctl(x, h) arch_compat_sysctl(x, _##h) 19.15 - 19.16 -#define xen_sysctl_physinfo compat_sysctl_physinfo 19.17 -#define xen_sysctl_physinfo_t compat_sysctl_physinfo_t 19.18 - 19.19 -#define xen_sysctl_ioport_emulation compat_sysctl_ioport_emulation 19.20 -#define xen_sysctl_ioport_emulation_t compat_sysctl_ioport_emulation_t 19.21 - 19.22 -#define COMPAT 19.23 -#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) 19.24 -typedef int ret_t; 19.25 - 19.26 -#include "../sysctl.c" 19.27 - 19.28 -/* 19.29 - * Local variables: 19.30 - * mode: C 19.31 - * c-set-style: "BSD" 19.32 - * c-basic-offset: 4 19.33 - * tab-width: 4 19.34 - * indent-tabs-mode: nil 19.35 - * End: 19.36 - */
20.1 --- a/xen/common/compat/Makefile Wed Jan 24 15:59:09 2007 +0000 20.2 +++ b/xen/common/compat/Makefile Wed Jan 24 16:33:19 2007 +0000 20.3 @@ -1,13 +1,9 @@ 20.4 obj-y += domain.o 20.5 -obj-y += domctl.o 20.6 obj-y += kernel.o 20.7 obj-y += memory.o 20.8 obj-y += multicall.o 20.9 -obj-y += sysctl.o 20.10 obj-y += xlat.o 20.11 20.12 # extra dependencies 20.13 -domctl.o: ../domctl.c 20.14 kernel.o: ../kernel.c 20.15 multicall.o: ../multicall.c 20.16 -sysctl.o: ../sysctl.c
21.1 --- a/xen/common/compat/domctl.c Wed Jan 24 15:59:09 2007 +0000 21.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 21.3 @@ -1,137 +0,0 @@ 21.4 -/****************************************************************************** 21.5 - * compat/domctl.c 21.6 - */ 21.7 - 21.8 -#include <xen/config.h> 21.9 -#include <compat/domctl.h> 21.10 -#include <xen/sched.h> 21.11 -#include <xen/cpumask.h> 21.12 -#include <asm/uaccess.h> 21.13 - 21.14 -DEFINE_XEN_GUEST_HANDLE(compat_domctl_t); 21.15 -#define xen_domctl compat_domctl 21.16 -#define xen_domctl_t compat_domctl_t 21.17 -#define do_domctl(h) compat_domctl(_##h) 21.18 -#define arch_do_domctl(x, h) arch_compat_domctl(x, _##h) 21.19 - 21.20 -#define xen_domain_handle_t compat_domain_handle_t 21.21 - 21.22 -#define xen_domctl_vcpucontext compat_domctl_vcpucontext 21.23 -#define xen_domctl_vcpucontext_t compat_domctl_vcpucontext_t 21.24 - 21.25 -#define xen_domctl_createdomain compat_domctl_createdomain 21.26 -#define xen_domctl_createdomain_t compat_domctl_createdomain_t 21.27 - 21.28 -#define xen_domctl_max_vcpus compat_domctl_max_vcpus 21.29 -#define xen_domctl_max_vcpus_t compat_domctl_max_vcpus_t 21.30 - 21.31 -static void cpumask_to_compat_ctl_cpumap( 21.32 - struct compat_ctl_cpumap *cmpctl_cpumap, cpumask_t *cpumask) 21.33 -{ 21.34 - unsigned int guest_bytes, copy_bytes, i; 21.35 - /*static const*/ uint8_t zero = 0; 21.36 - 21.37 - if ( compat_handle_is_null(cmpctl_cpumap->bitmap) ) 21.38 - return; 21.39 - 21.40 - guest_bytes = (cmpctl_cpumap->nr_cpus + 7) / 8; 21.41 - copy_bytes = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8); 21.42 - 21.43 - copy_to_compat(cmpctl_cpumap->bitmap, 21.44 - (uint8_t *)cpus_addr(*cpumask), 21.45 - copy_bytes); 21.46 - 21.47 - for ( i = copy_bytes; i < guest_bytes; i++ ) 21.48 - copy_to_compat_offset(cmpctl_cpumap->bitmap, i, &zero, 1); 21.49 -} 21.50 -#define cpumask_to_xenctl_cpumap cpumask_to_compat_ctl_cpumap 21.51 - 21.52 -void compat_ctl_cpumap_to_cpumask( 21.53 - cpumask_t *cpumask, struct compat_ctl_cpumap *cmpctl_cpumap) 21.54 -{ 21.55 - unsigned int guest_bytes, copy_bytes; 21.56 - 21.57 - guest_bytes = (cmpctl_cpumap->nr_cpus + 7) / 8; 21.58 - copy_bytes = min_t(unsigned int, guest_bytes, (NR_CPUS + 7) / 8); 21.59 - 21.60 - cpus_clear(*cpumask); 21.61 - 21.62 - if ( compat_handle_is_null(cmpctl_cpumap->bitmap) ) 21.63 - return; 21.64 - 21.65 - copy_from_compat((uint8_t *)cpus_addr(*cpumask), 21.66 - cmpctl_cpumap->bitmap, 21.67 - copy_bytes); 21.68 -} 21.69 -#define xenctl_cpumap_to_cpumask compat_ctl_cpumap_to_cpumask 21.70 - 21.71 -#define xen_domctl_vcpuaffinity compat_domctl_vcpuaffinity 21.72 -#define xen_domctl_vcpuaffinity_t compat_domctl_vcpuaffinity_t 21.73 - 21.74 -static int compat_sched_adjust(struct domain *d, 21.75 - struct compat_domctl_scheduler_op *cop) 21.76 -{ 21.77 - struct xen_domctl_scheduler_op nop; 21.78 - int ret; 21.79 - enum XLAT_domctl_scheduler_op_u u; 21.80 - 21.81 - switch ( cop->sched_id ) 21.82 - { 21.83 - case XEN_SCHEDULER_SEDF: u = XLAT_domctl_scheduler_op_u_sedf; break; 21.84 - case XEN_SCHEDULER_CREDIT: u = XLAT_domctl_scheduler_op_u_credit; break; 21.85 - default: return -EINVAL; 21.86 - } 21.87 - XLAT_domctl_scheduler_op(&nop, cop); 21.88 - ret = sched_adjust(d, &nop); 21.89 - XLAT_domctl_scheduler_op(cop, &nop); 21.90 - 21.91 - return ret; 21.92 -} 21.93 -#define sched_adjust(d, op) compat_sched_adjust(d, op) 21.94 -#define xen_domctl_scheduler_op compat_domctl_scheduler_op 21.95 -#define xen_domctl_scheduler_op_t compat_domctl_scheduler_op_t 21.96 - 21.97 -#define xen_domctl_getdomaininfo compat_domctl_getdomaininfo 21.98 -#define xen_domctl_getdomaininfo_t compat_domctl_getdomaininfo_t 21.99 -#define getdomaininfo(d, i) compat_getdomaininfo(d, i) 21.100 - 21.101 -#define xen_domctl_getvcpuinfo compat_domctl_getvcpuinfo 21.102 -#define xen_domctl_getvcpuinfo_t compat_domctl_getvcpuinfo_t 21.103 - 21.104 -#define xen_domctl_max_mem compat_domctl_max_mem 21.105 -#define xen_domctl_max_mem_t compat_domctl_max_mem_t 21.106 - 21.107 -#define xen_domctl_setdomainhandle compat_domctl_setdomainhandle 21.108 -#define xen_domctl_setdomainhandle_t compat_domctl_setdomainhandle_t 21.109 - 21.110 -#define xen_domctl_setdebugging compat_domctl_setdebugging 21.111 -#define xen_domctl_setdebugging_t compat_domctl_setdebugging_t 21.112 - 21.113 -#define xen_domctl_irq_permission compat_domctl_irq_permission 21.114 -#define xen_domctl_irq_permission_t compat_domctl_irq_permission_t 21.115 - 21.116 -#define xen_domctl_iomem_permission compat_domctl_iomem_permission 21.117 -#define xen_domctl_iomem_permission_t compat_domctl_iomem_permission_t 21.118 - 21.119 -#define xen_domctl_settimeoffset compat_domctl_settimeoffset 21.120 -#define xen_domctl_settimeoffset_t compat_domctl_settimeoffset_t 21.121 - 21.122 -#define COMPAT 21.123 -#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) 21.124 -#define _u_domctl u_domctl 21.125 -//#undef guest_handle_cast 21.126 -//#define guest_handle_cast compat_handle_cast 21.127 -//#define copy_to_xxx_offset copy_to_compat_offset 21.128 -typedef int ret_t; 21.129 - 21.130 -#include "../domctl.c" 21.131 - 21.132 -/* 21.133 - * Local variables: 21.134 - * mode: C 21.135 - * c-set-style: "BSD" 21.136 - * c-basic-offset: 4 21.137 - * tab-width: 4 21.138 - * indent-tabs-mode: nil 21.139 - * End: 21.140 - */
22.1 --- a/xen/common/compat/sysctl.c Wed Jan 24 15:59:09 2007 +0000 22.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 22.3 @@ -1,95 +0,0 @@ 22.4 -/****************************************************************************** 22.5 - * compat/sysctl.c 22.6 - */ 22.7 - 22.8 -#include <xen/config.h> 22.9 -#include <compat/sysctl.h> 22.10 -#include <xen/domain.h> 22.11 -#include <xen/guest_access.h> 22.12 -#include <xen/perfc.h> 22.13 -#include <xen/trace.h> 22.14 - 22.15 -DEFINE_XEN_GUEST_HANDLE(compat_sysctl_t); 22.16 -#define xen_sysctl compat_sysctl 22.17 -#define xen_sysctl_t compat_sysctl_t 22.18 -#define do_sysctl(h) compat_sysctl(_##h) 22.19 -#define arch_do_sysctl(x, h) arch_compat_sysctl(x, _##h) 22.20 - 22.21 -#define xen_sysctl_readconsole compat_sysctl_readconsole 22.22 -#define xen_sysctl_readconsole_t compat_sysctl_readconsole_t 22.23 - 22.24 -static int compat_tb_control(struct compat_sysctl_tbuf_op *cmp_tbc) 22.25 -{ 22.26 - struct xen_sysctl_tbuf_op nat_tbc; 22.27 - int ret; 22.28 - 22.29 -#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) \ 22.30 - guest_from_compat_handle((_d_)->bitmap, (_s_)->bitmap) 22.31 - XLAT_sysctl_tbuf_op(&nat_tbc, cmp_tbc); 22.32 -#undef XLAT_ctl_cpumap_HNDL_bitmap 22.33 - ret = tb_control(&nat_tbc); 22.34 -#define XLAT_ctl_cpumap_HNDL_bitmap(_d_, _s_) ((void)0) 22.35 - XLAT_sysctl_tbuf_op(cmp_tbc, &nat_tbc); 22.36 -#undef XLAT_ctl_cpumap_HNDL_bitmap 22.37 - return ret; 22.38 -} 22.39 -#define xen_sysctl_tbuf_op compat_sysctl_tbuf_op 22.40 -#define xen_sysctl_tbuf_op_t compat_sysctl_tbuf_op_t 22.41 -#define tb_control(p) compat_tb_control(p) 22.42 - 22.43 -#define xen_sysctl_sched_id compat_sysctl_sched_id 22.44 -#define xen_sysctl_sched_id_t compat_sysctl_sched_id_t 22.45 - 22.46 -#define xen_sysctl_getdomaininfolist compat_sysctl_getdomaininfolist 22.47 -#define xen_sysctl_getdomaininfolist_t compat_sysctl_getdomaininfolist_t 22.48 -#define xen_domctl_getdomaininfo compat_domctl_getdomaininfo 22.49 -#define xen_domctl_getdomaininfo_t compat_domctl_getdomaininfo_t 22.50 -#define getdomaininfo(d, i) compat_getdomaininfo(d, i) 22.51 - 22.52 -#ifdef PERF_COUNTERS 22.53 -static int compat_perfc_control(struct compat_sysctl_perfc_op *cmp_pc) 22.54 -{ 22.55 - CHECK_sysctl_perfc_desc; 22.56 - CHECK_TYPE(sysctl_perfc_val); 22.57 - struct xen_sysctl_perfc_op nat_pc; 22.58 - int ret; 22.59 - 22.60 -#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_) \ 22.61 - guest_from_compat_handle((_d_)->desc, (_s_)->desc) 22.62 -#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_) \ 22.63 - guest_from_compat_handle((_d_)->val, (_s_)->val) 22.64 - XLAT_sysctl_perfc_op(&nat_pc, cmp_pc); 22.65 -#undef XLAT_sysctl_perfc_op_HNDL_val 22.66 -#undef XLAT_sysctl_perfc_op_HNDL_desc 22.67 - ret = perfc_control(&nat_pc); 22.68 -#define XLAT_sysctl_perfc_op_HNDL_desc(_d_, _s_) 22.69 -#define XLAT_sysctl_perfc_op_HNDL_val(_d_, _s_) 22.70 - XLAT_sysctl_perfc_op(cmp_pc, &nat_pc); 22.71 -#undef XLAT_sysctl_perfc_op_HNDL_val 22.72 -#undef XLAT_sysctl_perfc_op_HNDL_desc 22.73 - return ret; 22.74 -} 22.75 -#define xen_sysctl_perfc_op compat_sysctl_perfc_op 22.76 -#define xen_sysctl_perfc_op_t compat_sysctl_perfc_op_t 22.77 -#define perfc_control(p) compat_perfc_control(p) 22.78 -#endif 22.79 - 22.80 -#define COMPAT 22.81 -#define _XEN_GUEST_HANDLE(t) XEN_GUEST_HANDLE(t) 22.82 -#define _u_sysctl u_sysctl 22.83 -#undef guest_handle_cast 22.84 -#define guest_handle_cast compat_handle_cast 22.85 -#define copy_to_xxx_offset copy_to_compat_offset 22.86 -typedef int ret_t; 22.87 - 22.88 -#include "../sysctl.c" 22.89 - 22.90 -/* 22.91 - * Local variables: 22.92 - * mode: C 22.93 - * c-set-style: "BSD" 22.94 - * c-basic-offset: 4 22.95 - * tab-width: 4 22.96 - * indent-tabs-mode: nil 22.97 - * End: 22.98 - */
23.1 --- a/xen/common/domain.c Wed Jan 24 15:59:09 2007 +0000 23.2 +++ b/xen/common/domain.c Wed Jan 24 16:33:19 2007 +0000 23.3 @@ -27,9 +27,6 @@ 23.4 #include <asm/debugger.h> 23.5 #include <public/sched.h> 23.6 #include <public/vcpu.h> 23.7 -#ifdef CONFIG_COMPAT 23.8 -#include <compat/domctl.h> 23.9 -#endif 23.10 23.11 /* Both these structures are protected by the domlist_lock. */ 23.12 DEFINE_RWLOCK(domlist_lock); 23.13 @@ -451,75 +448,6 @@ void domain_unpause_by_systemcontroller( 23.14 } 23.15 } 23.16 23.17 - 23.18 -/* 23.19 - * set_info_guest is used for final setup, launching, and state modification 23.20 - * of domains other than domain 0. ie. the domains that are being built by 23.21 - * the userspace dom0 domain builder. 23.22 - */ 23.23 -int set_info_guest(struct domain *d, 23.24 - xen_domctl_vcpucontext_u vcpucontext) 23.25 -{ 23.26 - int rc = 0; 23.27 - vcpu_guest_context_u c; 23.28 -#ifdef CONFIG_COMPAT 23.29 - CHECK_FIELD(domctl_vcpucontext, vcpu); 23.30 -#endif 23.31 - unsigned long vcpu = vcpucontext.nat->vcpu; 23.32 - struct vcpu *v; 23.33 - 23.34 - if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) ) 23.35 - return -EINVAL; 23.36 - 23.37 - if ( IS_COMPAT(v->domain) 23.38 - ? compat_handle_is_null(vcpucontext.cmp->ctxt) 23.39 - : guest_handle_is_null(vcpucontext.nat->ctxt) ) 23.40 - return vcpu_reset(v); 23.41 - 23.42 -#ifdef CONFIG_COMPAT 23.43 - BUILD_BUG_ON(sizeof(struct vcpu_guest_context) 23.44 - < sizeof(struct compat_vcpu_guest_context)); 23.45 -#endif 23.46 - if ( (c.nat = xmalloc(struct vcpu_guest_context)) == NULL ) 23.47 - return -ENOMEM; 23.48 - 23.49 - domain_pause(d); 23.50 - 23.51 - if ( !IS_COMPAT(v->domain) ) 23.52 - { 23.53 - if ( !IS_COMPAT(current->domain) 23.54 - ? copy_from_guest(c.nat, vcpucontext.nat->ctxt, 1) 23.55 -#ifndef CONFIG_COMPAT 23.56 - : 0 ) 23.57 -#else 23.58 - : copy_from_guest(c.nat, 23.59 - compat_handle_cast(vcpucontext.cmp->ctxt, 23.60 - void), 23.61 - 1) ) 23.62 -#endif 23.63 - rc = -EFAULT; 23.64 - } 23.65 -#ifdef CONFIG_COMPAT 23.66 - else 23.67 - { 23.68 - if ( !IS_COMPAT(current->domain) 23.69 - ? copy_from_guest(c.cmp, 23.70 - guest_handle_cast(vcpucontext.nat->ctxt, void), 23.71 - 1) 23.72 - : copy_from_compat(c.cmp, vcpucontext.cmp->ctxt, 1) ) 23.73 - rc = -EFAULT; 23.74 - } 23.75 -#endif 23.76 - 23.77 - if ( rc == 0 ) 23.78 - rc = arch_set_info_guest(v, c); 23.79 - 23.80 - domain_unpause(d); 23.81 - 23.82 - xfree(c.nat); 23.83 - return rc; 23.84 -} 23.85 - 23.86 int boot_vcpu(struct domain *d, int vcpuid, vcpu_guest_context_u ctxt) 23.87 { 23.88 struct vcpu *v = d->vcpu[vcpuid];
24.1 --- a/xen/common/domctl.c Wed Jan 24 15:59:09 2007 +0000 24.2 +++ b/xen/common/domctl.c Wed Jan 24 16:33:19 2007 +0000 24.3 @@ -19,23 +19,13 @@ 24.4 #include <xen/iocap.h> 24.5 #include <xen/guest_access.h> 24.6 #include <xen/bitmap.h> 24.7 -#ifdef CONFIG_COMPAT 24.8 -#include <xen/compat.h> 24.9 -#endif 24.10 #include <asm/current.h> 24.11 #include <public/domctl.h> 24.12 #include <acm/acm_hooks.h> 24.13 24.14 -#ifndef COMPAT 24.15 -typedef long ret_t; 24.16 -#define copy_to_xxx_offset copy_to_guest_offset 24.17 -#endif 24.18 - 24.19 -extern ret_t arch_do_domctl( 24.20 +extern long arch_do_domctl( 24.21 struct xen_domctl *op, XEN_GUEST_HANDLE(xen_domctl_t) u_domctl); 24.22 24.23 -#ifndef COMPAT 24.24 - 24.25 void cpumask_to_xenctl_cpumap( 24.26 struct xenctl_cpumap *xenctl_cpumap, cpumask_t *cpumask) 24.27 { 24.28 @@ -76,8 +66,6 @@ void xenctl_cpumap_to_cpumask( 24.29 bitmap_byte_to_long(cpus_addr(*cpumask), bytemap, NR_CPUS); 24.30 } 24.31 24.32 -#endif /* COMPAT */ 24.33 - 24.34 static inline int is_free_domid(domid_t dom) 24.35 { 24.36 struct domain *d; 24.37 @@ -182,9 +170,9 @@ static unsigned int default_vcpu0_locati 24.38 return cpu; 24.39 } 24.40 24.41 -ret_t do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) 24.42 +long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl) 24.43 { 24.44 - ret_t ret = 0; 24.45 + long ret = 0; 24.46 struct xen_domctl curop, *op = &curop; 24.47 void *ssid = NULL; /* save security ptr between pre and post/fail hooks */ 24.48 static DEFINE_SPINLOCK(domctl_lock); 24.49 @@ -209,12 +197,52 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom 24.50 case XEN_DOMCTL_setvcpucontext: 24.51 { 24.52 struct domain *d = find_domain_by_id(op->domain); 24.53 + vcpu_guest_context_u c = { .nat = NULL }; 24.54 + unsigned int vcpu = op->u.vcpucontext.vcpu; 24.55 + struct vcpu *v; 24.56 + 24.57 ret = -ESRCH; 24.58 - if ( d != NULL ) 24.59 + if ( d == NULL ) 24.60 + break; 24.61 + 24.62 + ret = -EINVAL; 24.63 + if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) ) 24.64 + goto svc_out; 24.65 + 24.66 + if ( guest_handle_is_null(op->u.vcpucontext.ctxt) ) 24.67 { 24.68 - ret = set_info_guest(d, &op->u.vcpucontext); 24.69 - put_domain(d); 24.70 + ret = vcpu_reset(v); 24.71 + goto svc_out; 24.72 } 24.73 + 24.74 +#ifdef CONFIG_COMPAT 24.75 + BUILD_BUG_ON(sizeof(struct vcpu_guest_context) 24.76 + < sizeof(struct compat_vcpu_guest_context)); 24.77 +#endif 24.78 + ret = -ENOMEM; 24.79 + if ( (c.nat = xmalloc(struct vcpu_guest_context)) == NULL ) 24.80 + goto svc_out; 24.81 + 24.82 + if ( !IS_COMPAT(v->domain) ) 24.83 + ret = copy_from_guest(c.nat, op->u.vcpucontext.ctxt, 1); 24.84 +#ifdef CONFIG_COMPAT 24.85 + else 24.86 + ret = copy_from_guest(c.cmp, 24.87 + guest_handle_cast(op->u.vcpucontext.ctxt, 24.88 + void), 1); 24.89 +#endif 24.90 + ret = ret ? -EFAULT : 0; 24.91 + 24.92 + if ( ret == 0 ) 24.93 + { 24.94 + domain_pause(d); 24.95 + ret = arch_set_info_guest(v, c); 24.96 + domain_unpause(d); 24.97 + } 24.98 + 24.99 + svc_out: 24.100 + xfree(c.nat); 24.101 + put_domain(d); 24.102 } 24.103 break; 24.104 24.105 @@ -313,32 +341,12 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom 24.106 if ( (d = domain_create(dom, domcr_flags)) == NULL ) 24.107 break; 24.108 24.109 +#ifdef CONFIG_COMPAT 24.110 + if ( IS_COMPAT(current->domain) && ((ret = switch_compat(d)) != 0) ) 24.111 + break; 24.112 +#endif 24.113 + 24.114 ret = 0; 24.115 - switch ( (op->u.createdomain.flags >> XEN_DOMCTL_CDF_WORDSIZE_SHIFT) 24.116 - & XEN_DOMCTL_CDF_WORDSIZE_MASK ) 24.117 - { 24.118 - case 0: 24.119 - if ( !IS_COMPAT(current->domain) ) 24.120 - op->u.createdomain.flags |= BITS_PER_LONG 24.121 - << XEN_DOMCTL_CDF_WORDSIZE_SHIFT; 24.122 -#ifdef CONFIG_COMPAT 24.123 - else 24.124 - { 24.125 - op->u.createdomain.flags |= COMPAT_BITS_PER_LONG 24.126 - << XEN_DOMCTL_CDF_WORDSIZE_SHIFT; 24.127 - case COMPAT_BITS_PER_LONG: 24.128 - ret = switch_compat(d); 24.129 - } 24.130 -#endif 24.131 - break; 24.132 - case BITS_PER_LONG: 24.133 - break; 24.134 - default: 24.135 - ret = -EINVAL; 24.136 - break; 24.137 - } 24.138 - if ( ret ) 24.139 - break; 24.140 24.141 memcpy(d->handle, op->u.createdomain.handle, 24.142 sizeof(xen_domain_handle_t)); 24.143 @@ -501,9 +509,9 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom 24.144 24.145 case XEN_DOMCTL_getvcpucontext: 24.146 { 24.147 - vcpu_guest_context_u c; 24.148 - struct domain *d; 24.149 - struct vcpu *v; 24.150 + vcpu_guest_context_u c = { .nat = NULL }; 24.151 + struct domain *d; 24.152 + struct vcpu *v; 24.153 24.154 ret = -ESRCH; 24.155 if ( (d = find_domain_by_id(op->domain)) == NULL ) 24.156 @@ -539,35 +547,18 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom 24.157 vcpu_unpause(v); 24.158 24.159 if ( !IS_COMPAT(v->domain) ) 24.160 - { 24.161 -#ifndef COMPAT 24.162 - if ( copy_to_guest(op->u.vcpucontext.ctxt, c.nat, 1) ) 24.163 -#else 24.164 - if ( copy_to_guest(compat_handle_cast(op->u.vcpucontext.ctxt, 24.165 - void), 24.166 - c.nat, 1) ) 24.167 -#endif 24.168 - ret = -EFAULT; 24.169 - } 24.170 + ret = copy_to_guest(op->u.vcpucontext.ctxt, c.nat, 1); 24.171 #ifdef CONFIG_COMPAT 24.172 else 24.173 - { 24.174 -#ifndef COMPAT 24.175 - if ( copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt, void), 24.176 - c.cmp, 1) ) 24.177 -#else 24.178 - if ( copy_to_compat(op->u.vcpucontext.ctxt, c.cmp, 1) ) 24.179 -#endif 24.180 - ret = -EFAULT; 24.181 - } 24.182 + ret = copy_to_guest(guest_handle_cast(op->u.vcpucontext.ctxt, 24.183 + void), c.cmp, 1); 24.184 #endif 24.185 24.186 - xfree(c.nat); 24.187 - 24.188 - if ( copy_to_guest(u_domctl, op, 1) ) 24.189 + if ( copy_to_guest(u_domctl, op, 1) || ret ) 24.190 ret = -EFAULT; 24.191 24.192 getvcpucontext_out: 24.193 + xfree(c.nat); 24.194 put_domain(d); 24.195 } 24.196 break; 24.197 @@ -726,16 +717,6 @@ ret_t do_domctl(XEN_GUEST_HANDLE(xen_dom 24.198 } 24.199 break; 24.200 24.201 -#ifdef CONFIG_COMPAT 24.202 - case XEN_DOMCTL_set_compat: 24.203 - ret = switch_compat(find_domain_by_id(op->domain)); 24.204 - break; 24.205 - 24.206 - case XEN_DOMCTL_set_native: 24.207 - ret = switch_native(find_domain_by_id(op->domain)); 24.208 - break; 24.209 -#endif 24.210 - 24.211 default: 24.212 ret = arch_do_domctl(op, u_domctl); 24.213 break;
25.1 --- a/xen/common/sysctl.c Wed Jan 24 15:59:09 2007 +0000 25.2 +++ b/xen/common/sysctl.c Wed Jan 24 16:33:19 2007 +0000 25.3 @@ -21,17 +21,12 @@ 25.4 #include <asm/current.h> 25.5 #include <public/sysctl.h> 25.6 25.7 -#ifndef COMPAT 25.8 -typedef long ret_t; 25.9 -#define copy_to_xxx_offset copy_to_guest_offset 25.10 -#endif 25.11 - 25.12 -extern ret_t arch_do_sysctl( 25.13 +extern long arch_do_sysctl( 25.14 struct xen_sysctl *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl); 25.15 25.16 -ret_t do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) 25.17 +long do_sysctl(XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl) 25.18 { 25.19 - ret_t ret = 0; 25.20 + long ret = 0; 25.21 struct xen_sysctl curop, *op = &curop; 25.22 static DEFINE_SPINLOCK(sysctl_lock); 25.23 25.24 @@ -101,8 +96,8 @@ ret_t do_sysctl(XEN_GUEST_HANDLE(xen_sys 25.25 25.26 put_domain(d); 25.27 25.28 - if ( copy_to_xxx_offset(op->u.getdomaininfolist.buffer, 25.29 - num_domains, &info, 1) ) 25.30 + if ( copy_to_guest_offset(op->u.getdomaininfolist.buffer, 25.31 + num_domains, &info, 1) ) 25.32 { 25.33 ret = -EFAULT; 25.34 break;
26.1 --- a/xen/include/Makefile Wed Jan 24 15:59:09 2007 +0000 26.2 +++ b/xen/include/Makefile Wed Jan 24 16:33:19 2007 +0000 26.3 @@ -6,7 +6,6 @@ headers-y := \ 26.4 compat/acm.h \ 26.5 compat/acm_ops.h \ 26.6 compat/callback.h \ 26.7 - compat/domctl.h \ 26.8 compat/elfnote.h \ 26.9 compat/event_channel.h \ 26.10 compat/features.h \ 26.11 @@ -17,7 +16,6 @@ headers-y := \ 26.12 compat/physdev.h \ 26.13 compat/platform.h \ 26.14 compat/sched.h \ 26.15 - compat/sysctl.h \ 26.16 compat/trace.h \ 26.17 compat/vcpu.h \ 26.18 compat/version.h \
27.1 --- a/xen/include/public/arch-x86/xen-x86_32.h Wed Jan 24 15:59:09 2007 +0000 27.2 +++ b/xen/include/public/arch-x86/xen-x86_32.h Wed Jan 24 16:33:19 2007 +0000 27.3 @@ -21,7 +21,7 @@ 27.4 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27.5 * DEALINGS IN THE SOFTWARE. 27.6 * 27.7 - * Copyright (c) 2004-2006, K A Fraser 27.8 + * Copyright (c) 2004-2007, K A Fraser 27.9 */ 27.10 27.11 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ 27.12 @@ -89,6 +89,23 @@ 27.13 #define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START) 27.14 #endif 27.15 27.16 +/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */ 27.17 +#if defined(__XEN__) || defined(__XEN_TOOLS__) 27.18 +#undef __DEFINE_XEN_GUEST_HANDLE 27.19 +#define __DEFINE_XEN_GUEST_HANDLE(name, type) \ 27.20 + typedef struct { type *p; } \ 27.21 + __guest_handle_ ## name; \ 27.22 + typedef struct { union { type *p; uint64_aligned_t q; }; } \ 27.23 + __guest_handle_64_ ## name 27.24 +#undef set_xen_guest_handle 27.25 +#define set_xen_guest_handle(hnd, val) \ 27.26 + do { if ( sizeof(hnd) == 8 ) *(uint64_t *)&(hnd) = 0; \ 27.27 + (hnd).p = val; \ 27.28 + } while ( 0 ) 27.29 +#define uint64_aligned_t uint64_t __attribute__((aligned(8))) 27.30 +#define XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name 27.31 +#endif 27.32 + 27.33 #ifndef __ASSEMBLY__ 27.34 27.35 struct cpu_user_regs {
28.1 --- a/xen/include/public/arch-x86/xen.h Wed Jan 24 15:59:09 2007 +0000 28.2 +++ b/xen/include/public/arch-x86/xen.h Wed Jan 24 16:33:19 2007 +0000 28.3 @@ -43,6 +43,12 @@ 28.4 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0) 28.5 #endif 28.6 28.7 +#if defined(__i386__) 28.8 +#include "xen-x86_32.h" 28.9 +#elif defined(__x86_64__) 28.10 +#include "xen-x86_64.h" 28.11 +#endif 28.12 + 28.13 #ifndef __ASSEMBLY__ 28.14 /* Guest handles for primitive C types. */ 28.15 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char); 28.16 @@ -57,12 +63,6 @@ typedef unsigned long xen_pfn_t; 28.17 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); 28.18 #endif 28.19 28.20 -#if defined(__i386__) 28.21 -#include "xen-x86_32.h" 28.22 -#elif defined(__x86_64__) 28.23 -#include "xen-x86_64.h" 28.24 -#endif 28.25 - 28.26 /* 28.27 * SEGMENT DESCRIPTOR TABLES 28.28 */
29.1 --- a/xen/include/public/domctl.h Wed Jan 24 15:59:09 2007 +0000 29.2 +++ b/xen/include/public/domctl.h Wed Jan 24 16:33:19 2007 +0000 29.3 @@ -34,10 +34,10 @@ 29.4 29.5 #include "xen.h" 29.6 29.7 -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000004 29.8 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000005 29.9 29.10 struct xenctl_cpumap { 29.11 - XEN_GUEST_HANDLE(uint8_t) bitmap; 29.12 + XEN_GUEST_HANDLE_64(uint8_t) bitmap; 29.13 uint32_t nr_cpus; 29.14 }; 29.15 29.16 @@ -53,8 +53,6 @@ struct xen_domctl_createdomain { 29.17 /* Is this an HVM guest (as opposed to a PV guest)? */ 29.18 #define _XEN_DOMCTL_CDF_hvm_guest 0 29.19 #define XEN_DOMCTL_CDF_hvm_guest (1U<<_XEN_DOMCTL_CDF_hvm_guest) 29.20 -#define XEN_DOMCTL_CDF_WORDSIZE_MASK 255 29.21 -#define XEN_DOMCTL_CDF_WORDSIZE_SHIFT 24 29.22 uint32_t flags; 29.23 }; 29.24 typedef struct xen_domctl_createdomain xen_domctl_createdomain_t; 29.25 @@ -94,10 +92,10 @@ struct xen_domctl_getdomaininfo { 29.26 #define XEN_DOMINF_shutdownmask 255 29.27 #define XEN_DOMINF_shutdownshift 16 29.28 uint32_t flags; /* XEN_DOMINF_* */ 29.29 - uint64_t tot_pages; 29.30 - uint64_t max_pages; 29.31 - uint64_t shared_info_frame; /* GMFN of shared_info struct */ 29.32 - uint64_t cpu_time; 29.33 + uint64_aligned_t tot_pages; 29.34 + uint64_aligned_t max_pages; 29.35 + uint64_aligned_t shared_info_frame; /* GMFN of shared_info struct */ 29.36 + uint64_aligned_t cpu_time; 29.37 uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ 29.38 uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ 29.39 uint32_t ssidref; 29.40 @@ -111,12 +109,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdo 29.41 struct xen_domctl_getmemlist { 29.42 /* IN variables. */ 29.43 /* Max entries to write to output buffer. */ 29.44 - uint64_t max_pfns; 29.45 + uint64_aligned_t max_pfns; 29.46 /* Start index in guest's page list. */ 29.47 - uint64_t start_pfn; 29.48 - XEN_GUEST_HANDLE(xen_pfn_t) buffer; 29.49 + uint64_aligned_t start_pfn; 29.50 + XEN_GUEST_HANDLE_64(uint64_t) buffer; 29.51 /* OUT variables. */ 29.52 - uint64_t num_pfns; 29.53 + uint64_aligned_t num_pfns; 29.54 }; 29.55 typedef struct xen_domctl_getmemlist xen_domctl_getmemlist_t; 29.56 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getmemlist_t); 29.57 @@ -137,7 +135,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getme 29.58 29.59 struct xen_domctl_getpageframeinfo { 29.60 /* IN variables. */ 29.61 - uint64_t gmfn; /* GMFN to query */ 29.62 + uint64_aligned_t gmfn; /* GMFN to query */ 29.63 /* OUT variables. */ 29.64 /* Is the page PINNED to a type? */ 29.65 uint32_t type; /* see above type defs */ 29.66 @@ -149,9 +147,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpa 29.67 #define XEN_DOMCTL_getpageframeinfo2 8 29.68 struct xen_domctl_getpageframeinfo2 { 29.69 /* IN variables. */ 29.70 - uint64_t num; 29.71 + uint64_aligned_t num; 29.72 /* IN/OUT variables. */ 29.73 - XEN_GUEST_HANDLE(ulong) array; 29.74 + XEN_GUEST_HANDLE_64(uint32_t) array; 29.75 }; 29.76 typedef struct xen_domctl_getpageframeinfo2 xen_domctl_getpageframeinfo2_t; 29.77 DEFINE_XEN_GUEST_HANDLE(xen_domctl_getpageframeinfo2_t); 29.78 @@ -225,8 +223,8 @@ struct xen_domctl_shadow_op { 29.79 uint32_t mb; /* Shadow memory allocation in MB */ 29.80 29.81 /* OP_PEEK / OP_CLEAN */ 29.82 - XEN_GUEST_HANDLE(ulong) dirty_bitmap; 29.83 - uint64_t pages; /* Size of buffer. Updated with actual size. */ 29.84 + XEN_GUEST_HANDLE_64(uint8_t) dirty_bitmap; 29.85 + uint64_aligned_t pages; /* Size of buffer. Updated with actual size. */ 29.86 struct xen_domctl_shadow_op_stats stats; 29.87 }; 29.88 typedef struct xen_domctl_shadow_op xen_domctl_shadow_op_t; 29.89 @@ -236,7 +234,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_shado 29.90 #define XEN_DOMCTL_max_mem 11 29.91 struct xen_domctl_max_mem { 29.92 /* IN variables. */ 29.93 - uint64_t max_memkb; 29.94 + uint64_aligned_t max_memkb; 29.95 }; 29.96 typedef struct xen_domctl_max_mem xen_domctl_max_mem_t; 29.97 DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_mem_t); 29.98 @@ -246,7 +244,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_max_m 29.99 #define XEN_DOMCTL_getvcpucontext 13 29.100 struct xen_domctl_vcpucontext { 29.101 uint32_t vcpu; /* IN */ 29.102 - XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt; /* IN/OUT */ 29.103 + XEN_GUEST_HANDLE_64(vcpu_guest_context_t) ctxt; /* IN/OUT */ 29.104 }; 29.105 typedef struct xen_domctl_vcpucontext xen_domctl_vcpucontext_t; 29.106 DEFINE_XEN_GUEST_HANDLE(xen_domctl_vcpucontext_t); 29.107 @@ -260,7 +258,7 @@ struct xen_domctl_getvcpuinfo { 29.108 uint8_t online; /* currently online (not hotplugged)? */ 29.109 uint8_t blocked; /* blocked waiting for an event? */ 29.110 uint8_t running; /* currently scheduled on its CPU? */ 29.111 - uint64_t cpu_time; /* total cpu time consumed (ns) */ 29.112 + uint64_aligned_t cpu_time; /* total cpu time consumed (ns) */ 29.113 uint32_t cpu; /* current mapping */ 29.114 }; 29.115 typedef struct xen_domctl_getvcpuinfo xen_domctl_getvcpuinfo_t; 29.116 @@ -298,9 +296,9 @@ struct xen_domctl_scheduler_op { 29.117 uint32_t cmd; /* XEN_DOMCTL_SCHEDOP_* */ 29.118 union { 29.119 struct xen_domctl_sched_sedf { 29.120 - uint64_t period; 29.121 - uint64_t slice; 29.122 - uint64_t latency; 29.123 + uint64_aligned_t period; 29.124 + uint64_aligned_t slice; 29.125 + uint64_aligned_t latency; 29.126 uint32_t extratime; 29.127 uint32_t weight; 29.128 } sedf; 29.129 @@ -341,9 +339,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_irq_p 29.130 29.131 #define XEN_DOMCTL_iomem_permission 20 29.132 struct xen_domctl_iomem_permission { 29.133 - uint64_t first_mfn; /* first page (physical page number) in range */ 29.134 - uint64_t nr_mfns; /* number of pages in range (>0) */ 29.135 - uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ 29.136 + uint64_aligned_t first_mfn;/* first page (physical page number) in range */ 29.137 + uint64_aligned_t nr_mfns; /* number of pages in range (>0) */ 29.138 + uint8_t allow_access; /* allow (!0) or deny (0) access to range? */ 29.139 }; 29.140 typedef struct xen_domctl_iomem_permission xen_domctl_iomem_permission_t; 29.141 DEFINE_XEN_GUEST_HANDLE(xen_domctl_iomem_permission_t); 29.142 @@ -360,7 +358,7 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_iopor 29.143 29.144 #define XEN_DOMCTL_hypercall_init 22 29.145 struct xen_domctl_hypercall_init { 29.146 - uint64_t gmfn; /* GMFN to be initialised */ 29.147 + uint64_aligned_t gmfn; /* GMFN to be initialised */ 29.148 }; 29.149 typedef struct xen_domctl_hypercall_init xen_domctl_hypercall_init_t; 29.150 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hypercall_init_t); 29.151 @@ -371,12 +369,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_hyper 29.152 #define _XEN_DOMAINSETUP_query 1 /* Get parameters (for save) */ 29.153 #define XEN_DOMAINSETUP_query (1UL<<_XEN_DOMAINSETUP_query) 29.154 typedef struct xen_domctl_arch_setup { 29.155 - uint64_t flags; /* XEN_DOMAINSETUP_* */ 29.156 + uint64_aligned_t flags; /* XEN_DOMAINSETUP_* */ 29.157 #ifdef __ia64__ 29.158 - uint64_t bp; /* mpaddr of boot param area */ 29.159 - uint64_t maxmem; /* Highest memory address for MDT. */ 29.160 - uint64_t xsi_va; /* Xen shared_info area virtual address. */ 29.161 - uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */ 29.162 + uint64_aligned_t bp; /* mpaddr of boot param area */ 29.163 + uint64_aligned_t maxmem; /* Highest memory address for MDT. */ 29.164 + uint64_aligned_t xsi_va; /* Xen shared_info area virtual address. */ 29.165 + uint32_t hypercall_imm; /* Break imm for Xen hypercalls. */ 29.166 #endif 29.167 } xen_domctl_arch_setup_t; 29.168 DEFINE_XEN_GUEST_HANDLE(xen_domctl_arch_setup_t); 29.169 @@ -399,7 +397,7 @@ DEFINE_XEN_GUEST_HANDLE(hvm_domain_conte 29.170 #define XEN_DOMCTL_gethvmcontext 33 29.171 #define XEN_DOMCTL_sethvmcontext 34 29.172 typedef struct xen_domctl_hvmcontext { 29.173 - XEN_GUEST_HANDLE(hvm_domain_context_t) ctxt; /* IN/OUT */ 29.174 + XEN_GUEST_HANDLE_64(hvm_domain_context_t) ctxt; /* IN/OUT */ 29.175 } xen_domctl_hvmcontext_t; 29.176 DEFINE_XEN_GUEST_HANDLE(xen_domctl_hvmcontext_t); 29.177 29.178 @@ -410,9 +408,6 @@ struct xen_domctl_real_mode_area { 29.179 typedef struct xen_domctl_real_mode_area xen_domctl_real_mode_area_t; 29.180 DEFINE_XEN_GUEST_HANDLE(xen_domctl_real_mode_area_t); 29.181 29.182 -#define XEN_DOMCTL_set_compat 42 29.183 -#define XEN_DOMCTL_set_native 43 29.184 - 29.185 struct xen_domctl { 29.186 uint32_t cmd; 29.187 uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
30.1 --- a/xen/include/public/sysctl.h Wed Jan 24 15:59:09 2007 +0000 30.2 +++ b/xen/include/public/sysctl.h Wed Jan 24 16:33:19 2007 +0000 30.3 @@ -34,7 +34,7 @@ 30.4 #include "xen.h" 30.5 #include "domctl.h" 30.6 30.7 -#define XEN_SYSCTL_INTERFACE_VERSION 0x00000002 30.8 +#define XEN_SYSCTL_INTERFACE_VERSION 0x00000003 30.9 30.10 /* 30.11 * Read console content from Xen buffer ring. 30.12 @@ -43,7 +43,7 @@ 30.13 struct xen_sysctl_readconsole { 30.14 /* IN variables. */ 30.15 uint32_t clear; /* Non-zero -> clear after reading. */ 30.16 - XEN_GUEST_HANDLE(char) buffer; /* Buffer start */ 30.17 + XEN_GUEST_HANDLE_64(char) buffer; /* Buffer start */ 30.18 /* IN/OUT variables. */ 30.19 uint32_t count; /* In: Buffer size; Out: Used buffer size */ 30.20 }; 30.21 @@ -65,7 +65,7 @@ struct xen_sysctl_tbuf_op { 30.22 struct xenctl_cpumap cpu_mask; 30.23 uint32_t evt_mask; 30.24 /* OUT variables */ 30.25 - uint64_t buffer_mfn; 30.26 + uint64_aligned_t buffer_mfn; 30.27 uint32_t size; 30.28 }; 30.29 typedef struct xen_sysctl_tbuf_op xen_sysctl_tbuf_op_t; 30.30 @@ -81,9 +81,9 @@ struct xen_sysctl_physinfo { 30.31 uint32_t sockets_per_node; 30.32 uint32_t nr_nodes; 30.33 uint32_t cpu_khz; 30.34 - uint64_t total_pages; 30.35 - uint64_t free_pages; 30.36 - uint64_t scrub_pages; 30.37 + uint64_aligned_t total_pages; 30.38 + uint64_aligned_t free_pages; 30.39 + uint64_aligned_t scrub_pages; 30.40 uint32_t hw_cap[8]; 30.41 }; 30.42 typedef struct xen_sysctl_physinfo xen_sysctl_physinfo_t; 30.43 @@ -121,9 +121,9 @@ struct xen_sysctl_perfc_op { 30.44 uint32_t nr_counters; /* number of counters description */ 30.45 uint32_t nr_vals; /* number of values */ 30.46 /* counter information (or NULL) */ 30.47 - XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc; 30.48 + XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc; 30.49 /* counter values (or NULL) */ 30.50 - XEN_GUEST_HANDLE(xen_sysctl_perfc_val_t) val; 30.51 + XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val; 30.52 }; 30.53 typedef struct xen_sysctl_perfc_op xen_sysctl_perfc_op_t; 30.54 DEFINE_XEN_GUEST_HANDLE(xen_sysctl_perfc_op_t); 30.55 @@ -133,7 +133,7 @@ struct xen_sysctl_getdomaininfolist { 30.56 /* IN variables. */ 30.57 domid_t first_domain; 30.58 uint32_t max_domains; 30.59 - XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t) buffer; 30.60 + XEN_GUEST_HANDLE_64(xen_domctl_getdomaininfo_t) buffer; 30.61 /* OUT variables. */ 30.62 uint32_t num_domains; 30.63 };
31.1 --- a/xen/include/public/xen.h Wed Jan 24 15:59:09 2007 +0000 31.2 +++ b/xen/include/public/xen.h Wed Jan 24 16:33:19 2007 +0000 31.3 @@ -588,6 +588,16 @@ DEFINE_XEN_GUEST_HANDLE(uint64_t); 31.4 31.5 #endif /* !__ASSEMBLY__ */ 31.6 31.7 +/* Default definitions for macros used by domctl/sysctl. */ 31.8 +#if defined(__XEN__) || defined(__XEN_TOOLS__) 31.9 +#ifndef uint64_aligned_t 31.10 +#define uint64_aligned_t uint64_t 31.11 +#endif 31.12 +#ifndef XEN_GUEST_HANDLE_64 31.13 +#define XEN_GUEST_HANDLE_64(name) XEN_GUEST_HANDLE(name) 31.14 +#endif 31.15 +#endif 31.16 + 31.17 #endif /* __XEN_PUBLIC_XEN_H__ */ 31.18 31.19 /*
32.1 --- a/xen/include/xen/domain.h Wed Jan 24 15:59:09 2007 +0000 32.2 +++ b/xen/include/xen/domain.h Wed Jan 24 16:33:19 2007 +0000 32.3 @@ -18,11 +18,7 @@ struct domain *alloc_domain(domid_t domi 32.4 void free_domain(struct domain *d); 32.5 32.6 struct xen_domctl_getdomaininfo; 32.7 -void getdomaininfo( 32.8 - struct domain *d, struct xen_domctl_getdomaininfo *info); 32.9 -struct compat_domctl_getdomaininfo; 32.10 -void compat_getdomaininfo( 32.11 - struct domain *d, struct compat_domctl_getdomaininfo *info); 32.12 +void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info); 32.13 32.14 /* 32.15 * Arch-specifics.
33.1 --- a/xen/include/xen/sched.h Wed Jan 24 15:59:09 2007 +0000 33.2 +++ b/xen/include/xen/sched.h Wed Jan 24 16:33:19 2007 +0000 33.3 @@ -276,13 +276,6 @@ int construct_dom0( 33.4 unsigned long initrd_start, unsigned long initrd_len, 33.5 char *cmdline); 33.6 33.7 -typedef union { 33.8 - struct xen_domctl_vcpucontext *nat; 33.9 - struct compat_domctl_vcpucontext *cmp; 33.10 -} xen_domctl_vcpucontext_u __attribute__((__transparent_union__)); 33.11 - 33.12 -int set_info_guest(struct domain *d, xen_domctl_vcpucontext_u); 33.13 - 33.14 struct domain *find_domain_by_id(domid_t dom); 33.15 void domain_destroy(struct domain *d); 33.16 void domain_kill(struct domain *d);
34.1 --- a/xen/include/xlat.lst Wed Jan 24 15:59:09 2007 +0000 34.2 +++ b/xen/include/xlat.lst Wed Jan 24 16:33:19 2007 +0000 34.3 @@ -10,10 +10,6 @@ 34.4 ! trap_info arch-x86/xen.h 34.5 ! vcpu_guest_context arch-x86/xen.h 34.6 ? acm_getdecision acm_ops.h 34.7 -! ctl_cpumap domctl.h 34.8 -! domctl_scheduler_op domctl.h 34.9 -! domctl_shadow_op domctl.h 34.10 -! domctl_shadow_op_stats domctl.h 34.11 ? evtchn_alloc_unbound event_channel.h 34.12 ? evtchn_bind_interdomain event_channel.h 34.13 ? evtchn_bind_ipi event_channel.h 34.14 @@ -43,9 +39,6 @@ 34.15 ! sched_poll sched.h 34.16 ? sched_remote_shutdown sched.h 34.17 ? sched_shutdown sched.h 34.18 -? sysctl_perfc_desc sysctl.h 34.19 -! sysctl_perfc_op sysctl.h 34.20 -! sysctl_tbuf_op sysctl.h 34.21 ? t_buf trace.h 34.22 ! vcpu_runstate_info vcpu.h 34.23 ? xenoprof_init xenoprof.h