qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: "João Corrêa" <joao.lvwr@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] help with helper functions
Date: Tue, 20 Mar 2012 08:20:24 +0000	[thread overview]
Message-ID: <CAFEAcA_NkQ5W3L2jhZ1ALX4uy-c_tvhOZGgtAXD0wX_63moKfA@mail.gmail.com> (raw)
In-Reply-To: <CALMZKf4aV7c_nzSfSv8SKais5SM1CnMuY0btuGJ6K5BhAf1b5A@mail.gmail.com>

On 19 March 2012 22:34, João Corrêa <joao.lvwr@gmail.com> wrote:
> I'm trying to use some helper functions to instrument translated code, but
> I'm getting some segfaults while doing it. Here are some code I've placed:
>
> target-i386/helper.h
> DEF_HELPER_1(foo, void, tl)
>
> target-i386/op_helper.c
> #ifdef TARGET_X86_64
>
> void foo(target_ulong t0){

Should be
HELPER(foo)(target_ulong t0) {

> }
>
> target-i386/translate.c
> static inline void gen_jmp_im(target_ulong pc){
>     #ifdef TARGET_X86_64
>     printf("test2\n");
>     gen_foo(pc);

should be gen_helper_foo().

But your main problem here is that gen_helper_*() take TCGv
types (TCG values), not immediate constants. You need to emit
TCG code to load 'pc' into a TCG temporary first.

If you configure --enable-debug then it ought to put in some
extra typechecking code which will make this fail compilation.

-- PMM

      reply	other threads:[~2012-03-20  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 22:34 [Qemu-devel] help with helper functions João Corrêa
2012-03-20  8:20 ` Peter Maydell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFEAcA_NkQ5W3L2jhZ1ALX4uy-c_tvhOZGgtAXD0wX_63moKfA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=joao.lvwr@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).