qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 08/16] target-or32: Add instruction tanslatio


From: Wei-Ren Chen
Subject: Re: [Qemu-devel] [PATCH v6 08/16] target-or32: Add instruction tanslation
Date: Tue, 26 Jun 2012 17:14:07 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

> > 0xffffffff is -1, 0x80000000 is -MAX.
> > -1/-MAX ?will raise a exception, and I've handle this.
> > -MAX/-1 ?will get a MAX, for max value of a register is -(-MAX)-1, so,
> > it overflowed, I didn't handle this.
> 
> Actually you did this with three brcondi in the else branch. The only thing
> left is not to crash in case guest doesn't want range exception.

So Jia need to do something like below

  /*
   *  if ((%ra == 0xffffffff || %rb == 0x80000000) && (sr_ove == 0))
   *    goto lab3;
   *
   *  lab3:
   *    compute %ra/%rb but do NOT cause host failed? 
   */
  tcg_gen_ori_tl(cpu_sr, cpu_sr, SR_OV);
  tcg_gen_ori_tl(cpu_sr, cpu_sr, SR_CY);
  tcg_gen_brcondi_tl(TCG_COND_NE, sr_ove, SR_OVE, lab3);
  gen_exception(dc, EXCP_RANGE);
  gen_set_label(lab2);
  tcg_gen_div_tl(cpu_R[rd], cpu_R[ra], cpu_R[rb]);  
  gen_set_label(lab3);

    ??? 

How can this be done?  

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj



reply via email to

[Prev in Thread] Current Thread [Next in Thread]