qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] TCG register allocator


From: Xin Tong
Subject: Re: [Qemu-devel] TCG register allocator
Date: Wed, 25 Jan 2012 10:54:16 -0500

I have a bug, it segfaults when executing a translation blocks. when i
disable block chaining, the bug disappears.  However, with block
chaining, i do not know which translation block jumps to the code
which caused the segfault. I want to reserve a register and use it to
record the last translation block executed.  So at entry, i assign the
translation blocks address to the register and when the segfault
happens, I can get the last translation block executed.

Thanks



On Wed, Jan 25, 2012 at 10:49 AM, Peter Maydell
<address@hidden> wrote:
> On 25 January 2012 15:42, Xin Tong <address@hidden> wrote:
>> I tried to reserve a register in target-i386 with this code
>>
>> target-i386/translate.c    tb_env = tcg_global_reg_new_ptr(TCG_AREG1, "env");
>
> Why do you want to define a second global which holds the environment
> variable? Just use TCG_AREG0 for that.
>
>> i386/tcg-target.h         #define TCG_AREG1 TCG_REG_R13
>>
>> i386/tcg-target.c         tcg_out_movi(s, TCG_TYPE_PTR, TCG_AREG1, args[0]);
>>
>> But when i looked into the dynamically generated code, the place which
>> i use TCG_AREG1 becomes RBP and RBP is not reserved either.
>
> If the reason you're trying to reserve a register is so you can use
> it as a temporary in tcg-target.c's codegen, then reserve it in
> tcg_target_init(). (But x86-32 is very short on registers as it is,
> so really it would be much better not to...)
>
> -- PMM



reply via email to

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