diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-05-12 10:15:07 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-05-12 10:15:07 +0100 |
commit | fb94ee0dddfbed5d759b9bfbc69dd01a40497520 (patch) | |
tree | fa33fbac93e722fd5fa1023b3699260d2e4f4645 /xen/common/compat | |
parent | 286b11f71d43cb6b4779353cbd05376ceee2b609 (diff) | |
download | xen-fb94ee0dddfbed5d759b9bfbc69dd01a40497520.tar.gz xen-fb94ee0dddfbed5d759b9bfbc69dd01a40497520.tar.bz2 xen-fb94ee0dddfbed5d759b9bfbc69dd01a40497520.zip |
x86: fix a few 32-on-64 compat mode issues
- handle VCPUOP_register_vcpu_info and VCPUOP_get_physid (and add
respective layout checks)
- add missing structure size check for struct vcpu_info
- add missing layout check for vcpu_set_periodic_timer
- handle VCPUOP_set_singleshot_timer via argument translation as the
structure sizes differ (due to padding in 64-bits)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/common/compat')
-rw-r--r-- | xen/common/compat/domain.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index 9e58cb145c..fa8e8d9907 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -11,11 +11,15 @@ #include <xen/hypercall.h> #include <compat/vcpu.h> +#define xen_vcpu_set_periodic_timer vcpu_set_periodic_timer +CHECK_vcpu_set_periodic_timer; +#undef xen_vcpu_set_periodic_timer + int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) { struct domain *d = current->domain; struct vcpu *v; - long rc = 0; + int rc = 0; if ( (vcpuid < 0) || (vcpuid >= MAX_VIRT_CPUS) ) return -EINVAL; @@ -57,7 +61,6 @@ int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) case VCPUOP_is_up: case VCPUOP_set_periodic_timer: case VCPUOP_stop_periodic_timer: - case VCPUOP_set_singleshot_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_send_nmi: rc = do_vcpu_op(cmd, vcpuid, arg); @@ -77,6 +80,19 @@ int compat_vcpu_op(int cmd, int vcpuid, XEN_GUEST_HANDLE(void) arg) break; } + case VCPUOP_set_singleshot_timer: + { + struct compat_vcpu_set_singleshot_timer cmp; + struct vcpu_set_singleshot_timer *nat; + + if ( copy_from_guest(&cmp, arg, 1) ) + return -EFAULT; + nat = (void *)COMPAT_ARG_XLAT_VIRT_START(current->vcpu_id); + XLAT_vcpu_set_singleshot_timer(nat, &cmp); + rc = do_vcpu_op(cmd, vcpuid, guest_handle_from_ptr(nat, void)); + break; + } + default: rc = arch_compat_vcpu_op(cmd, v, arg); break; |