[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/9] x86/hypercall: Move the hypercall arg tables into C
Editing (and indeed, finding) the hypercall args tables can be tricky, especially towards the end where .rept's are used to maintain the correct layout. Move this all into C, and let the compiler do the hard work. As 0 is the default value, drop all explicit 0's. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> --- xen/arch/x86/Makefile | 1 + xen/arch/x86/hypercall.c | 123 +++++++++++++++++++++++++++++++++++++ xen/arch/x86/x86_64/compat/entry.S | 51 --------------- xen/arch/x86/x86_64/entry.S | 51 --------------- 4 files changed, 124 insertions(+), 102 deletions(-) create mode 100644 xen/arch/x86/hypercall.c diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index b18f033..6dab907 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -28,6 +28,7 @@ obj-y += e820.o obj-y += extable.o obj-y += flushtlb.o obj-$(CONFIG_CRASH_DEBUG) += gdbstub.o +obj-y += hypercall.o obj-y += i387.o obj-y += i8259.o obj-y += io_apic.o diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c new file mode 100644 index 0000000..4b42f86 --- /dev/null +++ b/xen/arch/x86/hypercall.c @@ -0,0 +1,123 @@ +/****************************************************************************** + * arch/x86/hypercall.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; If not, see <http://www.gnu.org/licenses/>. + * + * Copyright (c) 2015,2016 Citrix Systems Ltd. + */ + +#include <xen/hypercall.h> + +#define ARGS(x, n) \ + [ __HYPERVISOR_ ## x ] = (n) + +const uint8_t hypercall_args_table[NR_hypercalls] = +{ + ARGS(set_trap_table, 1), + ARGS(mmu_update, 4), + ARGS(set_gdt, 2), + ARGS(stack_switch, 2), + ARGS(set_callbacks, 3), + ARGS(fpu_taskswitch, 1), + ARGS(sched_op_compat, 2), + ARGS(platform_op, 1), + ARGS(set_debugreg, 2), + ARGS(get_debugreg, 1), + ARGS(update_descriptor, 2), + ARGS(memory_op, 2), + ARGS(multicall, 2), + ARGS(update_va_mapping, 3), + ARGS(set_timer_op, 1), + ARGS(event_channel_op_compat, 1), + ARGS(xen_version, 2), + ARGS(console_io, 3), + ARGS(physdev_op_compat, 1), + ARGS(grant_table_op, 3), + ARGS(vm_assist, 2), + ARGS(update_va_mapping_otherdomain, 4), + ARGS(vcpu_op, 3), + ARGS(set_segment_base, 2), + ARGS(mmuext_op, 4), + ARGS(xsm_op, 1), + ARGS(nmi_op, 2), + ARGS(sched_op, 2), + ARGS(callback_op, 2), + ARGS(xenoprof_op, 2), + ARGS(event_channel_op, 2), + ARGS(physdev_op, 2), + ARGS(hvm_op, 2), + ARGS(sysctl, 1), + ARGS(domctl, 1), + ARGS(kexec_op, 2), + ARGS(tmem_op, 1), + ARGS(xenpmu_op, 2), + ARGS(mca, 1), + ARGS(arch_1, 1), +}; + +const uint8_t compat_hypercall_args_table[NR_hypercalls] = +{ + ARGS(set_trap_table, 1), + ARGS(mmu_update, 4), + ARGS(set_gdt, 2), + ARGS(stack_switch, 2), + ARGS(set_callbacks, 4), + ARGS(fpu_taskswitch, 1), + ARGS(sched_op_compat, 2), + ARGS(platform_op, 1), + ARGS(set_debugreg, 2), + ARGS(get_debugreg, 1), + ARGS(update_descriptor, 4), + ARGS(memory_op, 2), + ARGS(multicall, 2), + ARGS(update_va_mapping, 4), + ARGS(set_timer_op, 2), + ARGS(event_channel_op_compat, 1), + ARGS(xen_version, 2), + ARGS(console_io, 3), + ARGS(physdev_op_compat, 1), + ARGS(grant_table_op, 3), + ARGS(vm_assist, 2), + ARGS(update_va_mapping_otherdomain, 5), + ARGS(vcpu_op, 3), + ARGS(mmuext_op, 4), + ARGS(xsm_op, 1), + ARGS(nmi_op, 2), + ARGS(sched_op, 2), + ARGS(callback_op, 2), + ARGS(xenoprof_op, 2), + ARGS(event_channel_op, 2), + ARGS(physdev_op, 2), + ARGS(hvm_op, 2), + ARGS(sysctl, 1), + ARGS(domctl, 1), + ARGS(kexec_op, 2), + ARGS(tmem_op, 1), + ARGS(xenpmu_op, 2), + ARGS(mca, 1), + ARGS(arch_1, 1), +}; + +#undef ARGS + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ + diff --git a/xen/arch/x86/x86_64/compat/entry.S b/xen/arch/x86/x86_64/compat/entry.S index 89673c4..1a8e085 100644 --- a/xen/arch/x86/x86_64/compat/entry.S +++ b/xen/arch/x86/x86_64/compat/entry.S @@ -477,54 +477,3 @@ ENTRY(compat_hypercall_table) .rept NR_hypercalls-((.-compat_hypercall_table)/8) .quad compat_ni_hypercall .endr - -ENTRY(compat_hypercall_args_table) - .byte 1 /* compat_set_trap_table */ /* 0 */ - .byte 4 /* compat_mmu_update */ - .byte 2 /* compat_set_gdt */ - .byte 2 /* compat_stack_switch */ - .byte 4 /* compat_set_callbacks */ - .byte 1 /* compat_fpu_taskswitch */ /* 5 */ - .byte 2 /* compat_sched_op_compat */ - .byte 1 /* compat_platform_op */ - .byte 2 /* compat_set_debugreg */ - .byte 1 /* compat_get_debugreg */ - .byte 4 /* compat_update_descriptor */ /* 10 */ - .byte 0 /* compat_ni_hypercall */ - .byte 2 /* compat_memory_op */ - .byte 2 /* compat_multicall */ - .byte 4 /* compat_update_va_mapping */ - .byte 2 /* compat_set_timer_op */ /* 15 */ - .byte 1 /* compat_event_channel_op_compat */ - .byte 2 /* compat_xen_version */ - .byte 3 /* compat_console_io */ - .byte 1 /* compat_physdev_op_compat */ - .byte 3 /* compat_grant_table_op */ /* 20 */ - .byte 2 /* compat_vm_assist */ - .byte 5 /* compat_update_va_mapping_otherdomain */ - .byte 0 /* compat_iret */ - .byte 3 /* compat_vcpu_op */ - .byte 0 /* compat_ni_hypercall */ /* 25 */ - .byte 4 /* compat_mmuext_op */ - .byte 1 /* do_xsm_op */ - .byte 2 /* compat_nmi_op */ - .byte 2 /* compat_sched_op */ - .byte 2 /* compat_callback_op */ /* 30 */ - .byte 2 /* compat_xenoprof_op */ - .byte 2 /* compat_event_channel_op */ - .byte 2 /* compat_physdev_op */ - .byte 2 /* do_hvm_op */ - .byte 1 /* do_sysctl */ /* 35 */ - .byte 1 /* do_domctl */ - .byte 2 /* compat_kexec_op */ - .byte 1 /* do_tmem_op */ - .byte 0 /* reserved for XenClient */ - .byte 2 /* do_xenpmu_op */ /* 40 */ - .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table) - .byte 0 /* compat_ni_hypercall */ - .endr - .byte 1 /* do_mca */ - .byte 1 /* paging_domctl_continuation */ - .rept NR_hypercalls-(.-compat_hypercall_args_table) - .byte 0 /* compat_ni_hypercall */ - .endr diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S index ad8c64c..5c6606b 100644 --- a/xen/arch/x86/x86_64/entry.S +++ b/xen/arch/x86/x86_64/entry.S @@ -801,57 +801,6 @@ ENTRY(hypercall_table) .quad do_ni_hypercall .endr -ENTRY(hypercall_args_table) - .byte 1 /* do_set_trap_table */ /* 0 */ - .byte 4 /* do_mmu_update */ - .byte 2 /* do_set_gdt */ - .byte 2 /* do_stack_switch */ - .byte 3 /* do_set_callbacks */ - .byte 1 /* do_fpu_taskswitch */ /* 5 */ - .byte 2 /* do_sched_op_compat */ - .byte 1 /* do_platform_op */ - .byte 2 /* do_set_debugreg */ - .byte 1 /* do_get_debugreg */ - .byte 2 /* do_update_descriptor */ /* 10 */ - .byte 0 /* do_ni_hypercall */ - .byte 2 /* do_memory_op */ - .byte 2 /* do_multicall */ - .byte 3 /* do_update_va_mapping */ - .byte 1 /* do_set_timer_op */ /* 15 */ - .byte 1 /* do_event_channel_op_compat */ - .byte 2 /* do_xen_version */ - .byte 3 /* do_console_io */ - .byte 1 /* do_physdev_op_compat */ - .byte 3 /* do_grant_table_op */ /* 20 */ - .byte 2 /* do_vm_assist */ - .byte 4 /* do_update_va_mapping_otherdomain */ - .byte 0 /* do_iret */ - .byte 3 /* do_vcpu_op */ - .byte 2 /* do_set_segment_base */ /* 25 */ - .byte 4 /* do_mmuext_op */ - .byte 1 /* do_xsm_op */ - .byte 2 /* do_nmi_op */ - .byte 2 /* do_sched_op */ - .byte 2 /* do_callback_op */ /* 30 */ - .byte 2 /* do_xenoprof_op */ - .byte 2 /* do_event_channel_op */ - .byte 2 /* do_physdev_op */ - .byte 2 /* do_hvm_op */ - .byte 1 /* do_sysctl */ /* 35 */ - .byte 1 /* do_domctl */ - .byte 2 /* do_kexec */ - .byte 1 /* do_tmem_op */ - .byte 0 /* reserved for XenClient */ - .byte 2 /* do_xenpmu_op */ /* 40 */ - .rept __HYPERVISOR_arch_0-(.-hypercall_args_table) - .byte 0 /* do_ni_hypercall */ - .endr - .byte 1 /* do_mca */ /* 48 */ - .byte 1 /* paging_domctl_continuation */ - .rept NR_hypercalls-(.-hypercall_args_table) - .byte 0 /* do_ni_hypercall */ - .endr - /* Table of automatically generated entry points. One per vector. */ .section .init.rodata, "a", @progbits GLOBAL(autogen_entrypoints) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |