ia64/xen-unstable

changeset 9767:46597f27a0f5

[IA64] Hypercall cleanup

Clean up xen_hypercall to query hypercall table instead.

Signed-off-by Kevin Tian <kevin.tian@intel.com>
author awilliam@xenbuild.aw
date Tue Apr 25 22:27:18 2006 -0600 (2006-04-25)
parents ffba1376c4fb
children 63af1c14fa18
files xen/arch/ia64/xen/hypercall.c
line diff
     1.1 --- a/xen/arch/ia64/xen/hypercall.c	Tue Apr 25 22:10:05 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/hypercall.c	Tue Apr 25 22:27:18 2006 -0600
     1.3 @@ -24,6 +24,7 @@
     1.4  #include <xen/irq.h>
     1.5  #include <asm/hw_irq.h>
     1.6  #include <public/physdev.h>
     1.7 +#include <xen/domain.h>
     1.8  
     1.9  extern unsigned long translate_domain_mpaddr(unsigned long);
    1.10  static long do_physdev_op(GUEST_HANDLE(physdev_op_t) uop);
    1.11 @@ -55,7 +56,7 @@ hypercall_t ia64_hypercall_table[] =
    1.12  	(hypercall_t)do_event_channel_op,
    1.13  	(hypercall_t)do_xen_version,
    1.14  	(hypercall_t)do_console_io,
    1.15 -	(hypercall_t)do_physdev_op,          	/* do_physdev_op */
    1.16 +	(hypercall_t)do_physdev_op,
    1.17  	(hypercall_t)do_grant_table_op,						/* 20 */
    1.18  	(hypercall_t)do_ni_hypercall,		/* do_vm_assist */
    1.19  	(hypercall_t)do_ni_hypercall,		/* do_update_va_mapping_otherdomain */
    1.20 @@ -73,67 +74,25 @@ hypercall_t ia64_hypercall_table[] =
    1.21  static int
    1.22  xen_hypercall (struct pt_regs *regs)
    1.23  {
    1.24 -	switch (regs->r2) {
    1.25 -	    case __HYPERVISOR_sched_op_compat:
    1.26 -		regs->r8 = do_sched_op_compat((int) regs->r14,
    1.27 -		                              (unsigned long) regs->r15);
    1.28 -		break;
    1.29 -
    1.30 -	    case __HYPERVISOR_dom0_op:
    1.31 -		regs->r8 = do_dom0_op(guest_handle_from_ptr(regs->r14,
    1.32 -							    dom0_op_t));
    1.33 -		break;
    1.34 -
    1.35 -	    case __HYPERVISOR_memory_op:
    1.36 -		regs->r8 = do_memory_op(regs->r14,
    1.37 -			guest_handle_from_ptr(regs->r15, void));
    1.38 -		break;
    1.39 -
    1.40 -	    case __HYPERVISOR_event_channel_op:
    1.41 -		regs->r8 = do_event_channel_op(guest_handle_from_ptr(regs->r14, evtchn_op_t));
    1.42 -		break;
    1.43 -
    1.44 -	    case __HYPERVISOR_physdev_op:
    1.45 -		regs->r8 = do_physdev_op(guest_handle_from_ptr(regs->r14,
    1.46 -			physdev_op_t));
    1.47 -		break;
    1.48 +	uint32_t cmd = (uint32_t)regs->r2;
    1.49  
    1.50 -	    case __HYPERVISOR_grant_table_op:
    1.51 -		regs->r8 = do_grant_table_op((unsigned int) regs->r14,
    1.52 -			guest_handle_from_ptr(regs->r15, void),
    1.53 -			(unsigned int) regs->r16);
    1.54 -		break;
    1.55 -
    1.56 -	    case __HYPERVISOR_console_io:
    1.57 -		regs->r8 = do_console_io((int) regs->r14, (int) regs->r15,
    1.58 -			guest_handle_from_ptr(regs->r16, char));
    1.59 -		break;
    1.60 -
    1.61 -	    case __HYPERVISOR_xen_version:
    1.62 -		regs->r8 = do_xen_version((int) regs->r14,
    1.63 -			guest_handle_from_ptr(regs->r15, void));
    1.64 -		break;
    1.65 -
    1.66 -	    case __HYPERVISOR_multicall:
    1.67 -		regs->r8 = do_multicall(guest_handle_from_ptr(regs->r14,
    1.68 -			multicall_entry_t), (unsigned int) regs->r15);
    1.69 -		break;
    1.70 -
    1.71 -	    case __HYPERVISOR_sched_op:
    1.72 -		regs->r8 = do_sched_op((int) regs->r14,
    1.73 -		                       guest_handle_from_ptr(regs->r15, void));
    1.74 -		break;
    1.75 -
    1.76 +	if (cmd < nr_hypercalls)
    1.77 +		regs->r8 = (*ia64_hypercall_table[cmd])(
    1.78 +			regs->r14,
    1.79 +			regs->r15,
    1.80 +			regs->r16,
    1.81 +			regs->r17,
    1.82 +			regs->r18,
    1.83 +			regs->r19);
    1.84 +	else
    1.85  #ifdef CONFIG_XEN_IA64_DOM0_VP
    1.86 -	    case __HYPERVISOR_ia64_dom0vp_op:
    1.87 +	if (cmd ==  __HYPERVISOR_ia64_dom0vp_op) 
    1.88  		regs->r8 = do_dom0vp_op(regs->r14, regs->r15, regs->r16,
    1.89  		                        regs->r17, regs->r18);
    1.90 -		break;
    1.91 +	else
    1.92  #endif
    1.93 -	    default:
    1.94 -		printf("unknown xen hypercall %lx\n", regs->r2);
    1.95 -		regs->r8 = do_ni_hypercall();
    1.96 -	}
    1.97 +		regs->r8 = -ENOSYS;
    1.98 +
    1.99  	return 1;
   1.100  }
   1.101