qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 0/2] tcg-icount: Add and use tcg_set_insn_param to


From: Lluís Vilanova
Subject: Re: [Qemu-devel] [RFC 0/2] tcg-icount: Add and use tcg_set_insn_param to update tcg insn params
Date: Mon, 11 Jan 2016 21:16:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Edgar E Iglesias writes:

> From: "Edgar E. Iglesias" <address@hidden>
> Hi,

> On AArch64, when some load/stores trap under specific conditions, a set of
> detailed info describing the insn is provided to the trap handler (e.g size
> of the access, target registers, insn-length mode etc).
> This specific info is known at translation time and Peter suggested that
> we have a look at the insn_start mechanism to see if we can reuse it
> to pass along the info to the exception handling models. This would avoid
> the need for moves that slow down the non-trapping case.

> To do so, we'd need to first emit the insn_start and then after translating 
> the
> given target-insn, update the insn_start parameters with the decoded insn
> details.

> I noticed that icount does a similar thing where it emits a movi and later
> updates the immediate parameter with the real insn counter.

> These patches illustrate a possible change by updating the icount code to
> use a new tcg_set_insn_param() tcg call instead of directly peeking/poking
> into tcg structures. This same mechanism can be used in the AArch64
> translator.

> Any thoughts on this approach? Or ideas on better options to achieve this?

Great! I implemented a similar thing long time ago. In my case the machinery is
completely hidden under the concept of "value promises" in TCG (i.e., the user
does not need to know about TCG internals like tcg_op_buf_count):

   // create promise
   TCGv_promise_i32 imm_p;
   TCGv_i32 imm = tcg_const_promise_i32(&imm_p); // akin to tcg_const_i32()
   ...
   // operate with promised immediate 'imm'
   ...
   // resolve promised value
   tcg_set_promise_i32(imm_p, resolved_value);

Here's the changes (the diff on a single page returns a 500 error, so use the
per-file diff links):

https://projects.gso.ac.upc.edu/projects/qemu-dbi/repository/revisions/c85708f0845e4b983ebd6d6977cf3186e7bedba6

Note that this was written a long time ago, so it would probably need adapting.


Cheers,
  Lluis



reply via email to

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