# HG changeset patch # User kaf24@localhost.localdomain # Node ID e0291e3ed603f5437d1e88c7b746b6617346792c # Parent 2f8a7e5fd8bab112208c7cf51941aaa79afc615f 32-on-64: New set_address_size domctl for switching to compat mode. From: Gerd Hoffmann Signed-off-by: Keir Fraser Index: xen-3.0.4-testing/xen/arch/x86/domctl.c =================================================================== --- xen-3.0.4-testing.orig/xen/arch/x86/domctl.c +++ xen-3.0.4-testing/xen/arch/x86/domctl.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -293,6 +294,46 @@ _long arch_do_domctl( } break; + case XEN_DOMCTL_set_address_size: + { + struct domain *d; + + ret = -ESRCH; + if ( (d = find_domain_by_id(domctl->domain)) == NULL ) + break; + + switch ( domctl->u.address_size.size ) + { +#ifdef CONFIG_COMPAT + case 32: + ret = switch_compat(d); + break; + case 64: + ret = switch_native(d); + break; +#endif + default: + ret = (domctl->u.address_size.size == BITS_PER_LONG) ? 0 : -EINVAL; + break; + } + + put_domain(d); + } + + case XEN_DOMCTL_get_address_size: + { + struct domain *d; + + ret = -ESRCH; + if ( (d = find_domain_by_id(domctl->domain)) == NULL ) + break; + + domctl->u.address_size.size = BITS_PER_GUEST_LONG(d); + + ret = 0; + put_domain(d); + } + default: ret = -ENOSYS; break; Index: xen-3.0.4-testing/xen/include/public/domctl.h =================================================================== --- xen-3.0.4-testing.orig/xen/include/public/domctl.h +++ xen-3.0.4-testing/xen/include/public/domctl.h @@ -387,6 +387,13 @@ struct xen_domctl_settimeoffset { typedef struct xen_domctl_settimeoffset xen_domctl_settimeoffset_t; DEFINE_XEN_GUEST_HANDLE(xen_domctl_settimeoffset_t); +#define XEN_DOMCTL_set_address_size 35 +#define XEN_DOMCTL_get_address_size 36 +typedef struct xen_domctl_address_size { + uint32_t size; +} xen_domctl_address_size_t; +DEFINE_XEN_GUEST_HANDLE(xen_domctl_address_size_t); + #define XEN_DOMCTL_real_mode_area 26 struct xen_domctl_real_mode_area { uint32_t log; /* log2 of Real Mode Area size */ @@ -423,6 +430,7 @@ struct xen_domctl { struct xen_domctl_arch_setup arch_setup; struct xen_domctl_settimeoffset settimeoffset; struct xen_domctl_real_mode_area real_mode_area; + struct xen_domctl_address_size address_size; uint8_t pad[128]; } u; };