[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] help with helper functions
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] help with helper functions |
Date: |
Tue, 20 Mar 2012 08:20:24 +0000 |
On 19 March 2012 22:34, João Corrêa <address@hidden> 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