From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 7/9] x86/pv: Merge the pv hypercall tables
Date: Mon, 18 Jul 2016 10:51:43 +0100 [thread overview]
Message-ID: <1468835505-7278-8-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1468835505-7278-1-git-send-email-andrew.cooper3@citrix.com>
For the same reason as c/s 33a231e3f "x86/HVM: fold hypercall tables", this
removes the risk of accidentally updating only one of the tables.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
---
xen/arch/x86/hypercall.c | 75 +++++++++---------------------------------------
1 file changed, 13 insertions(+), 62 deletions(-)
diff --git a/xen/arch/x86/hypercall.c b/xen/arch/x86/hypercall.c
index 892012d..b9bd58d 100644
--- a/xen/arch/x86/hypercall.c
+++ b/xen/arch/x86/hypercall.c
@@ -114,64 +114,15 @@ const uint8_t compat_hypercall_args_table[NR_hypercalls] =
#undef ARGS
#define HYPERCALL(x) \
- [ __HYPERVISOR_ ## x ] = (hypercall_fn_t *) do_ ## x
+ [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x, \
+ (hypercall_fn_t *) do_ ## x }
+#define COMPAT_CALL(x) \
+ [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x, \
+ (hypercall_fn_t *) compat_ ## x }
#define do_arch_1 paging_domctl_continuation
-hypercall_fn_t *const hypercall_table[NR_hypercalls] = {
- HYPERCALL(set_trap_table),
- HYPERCALL(mmu_update),
- HYPERCALL(set_gdt),
- HYPERCALL(stack_switch),
- HYPERCALL(set_callbacks),
- HYPERCALL(fpu_taskswitch),
- HYPERCALL(sched_op_compat),
- HYPERCALL(platform_op),
- HYPERCALL(set_debugreg),
- HYPERCALL(get_debugreg),
- HYPERCALL(update_descriptor),
- HYPERCALL(memory_op),
- HYPERCALL(multicall),
- HYPERCALL(update_va_mapping),
- HYPERCALL(set_timer_op),
- HYPERCALL(event_channel_op_compat),
- HYPERCALL(xen_version),
- HYPERCALL(console_io),
- HYPERCALL(physdev_op_compat),
- HYPERCALL(grant_table_op),
- HYPERCALL(vm_assist),
- HYPERCALL(update_va_mapping_otherdomain),
- HYPERCALL(iret),
- HYPERCALL(vcpu_op),
- HYPERCALL(set_segment_base),
- HYPERCALL(mmuext_op),
- HYPERCALL(xsm_op),
- HYPERCALL(nmi_op),
- HYPERCALL(sched_op),
- HYPERCALL(callback_op),
-#ifdef CONFIG_XENOPROF
- HYPERCALL(xenoprof_op),
-#endif
- HYPERCALL(event_channel_op),
- HYPERCALL(physdev_op),
- HYPERCALL(hvm_op),
- HYPERCALL(sysctl),
- HYPERCALL(domctl),
-#ifdef CONFIG_KEXEC
- HYPERCALL(kexec_op),
-#endif
-#ifdef CONFIG_TMEM
- HYPERCALL(tmem_op),
-#endif
- HYPERCALL(xenpmu_op),
- HYPERCALL(mca),
- HYPERCALL(arch_1),
-};
-
-#define COMPAT_CALL(x) \
- [ __HYPERVISOR_ ## x ] = (hypercall_fn_t *) compat_ ## x
-
-hypercall_fn_t *const compat_hypercall_table[NR_hypercalls] = {
+static const hypercall_table_t pv_hypercall_table[NR_hypercalls] = {
COMPAT_CALL(set_trap_table),
HYPERCALL(mmu_update),
COMPAT_CALL(set_gdt),
@@ -236,7 +187,7 @@ long pv_hypercall(struct cpu_user_regs *regs)
ASSERT(curr->arch.flags & TF_kernel_mode);
- if ( (eax >= NR_hypercalls) || !hypercall_table[eax] )
+ if ( (eax >= NR_hypercalls) || !pv_hypercall_table[eax].native )
return -ENOSYS;
if ( !is_pv_32bit_vcpu(curr) )
@@ -267,7 +218,7 @@ long pv_hypercall(struct cpu_user_regs *regs)
__trace_hypercall(TRC_PV_HYPERCALL_V2, eax, args);
}
- ret = hypercall_table[eax](rdi, rsi, rdx, r10, r8, r9);
+ ret = pv_hypercall_table[eax].native(rdi, rsi, rdx, r10, r8, r9);
#ifndef NDEBUG
if ( regs->rip == old_rip )
@@ -314,7 +265,7 @@ long pv_hypercall(struct cpu_user_regs *regs)
__trace_hypercall(TRC_PV_HYPERCALL_V2, eax, args);
}
- ret = compat_hypercall_table[eax](ebx, ecx, edx, esi, edi, ebp);
+ ret = pv_hypercall_table[eax].compat(ebx, ecx, edx, esi, edi, ebp);
#ifndef NDEBUG
if ( regs->rip == old_rip )
@@ -344,8 +295,8 @@ void arch_do_multicall_call(struct mc_state *state)
{
struct multicall_entry *call = &state->call;
- if ( (call->op < NR_hypercalls) && hypercall_table[call->op] )
- call->result = hypercall_table[call->op](
+ if ( (call->op < NR_hypercalls) && pv_hypercall_table[call->op].native )
+ call->result = pv_hypercall_table[call->op].native(
call->args[0], call->args[1], call->args[2],
call->args[3], call->args[4], call->args[5]);
else
@@ -356,8 +307,8 @@ void arch_do_multicall_call(struct mc_state *state)
{
struct compat_multicall_entry *call = &state->compat_call;
- if ( (call->op < NR_hypercalls) && compat_hypercall_table[call->op] )
- call->result = compat_hypercall_table[call->op](
+ if ( (call->op < NR_hypercalls) && pv_hypercall_table[call->op].compat )
+ call->result = pv_hypercall_table[call->op].compat(
call->args[0], call->args[1], call->args[2],
call->args[3], call->args[4], call->args[5]);
else
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-07-18 9:51 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 9:51 [PATCH 0/9] x86: Move the pv hypercall into C Andrew Cooper
2016-07-18 9:51 ` [PATCH 1/9] x86/hypercall: Move some of the hvm hypercall infrastructure into hypercall.h Andrew Cooper
2016-08-02 12:50 ` Jan Beulich
2016-08-02 13:14 ` Andrew Cooper
2016-08-02 13:28 ` Jan Beulich
2016-08-02 14:04 ` Julien Grall
2016-08-02 14:17 ` Jan Beulich
2016-08-02 14:26 ` Julien Grall
2016-08-02 14:54 ` Jan Beulich
2016-08-02 14:59 ` Andrew Cooper
2016-08-02 15:05 ` Jan Beulich
2016-08-02 18:43 ` Stefano Stabellini
2016-08-03 8:53 ` Jan Beulich
2016-08-03 10:55 ` Julien Grall
2016-08-03 18:20 ` Stefano Stabellini
2016-08-04 11:27 ` Julien Grall
2016-07-18 9:51 ` [PATCH 2/9] x86/pv: Support do_set_segment_base() for compat guests Andrew Cooper
2016-08-02 12:52 ` Jan Beulich
2016-08-02 13:25 ` Andrew Cooper
2016-08-02 13:31 ` Jan Beulich
2016-08-02 13:39 ` Andrew Cooper
2016-08-02 13:47 ` Jan Beulich
2016-07-18 9:51 ` [PATCH 3/9] x86/hypercall: Move the hypercall arg tables into C Andrew Cooper
2016-08-02 12:59 ` Jan Beulich
2016-07-18 9:51 ` [PATCH 4/9] x86/pv: Implement pv_hypercall() in C Andrew Cooper
2016-08-02 13:12 ` Jan Beulich
2016-08-02 14:06 ` Andrew Cooper
2016-08-02 14:19 ` Jan Beulich
2016-08-11 11:57 ` Andrew Cooper
2016-08-11 12:20 ` Jan Beulich
2016-07-18 9:51 ` [PATCH 5/9] x86/hypercall: Move the hypercall tables into C Andrew Cooper
2016-08-02 13:23 ` Jan Beulich
2016-08-02 13:30 ` Andrew Cooper
2016-08-02 13:40 ` Jan Beulich
2016-08-11 12:00 ` Andrew Cooper
2016-07-18 9:51 ` [PATCH 6/9] xen/multicall: Rework arch multicall handling Andrew Cooper
2016-07-20 12:35 ` Julien Grall
2016-08-03 15:02 ` Jan Beulich
2016-08-03 15:12 ` Andrew Cooper
2016-07-18 9:51 ` Andrew Cooper [this message]
2016-08-03 15:07 ` [PATCH 7/9] x86/pv: Merge the pv hypercall tables Jan Beulich
2016-08-11 12:36 ` Andrew Cooper
2016-07-18 9:51 ` [PATCH 8/9] x86/hypercall: Merge the hypercall arg tables Andrew Cooper
2016-08-03 15:12 ` Jan Beulich
2016-08-03 15:15 ` Andrew Cooper
2016-08-03 15:28 ` Jan Beulich
2016-07-18 9:51 ` [PATCH 9/9] x86/hypercall: Reduce the size of the hypercall tables Andrew Cooper
2016-08-03 15:17 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1468835505-7278-8-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).