ia64/xen-unstable

changeset 17606:b03e24f9c1d8

[IA64] fix sal emulation.

fix sal emulation, SAL_SET_VECTORS, SAL_MC_SET_PARAMS.
It allowed any domains to change system wide state. But only
dom0 is able to change it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Thu May 15 14:18:38 2008 +0900 (2008-05-15)
parents f0737df2dee1
children ef290f39ae6b
files xen/arch/ia64/xen/fw_emul.c
line diff
     1.1 --- a/xen/arch/ia64/xen/fw_emul.c	Thu May 15 14:18:38 2008 +0900
     1.2 +++ b/xen/arch/ia64/xen/fw_emul.c	Thu May 15 14:18:38 2008 +0900
     1.3 @@ -200,10 +200,15 @@ sal_emulator (long index, unsigned long 
     1.4  				d->arch.sal_data->boot_rdv_r1 = in3;
     1.5  			}
     1.6   		}
     1.7 - 		else
     1.8 -		{
     1.9 -			if (in1 > sizeof(sal_vectors)/sizeof(sal_vectors[0])-1)
    1.10 -				BUG();
    1.11 + 		else if (current->domain == dom0) {
    1.12 +			if (in1 >
    1.13 +			    sizeof(sal_vectors)/sizeof(sal_vectors[0])-1) {
    1.14 +				gdprintk(XENLOG_DEBUG,
    1.15 +					 "SAL_SET_VECTORS invalid in1 %ld\n",
    1.16 +					 in1);
    1.17 +				status = -2;
    1.18 +				break;
    1.19 +			}
    1.20  			sal_vectors[in1].vector_type	= in1;
    1.21  			sal_vectors[in1].handler_addr1	= in2;
    1.22  			sal_vectors[in1].gp1		= in3;
    1.23 @@ -211,6 +216,10 @@ sal_emulator (long index, unsigned long 
    1.24  			sal_vectors[in1].handler_addr2	= in5;
    1.25  			sal_vectors[in1].gp2		= in6;
    1.26  			sal_vectors[in1].handler_len2	= in7;
    1.27 +		} else {
    1.28 +			gdprintk(XENLOG_DEBUG, "NON-PRIV DOMAIN CALLED "
    1.29 +				 "SAL_SET_VECTORS %ld\n", in1);
    1.30 +			status = -2;
    1.31  		}
    1.32  		break;
    1.33  	    case SAL_GET_STATE_INFO:
    1.34 @@ -352,13 +361,25 @@ sal_emulator (long index, unsigned long 
    1.35  		printk("*** CALLED SAL_MC_RENDEZ.  IGNORED...\n");
    1.36  		break;
    1.37  	    case SAL_MC_SET_PARAMS:
    1.38 -		if (in1 > sizeof(sal_mc_params)/sizeof(sal_mc_params[0]))
    1.39 -			BUG();
    1.40 -		sal_mc_params[in1].param_type	= in1;
    1.41 -		sal_mc_params[in1].i_or_m	= in2;
    1.42 -		sal_mc_params[in1].i_or_m_val	= in3;
    1.43 -		sal_mc_params[in1].timeout	= in4;
    1.44 -		sal_mc_params[in1].rz_always	= in5;
    1.45 +		if (current->domain == dom0) {
    1.46 +			if (in1 > 
    1.47 +			    sizeof(sal_mc_params) / sizeof(sal_mc_params[0])) {
    1.48 +				gdprintk(XENLOG_DEBUG,
    1.49 +					 "SAL_MC_SET_PARAMS invalid in1 %ld\n",
    1.50 +					 in1);
    1.51 +				status = -2;
    1.52 +				break;
    1.53 +			}
    1.54 +			sal_mc_params[in1].param_type	= in1;
    1.55 +			sal_mc_params[in1].i_or_m	= in2;
    1.56 +			sal_mc_params[in1].i_or_m_val	= in3;
    1.57 +			sal_mc_params[in1].timeout	= in4;
    1.58 +			sal_mc_params[in1].rz_always	= in5;
    1.59 +		} else {
    1.60 +			gdprintk(XENLOG_DEBUG,
    1.61 +				 "*** CALLED SAL_MC_SET_PARAMS. IGNORED...\n");
    1.62 +			status = -1; /* not implemented */
    1.63 +		}
    1.64  		break;
    1.65  	    case SAL_CACHE_FLUSH:
    1.66  		if (1) {