2.3.13-pre4 tweeks

Richard Henderson (rth@twiddle.net)
Wed, 4 Aug 1999 02:31:13 -0700


I'd like to take this opportunity to move __cacheline_aligned
where it belongs -- <asm/cache.h>. I don't like not having
the __aligned__(N) tag on there. It hides information from
the compiler that might (one day) be of use. And it's Right.

Matti reported problems with __kernel_thread missing at link.
Dunno what was up with that, but I moved kernel_thread into
<asm/processor.h> like everyone else.

r~

diff -Nrup 2.3.13-4/arch/alpha/kernel/alpha_ksyms.c 2.3.13-axp/arch/alpha/kernel/alpha_ksyms.c
--- 2.3.13-4/arch/alpha/kernel/alpha_ksyms.c Wed Aug 4 02:20:51 1999
+++ 2.3.13-axp/arch/alpha/kernel/alpha_ksyms.c Wed Aug 4 01:43:35 1999
@@ -105,7 +105,7 @@ EXPORT_SYMBOL(alpha_read_fp_reg);
EXPORT_SYMBOL(alpha_write_fp_reg);

/* In-kernel system calls. */
-EXPORT_SYMBOL(__kernel_thread);
+EXPORT_SYMBOL(kernel_thread);
EXPORT_SYMBOL(sys_open);
EXPORT_SYMBOL(sys_dup);
EXPORT_SYMBOL(sys_exit);
diff -Nrup 2.3.13-4/arch/alpha/kernel/entry.S 2.3.13-axp/arch/alpha/kernel/entry.S
--- 2.3.13-4/arch/alpha/kernel/entry.S Wed Aug 4 02:21:03 1999
+++ 2.3.13-axp/arch/alpha/kernel/entry.S Wed Aug 4 01:42:09 1999
@@ -38,6 +38,8 @@
*/
#define PF_PTRACED 0x00000010

+#define CLONE_VM 0x00000100
+
/*
* This defines the normal kernel pt-regs layout.
*
@@ -225,21 +227,23 @@ kernel_clone:
.end kernel_clone

/*
- * __kernel_thread(clone_flags, fn, arg)
+ * kernel_thread(fn, arg, clone_flags)
*/
.align 3
-.globl __kernel_thread
-.ent __kernel_thread
-__kernel_thread:
+.globl kernel_thread
+.ent kernel_thread
+kernel_thread:
ldgp $29,0($27) /* we can be called from a module */
.frame $30, 4*8, $26
subq $30,4*8,$30
stq $10,16($30)
stq $9,8($30)
+ lda $0,CLONE_VM
stq $26,0($30)
.prologue 1
- mov $17,$9 /* save fn */
- mov $18,$10 /* save arg */
+ mov $16,$9 /* save fn */
+ mov $17,$10 /* save arg */
+ or $18,$0,$16 /* shuffle flags to front; add CLONE_VM. */
bsr $26,kernel_clone
bne $20,1f /* $20 is non-zero in child */
ldq $26,0($30)
@@ -257,7 +261,7 @@ __kernel_thread:
mov $0,$16
mov $31,$26
jsr $31,sys_exit
-.end __kernel_thread
+.end kernel_thread

/*
* __kernel_execve(path, argv, envp, regs)
diff -Nrup 2.3.13-4/arch/alpha/vmlinux.lds 2.3.13-axp/arch/alpha/vmlinux.lds
--- 2.3.13-4/arch/alpha/vmlinux.lds Wed Aug 4 02:21:03 1999
+++ 2.3.13-axp/arch/alpha/vmlinux.lds Wed Aug 4 01:34:57 1999
@@ -45,6 +45,7 @@ SECTIONS

/* Global data */
_data = .;
+ .data.cacheline_aligned : { *(.data.cacheline_aligned) }
.rodata : { *(.rodata) }
.data : { *(.data) CONSTRUCTORS }
.got : { *(.got) }
diff -Nrup 2.3.13-4/drivers/sound/sb_common.c 2.3.13-axp/drivers/sound/sb_common.c
--- 2.3.13-4/drivers/sound/sb_common.c Wed May 26 09:35:00 1999
+++ 2.3.13-axp/drivers/sound/sb_common.c Wed Aug 4 02:14:05 1999
@@ -18,7 +18,7 @@
*/
#include <linux/config.h>
#include <linux/delay.h>
-#include <asm/init.h>
+#include <linux/init.h>

#include "sound_config.h"
#include "sound_firmware.h"
diff -Nrup 2.3.13-4/include/asm-alpha/cache.h 2.3.13-axp/include/asm-alpha/cache.h
--- 2.3.13-4/include/asm-alpha/cache.h Mon Mar 15 16:11:55 1999
+++ 2.3.13-axp/include/asm-alpha/cache.h Wed Aug 4 01:21:55 1999
@@ -10,4 +10,12 @@
#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
#define SMP_CACHE_BYTES L1_CACHE_BYTES

+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff -Nrup 2.3.13-4/include/asm-alpha/init.h 2.3.13-axp/include/asm-alpha/init.h
--- 2.3.13-4/include/asm-alpha/init.h Wed Aug 4 02:21:04 1999
+++ 2.3.13-axp/include/asm-alpha/init.h Wed Aug 4 01:22:07 1999
@@ -1,49 +1 @@
-#ifndef _ALPHA_INIT_H
-#define _ALPHA_INIT_H
-
-#ifndef MODULE
-
-#define __init __attribute__ ((__section__ (".text.init")))
-#define __initdata __attribute__ ((__section__ (".data.init")))
-#define __initfunc(__arginit) \
- __arginit __init; \
- __arginit
-
-/* For assembly routines */
-#define __INIT .section .text.init,"ax"
-#define __FINIT .previous
-#define __INITDATA .section .data.init,"a"
-
-#define __cacheline_aligned __attribute__((__aligned__(32)))
-
-/*
- * Used for initialization calls.
- */
-
-typedef int (*initcall_t)(void);
-
-extern initcall_t __initcall_start, __initcall_end;
-
-#define __initcall(fn) \
- static __attribute__ ((unused, __section__ (".initcall.init"))) \
- initcall_t __initcall_##fn = fn
-
-/*
- * Used for kernel command line parameter setup.
- */
-
-struct kernel_param {
- const char *str;
- int (*setup_func)(char *);
-};
-
-extern struct kernel_param __setup_start, __setup_end;
-
-#define __setup(str, fn) \
- static __attribute__ ((__section__ (".data.init"))) \
- char __setup_str_##fn[] = str; \
- static __attribute__ ((unused, __section__ (".setup.init"))) \
- struct kernel_param __setup_##fn = { __setup_str_##fn, fn }
-
-#endif /* MODULE */
-#endif /* _ALPHA_INIT_H */
+#error "<asm/init.h> should never be used - use <linux/init.h> instead"
diff -Nrup 2.3.13-4/include/asm-alpha/processor.h 2.3.13-axp/include/asm-alpha/processor.h
--- 2.3.13-4/include/asm-alpha/processor.h Wed Aug 4 02:21:04 1999
+++ 2.3.13-axp/include/asm-alpha/processor.h Wed Aug 4 01:43:20 1999
@@ -111,13 +111,14 @@ extern inline unsigned long thread_saved
return 0;
}

-/*
- * Do necessary setup to start up a newly executed thread.
- */
+/* Do necessary setup to start up a newly executed thread. */
extern void start_thread(struct pt_regs *, unsigned long, unsigned long);

/* Free all resources held by a thread. */
extern void release_thread(struct task_struct *);
+
+/* Create a kernel thread without removing it from tasklists. */
+extern long kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);

#define copy_segments(tsk, mm) do { } while (0)
#define release_segments(mm) do { } while (0)
diff -Nrup 2.3.13-4/include/asm-alpha/unistd.h 2.3.13-axp/include/asm-alpha/unistd.h
--- 2.3.13-4/include/asm-alpha/unistd.h Wed Aug 4 02:21:04 1999
+++ 2.3.13-axp/include/asm-alpha/unistd.h Wed Aug 4 01:35:07 1999
@@ -496,13 +496,6 @@ type name (type1 arg1,type2 arg2,type3 a
#include <linux/string.h>
#include <linux/signal.h>

-extern long __kernel_thread(unsigned long, int (*)(void *), void *);
-
-static inline long kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
-{
- return __kernel_thread(flags | CLONE_VM, fn, arg);
-}
-
extern void sys_idle(void);
static inline void idle(void)
{
diff -Nrup 2.3.13-4/include/asm-i386/cache.h 2.3.13-axp/include/asm-i386/cache.h
--- 2.3.13-4/include/asm-i386/cache.h Mon Mar 15 16:11:55 1999
+++ 2.3.13-axp/include/asm-i386/cache.h Wed Aug 4 01:23:35 1999
@@ -15,4 +15,12 @@

#define SMP_CACHE_BYTES L1_CACHE_BYTES

+#ifdef MODULE
+#define __cacheline_aligned __attribute__((__aligned__(L1_CACHE_BYTES)))
+#else
+#define __cacheline_aligned \
+ __attribute__((__aligned__(L1_CACHE_BYTES), \
+ __section__(".data.cacheline_aligned")))
+#endif
+
#endif
diff -Nrup 2.3.13-4/include/linux/init.h 2.3.13-axp/include/linux/init.h
--- 2.3.13-4/include/linux/init.h Wed Aug 4 02:21:04 1999
+++ 2.3.13-axp/include/linux/init.h Wed Aug 4 02:12:14 1999
@@ -94,9 +94,6 @@ extern struct kernel_param __setup_start
#define __FINIT .previous
#define __INITDATA .section ".data.init","aw"

-#define __cacheline_aligned __attribute__ \
- ((__section__ (".data.cacheline_aligned")))
-
#define module_init(x) __initcall(x);
#define module_exit(x) /* nothing */

@@ -107,18 +104,24 @@ extern struct kernel_param __setup_start
#define __initdata
#define __exitdata
#define __initfunc(__arginit) __arginit
-#defint __initcall
+#define __initcall
/* For assembly routines */
#define __INIT
#define __FINIT
#define __INITDATA

+/* Not sure what version aliases were introduced in, but certainly in 2.95. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+#define module_init(x) int init_module(void) __attribute__((alias(#x)));
+#define module_exit(x) void cleanup_module(void) __attribute__((alias(#x)));
+#else
#define module_init(x) int init_module(void) { return x(); }
#define module_exit(x) void cleanup_module(void) { x(); }
+#endif

#endif

-#if __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
#define __initlocaldata __initdata
#else
#define __initlocaldata

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/