From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgoUx-00066y-Gm for qemu-devel@nongnu.org; Tue, 29 Sep 2015 02:34:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZgoUt-0003ZA-JH for qemu-devel@nongnu.org; Tue, 29 Sep 2015 02:34:47 -0400 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:33400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZgoUt-0003Z6-FE for qemu-devel@nongnu.org; Tue, 29 Sep 2015 02:34:43 -0400 Received: by qkas79 with SMTP id s79so12942040qka.0 for ; Mon, 28 Sep 2015 23:34:42 -0700 (PDT) Sender: Richard Henderson References: <1443478010-2620-1-git-send-email-gang.chen.5i5j@gmail.com> From: Richard Henderson Message-ID: <560A30E4.7020608@twiddle.net> Date: Mon, 28 Sep 2015 23:34:12 -0700 MIME-Version: 1.0 In-Reply-To: <1443478010-2620-1-git-send-email-gang.chen.5i5j@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-tilegx: Support iret instruction and related special registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: gang.chen.5i5j@gmail.com, peter.maydell@linaro.org Cc: cmetcalf@ezchip.com, qemu-devel@nongnu.org, xili_gchen_5257@hotmail.com On 09/28/2015 03:06 PM, gang.chen.5i5j@gmail.com wrote: > From: Chen Gang > > Acording to the __longjmp tilegx libc implementation, and reference from > tilegx ISA document, we can left iret instruction empty. The related > code is below: > > ENTRY (__longjmp) > FEEDBACK_ENTER(__longjmp) > > #define RESTORE(r) { LD r, r0 ; ADDI_PTR r0, r0, REGSIZE } > FOR_EACH_CALLEE_SAVED_REG(RESTORE) > > { > LD r2, r0 ; retrieve ICS bit from jmp_buf > movei r3, 1 > CMPEQI r0, r1, 0 > } > > { > mtspr INTERRUPT_CRITICAL_SECTION, r3 > shli r2, r2, SPR_EX_CONTEXT_0_1__ICS_SHIFT > } > > { > mtspr EX_CONTEXT_0_0, lr > ori r2, r2, RETURN_PL > } > > { > or r0, r1, r0 > mtspr EX_CONTEXT_0_1, r2 > } > > iret > > jrp lr > > So can let busybox sh run correctly. > > Signed-off-by: Chen Gang > --- > target-tilegx/cpu.h | 2 ++ > target-tilegx/translate.c | 8 +++++++- > 2 files changed, 9 insertions(+), 1 deletion(-) > > diff --git a/target-tilegx/cpu.h b/target-tilegx/cpu.h > index 4b05cd2..02e1a18 100644 > --- a/target-tilegx/cpu.h > +++ b/target-tilegx/cpu.h > @@ -54,6 +54,8 @@ enum { > TILEGX_SPR_CRITICAL_SEC = 1, > TILEGX_SPR_SIM_CONTROL = 2, > TILEGX_SPR_EX_CONTEXT_1 = 3, > + TILEGX_SPR_EX_CONTEXT_0_0 = 4, > + TILEGX_SPR_EX_CONTEXT_0_1 = 5, Don't add spr's you're not going to use. r~