aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/kernel
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-05-09 06:12:06 -0400
committerPaul Mackerras <paulus@samba.org>2008-05-09 06:12:06 -0400
commit2a5f2e3e6cd1ce9fb3f8b186b6bc9aa1f1497a92 (patch)
treeb2306840f227972a7c9d4a2b75e516fe81358ce8 /arch/m68knommu/kernel
parent02539d71fa98d5737bb668b02286c76241e4bac9 (diff)
parent78be76476a34a77f0ea9db2f78ba46a2b0fd5ab5 (diff)
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx into merge
Diffstat (limited to 'arch/m68knommu/kernel')
-rw-r--r--arch/m68knommu/kernel/asm-offsets.c7
-rw-r--r--arch/m68knommu/kernel/entry.S9
-rw-r--r--arch/m68knommu/kernel/setup.c2
-rw-r--r--arch/m68knommu/kernel/signal.c21
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c17
-rw-r--r--arch/m68knommu/kernel/traps.c88
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S3
7 files changed, 73 insertions, 74 deletions
diff --git a/arch/m68knommu/kernel/asm-offsets.c b/arch/m68knommu/kernel/asm-offsets.c
index d97b89bae53c..c785d07c02cc 100644
--- a/arch/m68knommu/kernel/asm-offsets.c
+++ b/arch/m68knommu/kernel/asm-offsets.c
@@ -13,15 +13,11 @@
13#include <linux/kernel_stat.h> 13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <linux/hardirq.h> 15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
16#include <asm/bootinfo.h> 17#include <asm/bootinfo.h>
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <asm/thread_info.h> 19#include <asm/thread_info.h>
19 20
20#define DEFINE(sym, val) \
21 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
22
23#define BLANK() asm volatile("\n->" : : )
24
25int main(void) 21int main(void)
26{ 22{
27 /* offsets into the task struct */ 23 /* offsets into the task struct */
@@ -91,6 +87,7 @@ int main(void)
91 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 87 DEFINE(TI_TASK, offsetof(struct thread_info, task));
92 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 88 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 89 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
90 DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count));
94 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 91 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
95 92
96 return 0; 93 return 0;
diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S
index 1e7ea6a3e1a1..f4782d2dce8f 100644
--- a/arch/m68knommu/kernel/entry.S
+++ b/arch/m68knommu/kernel/entry.S
@@ -32,6 +32,7 @@
32#include <asm/segment.h> 32#include <asm/segment.h>
33#include <asm/asm-offsets.h> 33#include <asm/asm-offsets.h>
34#include <asm/entry.h> 34#include <asm/entry.h>
35#include <asm/unistd.h>
35 36
36.text 37.text
37 38
@@ -140,3 +141,11 @@ ENTRY(sys_rt_sigreturn)
140 RESTORE_SWITCH_STACK 141 RESTORE_SWITCH_STACK
141 rts 142 rts
142 143
144ENTRY(ret_from_user_signal)
145 moveq #__NR_sigreturn,%d0
146 trap #0
147
148ENTRY(ret_from_user_rt_signal)
149 move #__NR_rt_sigreturn,%d0
150 trap #0
151
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index d6f0200316fe..03f4fe6a2fc0 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -162,7 +162,7 @@ void __init setup_arch(char **cmdline_p)
162 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n"); 162 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
163#endif 163#endif
164#ifdef CONFIG_M5235EVB 164#ifdef CONFIG_M5235EVB
165 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)"); 165 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
166#endif 166#endif
167 167
168#ifdef DEBUG 168#ifdef DEBUG
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 70371378db86..bbfcae9e52b4 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -51,6 +51,8 @@
51 51
52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
53 53
54void ret_from_user_signal(void);
55void ret_from_user_rt_signal(void);
54asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs); 56asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs);
55 57
56/* 58/*
@@ -539,10 +541,6 @@ static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
539 return err; 541 return err;
540} 542}
541 543
542static inline void push_cache (unsigned long vaddr)
543{
544}
545
546static inline void * 544static inline void *
547get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 545get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
548{ 546{
@@ -586,16 +584,11 @@ static void setup_frame (int sig, struct k_sigaction *ka,
586 err |= copy_to_user (&frame->sc, &context, sizeof(context)); 584 err |= copy_to_user (&frame->sc, &context, sizeof(context));
587 585
588 /* Set up to return from userspace. */ 586 /* Set up to return from userspace. */
589 err |= __put_user(frame->retcode, &frame->pretcode); 587 err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
590 /* moveq #,d0; trap #0 */
591 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
592 (long *)(frame->retcode));
593 588
594 if (err) 589 if (err)
595 goto give_sigsegv; 590 goto give_sigsegv;
596 591
597 push_cache ((unsigned long) &frame->retcode);
598
599 /* Set up registers for signal handler */ 592 /* Set up registers for signal handler */
600 wrusp ((unsigned long) frame); 593 wrusp ((unsigned long) frame);
601 regs->pc = (unsigned long) ka->sa.sa_handler; 594 regs->pc = (unsigned long) ka->sa.sa_handler;
@@ -655,17 +648,11 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
655 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set)); 648 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
656 649
657 /* Set up to return from userspace. */ 650 /* Set up to return from userspace. */
658 err |= __put_user(frame->retcode, &frame->pretcode); 651 err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
659 /* moveq #,d0; notb d0; trap #0 */
660 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
661 (long *)(frame->retcode + 0));
662 err |= __put_user(0x4e40, (short *)(frame->retcode + 4));
663 652
664 if (err) 653 if (err)
665 goto give_sigsegv; 654 goto give_sigsegv;
666 655
667 push_cache ((unsigned long) &frame->retcode);
668
669 /* Set up registers for signal handler */ 656 /* Set up registers for signal handler */
670 wrusp ((unsigned long) frame); 657 wrusp ((unsigned long) frame);
671 regs->pc = (unsigned long) ka->sa.sa_handler; 658 regs->pc = (unsigned long) ka->sa.sa_handler;
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index 65f7a95f056e..700281638629 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -28,23 +28,6 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/unistd.h> 29#include <asm/unistd.h>
30 30
31/*
32 * sys_pipe() is the normal C calling standard for creating
33 * a pipe. It's not the way unix traditionally does this, though.
34 */
35asmlinkage int sys_pipe(unsigned long * fildes)
36{
37 int fd[2];
38 int error;
39
40 error = do_pipe(fd);
41 if (!error) {
42 if (copy_to_user(fildes, fd, 2*sizeof(int)))
43 error = -EFAULT;
44 }
45 return error;
46}
47
48/* common code for old and new mmaps */ 31/* common code for old and new mmaps */
49static inline long do_mmap2( 32static inline long do_mmap2(
50 unsigned long addr, unsigned long len, 33 unsigned long addr, unsigned long len,
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c
index 437a061d8b94..ec9aea652e79 100644
--- a/arch/m68knommu/kernel/traps.c
+++ b/arch/m68knommu/kernel/traps.c
@@ -28,6 +28,7 @@
28#include <linux/linkage.h> 28#include <linux/linkage.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
31 32
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/fpu.h> 34#include <asm/fpu.h>
@@ -102,56 +103,47 @@ asmlinkage void buserr_c(struct frame *fp)
102 force_sig(SIGSEGV, current); 103 force_sig(SIGSEGV, current);
103} 104}
104 105
105
106int kstack_depth_to_print = 48; 106int kstack_depth_to_print = 48;
107 107
108void show_stack(struct task_struct *task, unsigned long *stack) 108static void __show_stack(struct task_struct *task, unsigned long *stack)
109{ 109{
110 unsigned long *endstack, addr; 110 unsigned long *endstack, addr;
111 extern char _start, _etext; 111 unsigned long *last_stack;
112 int i; 112 int i;
113 113
114 if (!stack) { 114 if (!stack)
115 if (task) 115 stack = (unsigned long *)task->thread.ksp;
116 stack = (unsigned long *)task->thread.ksp;
117 else
118 stack = (unsigned long *)&stack;
119 }
120 116
121 addr = (unsigned long) stack; 117 addr = (unsigned long) stack;
122 endstack = (unsigned long *) PAGE_ALIGN(addr); 118 endstack = (unsigned long *) PAGE_ALIGN(addr);
123 119
124 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack); 120 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack);
125 for (i = 0; i < kstack_depth_to_print; i++) { 121 for (i = 0; i < kstack_depth_to_print; i++) {
126 if (stack + 1 > endstack) 122 if (stack + 1 + i > endstack)
127 break; 123 break;
128 if (i % 8 == 0) 124 if (i % 8 == 0)
129 printk("\n" KERN_EMERG " "); 125 printk("\n" KERN_EMERG " ");
130 printk(" %08lx", *stack++); 126 printk(" %08lx", *(stack + i));
131 } 127 }
132 printk("\n"); 128 printk("\n");
133 129
134 printk(KERN_EMERG "Call Trace:"); 130#ifdef CONFIG_FRAME_POINTER
135 i = 0; 131 printk(KERN_EMERG "Call Trace:\n");
136 while (stack + 1 <= endstack) { 132
137 addr = *stack++; 133 last_stack = stack - 1;
138 /* 134 while (stack <= endstack && stack > last_stack) {
139 * If the address is either in the text segment of the 135
140 * kernel, or in the region which contains vmalloc'ed 136 addr = *(stack + 1);
141 * memory, it *may* be the address of a calling 137 printk(KERN_EMERG " [%08lx] ", addr);
142 * routine; if so, print it so that someone tracing 138 print_symbol(KERN_CONT "%s\n", addr);
143 * down the cause of the crash will be able to figure 139
144 * out the call path that was taken. 140 last_stack = stack;
145 */ 141 stack = (unsigned long *)*stack;
146 if (((addr >= (unsigned long) &_start) &&
147 (addr <= (unsigned long) &_etext))) {
148 if (i % 4 == 0)
149 printk("\n" KERN_EMERG " ");
150 printk(" [<%08lx>]", addr);
151 i++;
152 }
153 } 142 }
154 printk("\n"); 143 printk("\n");
144#else
145 printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n");
146#endif
155} 147}
156 148
157void bad_super_trap(struct frame *fp) 149void bad_super_trap(struct frame *fp)
@@ -298,19 +290,47 @@ asmlinkage void set_esp0(unsigned long ssp)
298 current->thread.esp0 = ssp; 290 current->thread.esp0 = ssp;
299} 291}
300 292
301
302/* 293/*
303 * The architecture-independent backtrace generator 294 * The architecture-independent backtrace generator
304 */ 295 */
305void dump_stack(void) 296void dump_stack(void)
306{ 297{
307 unsigned long stack; 298 /*
299 * We need frame pointers for this little trick, which works as follows:
300 *
301 * +------------+ 0x00
302 * | Next SP | -> 0x0c
303 * +------------+ 0x04
304 * | Caller |
305 * +------------+ 0x08
306 * | Local vars | -> our stack var
307 * +------------+ 0x0c
308 * | Next SP | -> 0x18, that is what we pass to show_stack()
309 * +------------+ 0x10
310 * | Caller |
311 * +------------+ 0x14
312 * | Local vars |
313 * +------------+ 0x18
314 * | ... |
315 * +------------+
316 */
308 317
309 show_stack(current, &stack); 318 unsigned long *stack;
310}
311 319
320 stack = (unsigned long *)&stack;
321 stack++;
322 __show_stack(current, stack);
323}
312EXPORT_SYMBOL(dump_stack); 324EXPORT_SYMBOL(dump_stack);
313 325
326void show_stack(struct task_struct *task, unsigned long *stack)
327{
328 if (!stack && !task)
329 dump_stack();
330 else
331 __show_stack(task, stack);
332}
333
314#ifdef CONFIG_M68KFPU_EMU 334#ifdef CONFIG_M68KFPU_EMU
315asmlinkage void fpemu_signal(int signal, int code, void *addr) 335asmlinkage void fpemu_signal(int signal, int code, void *addr)
316{ 336{
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index b44edb08e212..5592e0bf951f 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -64,6 +64,7 @@ SECTIONS {
64 _stext = . ; 64 _stext = . ;
65 TEXT_TEXT 65 TEXT_TEXT
66 SCHED_TEXT 66 SCHED_TEXT
67 LOCK_TEXT
67 *(.text.lock) 68 *(.text.lock)
68 69
69 . = ALIGN(16); /* Exception table */ 70 . = ALIGN(16); /* Exception table */
@@ -73,6 +74,7 @@ SECTIONS {
73 74
74 *(.rodata) *(.rodata.*) 75 *(.rodata) *(.rodata.*)
75 *(__vermagic) /* Kernel version magic */ 76 *(__vermagic) /* Kernel version magic */
77 *(__markers_strings)
76 *(.rodata1) 78 *(.rodata1)
77 *(.rodata.str1.1) 79 *(.rodata.str1.1)
78 80
@@ -182,6 +184,7 @@ SECTIONS {
182 *(COMMON) 184 *(COMMON)
183 . = ALIGN(4) ; 185 . = ALIGN(4) ;
184 _ebss = . ; 186 _ebss = . ;
187 _end = . ;
185 } > BSS 188 } > BSS
186 189
187} 190}