From: NIIBE Y. <gn...@ch...> - 2000-08-04 03:23:46
|
Updated. 2000-08-04 NIIBE Yutaka <gn...@m1...> Machvec support. * arch/sh/kernel/setup.c: Remove WEAK references. (get_mv_byname): Use .macvec.init. section. * include/asm-sh/machvec_init.h (__initmv): Use .macvec.init. section. * arch/sh/vmlinux.lds.S (.machvec.init): Added new section for Machine Vector. Index: arch/sh/vmlinux.lds.S =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/vmlinux.lds.S,v retrieving revision 1.5 diff -u -r1.5 vmlinux.lds.S --- arch/sh/vmlinux.lds.S 2000/07/20 06:50:06 1.5 +++ arch/sh/vmlinux.lds.S 2000/08/04 03:14:22 @@ -61,6 +61,9 @@ __initcall_start = .; .initcall.init : { *(.initcall.init) } __initcall_end = .; + __machvec_start = .; + .machvec.init : { *(.machvec.init) } + __machvec_end = .; . = ALIGN(4096); __init_end = .; Index: arch/sh/kernel/setup.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/kernel/setup.c,v retrieving revision 1.10 diff -u -r1.10 setup.c --- arch/sh/kernel/setup.c 2000/08/01 03:18:38 1.10 +++ arch/sh/kernel/setup.c 2000/08/04 03:14:23 @@ -63,16 +64,6 @@ extern int root_mountflags; extern int _text, _etext, _edata, _end; -/* __attribute__(weak) doesn't appear to do anything */ -#define WEAK(X) \ - extern struct sh_machine_vector X; \ - asm(".weak "#X) - -WEAK(mv_unknown); -WEAK(mv_hp600); -WEAK(mv_od); -WEAK(mv_se); - #define MV_NAME_SIZE 32 static struct sh_machine_vector* __init get_mv_byname(const char* name); @@ -426,17 +471,16 @@ struct sh_machine_vector* __init get_mv_byname(const char* name) { extern int strcasecmp(const char *, const char *); - static struct sh_machine_vector *all_vecs[] __initlocaldata = - { - &mv_hp600, - &mv_od, - &mv_se, - }; - - int i, n = sizeof(all_vecs)/sizeof(*all_vecs); + extern long __machvec_start, __machvec_end; + struct sh_machine_vector *all_vecs = + (struct sh_machine_vector *)&__machvec_start; + + int i, n = ((unsigned long)&__machvec_end + - (unsigned long)&__machvec_start)/ + sizeof(struct sh_machine_vector); for (i = 0; i < n; ++i) { - struct sh_machine_vector *mv = all_vecs[i]; + struct sh_machine_vector *mv = &all_vecs[i]; if (mv == NULL) continue; if (strcasecmp(name, mv->mv_name) == 0) { Index: include/asm-sh/machvec_init.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/machvec_init.h,v retrieving revision 1.1 diff -u -r1.1 machvec_init.h --- include/asm-sh/machvec_init.h 2000/07/31 12:31:12 1.1 +++ include/asm-sh/machvec_init.h 2000/08/04 03:14:34 @@ -26,10 +26,13 @@ * alias this one vector to alpha_mv, so no copy is needed. * * Upshot: set __initdata to nothing for non-GENERIC kernels. + * + * Note we do the same thing for the UNKNOWN kernel, as we need to write + * to the machine vector while setting it up. */ -#ifdef CONFIG_SH_GENERIC -#define __initmv __initdata +#if defined(CONFIG_SH_GENERIC) || defined(CONFIG_SH_UNKNOWN) +#define __initmv __attribute__((unused,__section__ (".machvec.init"))) #define ALIAS_MV(x) #else #define __initmv |