qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 0/3] Fix exceptions handling for MIPS and i38


From: Aurelien Jarno
Subject: Re: [Qemu-devel] [PATCH v2 0/3] Fix exceptions handling for MIPS and i386
Date: Wed, 17 Jun 2015 16:19:01 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On 2015-06-17 15:41, Pavel Dovgalyuk wrote:
> In icount mode every translation block looks as follows:
> 
> if icount < n then exit
> icount -= n
> instr1
> instr2
> ...
> instrn
> exit
> 
> When one of these instructions initiates an exception, icount should be 
> restored and adjusted number of instructions should be subtracted from icount
> instead of initial n.
> 
> tlb_fill function passes retaddr to raise_exception, which allows restoring
> current instructions in TB and correct icount calculation.
> 
> When exception triggered with other function (e.g. by embedding call to 
> exception raising helper into TB), then PC is not passed as retaddr and
> correct icount is not recovered. In such cases icount will be decreased 
> by the value equal to the size of TB.

Looking at how icount work, I see it's basically a variable in the CPU
state (icount_decr.u16.low), which is already accessed from the TB.
Couldn't we adjust it using additional code before generating an
exception, when in icount mode.

For example for MIPS, we can add some code before generate_exception
which use the value from s->gen_opc_icount[j] to adjust
the variable icount_decr.u16.low.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
address@hidden                 http://www.aurel32.net



reply via email to

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