sh: break out vbr register code
PATCH 1/1 sh: break out vbr register code
From: Magnus Damm <[email protected]>
Add set_vbr_register(), get_vbr_register() and vbr_base to system.h.
Signed-off-by Magnus Damm <[email protected]>
---
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(-)
arch/sh/include/asm/system.h +19 -0
@@ -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) +{ + asmvolatile ("ldc %0, vbr" + :/* no output */ + :"r" (base) + :"memory" ); +} + +static inline void *get_vbr_register (void ) +{ + registerunsigned long vbr; + + asmvolatile ("stc vbr, %0" :"=r" (vbr)); + +return (void *)vbr; +} +#define arch_align_stack (x) (x)struct mem_access {
arch/sh/kernel/traps_32.c +2 -11
@@ -768,16 +768,12 @@ void *gdb_vbr_vector;static inline void __init gdb_vbr_init (void ) { - registerunsigned 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. */ - asmvolatile ("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(vvoid __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. */ - asmvolatile ("ldc %0, vbr" - :/* no output */ - :"r" (&vbr_base) - :"memory" ); +set_vbr_register (&vbr_base); }void *set_exception_table_vec (unsigned int vec,void *handler)
Quoted 11 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add
set_vbr_register(),get_vbr_register()andvbr_basetosystem.h.Signed-off-by Magnus Damm <[email protected]>---
This register needs to be modified by the suspend code as well, so break it out.
Let's just open code the instruction instead, there is not much point in having wrapper for a single instruction..
Quoted 4 lines
arch/sh/include/asm/system.h | 19 +++++++++++++++++++ arch/sh/kernel/traps_32.c | 13 ++----------- 2 files changed, 21 insertions(+), 11 deletions(-)
It can't be in system.h anyways, since SH-5 also uses this file.