qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] gen_icount_start
@ 2012-12-30 23:14 biswaranjan panda
  2012-12-31  1:01 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: biswaranjan panda @ 2012-12-30 23:14 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

Hi ,

I am trying to understand how to count the number of instructions executed
in the guest and came across the gen_icount_start and gen_icount_end
functions.
What I understand is that in gen_icount_start 'icount_arg' keeps a pointer
to gen_opparam_ptr which is used in gen_icount_end to patch up the value .
I however didnt understand what the 'horrid hack' is about. Can any one
give me some idea on this ?

Thanks !

[-- Attachment #2: Type: text/html, Size: 609 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] gen_icount_start
  2012-12-30 23:14 [Qemu-devel] gen_icount_start biswaranjan panda
@ 2012-12-31  1:01 ` Peter Maydell
  2013-01-18 20:44   ` biswaranjan panda
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2012-12-31  1:01 UTC (permalink / raw)
  To: biswaranjan panda; +Cc: qemu-devel

On 30 December 2012 23:14, biswaranjan panda
<biswaranjan.nitrkl@gmail.com> wrote:
> What I understand is that in gen_icount_start 'icount_arg' keeps a pointer
> to gen_opparam_ptr which is used in gen_icount_end to patch up the value . I
> however didnt understand what the 'horrid hack' is about. Can any one give
> me some idea on this ?

My guess is that it's a hack because it's a layering violation. Functions
that generate TCG (intermediate representation) should do it by calling
the tcg_ functions, and the data structures and variables like
gen_opparam_ptr should be internal to the TCG layer. However here we
rely on knowing implementation details of how the TCG layer actually writes
out the ops and parameters when you call tcg_gen_subi_i32().
A clean design would make the TCG layer provide some kind of API for
writing out code and then fixing up the values afterwards, but on the other
hand if we only have one use case...

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] gen_icount_start
  2012-12-31  1:01 ` Peter Maydell
@ 2013-01-18 20:44   ` biswaranjan panda
  0 siblings, 0 replies; 3+ messages in thread
From: biswaranjan panda @ 2013-01-18 20:44 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2206 bytes --]

> What I understand is that in gen_icount_start 'icount_arg' keeps a pointer
> to gen_opparam_ptr which is used in gen_icount_end to patch up the value
. I
> however didnt understand what the 'horrid hack' is about. Can any one give
> me some idea on this ?

>My guess is that it's a hack because it's a layering violation. Functions
>that generate TCG (intermediate representation) should do it by calling
>the tcg_ functions, and the data structures and variables like
>gen_opparam_ptr should be internal to the TCG layer. However here we
>rely on knowing implementation details of how the TCG layer actually writes
>out the ops and parameters when you call tcg_gen_subi_i32().
>A clean design would make the TCG layer provide some kind of API for
>writing out code and then fixing up the values afterwards, but on the other
>hand if we only have one use case...


Oh I just found out from the mailing list archives that '0xdeadbeef' is a
value that is later patched by the number of instructions 'num_insns' and
that is what the hack is about.

http://thread.gmane.org/gmane.comp.emulators.qemu/131848/focus=132842

Regards,
Biswa


On Sun, Dec 30, 2012 at 8:01 PM, Peter Maydell <peter.maydell@linaro.org>wrote:

> On 30 December 2012 23:14, biswaranjan panda
> <biswaranjan.nitrkl@gmail.com> wrote:
> > What I understand is that in gen_icount_start 'icount_arg' keeps a
> pointer
> > to gen_opparam_ptr which is used in gen_icount_end to patch up the value
> . I
> > however didnt understand what the 'horrid hack' is about. Can any one
> give
> > me some idea on this ?
>
> My guess is that it's a hack because it's a layering violation. Functions
> that generate TCG (intermediate representation) should do it by calling
> the tcg_ functions, and the data structures and variables like
> gen_opparam_ptr should be internal to the TCG layer. However here we
> rely on knowing implementation details of how the TCG layer actually writes
> out the ops and parameters when you call tcg_gen_subi_i32().
> A clean design would make the TCG layer provide some kind of API for
> writing out code and then fixing up the values afterwards, but on the other
> hand if we only have one use case...
>
> -- PMM
>

[-- Attachment #2: Type: text/html, Size: 4575 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-18 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-30 23:14 [Qemu-devel] gen_icount_start biswaranjan panda
2012-12-31  1:01 ` Peter Maydell
2013-01-18 20:44   ` biswaranjan panda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).