ia64/xen-unstable

changeset 6858:8e7df3b10d85

Properly return extents for hypervisor memory ops call
Signed-off-by Kevin Tian <kevin.tian@intel.com>
author djm@kirby.fc.hp.com
date Thu Sep 15 10:53:34 2005 -0600 (2005-09-15)
parents 55bc6698c889
children 6bf96d977ecc
files xen/arch/ia64/xen/hypercall.c
line diff
     1.1 --- a/xen/arch/ia64/xen/hypercall.c	Wed Sep 14 18:00:23 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/hypercall.c	Thu Sep 15 10:53:34 2005 -0600
     1.3 @@ -14,6 +14,7 @@
     1.4  
     1.5  #include <asm/vcpu.h>
     1.6  #include <asm/dom_fw.h>
     1.7 +#include <public/memory.h>
     1.8  
     1.9  extern unsigned long translate_domain_mpaddr(unsigned long);
    1.10  extern struct ia64_pal_retval xen_pal_emulator(UINT64,UINT64,UINT64,UINT64);
    1.11 @@ -152,9 +153,25 @@ ia64_hypercall (struct pt_regs *regs)
    1.12  		break;
    1.13  
    1.14  	    case __HYPERVISOR_memory_op:
    1.15 -		//regs->r8 = do_dom_mem_op(regs->r14, regs->r15, regs->r16, regs->r17, regs->r18); 
    1.16  		/* we don't handle reservations; just return success */
    1.17 -		regs->r8 = regs->r16;
    1.18 +		{
    1.19 +		    struct xen_memory_reservation reservation;
    1.20 +		    void *arg = regs->r15;
    1.21 +
    1.22 +		    switch(regs->r14) {
    1.23 +		    case XENMEM_increase_reservation:
    1.24 +		    case XENMEM_decrease_reservation:
    1.25 +			if (copy_from_user(&reservation, arg,
    1.26 +				sizeof(reservation)))
    1.27 +			    regs->r8 = -EFAULT;
    1.28 +			else
    1.29 +			    regs->r8 = reservation.nr_extents;
    1.30 +			break;
    1.31 +		    default:
    1.32 +			regs->r8 = do_memory_op(regs->r14, regs->r15);
    1.33 +			break;
    1.34 +		    }
    1.35 +		}
    1.36  		break;
    1.37  
    1.38  	    case __HYPERVISOR_event_channel_op: