ia64/xen-unstable

changeset 11459:997bd5fcf307

[IA64] Fix a bug in set_rse_reg

When setting rse reg, XEN needs to modify backing store memory.
This operation can't be interrupted, otherwise contents of
stack registers may be destroyed.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild.aw
date Thu Sep 21 15:34:24 2006 -0600 (2006-09-21)
parents a34659228c24
children da942e577e5e
files xen/arch/ia64/linux-xen/unaligned.c
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/unaligned.c	Thu Sep 21 15:34:10 2006 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/unaligned.c	Thu Sep 21 15:34:24 2006 -0600
     1.3 @@ -304,7 +304,7 @@ set_rse_reg (struct pt_regs *regs, unsig
     1.4  	unsigned long *bsp, *bspstore, *addr, *rnat_addr;
     1.5  	unsigned long *kbs = (void *) current + IA64_RBS_OFFSET;
     1.6  	unsigned long nat_mask;
     1.7 -    unsigned long old_rsc,new_rsc;
     1.8 +	unsigned long old_rsc, new_rsc, psr;
     1.9  	unsigned long rnat;
    1.10  	long sof = (regs->cr_ifs) & 0x7f;
    1.11  	long sor = 8 * ((regs->cr_ifs >> 14) & 0xf);
    1.12 @@ -321,16 +321,17 @@ set_rse_reg (struct pt_regs *regs, unsig
    1.13  		ridx = rotate_reg(sor, rrb_gr, ridx);
    1.14  
    1.15      old_rsc=ia64_get_rsc();
    1.16 -    new_rsc=old_rsc&(~0x3);
    1.17 +    /* put RSC to lazy mode, and set loadrs 0 */
    1.18 +    new_rsc = old_rsc & (~0x3fff0003);
    1.19      ia64_set_rsc(new_rsc);
    1.20 +    bsp = kbs + (regs->loadrs >> 19); /* 16 + 3 */
    1.21  
    1.22 +    addr = ia64_rse_skip_regs(bsp, -sof + ridx);
    1.23 +    nat_mask = 1UL << ia64_rse_slot_num(addr);
    1.24 +    rnat_addr = ia64_rse_rnat_addr(addr);
    1.25 +    
    1.26 +    local_irq_save(psr); 
    1.27      bspstore = (unsigned long*)ia64_get_bspstore();
    1.28 -    bsp =kbs + (regs->loadrs >> 19);//16+3
    1.29 -
    1.30 -	addr = ia64_rse_skip_regs(bsp, -sof + ridx);
    1.31 -    nat_mask = 1UL << ia64_rse_slot_num(addr);
    1.32 -	rnat_addr = ia64_rse_rnat_addr(addr);
    1.33 -
    1.34      if(addr >= bspstore){
    1.35  
    1.36          ia64_flushrs ();
    1.37 @@ -358,6 +359,7 @@ set_rse_reg (struct pt_regs *regs, unsig
    1.38          ia64_set_bspstore (bspstore);
    1.39          ia64_set_rnat(rnat);
    1.40      }
    1.41 +    local_irq_restore(psr);
    1.42      ia64_set_rsc(old_rsc);
    1.43  }
    1.44