From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq5CA-0006GD-FE for qemu-devel@nongnu.org; Wed, 25 Jan 2012 10:55:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rq5C4-0001xh-CT for qemu-devel@nongnu.org; Wed, 25 Jan 2012 10:55:34 -0500 Received: from mail-iy0-f173.google.com ([209.85.210.173]:59960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rq5C4-0001xd-4U for qemu-devel@nongnu.org; Wed, 25 Jan 2012 10:55:28 -0500 Received: by iahk25 with SMTP id k25so6602723iah.4 for ; Wed, 25 Jan 2012 07:55:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 25 Jan 2012 10:55:27 -0500 Message-ID: From: Xin Tong Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] TCG register allocator List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel 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 wrot= e: > I have a bug, it segfaults when executing a translation blocks. when i > disable block chaining, the bug disappears. =A0However, 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. =A0So 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 > wrote: >> On 25 January 2012 15:42, Xin Tong wrote: >>> I tried to reserve a register in target-i386 with this code >>> >>> target-i386/translate.c =A0 =A0tb_env =3D tcg_global_reg_new_ptr(TCG_AR= EG1, "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 =A0 =A0 =A0 =A0 #define TCG_AREG1 TCG_REG_R13 >>> >>> i386/tcg-target.c =A0 =A0 =A0 =A0 tcg_out_movi(s, TCG_TYPE_PTR, TCG_ARE= G1, 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