[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 04/13] x86: move compat_set_trap_table along side the non-compat variant
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/pv/callback.c | 47 ++++++++++++++++++++++++++++++++++++++ xen/arch/x86/x86_64/compat/traps.c | 44 ----------------------------------- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/xen/arch/x86/pv/callback.c b/xen/arch/x86/pv/callback.c index 0d7641df43..b9dd39bf0e 100644 --- a/xen/arch/x86/pv/callback.c +++ b/xen/arch/x86/pv/callback.c @@ -17,6 +17,7 @@ */ #include <xen/event.h> +#include <xen/hypercall.h> #include <xen/guest_access.h> #include <xen/lib.h> #include <xen/sched.h> @@ -364,6 +365,52 @@ long do_set_trap_table(XEN_GUEST_HANDLE_PARAM(const_trap_info_t) traps) return rc; } +int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) +{ + struct vcpu *curr = current; + struct compat_trap_info cur; + struct trap_info *dst = curr->arch.pv_vcpu.trap_ctxt; + long rc = 0; + + /* If no table is presented then clear the entire virtual IDT. */ + if ( guest_handle_is_null(traps) ) + { + memset(dst, 0, NR_VECTORS * sizeof(*dst)); + init_int80_direct_trap(curr); + return 0; + } + + for ( ; ; ) + { + if ( copy_from_guest(&cur, traps, 1) ) + { + rc = -EFAULT; + break; + } + + if ( cur.address == 0 ) + break; + + fixup_guest_code_selector(curr->domain, cur.cs); + + XLAT_trap_info(dst + cur.vector, &cur); + + if ( cur.vector == 0x80 ) + init_int80_direct_trap(curr); + + guest_handle_add_offset(traps, 1); + + if ( hypercall_preempt_check() ) + { + rc = hypercall_create_continuation( + __HYPERVISOR_set_trap_table, "h", traps); + break; + } + } + + return rc; +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/x86_64/compat/traps.c b/xen/arch/x86/x86_64/compat/traps.c index 9e1ccba646..cade7f2923 100644 --- a/xen/arch/x86/x86_64/compat/traps.c +++ b/xen/arch/x86/x86_64/compat/traps.c @@ -3,50 +3,6 @@ #include <compat/callback.h> #include <compat/arch-x86_32.h> -int compat_set_trap_table(XEN_GUEST_HANDLE(trap_info_compat_t) traps) -{ - struct compat_trap_info cur; - struct trap_info *dst = current->arch.pv_vcpu.trap_ctxt; - long rc = 0; - - /* If no table is presented then clear the entire virtual IDT. */ - if ( guest_handle_is_null(traps) ) - { - memset(dst, 0, NR_VECTORS * sizeof(*dst)); - init_int80_direct_trap(current); - return 0; - } - - for ( ; ; ) - { - if ( copy_from_guest(&cur, traps, 1) ) - { - rc = -EFAULT; - break; - } - - if ( cur.address == 0 ) - break; - - fixup_guest_code_selector(current->domain, cur.cs); - - XLAT_trap_info(dst + cur.vector, &cur); - - if ( cur.vector == 0x80 ) - init_int80_direct_trap(current); - - guest_handle_add_offset(traps, 1); - - if ( hypercall_preempt_check() ) - { - rc = hypercall_create_continuation( - __HYPERVISOR_set_trap_table, "h", traps); - break; - } - } - - return rc; -} /* * Local variables: -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |