From patchwork Wed Mar 11 08:18:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 11077 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 n2B8LMTJ007139 for ; Wed, 11 Mar 2009 08:21:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751013AbZCKIVX (ORCPT ); Wed, 11 Mar 2009 04:21:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751223AbZCKIVW (ORCPT ); Wed, 11 Mar 2009 04:21:22 -0400 Received: from wa-out-1112.google.com ([209.85.146.182]:16748 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbZCKIVV (ORCPT ); Wed, 11 Mar 2009 04:21:21 -0400 Received: by wa-out-1112.google.com with SMTP id v33so1534628wah.21 for ; Wed, 11 Mar 2009 01:21:19 -0700 (PDT) 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=dMnuLog6R/q0n5MT1mtLbNmyxSNl9+lAojodIKRYuME=; b=qERjCMa7jmgLVzOOfh3tX9C/jNcbPgEly56q1FFWeAO0xV0fh+BWUqLeXhTD2a9p+i lmIktR+z0qxNzzL+1xJUEzHMosyhRvpW75pxMg/SYo/hTXEXkl9NXha++tvgAKaalpYE VVvjILcOgK80UcwvxVB/KKYxVi4alsNbAr1DU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=W90iXyXFEEbyPNiO9A1oVNHr2tZig40StkOpUWgJKFW+ucQmKc8yRXEJ6L8g40mpm6 1BfIyIInEmNGs77ZTVU4FvokO65vASKpwQGQqsfrJS6g0JwxsOVXii9rCjfNxC/iTEtm 9bgwAMSIPjVeYIhIPZkoa0VnXwZD6n3/jr100= Received: by 10.114.150.1 with SMTP id x1mr4969101wad.93.1236759679793; Wed, 11 Mar 2009 01:21:19 -0700 (PDT) Received: from rx1.opensource.se (210.5.32.202.bf.2iij.net [202.32.5.210]) by mx.google.com with ESMTPS id j34sm5978719waf.62.2009.03.11.01.21.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 11 Mar 2009 01:21:19 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Wed, 11 Mar 2009 17:18:52 +0900 Message-Id: <20090311081852.2041.19566.sendpatchset@rx1.opensource.se> Subject: [PATCH] sh: break out vbr register code Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Magnus Damm Add set_vbr_register(), get_vbr_register() and vbr_base to system.h. Signed-off-by: Magnus Damm --- This register needs to be modified by the suspend code as well, so break it out. arch/sh/include/asm/system.h | 19 +++++++++++++++++++ arch/sh/kernel/traps_32.c | 13 ++----------- 2 files changed, 21 insertions(+), 11 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 --- 0001/arch/sh/include/asm/system.h +++ work/arch/sh/include/asm/system.h 2009-03-11 16:53:11.000000000 +0900 @@ -180,6 +180,25 @@ BUILD_TRAP_HANDLER(singlestep); BUILD_TRAP_HANDLER(fpu_error); BUILD_TRAP_HANDLER(fpu_state_restore); +extern void *vbr_base; + +static inline void set_vbr_register(void *base) +{ + asm volatile("ldc %0, vbr" + : /* no output */ + : "r" (base) + : "memory"); +} + +static inline void *get_vbr_register(void) +{ + register unsigned long vbr; + + asm volatile("stc vbr, %0" : "=r" (vbr)); + + return (void *)vbr; +} + #define arch_align_stack(x) (x) struct mem_access { --- 0001/arch/sh/kernel/traps_32.c +++ work/arch/sh/kernel/traps_32.c 2009-03-11 16:52:16.000000000 +0900 @@ -768,16 +768,12 @@ void *gdb_vbr_vector; static inline void __init gdb_vbr_init(void) { - register unsigned long vbr; - /* * Read the old value of the VBR register to initialise * the vector through which debug and BIOS traps are * delegated by the Linux trap handler. */ - asm volatile("stc vbr, %0" : "=r" (vbr)); - - gdb_vbr_vector = (void *)(vbr + 0x100); + gdb_vbr_vector = get_vbr_register() + 0x100; printk("Setting GDB trap vector to 0x%08lx\n", (unsigned long)gdb_vbr_vector); } @@ -785,8 +781,6 @@ static inline void __init gdb_vbr_init(v void __cpuinit per_cpu_trap_init(void) { - extern void *vbr_base; - #ifdef CONFIG_SH_STANDARD_BIOS if (raw_smp_processor_id() == 0) gdb_vbr_init(); @@ -796,10 +790,7 @@ void __cpuinit per_cpu_trap_init(void) (or P2, virtural "fixed" address space). It's definitely should not in physical address. */ - asm volatile("ldc %0, vbr" - : /* no output */ - : "r" (&vbr_base) - : "memory"); + set_vbr_register(&vbr_base); } void *set_exception_table_vec(unsigned int vec, void *handler)