ia64/xen-unstable

changeset 9275:e3aa5b2387ac

[IA64] disable handling of legacy privified insns

Disable handling of privified insns into another instructions.
This is controled by a static constant.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Thu Mar 16 12:22:37 2006 -0700 (2006-03-16)
parents bbfbb9e09b55
children 1055f276cc4d
files xen/arch/ia64/xen/privop.c
line diff
     1.1 --- a/xen/arch/ia64/xen/privop.c	Thu Mar 16 12:20:59 2006 -0700
     1.2 +++ b/xen/arch/ia64/xen/privop.c	Thu Mar 16 12:22:37 2006 -0700
     1.3 @@ -20,6 +20,9 @@ extern void zero_reflect_counts(void);
     1.4  
     1.5  long priv_verbose=0;
     1.6  
     1.7 +/* Set to 1 to handle privified instructions from the privify tool. */
     1.8 +static const int privify_en = 0;
     1.9 +
    1.10  /**************************************************************************
    1.11  Hypercall bundle creation
    1.12  **************************************************************************/
    1.13 @@ -131,7 +134,8 @@ IA64FAULT priv_ptc_e(VCPU *vcpu, INST64 
    1.14  	UINT src = inst.M28.r3;
    1.15  
    1.16  	// NOTE: ptc_e with source gr > 63 is emulated as a fc r(y-64)
    1.17 -	if (src > 63) return(vcpu_fc(vcpu,vcpu_get_gr(vcpu,src - 64)));
    1.18 +	if (privify_en && src > 63)
    1.19 +		return(vcpu_fc(vcpu,vcpu_get_gr(vcpu,src - 64)));
    1.20  	return vcpu_ptc_e(vcpu,vcpu_get_gr(vcpu,src));
    1.21  }
    1.22  
    1.23 @@ -178,7 +182,7 @@ IA64FAULT priv_tpa(VCPU *vcpu, INST64 in
    1.24  	UINT src = inst.M46.r3;
    1.25  
    1.26  	// NOTE: tpa with source gr > 63 is emulated as a ttag rx=r(y-64)
    1.27 -	if (src > 63)
    1.28 +	if (privify_en && src > 63)
    1.29  		fault = vcpu_ttag(vcpu,vcpu_get_gr(vcpu,src-64),&padr);
    1.30  	else fault = vcpu_tpa(vcpu,vcpu_get_gr(vcpu,src),&padr);
    1.31  	if (fault == IA64_NO_FAULT)
    1.32 @@ -193,7 +197,7 @@ IA64FAULT priv_tak(VCPU *vcpu, INST64 in
    1.33  	UINT src = inst.M46.r3;
    1.34  
    1.35  	// NOTE: tak with source gr > 63 is emulated as a thash rx=r(y-64)
    1.36 -	if (src > 63)
    1.37 +	if (privify_en && src > 63)
    1.38  		fault = vcpu_thash(vcpu,vcpu_get_gr(vcpu,src-64),&key);
    1.39  	else fault = vcpu_tak(vcpu,vcpu_get_gr(vcpu,src),&key);
    1.40  	if (fault == IA64_NO_FAULT)
    1.41 @@ -280,7 +284,8 @@ IA64FAULT priv_mov_to_ar_reg(VCPU *vcpu,
    1.42  	// I26 and M29 are identical for these fields
    1.43  	UINT64 ar3 = inst.M29.ar3;
    1.44  
    1.45 -	if (inst.M29.r2 > 63 && inst.M29.ar3 < 8) { // privified mov from kr
    1.46 +	if (privify_en && inst.M29.r2 > 63 && inst.M29.ar3 < 8) {
    1.47 +		// privified mov from kr
    1.48  		UINT64 val;
    1.49  		if (vcpu_get_ar(vcpu,ar3,&val) != IA64_ILLOP_FAULT)
    1.50  			return vcpu_set_gr(vcpu, inst.M29.r2-64, val,0);
    1.51 @@ -404,14 +409,17 @@ IA64FAULT priv_mov_from_rr(VCPU *vcpu, I
    1.52  {
    1.53  	UINT64 val;
    1.54  	IA64FAULT fault;
    1.55 +	int reg;
    1.56  	
    1.57 -	if (inst.M43.r1 > 63) { // privified mov from cpuid
    1.58 -		fault = vcpu_get_cpuid(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val);
    1.59 +	reg = vcpu_get_gr(vcpu,inst.M43.r3);
    1.60 +	if (privify_en && inst.M43.r1 > 63) {
    1.61 +		// privified mov from cpuid
    1.62 +		fault = vcpu_get_cpuid(vcpu,reg,&val);
    1.63  		if (fault == IA64_NO_FAULT)
    1.64  			return vcpu_set_gr(vcpu, inst.M43.r1-64, val, 0);
    1.65  	}
    1.66  	else {
    1.67 -		fault = vcpu_get_rr(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val);
    1.68 +		fault = vcpu_get_rr(vcpu,reg,&val);
    1.69  		if (fault == IA64_NO_FAULT)
    1.70  			return vcpu_set_gr(vcpu, inst.M43.r1, val, 0);
    1.71  	}
    1.72 @@ -455,14 +463,17 @@ IA64FAULT priv_mov_from_pmc(VCPU *vcpu, 
    1.73  {
    1.74  	UINT64 val;
    1.75  	IA64FAULT fault;
    1.76 +	int reg;
    1.77  	
    1.78 -	if (inst.M43.r1 > 63) { // privified mov from pmd
    1.79 -		fault = vcpu_get_pmd(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val);
    1.80 +	reg = vcpu_get_gr(vcpu,inst.M43.r3);
    1.81 +	if (privify_en && inst.M43.r1 > 63) {
    1.82 +		// privified mov from pmd
    1.83 +		fault = vcpu_get_pmd(vcpu,reg,&val);
    1.84  		if (fault == IA64_NO_FAULT)
    1.85  			return vcpu_set_gr(vcpu, inst.M43.r1-64, val, 0);
    1.86  	}
    1.87  	else {
    1.88 -		fault = vcpu_get_pmc(vcpu,vcpu_get_gr(vcpu,inst.M43.r3),&val);
    1.89 +		fault = vcpu_get_pmc(vcpu,reg,&val);
    1.90  		if (fault == IA64_NO_FAULT)
    1.91  			return vcpu_set_gr(vcpu, inst.M43.r1, val, 0);
    1.92  	}
    1.93 @@ -666,7 +677,7 @@ priv_handle_op(VCPU *vcpu, REGS *regs, i
    1.94  		else if (inst.generic.major != 1) break;
    1.95  		x6 = inst.M29.x6;
    1.96  		if (x6 == 0x2a) {
    1.97 -			if (inst.M29.r2 > 63 && inst.M29.ar3 < 8)
    1.98 +			if (privify_en && inst.M29.r2 > 63 && inst.M29.ar3 < 8)
    1.99  				privcnt.mov_from_ar++; // privified mov from kr
   1.100  			else privcnt.mov_to_ar_reg++;
   1.101  			return priv_mov_to_ar_reg(vcpu,inst);
   1.102 @@ -674,14 +685,14 @@ priv_handle_op(VCPU *vcpu, REGS *regs, i
   1.103  		if (inst.M29.x3 != 0) break;
   1.104  		if (!(pfunc = Mpriv_funcs[x6])) break;
   1.105  		if (x6 == 0x1e || x6 == 0x1f)  { // tpa or tak are "special"
   1.106 -			if (inst.M46.r3 > 63) {
   1.107 +			if (privify_en && inst.M46.r3 > 63) {
   1.108  				if (x6 == 0x1e) x6 = 0x1b;
   1.109  				else x6 = 0x1a;
   1.110  			}
   1.111  		}
   1.112 -		if (x6 == 52 && inst.M28.r3 > 63)
   1.113 +		if (privify_en && x6 == 52 && inst.M28.r3 > 63)
   1.114  			privcnt.fc++;
   1.115 -		else if (x6 == 16 && inst.M43.r3 > 63)
   1.116 +		else if (privify_en && x6 == 16 && inst.M43.r3 > 63)
   1.117  			privcnt.cpuid++;
   1.118  		else privcnt.Mpriv_cnt[x6]++;
   1.119  		return (*pfunc)(vcpu,inst);
   1.120 @@ -718,7 +729,7 @@ priv_handle_op(VCPU *vcpu, REGS *regs, i
   1.121  #endif
   1.122  		if (inst.I26.x3 != 0) break;  // I26.x3 == I27.x3
   1.123  		if (inst.I26.x6 == 0x2a) {
   1.124 -			if (inst.I26.r2 > 63 && inst.I26.ar3 < 8)
   1.125 +			if (privify_en && inst.I26.r2 > 63 && inst.I26.ar3 < 8)
   1.126  				privcnt.mov_from_ar++; // privified mov from kr
   1.127  			else privcnt.mov_to_ar_reg++;
   1.128  			return priv_mov_to_ar_reg(vcpu,inst);