public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh: break out vbr register code
Date: Wed, 11 Mar 2009 08:18:52 +0000	[thread overview]
Message-ID: <20090311081852.2041.19566.sendpatchset@rx1.opensource.se> (raw)

From: Magnus Damm <damm@igel.co.jp>

Add set_vbr_register(), get_vbr_register() and vbr_base
to system.h.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 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(-)


--- 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)

             reply	other threads:[~2009-03-11  8:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11  8:18 Magnus Damm [this message]
2009-03-11  8:30 ` [PATCH] sh: break out vbr register code Paul Mundt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090311081852.2041.19566.sendpatchset@rx1.opensource.se \
    --to=magnus.damm@gmail.com \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox