From patchwork Mon Feb 23 07:15:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 8378 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n1N7HMEn002338 for ; Mon, 23 Feb 2009 07:17:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752289AbZBWHRW (ORCPT ); Mon, 23 Feb 2009 02:17:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752325AbZBWHRW (ORCPT ); Mon, 23 Feb 2009 02:17:22 -0500 Received: from wa-out-1112.google.com ([209.85.146.182]:31846 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752289AbZBWHRV (ORCPT ); Mon, 23 Feb 2009 02:17:21 -0500 Received: by wa-out-1112.google.com with SMTP id v33so1032375wah.21 for ; Sun, 22 Feb 2009 23:17:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=JBRUion4MEQIceHGYbRp+W4Rwo4n+w/mjK0Gk49cg18=; b=TVI0hA7u8jPv2R67Aho94ZfHNnsL+KWrPd2kqVLMkZ/aubu+CH1VuqSL9H2xT7xqYE HKRtvr8Bil0kCl8++GTITLa7iJbkAeWoduPlgr4hkTXVhQ9qMtBIqdK77BIn9HY9eZcI qjEdRYV/fxaz0qHObYXdtcRnq6AXfrd3txxO4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=qzDslGAsZedT/7+eoRatRdVGJXmB6iT3RK4ahbgPmCj9hV98ULhgqENoHQHu320lsE zZhSySCrSzJ47j177Y/UGjDFndbmgR8Ryf9Z22JUcTfYIkld6W1C84BVYEReD3sfTzQv 4MMxA56zXTE/N2DURgx3kN3tvXm8bL2aZ9GTQ= Received: by 10.114.240.13 with SMTP id n13mr1559186wah.41.1235373439876; Sun, 22 Feb 2009 23:17:19 -0800 (PST) Received: from rx1.opensource.se (mailhost.igel.co.jp [219.106.231.130]) by mx.google.com with ESMTPS id z20sm11132198pod.12.2009.02.22.23.17.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 22 Feb 2009 23:17:19 -0800 (PST) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Mon, 23 Feb 2009 16:15:07 +0900 Message-Id: <20090223071507.12292.25023.sendpatchset@rx1.opensource.se> Subject: [PATCH 02/04] sh: rework register restore code for sh3/sh4/sh4a Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm This patch reworks the sh3/sh4/sh4a register restore code in the following ways: - break out restore_regs() from restore_all() - the register saving order is unchanged - use restore_regs() in sh_bios_handler and restore_all - document the function Signed-off-by: Magnus Damm --- arch/sh/kernel/cpu/sh3/entry.S | 68 +++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 35 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0005/arch/sh/kernel/cpu/sh3/entry.S +++ work/arch/sh/kernel/cpu/sh3/entry.S 2009-02-23 14:16:13.000000000 +0900 @@ -188,44 +188,35 @@ call_dae: #if defined(CONFIG_SH_STANDARD_BIOS) /* Unwind the stack and jmp to the debug entry */ ENTRY(sh_bios_handler) - mov.l @r15+, r0 - mov.l @r15+, r1 - mov.l @r15+, r2 - mov.l @r15+, r3 - mov.l @r15+, r4 - mov.l @r15+, r5 - mov.l @r15+, r6 - mov.l @r15+, r7 - stc sr, r8 - mov.l 1f, r9 ! BL =1, RB=1, IMASK=0x0F - or r9, r8 - ldc r8, sr ! here, change the register bank - mov.l @r15+, r8 - mov.l @r15+, r9 - mov.l @r15+, r10 - mov.l @r15+, r11 - mov.l @r15+, r12 - mov.l @r15+, r13 - mov.l @r15+, r14 - mov.l @r15+, k0 - ldc.l @r15+, spc - lds.l @r15+, pr - mov.l @r15+, k1 - ldc.l @r15+, gbr - lds.l @r15+, mach - lds.l @r15+, macl - mov k0, r15 + mov.l 1f, r8 + bsr restore_regs + nop + + lds k2, pr ! restore pr + mov k4, r15 ! mov.l 2f, k0 mov.l @k0, k0 jmp @k0 - ldc k1, ssr + ldc k3, ssr .align 2 1: .long 0x300000f0 2: .long gdb_vbr_vector #endif /* CONFIG_SH_STANDARD_BIOS */ -restore_all: +! restore_regs() +! - restore r0, r1, r2, r3, r4, r5, r6, r7 from the stack +! - switch bank +! - restore r8, r9, r10, r11, r12, r13, r14, r15 from the stack +! - restore spc, pr*, ssr, gbr, mach, macl, skip default tra +! k2 returns original pr +! k3 returns original sr +! k4 returns original stack pointer +! r8 passes SR bitmask, overwritten with restored data on return +! r9 trashed +! BL=0 on entry, on exit BL=1 (depending on r8). + +restore_regs: mov.l @r15+, r0 mov.l @r15+, r1 mov.l @r15+, r2 @@ -235,10 +226,9 @@ restore_all: mov.l @r15+, r6 mov.l @r15+, r7 ! - stc sr, r8 - mov.l 7f, r9 - or r9, r8 ! BL =1, RB=1 - ldc r8, sr ! here, change the register bank + stc sr, r9 + or r8, r9 + ldc r9, sr ! mov.l @r15+, r8 mov.l @r15+, r9 @@ -249,12 +239,20 @@ restore_all: mov.l @r15+, r14 mov.l @r15+, k4 ! original stack pointer ldc.l @r15+, spc - lds.l @r15+, pr + mov.l @r15+, k2 ! original PR mov.l @r15+, k3 ! original SR ldc.l @r15+, gbr lds.l @r15+, mach lds.l @r15+, macl - add #4, r15 ! Skip syscall number + rts + add #4, r15 ! Skip syscall number + +restore_all: + mov.l 7f, r8 + bsr restore_regs + nop + + lds k2, pr ! restore pr ! #ifdef CONFIG_SH_DSP mov.l @r15+, k0 ! DSP mode marker