From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41649) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR1M5-0004to-Dk for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:32:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YR1M0-0002PG-PL for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:32:05 -0500 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:36004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YR1M0-0002PC-KL for qemu-devel@nongnu.org; Thu, 26 Feb 2015 11:32:00 -0500 Received: by mail-qg0-f44.google.com with SMTP id j5so9504884qga.3 for ; Thu, 26 Feb 2015 08:32:00 -0800 (PST) Sender: Richard Henderson Message-ID: <54EF4A7B.20107@twiddle.net> Date: Thu, 26 Feb 2015 06:31:55 -1000 From: Richard Henderson MIME-Version: 1.0 References: <54EC2DEE.8050809@sunrus.com.cn> <54ECBB02.1080801@redhat.com> <54ED443B.7040207@sunrus.com.cn> <54EE0433.3070101@twiddle.net> <54EE7A6D.6000704@sunrus.com.cn> In-Reply-To: <54EE7A6D.6000704@sunrus.com.cn> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-tilegx: Execute _start and reach to __libc_start_main successfully List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chen Gang S Cc: Peter Maydell , Chris Metcalf , Riku Voipio , qemu-devel , "walt@tilera.com" On 02/25/2015 03:44 PM, Chen Gang S wrote: > OK, thanks. After check ISA document again, for me, we have to still use > "y0, y1, y2", e.g. de5e598034ac3000 { fnop ; jalr r12 ; st r10, r11 } > > If y0 -> y1 -> y2: > > - if jalr succeeds, it will write pc to sp stack, but sp is not changed > (just like lr, pc, they are buffered to tcg temporary variables). > > - if st fails, as the result, we can still say the whole bundle is not > execute (it has already written pc to sp stack, but sp isn't changed, > so it is still OK). > > If y0 -> y2 -> y1: > > - if st succeeds, it will write data to the useful memory. > > - if jalr fails (e.g. sp stack is full, which may cause memory access > issue), we can not restore the bundle. You need to re-check the ISA document. JALR does not write to the "real" stack at all, and cannot raise any kind of exception. Section 2.1.2.3 clearly defines pushReturnStack as part of the branch prediction mechanism on the cpu. It can be completely ignored for QEMU. r~