The segfault is caused by jumping to the middle of an instruction. so i want to know which TB jumps here.
Thanks Xin On Wed, Jan 25, 2012 at 10:54 AM, Xin Tong <[email protected]> wrote: > 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 > <[email protected]> wrote: >> On 25 January 2012 15:42, Xin Tong <[email protected]> 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
