ia64/xen-unstable

changeset 1226:201765d1eb87

bitkeeper revision 1.825.1.7 (4062f47b6DnJOl2ZC6ptnk2jUPSAHA)

add dom0 op for controlling shadow page tables
author iap10@tetris.cl.cam.ac.uk
date Thu Mar 25 15:02:19 2004 +0000 (2004-03-25)
parents f99bce03c4db
children 53a93ee1224d
files xen/common/dom0_ops.c xen/common/shadow.c xen/include/hypervisor-ifs/dom0_ops.h xen/include/xen/shadow.h
line diff
     1.1 --- a/xen/common/dom0_ops.c	Thu Mar 25 13:24:43 2004 +0000
     1.2 +++ b/xen/common/dom0_ops.c	Thu Mar 25 15:02:19 2004 +0000
     1.3 @@ -18,6 +18,7 @@
     1.4  #include <asm/pdb.h>
     1.5  #include <xen/trace.h>
     1.6  #include <xen/console.h>
     1.7 +#include <xen/shadow.h>
     1.8  #include <hypervisor-ifs/sched_ctl.h>
     1.9  
    1.10  extern unsigned int alloc_new_dom_mem(struct task_struct *, unsigned int);
    1.11 @@ -485,6 +486,19 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
    1.12                                          op->u.pcidev_access.enable);
    1.13      }
    1.14      break;
    1.15 +
    1.16 +    case DOM0_SHADOW_CONTROL:
    1.17 +    {
    1.18 +        struct task_struct *p; 
    1.19 +	
    1.20 +	p = find_domain_by_id( op->u.shadow_control.domain );
    1.21 +	if ( p )
    1.22 +	{
    1.23 +            ret = shadow_mode_control(p, op->u.shadow_control.op );
    1.24 +	    put_task_struct(p);
    1.25 +        }
    1.26 +    }
    1.27 +    break;
    1.28       
    1.29      default:
    1.30          ret = -ENOSYS;
     2.1 --- a/xen/common/shadow.c	Thu Mar 25 13:24:43 2004 +0000
     2.2 +++ b/xen/common/shadow.c	Thu Mar 25 15:02:19 2004 +0000
     2.3 @@ -26,6 +26,28 @@ hypercall lock anyhow (at least initiall
     2.4  
     2.5  ********/
     2.6  
     2.7 +int shadow_mode_control( struct task_struct *p, unsigned int op )
     2.8 +{
     2.9 +	if (p->mm.shadow_mode && op == DOM0_SHADOW_CONTROL_OP_OFF )
    2.10 +    {
    2.11 +		shadow_mode_disable(p);
    2.12 +	}
    2.13 +	else if (p->mm.shadow_mode && op == DOM0_SHADOW_CONTROL_OP_ENABLE_TEST )
    2.14 +	{
    2.15 +        shadow_mode_disable(p);
    2.16 +        shadow_mode_enable(p, SHM_test);
    2.17 +	}	
    2.18 +	else if (p->mm.shadow_mode && op == DOM0_SHADOW_CONTROL_OP_FLUSH )
    2.19 +    {
    2.20 +		//shadow_mode_flush(p);
    2.21 +    }
    2.22 +	else
    2.23 +    {
    2.24 +		return -EINVAL;
    2.25 +    }
    2.26 +
    2.27 +	return 0;
    2.28 +}
    2.29  
    2.30  int shadow_mode_enable( struct task_struct *p, unsigned int mode )
    2.31  {
     3.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Thu Mar 25 13:24:43 2004 +0000
     3.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Thu Mar 25 15:02:19 2004 +0000
     3.3 @@ -214,6 +214,22 @@ typedef struct dom0_pcidev_access_st
     3.4      int          enable;
     3.5  } dom0_pcidev_access_t;
     3.6  
     3.7 +/* 
     3.8 + * Control shadow pagetables operation
     3.9 + */
    3.10 +#define DOM0_SHADOW_CONTROL   24
    3.11 +
    3.12 +#define DOM0_SHADOW_CONTROL_OP_OFF         0
    3.13 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
    3.14 +#define DOM0_SHADOW_CONTROL_OP_FLUSH       10
    3.15 +typedef struct dom0_shadow_control_st
    3.16 +{
    3.17 +    /* IN variables. */
    3.18 +    domid_t      domain;
    3.19 +    int          op;
    3.20 +} dom0_shadow_control_t;
    3.21 +
    3.22 +
    3.23  typedef struct dom0_op_st
    3.24  {
    3.25      unsigned long cmd;
    3.26 @@ -239,6 +255,7 @@ typedef struct dom0_op_st
    3.27          dom0_gettbufs_t         gettbufs;
    3.28          dom0_physinfo_t         physinfo;
    3.29          dom0_pcidev_access_t    pcidev_access;
    3.30 +	dom0_shadow_control_t   shadow_control;
    3.31      } u;
    3.32  } dom0_op_t;
    3.33  
     4.1 --- a/xen/include/xen/shadow.h	Thu Mar 25 13:24:43 2004 +0000
     4.2 +++ b/xen/include/xen/shadow.h	Thu Mar 25 15:02:19 2004 +0000
     4.3 @@ -22,6 +22,7 @@
     4.4  #define shadow_linear_pg_table ((l1_pgentry_t *)SH_LINEAR_PT_VIRT_START)
     4.5  #define shadow_linear_l2_table ((l2_pgentry_t *)(SH_LINEAR_PT_VIRT_START+(SH_LINEAR_PT_VIRT_START>>(L2_PAGETABLE_SHIFT-L1_PAGETABLE_SHIFT))))
     4.6  
     4.7 +extern int shadow_mode_control( struct task_struct *p, unsigned int op );
     4.8  extern pagetable_t shadow_mk_pagetable( struct task_struct *p, 
     4.9  										unsigned long gptbase);
    4.10  extern int shadow_fault( unsigned long va, long error_code );