aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m68knommu/kernel')
-rw-r--r--arch/m68knommu/kernel/Makefile10
-rw-r--r--arch/m68knommu/kernel/asm-offsets.c87
-rw-r--r--arch/m68knommu/kernel/dma.c74
-rw-r--r--arch/m68knommu/kernel/entry.S150
-rw-r--r--arch/m68knommu/kernel/init_task.c36
-rw-r--r--arch/m68knommu/kernel/irq.c56
-rw-r--r--arch/m68knommu/kernel/m68k_ksyms.c78
-rw-r--r--arch/m68knommu/kernel/module.c126
-rw-r--r--arch/m68knommu/kernel/process.c405
-rw-r--r--arch/m68knommu/kernel/ptrace.c279
-rw-r--r--arch/m68knommu/kernel/setup.c356
-rw-r--r--arch/m68knommu/kernel/signal.c789
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c94
-rw-r--r--arch/m68knommu/kernel/syscalltable.S365
-rw-r--r--arch/m68knommu/kernel/time.c89
-rw-r--r--arch/m68knommu/kernel/traps.c375
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S182
17 files changed, 0 insertions, 3551 deletions
diff --git a/arch/m68knommu/kernel/Makefile b/arch/m68knommu/kernel/Makefile
deleted file mode 100644
index 37c3fc074c0a..000000000000
--- a/arch/m68knommu/kernel/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Makefile for arch/m68knommu/kernel.
3#
4
5extra-y := vmlinux.lds
6
7obj-y += dma.o entry.o init_task.o irq.o m68k_ksyms.o process.o ptrace.o \
8 setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
9
10obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/m68knommu/kernel/asm-offsets.c b/arch/m68knommu/kernel/asm-offsets.c
deleted file mode 100644
index 9a8876f715d8..000000000000
--- a/arch/m68knommu/kernel/asm-offsets.c
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 * This program is used to generate definitions needed by
3 * assembly language modules.
4 *
5 * We use the technique used in the OSF Mach kernel code:
6 * generate asm statements containing #defines,
7 * compile this file to assembler, and then extract the
8 * #defines from the assembly-language output.
9 */
10
11#include <linux/stddef.h>
12#include <linux/sched.h>
13#include <linux/kernel_stat.h>
14#include <linux/ptrace.h>
15#include <linux/hardirq.h>
16#include <linux/kbuild.h>
17#include <asm/bootinfo.h>
18#include <asm/irq.h>
19#include <asm/thread_info.h>
20
21int main(void)
22{
23 /* offsets into the task struct */
24 DEFINE(TASK_STATE, offsetof(struct task_struct, state));
25 DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
26 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace));
27 DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
28 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
29 DEFINE(TASK_THREAD_INFO, offsetof(struct task_struct, stack));
30 DEFINE(TASK_MM, offsetof(struct task_struct, mm));
31 DEFINE(TASK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
32
33 /* offsets into the irq_cpustat_t struct */
34 DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
35
36 /* offsets into the thread struct */
37 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
38 DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
39 DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
40 DEFINE(THREAD_FS, offsetof(struct thread_struct, fs));
41 DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp));
42 DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
43 DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp));
44 DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl));
45 DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate));
46
47 /* offsets into the pt_regs */
48 DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0));
49 DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0));
50 DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1));
51 DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2));
52 DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3));
53 DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4));
54 DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5));
55 DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0));
56 DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1));
57 DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2));
58 DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc));
59 DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr));
60
61#ifdef CONFIG_COLDFIRE
62 /* bitfields are a bit difficult */
63 DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2);
64#else
65 /* bitfields are a bit difficult */
66 DEFINE(PT_OFF_VECTOR, offsetof(struct pt_regs, pc) + 4);
67#endif
68
69 /* signal defines */
70 DEFINE(SIGSEGV, SIGSEGV);
71 DEFINE(SEGV_MAPERR, SEGV_MAPERR);
72 DEFINE(SIGTRAP, SIGTRAP);
73 DEFINE(TRAP_TRACE, TRAP_TRACE);
74
75 DEFINE(PT_PTRACED, PT_PTRACED);
76
77 DEFINE(THREAD_SIZE, THREAD_SIZE);
78
79 /* Offsets in thread_info structure */
80 DEFINE(TI_TASK, offsetof(struct thread_info, task));
81 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
82 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
83 DEFINE(TI_PREEMPTCOUNT, offsetof(struct thread_info, preempt_count));
84 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
85
86 return 0;
87}
diff --git a/arch/m68knommu/kernel/dma.c b/arch/m68knommu/kernel/dma.c
deleted file mode 100644
index fc61541aeb71..000000000000
--- a/arch/m68knommu/kernel/dma.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * Dynamic DMA mapping support.
3 *
4 * We never have any address translations to worry about, so this
5 * is just alloc/free.
6 */
7
8#include <linux/types.h>
9#include <linux/gfp.h>
10#include <linux/mm.h>
11#include <linux/device.h>
12#include <linux/dma-mapping.h>
13#include <asm/cacheflush.h>
14
15void *dma_alloc_coherent(struct device *dev, size_t size,
16 dma_addr_t *dma_handle, gfp_t gfp)
17{
18 void *ret;
19 /* ignore region specifiers */
20 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
21
22 if (dev == NULL || (*dev->dma_mask < 0xffffffff))
23 gfp |= GFP_DMA;
24 ret = (void *)__get_free_pages(gfp, get_order(size));
25
26 if (ret != NULL) {
27 memset(ret, 0, size);
28 *dma_handle = virt_to_phys(ret);
29 }
30 return ret;
31}
32
33void dma_free_coherent(struct device *dev, size_t size,
34 void *vaddr, dma_addr_t dma_handle)
35{
36 free_pages((unsigned long)vaddr, get_order(size));
37}
38
39void dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
40 size_t size, enum dma_data_direction dir)
41{
42 switch (dir) {
43 case DMA_TO_DEVICE:
44 flush_dcache_range(handle, size);
45 break;
46 case DMA_FROM_DEVICE:
47 /* Should be clear already */
48 break;
49 default:
50 if (printk_ratelimit())
51 printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
52 break;
53 }
54}
55
56EXPORT_SYMBOL(dma_sync_single_for_device);
57dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size,
58 enum dma_data_direction dir)
59{
60 dma_addr_t handle = virt_to_phys(addr);
61 flush_dcache_range(handle, size);
62 return handle;
63}
64EXPORT_SYMBOL(dma_map_single);
65
66dma_addr_t dma_map_page(struct device *dev, struct page *page,
67 unsigned long offset, size_t size,
68 enum dma_data_direction dir)
69{
70 dma_addr_t handle = page_to_phys(page) + offset;
71 dma_sync_single_for_device(dev, handle, size, dir);
72 return handle;
73}
74EXPORT_SYMBOL(dma_map_page);
diff --git a/arch/m68knommu/kernel/entry.S b/arch/m68knommu/kernel/entry.S
deleted file mode 100644
index aff6f57ef8b5..000000000000
--- a/arch/m68knommu/kernel/entry.S
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/entry.S
3 *
4 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
5 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
6 * Kenneth Albanowski <kjahds@kjahds.com>,
7 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
8 *
9 * Based on:
10 *
11 * linux/arch/m68k/kernel/entry.S
12 *
13 * Copyright (C) 1991, 1992 Linus Torvalds
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file README.legal in the main directory of this archive
17 * for more details.
18 *
19 * Linux/m68k support by Hamish Macdonald
20 *
21 * 68060 fixes by Jesper Skov
22 * ColdFire support by Greg Ungerer (gerg@snapgear.com)
23 * 5307 fixes by David W. Miller
24 * linux 2.4 support David McCullough <davidm@snapgear.com>
25 */
26
27#include <linux/sys.h>
28#include <linux/linkage.h>
29#include <asm/errno.h>
30#include <asm/setup.h>
31#include <asm/segment.h>
32#include <asm/asm-offsets.h>
33#include <asm/entry.h>
34#include <asm/unistd.h>
35
36.text
37
38.globl buserr
39.globl trap
40.globl ret_from_exception
41.globl ret_from_signal
42.globl sys_fork
43.globl sys_clone
44.globl sys_vfork
45
46ENTRY(buserr)
47 SAVE_ALL
48 moveq #-1,%d0
49 movel %d0,%sp@(PT_OFF_ORIG_D0)
50 movel %sp,%sp@- /* stack frame pointer argument */
51 jsr buserr_c
52 addql #4,%sp
53 jra ret_from_exception
54
55ENTRY(trap)
56 SAVE_ALL
57 moveq #-1,%d0
58 movel %d0,%sp@(PT_OFF_ORIG_D0)
59 movel %sp,%sp@- /* stack frame pointer argument */
60 jsr trap_c
61 addql #4,%sp
62 jra ret_from_exception
63
64#ifdef TRAP_DBG_INTERRUPT
65
66.globl dbginterrupt
67ENTRY(dbginterrupt)
68 SAVE_ALL
69 moveq #-1,%d0
70 movel %d0,%sp@(PT_OFF_ORIG_D0)
71 movel %sp,%sp@- /* stack frame pointer argument */
72 jsr dbginterrupt_c
73 addql #4,%sp
74 jra ret_from_exception
75#endif
76
77ENTRY(reschedule)
78 /* save top of frame */
79 pea %sp@
80 jbsr set_esp0
81 addql #4,%sp
82 pea ret_from_exception
83 jmp schedule
84
85ENTRY(ret_from_fork)
86 movel %d1,%sp@-
87 jsr schedule_tail
88 addql #4,%sp
89 jra ret_from_exception
90
91ENTRY(sys_fork)
92 SAVE_SWITCH_STACK
93 pea %sp@(SWITCH_STACK_SIZE)
94 jbsr m68k_fork
95 addql #4,%sp
96 RESTORE_SWITCH_STACK
97 rts
98
99ENTRY(sys_vfork)
100 SAVE_SWITCH_STACK
101 pea %sp@(SWITCH_STACK_SIZE)
102 jbsr m68k_vfork
103 addql #4,%sp
104 RESTORE_SWITCH_STACK
105 rts
106
107ENTRY(sys_clone)
108 SAVE_SWITCH_STACK
109 pea %sp@(SWITCH_STACK_SIZE)
110 jbsr m68k_clone
111 addql #4,%sp
112 RESTORE_SWITCH_STACK
113 rts
114
115ENTRY(sys_sigsuspend)
116 SAVE_SWITCH_STACK
117 pea %sp@(SWITCH_STACK_SIZE)
118 jbsr do_sigsuspend
119 addql #4,%sp
120 RESTORE_SWITCH_STACK
121 rts
122
123ENTRY(sys_rt_sigsuspend)
124 SAVE_SWITCH_STACK
125 pea %sp@(SWITCH_STACK_SIZE)
126 jbsr do_rt_sigsuspend
127 addql #4,%sp
128 RESTORE_SWITCH_STACK
129 rts
130
131ENTRY(sys_sigreturn)
132 SAVE_SWITCH_STACK
133 jbsr do_sigreturn
134 RESTORE_SWITCH_STACK
135 rts
136
137ENTRY(sys_rt_sigreturn)
138 SAVE_SWITCH_STACK
139 jbsr do_rt_sigreturn
140 RESTORE_SWITCH_STACK
141 rts
142
143ENTRY(ret_from_user_signal)
144 moveq #__NR_sigreturn,%d0
145 trap #0
146
147ENTRY(ret_from_user_rt_signal)
148 movel #__NR_rt_sigreturn,%d0
149 trap #0
150
diff --git a/arch/m68knommu/kernel/init_task.c b/arch/m68knommu/kernel/init_task.c
deleted file mode 100644
index cbf9dc3cc51d..000000000000
--- a/arch/m68knommu/kernel/init_task.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/init_task.c
3 */
4#include <linux/mm.h>
5#include <linux/module.h>
6#include <linux/sched.h>
7#include <linux/init.h>
8#include <linux/init_task.h>
9#include <linux/fs.h>
10#include <linux/mqueue.h>
11
12#include <asm/uaccess.h>
13#include <asm/pgtable.h>
14
15static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
16static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
17/*
18 * Initial task structure.
19 *
20 * All other task structs will be allocated on slabs in fork.c
21 */
22__asm__(".align 4");
23struct task_struct init_task = INIT_TASK(init_task);
24
25EXPORT_SYMBOL(init_task);
26
27/*
28 * Initial thread structure.
29 *
30 * We need to make sure that this is 8192-byte aligned due to the
31 * way process stacks are handled. This is done by having a special
32 * "init_task" linker map entry..
33 */
34union thread_union init_thread_union __init_task_data =
35 { INIT_THREAD_INFO(init_task) };
36
diff --git a/arch/m68knommu/kernel/irq.c b/arch/m68knommu/kernel/irq.c
deleted file mode 100644
index c9cac36d4422..000000000000
--- a/arch/m68knommu/kernel/irq.c
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * irq.c
3 *
4 * (C) Copyright 2007, Greg Ungerer <gerg@snapgear.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/kernel_stat.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/seq_file.h>
18#include <asm/system.h>
19#include <asm/traps.h>
20
21asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
22{
23 struct pt_regs *oldregs = set_irq_regs(regs);
24
25 irq_enter();
26 generic_handle_irq(irq);
27 irq_exit();
28
29 set_irq_regs(oldregs);
30}
31
32int show_interrupts(struct seq_file *p, void *v)
33{
34 struct irqaction *ap;
35 int irq = *((loff_t *) v);
36
37 if (irq == 0)
38 seq_puts(p, " CPU0\n");
39
40 if (irq < NR_IRQS) {
41 ap = irq_desc[irq].action;
42 if (ap) {
43 seq_printf(p, "%3d: ", irq);
44 seq_printf(p, "%10u ", kstat_irqs(irq));
45 seq_printf(p, "%14s ", irq_desc[irq].chip->name);
46
47 seq_printf(p, "%s", ap->name);
48 for (ap = ap->next; ap; ap = ap->next)
49 seq_printf(p, ", %s", ap->name);
50 seq_putc(p, '\n');
51 }
52 }
53
54 return 0;
55}
56
diff --git a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c
deleted file mode 100644
index 39fe0a7aec32..000000000000
--- a/arch/m68knommu/kernel/m68k_ksyms.c
+++ /dev/null
@@ -1,78 +0,0 @@
1#include <linux/module.h>
2#include <linux/linkage.h>
3#include <linux/sched.h>
4#include <linux/string.h>
5#include <linux/mm.h>
6#include <linux/user.h>
7#include <linux/elfcore.h>
8#include <linux/in6.h>
9#include <linux/interrupt.h>
10
11#include <asm/setup.h>
12#include <asm/machdep.h>
13#include <asm/pgalloc.h>
14#include <asm/irq.h>
15#include <asm/io.h>
16#include <asm/checksum.h>
17#include <asm/current.h>
18
19extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
20
21/* platform dependent support */
22
23EXPORT_SYMBOL(__ioremap);
24EXPORT_SYMBOL(iounmap);
25EXPORT_SYMBOL(dump_fpu);
26
27EXPORT_SYMBOL(ip_fast_csum);
28
29EXPORT_SYMBOL(kernel_thread);
30
31/* Networking helper routines. */
32EXPORT_SYMBOL(csum_partial_copy_nocheck);
33
34/* The following are special because they're not called
35 explicitly (the C compiler generates them). Fortunately,
36 their interface isn't gonna change any time soon now, so
37 it's OK to leave it out of version control. */
38EXPORT_SYMBOL(memcpy);
39EXPORT_SYMBOL(memset);
40
41/*
42 * libgcc functions - functions that are used internally by the
43 * compiler... (prototypes are not correct though, but that
44 * doesn't really matter since they're not versioned).
45 */
46extern void __ashldi3(void);
47extern void __ashrdi3(void);
48extern void __divsi3(void);
49extern void __lshrdi3(void);
50extern void __modsi3(void);
51extern void __muldi3(void);
52extern void __mulsi3(void);
53extern void __udivsi3(void);
54extern void __umodsi3(void);
55
56 /* gcc lib functions */
57EXPORT_SYMBOL(__ashldi3);
58EXPORT_SYMBOL(__ashrdi3);
59EXPORT_SYMBOL(__divsi3);
60EXPORT_SYMBOL(__lshrdi3);
61EXPORT_SYMBOL(__modsi3);
62EXPORT_SYMBOL(__muldi3);
63EXPORT_SYMBOL(__mulsi3);
64EXPORT_SYMBOL(__udivsi3);
65EXPORT_SYMBOL(__umodsi3);
66
67#ifdef CONFIG_COLDFIRE
68extern unsigned int *dma_device_address;
69extern unsigned long dma_base_addr, _ramend;
70EXPORT_SYMBOL(dma_base_addr);
71EXPORT_SYMBOL(dma_device_address);
72EXPORT_SYMBOL(_ramend);
73
74extern asmlinkage void trap(void);
75extern void *_ramvec;
76EXPORT_SYMBOL(trap);
77EXPORT_SYMBOL(_ramvec);
78#endif /* CONFIG_COLDFIRE */
diff --git a/arch/m68knommu/kernel/module.c b/arch/m68knommu/kernel/module.c
deleted file mode 100644
index d11ffae7956a..000000000000
--- a/arch/m68knommu/kernel/module.c
+++ /dev/null
@@ -1,126 +0,0 @@
1#include <linux/moduleloader.h>
2#include <linux/elf.h>
3#include <linux/vmalloc.h>
4#include <linux/fs.h>
5#include <linux/string.h>
6#include <linux/kernel.h>
7
8#if 0
9#define DEBUGP printk
10#else
11#define DEBUGP(fmt...)
12#endif
13
14void *module_alloc(unsigned long size)
15{
16 if (size == 0)
17 return NULL;
18 return vmalloc(size);
19}
20
21
22/* Free memory returned from module_alloc */
23void module_free(struct module *mod, void *module_region)
24{
25 vfree(module_region);
26}
27
28/* We don't need anything special. */
29int module_frob_arch_sections(Elf_Ehdr *hdr,
30 Elf_Shdr *sechdrs,
31 char *secstrings,
32 struct module *mod)
33{
34 return 0;
35}
36
37int apply_relocate(Elf32_Shdr *sechdrs,
38 const char *strtab,
39 unsigned int symindex,
40 unsigned int relsec,
41 struct module *me)
42{
43 unsigned int i;
44 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
45 Elf32_Sym *sym;
46 uint32_t *location;
47
48 DEBUGP("Applying relocate section %u to %u\n", relsec,
49 sechdrs[relsec].sh_info);
50 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
51 /* This is where to make the change */
52 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
53 + rel[i].r_offset;
54 /* This is the symbol it is referring to. Note that all
55 undefined symbols have been resolved. */
56 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
57 + ELF32_R_SYM(rel[i].r_info);
58
59 switch (ELF32_R_TYPE(rel[i].r_info)) {
60 case R_68K_32:
61 /* We add the value into the location given */
62 *location += sym->st_value;
63 break;
64 case R_68K_PC32:
65 /* Add the value, subtract its postition */
66 *location += sym->st_value - (uint32_t)location;
67 break;
68 default:
69 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
70 me->name, ELF32_R_TYPE(rel[i].r_info));
71 return -ENOEXEC;
72 }
73 }
74 return 0;
75}
76
77int apply_relocate_add(Elf32_Shdr *sechdrs,
78 const char *strtab,
79 unsigned int symindex,
80 unsigned int relsec,
81 struct module *me)
82{
83 unsigned int i;
84 Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr;
85 Elf32_Sym *sym;
86 uint32_t *location;
87
88 DEBUGP("Applying relocate_add section %u to %u\n", relsec,
89 sechdrs[relsec].sh_info);
90 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
91 /* This is where to make the change */
92 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
93 + rel[i].r_offset;
94 /* This is the symbol it is referring to. Note that all
95 undefined symbols have been resolved. */
96 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
97 + ELF32_R_SYM(rel[i].r_info);
98
99 switch (ELF32_R_TYPE(rel[i].r_info)) {
100 case R_68K_32:
101 /* We add the value into the location given */
102 *location = rel[i].r_addend + sym->st_value;
103 break;
104 case R_68K_PC32:
105 /* Add the value, subtract its postition */
106 *location = rel[i].r_addend + sym->st_value - (uint32_t)location;
107 break;
108 default:
109 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
110 me->name, ELF32_R_TYPE(rel[i].r_info));
111 return -ENOEXEC;
112 }
113 }
114 return 0;
115}
116
117int module_finalize(const Elf_Ehdr *hdr,
118 const Elf_Shdr *sechdrs,
119 struct module *me)
120{
121 return 0;
122}
123
124void module_arch_cleanup(struct module *mod)
125{
126}
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
deleted file mode 100644
index 6d3390590e5b..000000000000
--- a/arch/m68knommu/kernel/process.c
+++ /dev/null
@@ -1,405 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/process.c
3 *
4 * Copyright (C) 1995 Hamish Macdonald
5 *
6 * 68060 fixes by Jesper Skov
7 *
8 * uClinux changes
9 * Copyright (C) 2000-2002, David McCullough <davidm@snapgear.com>
10 */
11
12/*
13 * This file handles the architecture-dependent parts of process handling..
14 */
15
16#include <linux/module.h>
17#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/kernel.h>
20#include <linux/mm.h>
21#include <linux/smp.h>
22#include <linux/smp_lock.h>
23#include <linux/stddef.h>
24#include <linux/unistd.h>
25#include <linux/ptrace.h>
26#include <linux/user.h>
27#include <linux/interrupt.h>
28#include <linux/reboot.h>
29#include <linux/fs.h>
30#include <linux/slab.h>
31
32#include <asm/uaccess.h>
33#include <asm/system.h>
34#include <asm/traps.h>
35#include <asm/machdep.h>
36#include <asm/setup.h>
37#include <asm/pgtable.h>
38
39asmlinkage void ret_from_fork(void);
40
41/*
42 * The following aren't currently used.
43 */
44void (*pm_idle)(void);
45EXPORT_SYMBOL(pm_idle);
46
47void (*pm_power_off)(void);
48EXPORT_SYMBOL(pm_power_off);
49
50/*
51 * The idle loop on an m68knommu..
52 */
53static void default_idle(void)
54{
55 local_irq_disable();
56 while (!need_resched()) {
57 /* This stop will re-enable interrupts */
58 __asm__("stop #0x2000" : : : "cc");
59 local_irq_disable();
60 }
61 local_irq_enable();
62}
63
64void (*idle)(void) = default_idle;
65
66/*
67 * The idle thread. There's no useful work to be
68 * done, so just try to conserve power and have a
69 * low exit latency (ie sit in a loop waiting for
70 * somebody to say that they'd like to reschedule)
71 */
72void cpu_idle(void)
73{
74 /* endless idle loop with no priority at all */
75 while (1) {
76 idle();
77 preempt_enable_no_resched();
78 schedule();
79 preempt_disable();
80 }
81}
82
83void machine_restart(char * __unused)
84{
85 if (mach_reset)
86 mach_reset();
87 for (;;);
88}
89
90void machine_halt(void)
91{
92 if (mach_halt)
93 mach_halt();
94 for (;;);
95}
96
97void machine_power_off(void)
98{
99 if (mach_power_off)
100 mach_power_off();
101 for (;;);
102}
103
104void show_regs(struct pt_regs * regs)
105{
106 printk(KERN_NOTICE "\n");
107 printk(KERN_NOTICE "Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
108 regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
109 printk(KERN_NOTICE "ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
110 regs->orig_d0, regs->d0, regs->a2, regs->a1);
111 printk(KERN_NOTICE "A0: %08lx D5: %08lx D4: %08lx\n",
112 regs->a0, regs->d5, regs->d4);
113 printk(KERN_NOTICE "D3: %08lx D2: %08lx D1: %08lx\n",
114 regs->d3, regs->d2, regs->d1);
115 if (!(regs->sr & PS_S))
116 printk(KERN_NOTICE "USP: %08lx\n", rdusp());
117}
118
119/*
120 * Create a kernel thread
121 */
122int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
123{
124 int retval;
125 long clone_arg = flags | CLONE_VM;
126 mm_segment_t fs;
127
128 fs = get_fs();
129 set_fs(KERNEL_DS);
130
131 __asm__ __volatile__ (
132 "movel %%sp, %%d2\n\t"
133 "movel %5, %%d1\n\t"
134 "movel %1, %%d0\n\t"
135 "trap #0\n\t"
136 "cmpl %%sp, %%d2\n\t"
137 "jeq 1f\n\t"
138 "movel %3, %%sp@-\n\t"
139 "jsr %4@\n\t"
140 "movel %2, %%d0\n\t"
141 "trap #0\n"
142 "1:\n\t"
143 "movel %%d0, %0\n"
144 : "=d" (retval)
145 : "i" (__NR_clone),
146 "i" (__NR_exit),
147 "a" (arg),
148 "a" (fn),
149 "a" (clone_arg)
150 : "cc", "%d0", "%d1", "%d2");
151
152 set_fs(fs);
153 return retval;
154}
155
156void flush_thread(void)
157{
158#ifdef CONFIG_FPU
159 unsigned long zero = 0;
160#endif
161 set_fs(USER_DS);
162 current->thread.fs = __USER_DS;
163#ifdef CONFIG_FPU
164 if (!FPU_IS_EMU)
165 asm volatile (".chip 68k/68881\n\t"
166 "frestore %0@\n\t"
167 ".chip 68k" : : "a" (&zero));
168#endif
169}
170
171/*
172 * "m68k_fork()".. By the time we get here, the
173 * non-volatile registers have also been saved on the
174 * stack. We do some ugly pointer stuff here.. (see
175 * also copy_thread)
176 */
177
178asmlinkage int m68k_fork(struct pt_regs *regs)
179{
180 /* fork almost works, enough to trick you into looking elsewhere :-( */
181 return(-EINVAL);
182}
183
184asmlinkage int m68k_vfork(struct pt_regs *regs)
185{
186 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
187}
188
189asmlinkage int m68k_clone(struct pt_regs *regs)
190{
191 unsigned long clone_flags;
192 unsigned long newsp;
193
194 /* syscall2 puts clone_flags in d1 and usp in d2 */
195 clone_flags = regs->d1;
196 newsp = regs->d2;
197 if (!newsp)
198 newsp = rdusp();
199 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
200}
201
202int copy_thread(unsigned long clone_flags,
203 unsigned long usp, unsigned long topstk,
204 struct task_struct * p, struct pt_regs * regs)
205{
206 struct pt_regs * childregs;
207 struct switch_stack * childstack, *stack;
208 unsigned long *retp;
209
210 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
211
212 *childregs = *regs;
213 childregs->d0 = 0;
214
215 retp = ((unsigned long *) regs);
216 stack = ((struct switch_stack *) retp) - 1;
217
218 childstack = ((struct switch_stack *) childregs) - 1;
219 *childstack = *stack;
220 childstack->retpc = (unsigned long)ret_from_fork;
221
222 p->thread.usp = usp;
223 p->thread.ksp = (unsigned long)childstack;
224
225 if (clone_flags & CLONE_SETTLS)
226 task_thread_info(p)->tp_value = regs->d5;
227
228 /*
229 * Must save the current SFC/DFC value, NOT the value when
230 * the parent was last descheduled - RGH 10-08-96
231 */
232 p->thread.fs = get_fs().seg;
233
234#ifdef CONFIG_FPU
235 if (!FPU_IS_EMU) {
236 /* Copy the current fpu state */
237 asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
238
239 if (p->thread.fpstate[0])
240 asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
241 "fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
242 : : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0])
243 : "memory");
244 /* Restore the state in case the fpu was busy */
245 asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
246 }
247#endif
248
249 return 0;
250}
251
252/* Fill in the fpu structure for a core dump. */
253
254int dump_fpu(struct pt_regs *regs, struct user_m68kfp_struct *fpu)
255{
256#ifdef CONFIG_FPU
257 char fpustate[216];
258
259 if (FPU_IS_EMU) {
260 int i;
261
262 memcpy(fpu->fpcntl, current->thread.fpcntl, 12);
263 memcpy(fpu->fpregs, current->thread.fp, 96);
264 /* Convert internal fpu reg representation
265 * into long double format
266 */
267 for (i = 0; i < 24; i += 3)
268 fpu->fpregs[i] = ((fpu->fpregs[i] & 0xffff0000) << 15) |
269 ((fpu->fpregs[i] & 0x0000ffff) << 16);
270 return 1;
271 }
272
273 /* First dump the fpu context to avoid protocol violation. */
274 asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");
275 if (!fpustate[0])
276 return 0;
277
278 asm volatile ("fmovem %/fpiar/%/fpcr/%/fpsr,%0"
279 :: "m" (fpu->fpcntl[0])
280 : "memory");
281 asm volatile ("fmovemx %/fp0-%/fp7,%0"
282 :: "m" (fpu->fpregs[0])
283 : "memory");
284#endif
285 return 1;
286}
287
288/*
289 * Generic dumping code. Used for panic and debug.
290 */
291void dump(struct pt_regs *fp)
292{
293 unsigned long *sp;
294 unsigned char *tp;
295 int i;
296
297 printk(KERN_EMERG "\nCURRENT PROCESS:\n\n");
298 printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid);
299
300 if (current->mm) {
301 printk(KERN_EMERG "TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n",
302 (int) current->mm->start_code,
303 (int) current->mm->end_code,
304 (int) current->mm->start_data,
305 (int) current->mm->end_data,
306 (int) current->mm->end_data,
307 (int) current->mm->brk);
308 printk(KERN_EMERG "USER-STACK=%08x KERNEL-STACK=%08x\n\n",
309 (int) current->mm->start_stack,
310 (int)(((unsigned long) current) + THREAD_SIZE));
311 }
312
313 printk(KERN_EMERG "PC: %08lx\n", fp->pc);
314 printk(KERN_EMERG "SR: %08lx SP: %08lx\n", (long) fp->sr, (long) fp);
315 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
316 fp->d0, fp->d1, fp->d2, fp->d3);
317 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
318 fp->d4, fp->d5, fp->a0, fp->a1);
319 printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %p\n",
320 (unsigned int) rdusp(), fp);
321
322 printk(KERN_EMERG "\nCODE:");
323 tp = ((unsigned char *) fp->pc) - 0x20;
324 for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) {
325 if ((i % 0x10) == 0)
326 printk(KERN_EMERG "%p: ", tp + i);
327 printk("%08x ", (int) *sp++);
328 }
329 printk(KERN_EMERG "\n");
330
331 printk(KERN_EMERG "KERNEL STACK:");
332 tp = ((unsigned char *) fp) - 0x40;
333 for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) {
334 if ((i % 0x10) == 0)
335 printk(KERN_EMERG "%p: ", tp + i);
336 printk("%08x ", (int) *sp++);
337 }
338 printk(KERN_EMERG "\n");
339
340 printk(KERN_EMERG "USER STACK:");
341 tp = (unsigned char *) (rdusp() - 0x10);
342 for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) {
343 if ((i % 0x10) == 0)
344 printk(KERN_EMERG "%p: ", tp + i);
345 printk("%08x ", (int) *sp++);
346 }
347 printk(KERN_EMERG "\n");
348}
349
350/*
351 * sys_execve() executes a new program.
352 */
353asmlinkage int sys_execve(const char *name,
354 const char *const *argv,
355 const char *const *envp)
356{
357 int error;
358 char * filename;
359 struct pt_regs *regs = (struct pt_regs *) &name;
360
361 filename = getname(name);
362 error = PTR_ERR(filename);
363 if (IS_ERR(filename))
364 return error;
365 error = do_execve(filename, argv, envp, regs);
366 putname(filename);
367 return error;
368}
369
370unsigned long get_wchan(struct task_struct *p)
371{
372 unsigned long fp, pc;
373 unsigned long stack_page;
374 int count = 0;
375 if (!p || p == current || p->state == TASK_RUNNING)
376 return 0;
377
378 stack_page = (unsigned long)p;
379 fp = ((struct switch_stack *)p->thread.ksp)->a6;
380 do {
381 if (fp < stack_page+sizeof(struct thread_info) ||
382 fp >= THREAD_SIZE-8+stack_page)
383 return 0;
384 pc = ((unsigned long *)fp)[1];
385 if (!in_sched_functions(pc))
386 return pc;
387 fp = *(unsigned long *) fp;
388 } while (count++ < 16);
389 return 0;
390}
391
392/*
393 * Return saved PC of a blocked thread.
394 */
395unsigned long thread_saved_pc(struct task_struct *tsk)
396{
397 struct switch_stack *sw = (struct switch_stack *)tsk->thread.ksp;
398
399 /* Check whether the thread is blocked in resume() */
400 if (in_sched_functions(sw->retpc))
401 return ((unsigned long *)sw->a6)[1];
402 else
403 return sw->retpc;
404}
405
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c
deleted file mode 100644
index f6be1248d216..000000000000
--- a/arch/m68knommu/kernel/ptrace.c
+++ /dev/null
@@ -1,279 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/ptrace.c
3 *
4 * Copyright (C) 1994 by Hamish Macdonald
5 * Taken from linux/kernel/ptrace.c and modified for M680x0.
6 * linux/kernel/ptrace.c is by Ross Biro 1/23/92, edited by Linus Torvalds
7 *
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of
10 * this archive for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/sched.h>
15#include <linux/mm.h>
16#include <linux/smp.h>
17#include <linux/errno.h>
18#include <linux/ptrace.h>
19#include <linux/user.h>
20#include <linux/signal.h>
21
22#include <asm/uaccess.h>
23#include <asm/page.h>
24#include <asm/pgtable.h>
25#include <asm/system.h>
26#include <asm/processor.h>
27
28/*
29 * does not yet catch signals sent when the child dies.
30 * in exit.c or in signal.c.
31 */
32
33/* determines which bits in the SR the user has access to. */
34/* 1 = access 0 = no access */
35#define SR_MASK 0x001f
36
37/* sets the trace bits. */
38#define TRACE_BITS 0x8000
39
40/* Find the stack offset for a register, relative to thread.esp0. */
41#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
42#define SW_REG(reg) ((long)&((struct switch_stack *)0)->reg \
43 - sizeof(struct switch_stack))
44/* Mapping from PT_xxx to the stack offset at which the register is
45 saved. Notice that usp has no stack-slot and needs to be treated
46 specially (see get_reg/put_reg below). */
47static int regoff[] = {
48 PT_REG(d1), PT_REG(d2), PT_REG(d3), PT_REG(d4),
49 PT_REG(d5), SW_REG(d6), SW_REG(d7), PT_REG(a0),
50 PT_REG(a1), PT_REG(a2), SW_REG(a3), SW_REG(a4),
51 SW_REG(a5), SW_REG(a6), PT_REG(d0), -1,
52 PT_REG(orig_d0), PT_REG(sr), PT_REG(pc),
53};
54
55/*
56 * Get contents of register REGNO in task TASK.
57 */
58static inline long get_reg(struct task_struct *task, int regno)
59{
60 unsigned long *addr;
61
62 if (regno == PT_USP)
63 addr = &task->thread.usp;
64 else if (regno < ARRAY_SIZE(regoff))
65 addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
66 else
67 return 0;
68 return *addr;
69}
70
71/*
72 * Write contents of register REGNO in task TASK.
73 */
74static inline int put_reg(struct task_struct *task, int regno,
75 unsigned long data)
76{
77 unsigned long *addr;
78
79 if (regno == PT_USP)
80 addr = &task->thread.usp;
81 else if (regno < ARRAY_SIZE(regoff))
82 addr = (unsigned long *) (task->thread.esp0 + regoff[regno]);
83 else
84 return -1;
85 *addr = data;
86 return 0;
87}
88
89void user_enable_single_step(struct task_struct *task)
90{
91 unsigned long srflags;
92 srflags = get_reg(task, PT_SR) | (TRACE_BITS << 16);
93 put_reg(task, PT_SR, srflags);
94}
95
96void user_disable_single_step(struct task_struct *task)
97{
98 unsigned long srflags;
99 srflags = get_reg(task, PT_SR) & ~(TRACE_BITS << 16);
100 put_reg(task, PT_SR, srflags);
101}
102
103/*
104 * Called by kernel/ptrace.c when detaching..
105 *
106 * Make sure the single step bit is not set.
107 */
108void ptrace_disable(struct task_struct *child)
109{
110 /* make sure the single step bit is not set. */
111 user_disable_single_step(child);
112}
113
114long arch_ptrace(struct task_struct *child, long request, long addr, long data)
115{
116 int ret;
117
118 switch (request) {
119 /* read the word at location addr in the USER area. */
120 case PTRACE_PEEKUSR: {
121 unsigned long tmp;
122
123 ret = -EIO;
124 if ((addr & 3) || addr < 0 ||
125 addr > sizeof(struct user) - 3)
126 break;
127
128 tmp = 0; /* Default return condition */
129 addr = addr >> 2; /* temporary hack. */
130 ret = -EIO;
131 if (addr < 19) {
132 tmp = get_reg(child, addr);
133 if (addr == PT_SR)
134 tmp >>= 16;
135 } else if (addr >= 21 && addr < 49) {
136 tmp = child->thread.fp[addr - 21];
137#ifdef CONFIG_M68KFPU_EMU
138 /* Convert internal fpu reg representation
139 * into long double format
140 */
141 if (FPU_IS_EMU && (addr < 45) && !(addr % 3))
142 tmp = ((tmp & 0xffff0000) << 15) |
143 ((tmp & 0x0000ffff) << 16);
144#endif
145 } else if (addr == 49) {
146 tmp = child->mm->start_code;
147 } else if (addr == 50) {
148 tmp = child->mm->start_data;
149 } else if (addr == 51) {
150 tmp = child->mm->end_code;
151 } else
152 break;
153 ret = put_user(tmp,(unsigned long *) data);
154 break;
155 }
156
157 case PTRACE_POKEUSR: /* write the word at location addr in the USER area */
158 ret = -EIO;
159 if ((addr & 3) || addr < 0 ||
160 addr > sizeof(struct user) - 3)
161 break;
162
163 addr = addr >> 2; /* temporary hack. */
164
165 if (addr == PT_SR) {
166 data &= SR_MASK;
167 data <<= 16;
168 data |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
169 }
170 if (addr < 19) {
171 if (put_reg(child, addr, data))
172 break;
173 ret = 0;
174 break;
175 }
176 if (addr >= 21 && addr < 48)
177 {
178#ifdef CONFIG_M68KFPU_EMU
179 /* Convert long double format
180 * into internal fpu reg representation
181 */
182 if (FPU_IS_EMU && (addr < 45) && !(addr % 3)) {
183 data = (unsigned long)data << 15;
184 data = (data & 0xffff0000) |
185 ((data & 0x0000ffff) >> 1);
186 }
187#endif
188 child->thread.fp[addr - 21] = data;
189 ret = 0;
190 }
191 break;
192
193 case PTRACE_GETREGS: { /* Get all gp regs from the child. */
194 int i;
195 unsigned long tmp;
196 for (i = 0; i < 19; i++) {
197 tmp = get_reg(child, i);
198 if (i == PT_SR)
199 tmp >>= 16;
200 if (put_user(tmp, (unsigned long *) data)) {
201 ret = -EFAULT;
202 break;
203 }
204 data += sizeof(long);
205 }
206 ret = 0;
207 break;
208 }
209
210 case PTRACE_SETREGS: { /* Set all gp regs in the child. */
211 int i;
212 unsigned long tmp;
213 for (i = 0; i < 19; i++) {
214 if (get_user(tmp, (unsigned long *) data)) {
215 ret = -EFAULT;
216 break;
217 }
218 if (i == PT_SR) {
219 tmp &= SR_MASK;
220 tmp <<= 16;
221 tmp |= get_reg(child, PT_SR) & ~(SR_MASK << 16);
222 }
223 put_reg(child, i, tmp);
224 data += sizeof(long);
225 }
226 ret = 0;
227 break;
228 }
229
230#ifdef PTRACE_GETFPREGS
231 case PTRACE_GETFPREGS: { /* Get the child FPU state. */
232 ret = 0;
233 if (copy_to_user((void *)data, &child->thread.fp,
234 sizeof(struct user_m68kfp_struct)))
235 ret = -EFAULT;
236 break;
237 }
238#endif
239
240#ifdef PTRACE_SETFPREGS
241 case PTRACE_SETFPREGS: { /* Set the child FPU state. */
242 ret = 0;
243 if (copy_from_user(&child->thread.fp, (void *)data,
244 sizeof(struct user_m68kfp_struct)))
245 ret = -EFAULT;
246 break;
247 }
248#endif
249
250 case PTRACE_GET_THREAD_AREA:
251 ret = put_user(task_thread_info(child)->tp_value,
252 (unsigned long __user *)data);
253 break;
254
255 default:
256 ret = ptrace_request(child, request, addr, data);
257 break;
258 }
259 return ret;
260}
261
262asmlinkage void syscall_trace(void)
263{
264 if (!test_thread_flag(TIF_SYSCALL_TRACE))
265 return;
266 if (!(current->ptrace & PT_PTRACED))
267 return;
268 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
269 ? 0x80 : 0));
270 /*
271 * this isn't the same as continuing with a signal, but it will do
272 * for normal use. strace only continues with a signal if the
273 * stopping signal is not SIGTRAP. -brl
274 */
275 if (current->exit_code) {
276 send_sig(current->exit_code, current, 1);
277 current->exit_code = 0;
278 }
279}
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
deleted file mode 100644
index ba92b90d5fbc..000000000000
--- a/arch/m68knommu/kernel/setup.c
+++ /dev/null
@@ -1,356 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/setup.c
3 *
4 * Copyright (C) 1999-2007 Greg Ungerer (gerg@snapgear.com)
5 * Copyright (C) 1998,1999 D. Jeff Dionne <jeff@uClinux.org>
6 * Copyleft ()) 2000 James D. Schettine {james@telos-systems.com}
7 * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>
8 * Copyright (C) 1995 Hamish Macdonald
9 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
10 * Copyright (C) 2001 Lineo, Inc. <www.lineo.com>
11 *
12 * 68VZ328 Fixes/support Evan Stawnyczy <e@lineo.ca>
13 */
14
15/*
16 * This file handles the architecture-dependent parts of system setup
17 */
18
19#include <linux/kernel.h>
20#include <linux/sched.h>
21#include <linux/delay.h>
22#include <linux/interrupt.h>
23#include <linux/fb.h>
24#include <linux/module.h>
25#include <linux/mm.h>
26#include <linux/console.h>
27#include <linux/errno.h>
28#include <linux/string.h>
29#include <linux/bootmem.h>
30#include <linux/seq_file.h>
31#include <linux/init.h>
32#include <linux/initrd.h>
33#include <linux/root_dev.h>
34
35#include <asm/setup.h>
36#include <asm/irq.h>
37#include <asm/machdep.h>
38#include <asm/pgtable.h>
39
40unsigned long memory_start;
41unsigned long memory_end;
42
43EXPORT_SYMBOL(memory_start);
44EXPORT_SYMBOL(memory_end);
45
46char __initdata command_line[COMMAND_LINE_SIZE];
47
48/* machine dependent timer functions */
49void (*mach_gettod)(int*, int*, int*, int*, int*, int*);
50int (*mach_set_clock_mmss)(unsigned long);
51
52/* machine dependent reboot functions */
53void (*mach_reset)(void);
54void (*mach_halt)(void);
55void (*mach_power_off)(void);
56
57#ifdef CONFIG_M68000
58 #define CPU "MC68000"
59#endif
60#ifdef CONFIG_M68328
61 #define CPU "MC68328"
62#endif
63#ifdef CONFIG_M68EZ328
64 #define CPU "MC68EZ328"
65#endif
66#ifdef CONFIG_M68VZ328
67 #define CPU "MC68VZ328"
68#endif
69#ifdef CONFIG_M68360
70 #define CPU "MC68360"
71#endif
72#if defined(CONFIG_M5206)
73 #define CPU "COLDFIRE(m5206)"
74#endif
75#if defined(CONFIG_M5206e)
76 #define CPU "COLDFIRE(m5206e)"
77#endif
78#if defined(CONFIG_M520x)
79 #define CPU "COLDFIRE(m520x)"
80#endif
81#if defined(CONFIG_M523x)
82 #define CPU "COLDFIRE(m523x)"
83#endif
84#if defined(CONFIG_M5249)
85 #define CPU "COLDFIRE(m5249)"
86#endif
87#if defined(CONFIG_M5271)
88 #define CPU "COLDFIRE(m5270/5271)"
89#endif
90#if defined(CONFIG_M5272)
91 #define CPU "COLDFIRE(m5272)"
92#endif
93#if defined(CONFIG_M5275)
94 #define CPU "COLDFIRE(m5274/5275)"
95#endif
96#if defined(CONFIG_M528x)
97 #define CPU "COLDFIRE(m5280/5282)"
98#endif
99#if defined(CONFIG_M5307)
100 #define CPU "COLDFIRE(m5307)"
101#endif
102#if defined(CONFIG_M532x)
103 #define CPU "COLDFIRE(m532x)"
104#endif
105#if defined(CONFIG_M5407)
106 #define CPU "COLDFIRE(m5407)"
107#endif
108#ifndef CPU
109 #define CPU "UNKNOWN"
110#endif
111
112extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
113extern int _ramstart, _ramend;
114
115#if defined(CONFIG_UBOOT)
116/*
117 * parse_uboot_commandline
118 *
119 * Copies u-boot commandline arguments and store them in the proper linux
120 * variables.
121 *
122 * Assumes:
123 * _init_sp global contains the address in the stack pointer when the
124 * kernel starts (see head.S::_start)
125 *
126 * U-Boot calling convention:
127 * (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end);
128 *
129 * _init_sp can be parsed as such
130 *
131 * _init_sp+00 = u-boot cmd after jsr into kernel (skip)
132 * _init_sp+04 = &kernel board_info (residual data)
133 * _init_sp+08 = &initrd_start
134 * _init_sp+12 = &initrd_end
135 * _init_sp+16 = &cmd_start
136 * _init_sp+20 = &cmd_end
137 *
138 * This also assumes that the memory locations pointed to are still
139 * unmodified. U-boot places them near the end of external SDRAM.
140 *
141 * Argument(s):
142 * commandp = the linux commandline arg container to fill.
143 * size = the sizeof commandp.
144 *
145 * Returns:
146 */
147void parse_uboot_commandline(char *commandp, int size)
148{
149 extern unsigned long _init_sp;
150 unsigned long *sp;
151 unsigned long uboot_kbd;
152 unsigned long uboot_initrd_start, uboot_initrd_end;
153 unsigned long uboot_cmd_start, uboot_cmd_end;
154
155
156 sp = (unsigned long *)_init_sp;
157 uboot_kbd = sp[1];
158 uboot_initrd_start = sp[2];
159 uboot_initrd_end = sp[3];
160 uboot_cmd_start = sp[4];
161 uboot_cmd_end = sp[5];
162
163 if (uboot_cmd_start && uboot_cmd_end)
164 strncpy(commandp, (const char *)uboot_cmd_start, size);
165#if defined(CONFIG_BLK_DEV_INITRD)
166 if (uboot_initrd_start && uboot_initrd_end &&
167 (uboot_initrd_end > uboot_initrd_start)) {
168 initrd_start = uboot_initrd_start;
169 initrd_end = uboot_initrd_end;
170 ROOT_DEV = Root_RAM0;
171 printk(KERN_INFO "initrd at 0x%lx:0x%lx\n",
172 initrd_start, initrd_end);
173 }
174#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
175}
176#endif /* #if defined(CONFIG_UBOOT) */
177
178void __init setup_arch(char **cmdline_p)
179{
180 int bootmap_size;
181
182 memory_start = PAGE_ALIGN(_ramstart);
183 memory_end = _ramend;
184
185 init_mm.start_code = (unsigned long) &_stext;
186 init_mm.end_code = (unsigned long) &_etext;
187 init_mm.end_data = (unsigned long) &_edata;
188 init_mm.brk = (unsigned long) 0;
189
190 config_BSP(&command_line[0], sizeof(command_line));
191
192#if defined(CONFIG_BOOTPARAM)
193 strncpy(&command_line[0], CONFIG_BOOTPARAM_STRING, sizeof(command_line));
194 command_line[sizeof(command_line) - 1] = 0;
195#endif /* CONFIG_BOOTPARAM */
196
197#if defined(CONFIG_UBOOT)
198 /* CONFIG_UBOOT and CONFIG_BOOTPARAM defined, concatenate cmdline */
199 #if defined(CONFIG_BOOTPARAM)
200 /* Add the whitespace separator */
201 command_line[strlen(CONFIG_BOOTPARAM_STRING)] = ' ';
202 /* Parse uboot command line into the rest of the buffer */
203 parse_uboot_commandline(
204 &command_line[(strlen(CONFIG_BOOTPARAM_STRING)+1)],
205 (sizeof(command_line) -
206 (strlen(CONFIG_BOOTPARAM_STRING)+1)));
207 /* Only CONFIG_UBOOT defined, create cmdline */
208 #else
209 parse_uboot_commandline(&command_line[0], sizeof(command_line));
210 #endif /* CONFIG_BOOTPARAM */
211 command_line[sizeof(command_line) - 1] = 0;
212#endif /* CONFIG_UBOOT */
213
214 printk(KERN_INFO "\x0F\r\n\nuClinux/" CPU "\n");
215
216#ifdef CONFIG_UCDIMM
217 printk(KERN_INFO "uCdimm by Lineo, Inc. <www.lineo.com>\n");
218#endif
219#ifdef CONFIG_M68VZ328
220 printk(KERN_INFO "M68VZ328 support by Evan Stawnyczy <e@lineo.ca>\n");
221#endif
222#ifdef CONFIG_COLDFIRE
223 printk(KERN_INFO "COLDFIRE port done by Greg Ungerer, gerg@snapgear.com\n");
224#ifdef CONFIG_M5307
225 printk(KERN_INFO "Modified for M5307 by Dave Miller, dmiller@intellistor.com\n");
226#endif
227#ifdef CONFIG_ELITE
228 printk(KERN_INFO "Modified for M5206eLITE by Rob Scott, rscott@mtrob.fdns.net\n");
229#endif
230#endif
231 printk(KERN_INFO "Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n");
232
233#if defined( CONFIG_PILOT ) && defined( CONFIG_M68328 )
234 printk(KERN_INFO "TRG SuperPilot FLASH card support <info@trgnet.com>\n");
235#endif
236#if defined( CONFIG_PILOT ) && defined( CONFIG_M68EZ328 )
237 printk(KERN_INFO "PalmV support by Lineo Inc. <jeff@uclinux.com>\n");
238#endif
239#if defined (CONFIG_M68360)
240 printk(KERN_INFO "QUICC port done by SED Systems <hamilton@sedsystems.ca>,\n");
241 printk(KERN_INFO "based on 2.0.38 port by Lineo Inc. <mleslie@lineo.com>.\n");
242#endif
243#ifdef CONFIG_DRAGEN2
244 printk(KERN_INFO "DragonEngine II board support by Georges Menie\n");
245#endif
246#ifdef CONFIG_M5235EVB
247 printk(KERN_INFO "Motorola M5235EVB support (C)2005 Syn-tech Systems, Inc. (Jate Sujjavanich)\n");
248#endif
249
250 pr_debug("KERNEL -> TEXT=0x%06x-0x%06x DATA=0x%06x-0x%06x "
251 "BSS=0x%06x-0x%06x\n", (int) &_stext, (int) &_etext,
252 (int) &_sdata, (int) &_edata,
253 (int) &_sbss, (int) &_ebss);
254 pr_debug("MEMORY -> ROMFS=0x%06x-0x%06x MEM=0x%06x-0x%06x\n ",
255 (int) &_ebss, (int) memory_start,
256 (int) memory_start, (int) memory_end);
257
258 /* Keep a copy of command line */
259 *cmdline_p = &command_line[0];
260 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
261 boot_command_line[COMMAND_LINE_SIZE-1] = 0;
262
263#ifdef DEBUG
264 if (strlen(*cmdline_p))
265 printk(KERN_DEBUG "Command line: '%s'\n", *cmdline_p);
266#endif
267
268#if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
269 conswitchp = &dummy_con;
270#endif
271
272 /*
273 * Give all the memory to the bootmap allocator, tell it to put the
274 * boot mem_map at the start of memory.
275 */
276 bootmap_size = init_bootmem_node(
277 NODE_DATA(0),
278 memory_start >> PAGE_SHIFT, /* map goes here */
279 PAGE_OFFSET >> PAGE_SHIFT, /* 0 on coldfire */
280 memory_end >> PAGE_SHIFT);
281 /*
282 * Free the usable memory, we have to make sure we do not free
283 * the bootmem bitmap so we then reserve it after freeing it :-)
284 */
285 free_bootmem(memory_start, memory_end - memory_start);
286 reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT);
287
288#if defined(CONFIG_UBOOT) && defined(CONFIG_BLK_DEV_INITRD)
289 if ((initrd_start > 0) && (initrd_start < initrd_end) &&
290 (initrd_end < memory_end))
291 reserve_bootmem(initrd_start, initrd_end - initrd_start,
292 BOOTMEM_DEFAULT);
293#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
294
295 /*
296 * Get kmalloc into gear.
297 */
298 paging_init();
299}
300
301/*
302 * Get CPU information for use by the procfs.
303 */
304static int show_cpuinfo(struct seq_file *m, void *v)
305{
306 char *cpu, *mmu, *fpu;
307 u_long clockfreq;
308
309 cpu = CPU;
310 mmu = "none";
311 fpu = "none";
312
313#ifdef CONFIG_COLDFIRE
314 clockfreq = (loops_per_jiffy * HZ) * 3;
315#else
316 clockfreq = (loops_per_jiffy * HZ) * 16;
317#endif
318
319 seq_printf(m, "CPU:\t\t%s\n"
320 "MMU:\t\t%s\n"
321 "FPU:\t\t%s\n"
322 "Clocking:\t%lu.%1luMHz\n"
323 "BogoMips:\t%lu.%02lu\n"
324 "Calibration:\t%lu loops\n",
325 cpu, mmu, fpu,
326 clockfreq / 1000000,
327 (clockfreq / 100000) % 10,
328 (loops_per_jiffy * HZ) / 500000,
329 ((loops_per_jiffy * HZ) / 5000) % 100,
330 (loops_per_jiffy * HZ));
331
332 return 0;
333}
334
335static void *c_start(struct seq_file *m, loff_t *pos)
336{
337 return *pos < NR_CPUS ? ((void *) 0x12345678) : NULL;
338}
339
340static void *c_next(struct seq_file *m, void *v, loff_t *pos)
341{
342 ++*pos;
343 return c_start(m, pos);
344}
345
346static void c_stop(struct seq_file *m, void *v)
347{
348}
349
350const struct seq_operations cpuinfo_op = {
351 .start = c_start,
352 .next = c_next,
353 .stop = c_stop,
354 .show = show_cpuinfo,
355};
356
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
deleted file mode 100644
index 5ab6a04af14e..000000000000
--- a/arch/m68knommu/kernel/signal.c
+++ /dev/null
@@ -1,789 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/signal.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11/*
12 * Linux/m68k support by Hamish Macdonald
13 *
14 * 68060 fixes by Jesper Skov
15 *
16 * 1997-12-01 Modified for POSIX.1b signals by Andreas Schwab
17 *
18 * mathemu support by Roman Zippel
19 * (Note: fpstate in the signal context is completely ignored for the emulator
20 * and the internal floating point format is put on stack)
21 */
22
23/*
24 * ++roman (07/09/96): implemented signal stacks (specially for tosemu on
25 * Atari :-) Current limitation: Only one sigstack can be active at one time.
26 * If a second signal with SA_ONSTACK set arrives while working on a sigstack,
27 * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested
28 * signal handlers!
29 */
30
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <linux/kernel.h>
34#include <linux/signal.h>
35#include <linux/syscalls.h>
36#include <linux/errno.h>
37#include <linux/wait.h>
38#include <linux/ptrace.h>
39#include <linux/unistd.h>
40#include <linux/stddef.h>
41#include <linux/highuid.h>
42#include <linux/tty.h>
43#include <linux/personality.h>
44#include <linux/binfmts.h>
45
46#include <asm/setup.h>
47#include <asm/uaccess.h>
48#include <asm/pgtable.h>
49#include <asm/traps.h>
50#include <asm/ucontext.h>
51
52#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
53
54void ret_from_user_signal(void);
55void ret_from_user_rt_signal(void);
56asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs);
57
58/*
59 * Atomically swap in the new signal mask, and wait for a signal.
60 */
61asmlinkage int do_sigsuspend(struct pt_regs *regs)
62{
63 old_sigset_t mask = regs->d3;
64 sigset_t saveset;
65
66 mask &= _BLOCKABLE;
67 spin_lock_irq(&current->sighand->siglock);
68 saveset = current->blocked;
69 siginitset(&current->blocked, mask);
70 recalc_sigpending();
71 spin_unlock_irq(&current->sighand->siglock);
72
73 regs->d0 = -EINTR;
74 while (1) {
75 current->state = TASK_INTERRUPTIBLE;
76 schedule();
77 if (do_signal(&saveset, regs))
78 return -EINTR;
79 }
80}
81
82asmlinkage int
83do_rt_sigsuspend(struct pt_regs *regs)
84{
85 sigset_t *unewset = (sigset_t *)regs->d1;
86 size_t sigsetsize = (size_t)regs->d2;
87 sigset_t saveset, newset;
88
89 /* XXX: Don't preclude handling different sized sigset_t's. */
90 if (sigsetsize != sizeof(sigset_t))
91 return -EINVAL;
92
93 if (copy_from_user(&newset, unewset, sizeof(newset)))
94 return -EFAULT;
95 sigdelsetmask(&newset, ~_BLOCKABLE);
96
97 spin_lock_irq(&current->sighand->siglock);
98 saveset = current->blocked;
99 current->blocked = newset;
100 recalc_sigpending();
101 spin_unlock_irq(&current->sighand->siglock);
102
103 regs->d0 = -EINTR;
104 while (1) {
105 current->state = TASK_INTERRUPTIBLE;
106 schedule();
107 if (do_signal(&saveset, regs))
108 return -EINTR;
109 }
110}
111
112asmlinkage int
113sys_sigaction(int sig, const struct old_sigaction *act,
114 struct old_sigaction *oact)
115{
116 struct k_sigaction new_ka, old_ka;
117 int ret;
118
119 if (act) {
120 old_sigset_t mask;
121 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
122 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
123 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
124 return -EFAULT;
125 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
126 __get_user(mask, &act->sa_mask);
127 siginitset(&new_ka.sa.sa_mask, mask);
128 }
129
130 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
131
132 if (!ret && oact) {
133 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
134 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
135 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
136 return -EFAULT;
137 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
138 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
139 }
140
141 return ret;
142}
143
144asmlinkage int
145sys_sigaltstack(const stack_t *uss, stack_t *uoss)
146{
147 return do_sigaltstack(uss, uoss, rdusp());
148}
149
150
151/*
152 * Do a signal return; undo the signal stack.
153 *
154 * Keep the return code on the stack quadword aligned!
155 * That makes the cache flush below easier.
156 */
157
158struct sigframe
159{
160 char *pretcode;
161 int sig;
162 int code;
163 struct sigcontext *psc;
164 char retcode[8];
165 unsigned long extramask[_NSIG_WORDS-1];
166 struct sigcontext sc;
167};
168
169struct rt_sigframe
170{
171 char *pretcode;
172 int sig;
173 struct siginfo *pinfo;
174 void *puc;
175 char retcode[8];
176 struct siginfo info;
177 struct ucontext uc;
178};
179
180#ifdef CONFIG_FPU
181
182static unsigned char fpu_version = 0; /* version number of fpu, set by setup_frame */
183
184static inline int restore_fpu_state(struct sigcontext *sc)
185{
186 int err = 1;
187
188 if (FPU_IS_EMU) {
189 /* restore registers */
190 memcpy(current->thread.fpcntl, sc->sc_fpcntl, 12);
191 memcpy(current->thread.fp, sc->sc_fpregs, 24);
192 return 0;
193 }
194
195 if (sc->sc_fpstate[0]) {
196 /* Verify the frame format. */
197 if (sc->sc_fpstate[0] != fpu_version)
198 goto out;
199
200 __asm__ volatile (".chip 68k/68881\n\t"
201 "fmovemx %0,%/fp0-%/fp1\n\t"
202 "fmoveml %1,%/fpcr/%/fpsr/%/fpiar\n\t"
203 ".chip 68k"
204 : /* no outputs */
205 : "m" (*sc->sc_fpregs), "m" (*sc->sc_fpcntl));
206 }
207 __asm__ volatile (".chip 68k/68881\n\t"
208 "frestore %0\n\t"
209 ".chip 68k" : : "m" (*sc->sc_fpstate));
210 err = 0;
211
212out:
213 return err;
214}
215
216#define FPCONTEXT_SIZE 216
217#define uc_fpstate uc_filler[0]
218#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
219#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
220
221static inline int rt_restore_fpu_state(struct ucontext *uc)
222{
223 unsigned char fpstate[FPCONTEXT_SIZE];
224 int context_size = 0;
225 fpregset_t fpregs;
226 int err = 1;
227
228 if (FPU_IS_EMU) {
229 /* restore fpu control register */
230 if (__copy_from_user(current->thread.fpcntl,
231 &uc->uc_mcontext.fpregs.f_pcr, 12))
232 goto out;
233 /* restore all other fpu register */
234 if (__copy_from_user(current->thread.fp,
235 uc->uc_mcontext.fpregs.f_fpregs, 96))
236 goto out;
237 return 0;
238 }
239
240 if (__get_user(*(long *)fpstate, (long *)&uc->uc_fpstate))
241 goto out;
242 if (fpstate[0]) {
243 context_size = fpstate[1];
244
245 /* Verify the frame format. */
246 if (fpstate[0] != fpu_version)
247 goto out;
248 if (__copy_from_user(&fpregs, &uc->uc_mcontext.fpregs,
249 sizeof(fpregs)))
250 goto out;
251 __asm__ volatile (".chip 68k/68881\n\t"
252 "fmovemx %0,%/fp0-%/fp7\n\t"
253 "fmoveml %1,%/fpcr/%/fpsr/%/fpiar\n\t"
254 ".chip 68k"
255 : /* no outputs */
256 : "m" (*fpregs.f_fpregs),
257 "m" (fpregs.f_pcr));
258 }
259 if (context_size &&
260 __copy_from_user(fpstate + 4, (long *)&uc->uc_fpstate + 1,
261 context_size))
262 goto out;
263 __asm__ volatile (".chip 68k/68881\n\t"
264 "frestore %0\n\t"
265 ".chip 68k" : : "m" (*fpstate));
266 err = 0;
267
268out:
269 return err;
270}
271
272#endif
273
274static inline int
275restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp,
276 int *pd0)
277{
278 int formatvec;
279 struct sigcontext context;
280 int err = 0;
281
282 /* Always make any pending restarted system calls return -EINTR */
283 current_thread_info()->restart_block.fn = do_no_restart_syscall;
284
285 /* get previous context */
286 if (copy_from_user(&context, usc, sizeof(context)))
287 goto badframe;
288
289 /* restore passed registers */
290 regs->d1 = context.sc_d1;
291 regs->a0 = context.sc_a0;
292 regs->a1 = context.sc_a1;
293 ((struct switch_stack *)regs - 1)->a5 = context.sc_a5;
294 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff);
295 regs->pc = context.sc_pc;
296 regs->orig_d0 = -1; /* disable syscall checks */
297 wrusp(context.sc_usp);
298 formatvec = context.sc_formatvec;
299 regs->format = formatvec >> 12;
300 regs->vector = formatvec & 0xfff;
301
302#ifdef CONFIG_FPU
303 err = restore_fpu_state(&context);
304#endif
305
306 *pd0 = context.sc_d0;
307 return err;
308
309badframe:
310 return 1;
311}
312
313static inline int
314rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
315 struct ucontext *uc, int *pd0)
316{
317 int temp;
318 greg_t *gregs = uc->uc_mcontext.gregs;
319 unsigned long usp;
320 int err;
321
322 /* Always make any pending restarted system calls return -EINTR */
323 current_thread_info()->restart_block.fn = do_no_restart_syscall;
324
325 err = __get_user(temp, &uc->uc_mcontext.version);
326 if (temp != MCONTEXT_VERSION)
327 goto badframe;
328 /* restore passed registers */
329 err |= __get_user(regs->d0, &gregs[0]);
330 err |= __get_user(regs->d1, &gregs[1]);
331 err |= __get_user(regs->d2, &gregs[2]);
332 err |= __get_user(regs->d3, &gregs[3]);
333 err |= __get_user(regs->d4, &gregs[4]);
334 err |= __get_user(regs->d5, &gregs[5]);
335 err |= __get_user(sw->d6, &gregs[6]);
336 err |= __get_user(sw->d7, &gregs[7]);
337 err |= __get_user(regs->a0, &gregs[8]);
338 err |= __get_user(regs->a1, &gregs[9]);
339 err |= __get_user(regs->a2, &gregs[10]);
340 err |= __get_user(sw->a3, &gregs[11]);
341 err |= __get_user(sw->a4, &gregs[12]);
342 err |= __get_user(sw->a5, &gregs[13]);
343 err |= __get_user(sw->a6, &gregs[14]);
344 err |= __get_user(usp, &gregs[15]);
345 wrusp(usp);
346 err |= __get_user(regs->pc, &gregs[16]);
347 err |= __get_user(temp, &gregs[17]);
348 regs->sr = (regs->sr & 0xff00) | (temp & 0xff);
349 regs->orig_d0 = -1; /* disable syscall checks */
350 regs->format = temp >> 12;
351 regs->vector = temp & 0xfff;
352
353 if (do_sigaltstack(&uc->uc_stack, NULL, usp) == -EFAULT)
354 goto badframe;
355
356 *pd0 = regs->d0;
357 return err;
358
359badframe:
360 return 1;
361}
362
363asmlinkage int do_sigreturn(unsigned long __unused)
364{
365 struct switch_stack *sw = (struct switch_stack *) &__unused;
366 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
367 unsigned long usp = rdusp();
368 struct sigframe *frame = (struct sigframe *)(usp - 4);
369 sigset_t set;
370 int d0;
371
372 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
373 goto badframe;
374 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
375 (_NSIG_WORDS > 1 &&
376 __copy_from_user(&set.sig[1], &frame->extramask,
377 sizeof(frame->extramask))))
378 goto badframe;
379
380 sigdelsetmask(&set, ~_BLOCKABLE);
381 spin_lock_irq(&current->sighand->siglock);
382 current->blocked = set;
383 recalc_sigpending();
384 spin_unlock_irq(&current->sighand->siglock);
385
386 if (restore_sigcontext(regs, &frame->sc, frame + 1, &d0))
387 goto badframe;
388 return d0;
389
390badframe:
391 force_sig(SIGSEGV, current);
392 return 0;
393}
394
395asmlinkage int do_rt_sigreturn(unsigned long __unused)
396{
397 struct switch_stack *sw = (struct switch_stack *) &__unused;
398 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
399 unsigned long usp = rdusp();
400 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4);
401 sigset_t set;
402 int d0;
403
404 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
405 goto badframe;
406 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
407 goto badframe;
408
409 sigdelsetmask(&set, ~_BLOCKABLE);
410 spin_lock_irq(&current->sighand->siglock);
411 current->blocked = set;
412 recalc_sigpending();
413 spin_unlock_irq(&current->sighand->siglock);
414
415 if (rt_restore_ucontext(regs, sw, &frame->uc, &d0))
416 goto badframe;
417 return d0;
418
419badframe:
420 force_sig(SIGSEGV, current);
421 return 0;
422}
423
424#ifdef CONFIG_FPU
425/*
426 * Set up a signal frame.
427 */
428
429static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
430{
431 if (FPU_IS_EMU) {
432 /* save registers */
433 memcpy(sc->sc_fpcntl, current->thread.fpcntl, 12);
434 memcpy(sc->sc_fpregs, current->thread.fp, 24);
435 return;
436 }
437
438 __asm__ volatile (".chip 68k/68881\n\t"
439 "fsave %0\n\t"
440 ".chip 68k"
441 : : "m" (*sc->sc_fpstate) : "memory");
442
443 if (sc->sc_fpstate[0]) {
444 fpu_version = sc->sc_fpstate[0];
445 __asm__ volatile (".chip 68k/68881\n\t"
446 "fmovemx %/fp0-%/fp1,%0\n\t"
447 "fmoveml %/fpcr/%/fpsr/%/fpiar,%1\n\t"
448 ".chip 68k"
449 : /* no outputs */
450 : "m" (*sc->sc_fpregs),
451 "m" (*sc->sc_fpcntl)
452 : "memory");
453 }
454}
455
456static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
457{
458 unsigned char fpstate[FPCONTEXT_SIZE];
459 int context_size = 0;
460 int err = 0;
461
462 if (FPU_IS_EMU) {
463 /* save fpu control register */
464 err |= copy_to_user(&uc->uc_mcontext.fpregs.f_pcr,
465 current->thread.fpcntl, 12);
466 /* save all other fpu register */
467 err |= copy_to_user(uc->uc_mcontext.fpregs.f_fpregs,
468 current->thread.fp, 96);
469 return err;
470 }
471
472 __asm__ volatile (".chip 68k/68881\n\t"
473 "fsave %0\n\t"
474 ".chip 68k"
475 : : "m" (*fpstate) : "memory");
476
477 err |= __put_user(*(long *)fpstate, (long *)&uc->uc_fpstate);
478 if (fpstate[0]) {
479 fpregset_t fpregs;
480 context_size = fpstate[1];
481 fpu_version = fpstate[0];
482 __asm__ volatile (".chip 68k/68881\n\t"
483 "fmovemx %/fp0-%/fp7,%0\n\t"
484 "fmoveml %/fpcr/%/fpsr/%/fpiar,%1\n\t"
485 ".chip 68k"
486 : /* no outputs */
487 : "m" (*fpregs.f_fpregs),
488 "m" (fpregs.f_pcr)
489 : "memory");
490 err |= copy_to_user(&uc->uc_mcontext.fpregs, &fpregs,
491 sizeof(fpregs));
492 }
493 if (context_size)
494 err |= copy_to_user((long *)&uc->uc_fpstate + 1, fpstate + 4,
495 context_size);
496 return err;
497}
498
499#endif
500
501static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
502 unsigned long mask)
503{
504 sc->sc_mask = mask;
505 sc->sc_usp = rdusp();
506 sc->sc_d0 = regs->d0;
507 sc->sc_d1 = regs->d1;
508 sc->sc_a0 = regs->a0;
509 sc->sc_a1 = regs->a1;
510 sc->sc_a5 = ((struct switch_stack *)regs - 1)->a5;
511 sc->sc_sr = regs->sr;
512 sc->sc_pc = regs->pc;
513 sc->sc_formatvec = regs->format << 12 | regs->vector;
514#ifdef CONFIG_FPU
515 save_fpu_state(sc, regs);
516#endif
517}
518
519static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs)
520{
521 struct switch_stack *sw = (struct switch_stack *)regs - 1;
522 greg_t *gregs = uc->uc_mcontext.gregs;
523 int err = 0;
524
525 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
526 err |= __put_user(regs->d0, &gregs[0]);
527 err |= __put_user(regs->d1, &gregs[1]);
528 err |= __put_user(regs->d2, &gregs[2]);
529 err |= __put_user(regs->d3, &gregs[3]);
530 err |= __put_user(regs->d4, &gregs[4]);
531 err |= __put_user(regs->d5, &gregs[5]);
532 err |= __put_user(sw->d6, &gregs[6]);
533 err |= __put_user(sw->d7, &gregs[7]);
534 err |= __put_user(regs->a0, &gregs[8]);
535 err |= __put_user(regs->a1, &gregs[9]);
536 err |= __put_user(regs->a2, &gregs[10]);
537 err |= __put_user(sw->a3, &gregs[11]);
538 err |= __put_user(sw->a4, &gregs[12]);
539 err |= __put_user(sw->a5, &gregs[13]);
540 err |= __put_user(sw->a6, &gregs[14]);
541 err |= __put_user(rdusp(), &gregs[15]);
542 err |= __put_user(regs->pc, &gregs[16]);
543 err |= __put_user(regs->sr, &gregs[17]);
544#ifdef CONFIG_FPU
545 err |= rt_save_fpu_state(uc, regs);
546#endif
547 return err;
548}
549
550static inline void *
551get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
552{
553 unsigned long usp;
554
555 /* Default to using normal stack. */
556 usp = rdusp();
557
558 /* This is the X/Open sanctioned signal stack switching. */
559 if (ka->sa.sa_flags & SA_ONSTACK) {
560 if (!sas_ss_flags(usp))
561 usp = current->sas_ss_sp + current->sas_ss_size;
562 }
563 return (void *)((usp - frame_size) & -8UL);
564}
565
566static void setup_frame (int sig, struct k_sigaction *ka,
567 sigset_t *set, struct pt_regs *regs)
568{
569 struct sigframe *frame;
570 struct sigcontext context;
571 int err = 0;
572
573 frame = get_sigframe(ka, regs, sizeof(*frame));
574
575 err |= __put_user((current_thread_info()->exec_domain
576 && current_thread_info()->exec_domain->signal_invmap
577 && sig < 32
578 ? current_thread_info()->exec_domain->signal_invmap[sig]
579 : sig),
580 &frame->sig);
581
582 err |= __put_user(regs->vector, &frame->code);
583 err |= __put_user(&frame->sc, &frame->psc);
584
585 if (_NSIG_WORDS > 1)
586 err |= copy_to_user(frame->extramask, &set->sig[1],
587 sizeof(frame->extramask));
588
589 setup_sigcontext(&context, regs, set->sig[0]);
590 err |= copy_to_user (&frame->sc, &context, sizeof(context));
591
592 /* Set up to return from userspace. */
593 err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
594
595 if (err)
596 goto give_sigsegv;
597
598 /* Set up registers for signal handler */
599 wrusp ((unsigned long) frame);
600 regs->pc = (unsigned long) ka->sa.sa_handler;
601 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
602 regs->format = 0x4; /*set format byte to make stack appear modulo 4
603 which it will be when doing the rte */
604
605adjust_stack:
606 /* Prepare to skip over the extra stuff in the exception frame. */
607 if (regs->stkadj) {
608 struct pt_regs *tregs =
609 (struct pt_regs *)((ulong)regs + regs->stkadj);
610#if defined(DEBUG)
611 printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj);
612#endif
613 /* This must be copied with decreasing addresses to
614 handle overlaps. */
615 tregs->vector = 0;
616 tregs->format = 0;
617 tregs->pc = regs->pc;
618 tregs->sr = regs->sr;
619 }
620 return;
621
622give_sigsegv:
623 force_sigsegv(sig, current);
624 goto adjust_stack;
625}
626
627static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
628 sigset_t *set, struct pt_regs *regs)
629{
630 struct rt_sigframe *frame;
631 int err = 0;
632
633 frame = get_sigframe(ka, regs, sizeof(*frame));
634
635 err |= __put_user((current_thread_info()->exec_domain
636 && current_thread_info()->exec_domain->signal_invmap
637 && sig < 32
638 ? current_thread_info()->exec_domain->signal_invmap[sig]
639 : sig),
640 &frame->sig);
641 err |= __put_user(&frame->info, &frame->pinfo);
642 err |= __put_user(&frame->uc, &frame->puc);
643 err |= copy_siginfo_to_user(&frame->info, info);
644
645 /* Create the ucontext. */
646 err |= __put_user(0, &frame->uc.uc_flags);
647 err |= __put_user(0, &frame->uc.uc_link);
648 err |= __put_user((void *)current->sas_ss_sp,
649 &frame->uc.uc_stack.ss_sp);
650 err |= __put_user(sas_ss_flags(rdusp()),
651 &frame->uc.uc_stack.ss_flags);
652 err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
653 err |= rt_setup_ucontext(&frame->uc, regs);
654 err |= copy_to_user (&frame->uc.uc_sigmask, set, sizeof(*set));
655
656 /* Set up to return from userspace. */
657 err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
658
659 if (err)
660 goto give_sigsegv;
661
662 /* Set up registers for signal handler */
663 wrusp ((unsigned long) frame);
664 regs->pc = (unsigned long) ka->sa.sa_handler;
665 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
666 regs->format = 0x4; /*set format byte to make stack appear modulo 4
667 which it will be when doing the rte */
668
669adjust_stack:
670 /* Prepare to skip over the extra stuff in the exception frame. */
671 if (regs->stkadj) {
672 struct pt_regs *tregs =
673 (struct pt_regs *)((ulong)regs + regs->stkadj);
674#if defined(DEBUG)
675 printk(KERN_DEBUG "Performing stackadjust=%04x\n", regs->stkadj);
676#endif
677 /* This must be copied with decreasing addresses to
678 handle overlaps. */
679 tregs->vector = 0;
680 tregs->format = 0;
681 tregs->pc = regs->pc;
682 tregs->sr = regs->sr;
683 }
684 return;
685
686give_sigsegv:
687 force_sigsegv(sig, current);
688 goto adjust_stack;
689}
690
691static inline void
692handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
693{
694 switch (regs->d0) {
695 case -ERESTARTNOHAND:
696 if (!has_handler)
697 goto do_restart;
698 regs->d0 = -EINTR;
699 break;
700
701 case -ERESTART_RESTARTBLOCK:
702 if (!has_handler) {
703 regs->d0 = __NR_restart_syscall;
704 regs->pc -= 2;
705 break;
706 }
707 regs->d0 = -EINTR;
708 break;
709
710 case -ERESTARTSYS:
711 if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
712 regs->d0 = -EINTR;
713 break;
714 }
715 /* fallthrough */
716 case -ERESTARTNOINTR:
717 do_restart:
718 regs->d0 = regs->orig_d0;
719 regs->pc -= 2;
720 break;
721 }
722}
723
724/*
725 * OK, we're invoking a handler
726 */
727static void
728handle_signal(int sig, struct k_sigaction *ka, siginfo_t *info,
729 sigset_t *oldset, struct pt_regs *regs)
730{
731 /* are we from a system call? */
732 if (regs->orig_d0 >= 0)
733 /* If so, check system call restarting.. */
734 handle_restart(regs, ka, 1);
735
736 /* set up the stack frame */
737 if (ka->sa.sa_flags & SA_SIGINFO)
738 setup_rt_frame(sig, ka, info, oldset, regs);
739 else
740 setup_frame(sig, ka, oldset, regs);
741
742 if (ka->sa.sa_flags & SA_ONESHOT)
743 ka->sa.sa_handler = SIG_DFL;
744
745 spin_lock_irq(&current->sighand->siglock);
746 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
747 if (!(ka->sa.sa_flags & SA_NODEFER))
748 sigaddset(&current->blocked,sig);
749 recalc_sigpending();
750 spin_unlock_irq(&current->sighand->siglock);
751}
752
753/*
754 * Note that 'init' is a special process: it doesn't get signals it doesn't
755 * want to handle. Thus you cannot kill init even with a SIGKILL even by
756 * mistake.
757 */
758asmlinkage int do_signal(sigset_t *oldset, struct pt_regs *regs)
759{
760 struct k_sigaction ka;
761 siginfo_t info;
762 int signr;
763
764 /*
765 * We want the common case to go fast, which
766 * is why we may in certain cases get here from
767 * kernel mode. Just return without doing anything
768 * if so.
769 */
770 if (!user_mode(regs))
771 return 1;
772
773 if (!oldset)
774 oldset = &current->blocked;
775
776 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
777 if (signr > 0) {
778 /* Whee! Actually deliver the signal. */
779 handle_signal(signr, &ka, &info, oldset, regs);
780 return 1;
781 }
782
783 /* Did we come from a system call? */
784 if (regs->orig_d0 >= 0) {
785 /* Restart the system call - no handlers present */
786 handle_restart(regs, NULL, 0);
787 }
788 return 0;
789}
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
deleted file mode 100644
index 68488ae47f0a..000000000000
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/sys_m68k.c
3 *
4 * This file contains various random system calls that
5 * have a non-standard calling sequence on the Linux/m68k
6 * platform.
7 */
8
9#include <linux/errno.h>
10#include <linux/sched.h>
11#include <linux/mm.h>
12#include <linux/smp.h>
13#include <linux/sem.h>
14#include <linux/msg.h>
15#include <linux/shm.h>
16#include <linux/stat.h>
17#include <linux/syscalls.h>
18#include <linux/mman.h>
19#include <linux/file.h>
20#include <linux/ipc.h>
21#include <linux/fs.h>
22
23#include <asm/setup.h>
24#include <asm/uaccess.h>
25#include <asm/cachectl.h>
26#include <asm/traps.h>
27#include <asm/cacheflush.h>
28#include <asm/unistd.h>
29
30/* sys_cacheflush -- flush (part of) the processor cache. */
31asmlinkage int
32sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long len)
33{
34 flush_cache_all();
35 return(0);
36}
37
38asmlinkage int sys_getpagesize(void)
39{
40 return PAGE_SIZE;
41}
42
43/*
44 * Do a system call from kernel instead of calling sys_execve so we
45 * end up with proper pt_regs.
46 */
47int kernel_execve(const char *filename,
48 const char *const argv[],
49 const char *const envp[])
50{
51 register long __res asm ("%d0") = __NR_execve;
52 register long __a asm ("%d1") = (long)(filename);
53 register long __b asm ("%d2") = (long)(argv);
54 register long __c asm ("%d3") = (long)(envp);
55 asm volatile ("trap #0" : "+d" (__res)
56 : "d" (__a), "d" (__b), "d" (__c));
57 return __res;
58}
59
60asmlinkage unsigned long sys_get_thread_area(void)
61{
62 return current_thread_info()->tp_value;
63}
64
65asmlinkage int sys_set_thread_area(unsigned long tp)
66{
67 current_thread_info()->tp_value = tp;
68 return 0;
69}
70
71/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
72 D1 (newval). */
73asmlinkage int
74sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
75 unsigned long __user * mem)
76{
77 struct mm_struct *mm = current->mm;
78 unsigned long mem_value;
79
80 down_read(&mm->mmap_sem);
81
82 mem_value = *mem;
83 if (mem_value == oldval)
84 *mem = newval;
85
86 up_read(&mm->mmap_sem);
87 return mem_value;
88}
89
90asmlinkage int sys_atomic_barrier(void)
91{
92 /* no code needed for uniprocs */
93 return 0;
94}
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
deleted file mode 100644
index 79b1ed198c07..000000000000
--- a/arch/m68knommu/kernel/syscalltable.S
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/syscalltable.S
3 *
4 * Copyright (C) 2002, Greg Ungerer (gerg@snapgear.com)
5 *
6 * Based on older entry.S files, the following copyrights apply:
7 *
8 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
9 * Kenneth Albanowski <kjahds@kjahds.com>,
10 * Copyright (C) 2000 Lineo Inc. (www.lineo.com)
11 * Copyright (C) 1991, 1992 Linus Torvalds
12 */
13
14#include <linux/sys.h>
15#include <linux/linkage.h>
16#include <asm/unistd.h>
17
18.text
19ALIGN
20ENTRY(sys_call_table)
21 .long sys_restart_syscall /* 0 - old "setup()" system call */
22 .long sys_exit
23 .long sys_fork
24 .long sys_read
25 .long sys_write
26 .long sys_open /* 5 */
27 .long sys_close
28 .long sys_waitpid
29 .long sys_creat
30 .long sys_link
31 .long sys_unlink /* 10 */
32 .long sys_execve
33 .long sys_chdir
34 .long sys_time
35 .long sys_mknod
36 .long sys_chmod /* 15 */
37 .long sys_chown16
38 .long sys_ni_syscall /* old break syscall holder */
39 .long sys_stat
40 .long sys_lseek
41 .long sys_getpid /* 20 */
42 .long sys_mount
43 .long sys_oldumount
44 .long sys_setuid16
45 .long sys_getuid16
46 .long sys_stime /* 25 */
47 .long sys_ptrace
48 .long sys_alarm
49 .long sys_fstat
50 .long sys_pause
51 .long sys_utime /* 30 */
52 .long sys_ni_syscall /* old stty syscall holder */
53 .long sys_ni_syscall /* old gtty syscall holder */
54 .long sys_access
55 .long sys_nice
56 .long sys_ni_syscall /* 35 */ /* old ftime syscall holder */
57 .long sys_sync
58 .long sys_kill
59 .long sys_rename
60 .long sys_mkdir
61 .long sys_rmdir /* 40 */
62 .long sys_dup
63 .long sys_pipe
64 .long sys_times
65 .long sys_ni_syscall /* old prof syscall holder */
66 .long sys_brk /* 45 */
67 .long sys_setgid16
68 .long sys_getgid16
69 .long sys_signal
70 .long sys_geteuid16
71 .long sys_getegid16 /* 50 */
72 .long sys_acct
73 .long sys_umount /* recycled never used phys() */
74 .long sys_ni_syscall /* old lock syscall holder */
75 .long sys_ioctl
76 .long sys_fcntl /* 55 */
77 .long sys_ni_syscall /* old mpx syscall holder */
78 .long sys_setpgid
79 .long sys_ni_syscall /* old ulimit syscall holder */
80 .long sys_ni_syscall
81 .long sys_umask /* 60 */
82 .long sys_chroot
83 .long sys_ustat
84 .long sys_dup2
85 .long sys_getppid
86 .long sys_getpgrp /* 65 */
87 .long sys_setsid
88 .long sys_sigaction
89 .long sys_sgetmask
90 .long sys_ssetmask
91 .long sys_setreuid16 /* 70 */
92 .long sys_setregid16
93 .long sys_sigsuspend
94 .long sys_sigpending
95 .long sys_sethostname
96 .long sys_setrlimit /* 75 */
97 .long sys_old_getrlimit
98 .long sys_getrusage
99 .long sys_gettimeofday
100 .long sys_settimeofday
101 .long sys_getgroups16 /* 80 */
102 .long sys_setgroups16
103 .long sys_old_select
104 .long sys_symlink
105 .long sys_lstat
106 .long sys_readlink /* 85 */
107 .long sys_uselib
108 .long sys_ni_syscall /* sys_swapon */
109 .long sys_reboot
110 .long sys_old_readdir
111 .long sys_old_mmap /* 90 */
112 .long sys_munmap
113 .long sys_truncate
114 .long sys_ftruncate
115 .long sys_fchmod
116 .long sys_fchown16 /* 95 */
117 .long sys_getpriority
118 .long sys_setpriority
119 .long sys_ni_syscall /* old profil syscall holder */
120 .long sys_statfs
121 .long sys_fstatfs /* 100 */
122 .long sys_ni_syscall /* ioperm for i386 */
123 .long sys_socketcall
124 .long sys_syslog
125 .long sys_setitimer
126 .long sys_getitimer /* 105 */
127 .long sys_newstat
128 .long sys_newlstat
129 .long sys_newfstat
130 .long sys_ni_syscall
131 .long sys_ni_syscall /* iopl for i386 */ /* 110 */
132 .long sys_vhangup
133 .long sys_ni_syscall /* obsolete idle() syscall */
134 .long sys_ni_syscall /* vm86old for i386 */
135 .long sys_wait4
136 .long sys_ni_syscall /* 115 */ /* sys_swapoff */
137 .long sys_sysinfo
138 .long sys_ipc
139 .long sys_fsync
140 .long sys_sigreturn
141 .long sys_clone /* 120 */
142 .long sys_setdomainname
143 .long sys_newuname
144 .long sys_cacheflush /* modify_ldt for i386 */
145 .long sys_adjtimex
146 .long sys_ni_syscall /* 125 */ /* sys_mprotect */
147 .long sys_sigprocmask
148 .long sys_ni_syscall /* old "creat_module" */
149 .long sys_init_module
150 .long sys_delete_module
151 .long sys_ni_syscall /* 130: old "get_kernel_syms" */
152 .long sys_quotactl
153 .long sys_getpgid
154 .long sys_fchdir
155 .long sys_bdflush
156 .long sys_sysfs /* 135 */
157 .long sys_personality
158 .long sys_ni_syscall /* for afs_syscall */
159 .long sys_setfsuid16
160 .long sys_setfsgid16
161 .long sys_llseek /* 140 */
162 .long sys_getdents
163 .long sys_select
164 .long sys_flock
165 .long sys_ni_syscall /* sys_msync */
166 .long sys_readv /* 145 */
167 .long sys_writev
168 .long sys_getsid
169 .long sys_fdatasync
170 .long sys_sysctl
171 .long sys_ni_syscall /* 150 */ /* sys_mlock */
172 .long sys_ni_syscall /* sys_munlock */
173 .long sys_ni_syscall /* sys_mlockall */
174 .long sys_ni_syscall /* sys_munlockall */
175 .long sys_sched_setparam
176 .long sys_sched_getparam /* 155 */
177 .long sys_sched_setscheduler
178 .long sys_sched_getscheduler
179 .long sys_sched_yield
180 .long sys_sched_get_priority_max
181 .long sys_sched_get_priority_min /* 160 */
182 .long sys_sched_rr_get_interval
183 .long sys_nanosleep
184 .long sys_ni_syscall /* sys_mremap */
185 .long sys_setresuid16
186 .long sys_getresuid16 /* 165 */
187 .long sys_getpagesize /* sys_getpagesize */
188 .long sys_ni_syscall /* old "query_module" */
189 .long sys_poll
190 .long sys_ni_syscall /* sys_nfsservctl */
191 .long sys_setresgid16 /* 170 */
192 .long sys_getresgid16
193 .long sys_prctl
194 .long sys_rt_sigreturn
195 .long sys_rt_sigaction
196 .long sys_rt_sigprocmask /* 175 */
197 .long sys_rt_sigpending
198 .long sys_rt_sigtimedwait
199 .long sys_rt_sigqueueinfo
200 .long sys_rt_sigsuspend
201 .long sys_pread64 /* 180 */
202 .long sys_pwrite64
203 .long sys_lchown16
204 .long sys_getcwd
205 .long sys_capget
206 .long sys_capset /* 185 */
207 .long sys_sigaltstack
208 .long sys_sendfile
209 .long sys_ni_syscall /* streams1 */
210 .long sys_ni_syscall /* streams2 */
211 .long sys_vfork /* 190 */
212 .long sys_getrlimit
213 .long sys_mmap_pgoff
214 .long sys_truncate64
215 .long sys_ftruncate64
216 .long sys_stat64 /* 195 */
217 .long sys_lstat64
218 .long sys_fstat64
219 .long sys_chown
220 .long sys_getuid
221 .long sys_getgid /* 200 */
222 .long sys_geteuid
223 .long sys_getegid
224 .long sys_setreuid
225 .long sys_setregid
226 .long sys_getgroups /* 205 */
227 .long sys_setgroups
228 .long sys_fchown
229 .long sys_setresuid
230 .long sys_getresuid
231 .long sys_setresgid /* 210 */
232 .long sys_getresgid
233 .long sys_lchown
234 .long sys_setuid
235 .long sys_setgid
236 .long sys_setfsuid /* 215 */
237 .long sys_setfsgid
238 .long sys_pivot_root
239 .long sys_ni_syscall
240 .long sys_ni_syscall
241 .long sys_getdents64 /* 220 */
242 .long sys_gettid
243 .long sys_tkill
244 .long sys_setxattr
245 .long sys_lsetxattr
246 .long sys_fsetxattr /* 225 */
247 .long sys_getxattr
248 .long sys_lgetxattr
249 .long sys_fgetxattr
250 .long sys_listxattr
251 .long sys_llistxattr /* 230 */
252 .long sys_flistxattr
253 .long sys_removexattr
254 .long sys_lremovexattr
255 .long sys_fremovexattr
256 .long sys_futex /* 235 */
257 .long sys_sendfile64
258 .long sys_ni_syscall /* sys_mincore */
259 .long sys_ni_syscall /* sys_madvise */
260 .long sys_fcntl64
261 .long sys_readahead /* 240 */
262 .long sys_io_setup
263 .long sys_io_destroy
264 .long sys_io_getevents
265 .long sys_io_submit
266 .long sys_io_cancel /* 245 */
267 .long sys_fadvise64
268 .long sys_exit_group
269 .long sys_lookup_dcookie
270 .long sys_epoll_create
271 .long sys_epoll_ctl /* 250 */
272 .long sys_epoll_wait
273 .long sys_ni_syscall /* sys_remap_file_pages */
274 .long sys_set_tid_address
275 .long sys_timer_create
276 .long sys_timer_settime /* 255 */
277 .long sys_timer_gettime
278 .long sys_timer_getoverrun
279 .long sys_timer_delete
280 .long sys_clock_settime
281 .long sys_clock_gettime /* 260 */
282 .long sys_clock_getres
283 .long sys_clock_nanosleep
284 .long sys_statfs64
285 .long sys_fstatfs64
286 .long sys_tgkill /* 265 */
287 .long sys_utimes
288 .long sys_fadvise64_64
289 .long sys_mbind
290 .long sys_get_mempolicy
291 .long sys_set_mempolicy /* 270 */
292 .long sys_mq_open
293 .long sys_mq_unlink
294 .long sys_mq_timedsend
295 .long sys_mq_timedreceive
296 .long sys_mq_notify /* 275 */
297 .long sys_mq_getsetattr
298 .long sys_waitid
299 .long sys_ni_syscall /* for sys_vserver */
300 .long sys_add_key
301 .long sys_request_key /* 280 */
302 .long sys_keyctl
303 .long sys_ioprio_set
304 .long sys_ioprio_get
305 .long sys_inotify_init
306 .long sys_inotify_add_watch /* 285 */
307 .long sys_inotify_rm_watch
308 .long sys_migrate_pages
309 .long sys_openat
310 .long sys_mkdirat
311 .long sys_mknodat /* 290 */
312 .long sys_fchownat
313 .long sys_futimesat
314 .long sys_fstatat64
315 .long sys_unlinkat
316 .long sys_renameat /* 295 */
317 .long sys_linkat
318 .long sys_symlinkat
319 .long sys_readlinkat
320 .long sys_fchmodat
321 .long sys_faccessat /* 300 */
322 .long sys_ni_syscall /* Reserved for pselect6 */
323 .long sys_ni_syscall /* Reserved for ppoll */
324 .long sys_unshare
325 .long sys_set_robust_list
326 .long sys_get_robust_list /* 305 */
327 .long sys_splice
328 .long sys_sync_file_range
329 .long sys_tee
330 .long sys_vmsplice
331 .long sys_move_pages /* 310 */
332 .long sys_sched_setaffinity
333 .long sys_sched_getaffinity
334 .long sys_kexec_load
335 .long sys_getcpu
336 .long sys_epoll_pwait /* 315 */
337 .long sys_utimensat
338 .long sys_signalfd
339 .long sys_timerfd_create
340 .long sys_eventfd
341 .long sys_fallocate /* 320 */
342 .long sys_timerfd_settime
343 .long sys_timerfd_gettime
344 .long sys_signalfd4
345 .long sys_eventfd2
346 .long sys_epoll_create1 /* 325 */
347 .long sys_dup3
348 .long sys_pipe2
349 .long sys_inotify_init1
350 .long sys_preadv
351 .long sys_pwritev /* 330 */
352 .long sys_rt_tgsigqueueinfo
353 .long sys_perf_event_open
354 .long sys_get_thread_area
355 .long sys_set_thread_area
356 .long sys_atomic_cmpxchg_32 /* 335 */
357 .long sys_atomic_barrier
358 .long sys_fanotify_init
359 .long sys_fanotify_mark
360 .long sys_prlimit64
361
362 .rept NR_syscalls-(.-sys_call_table)/4
363 .long sys_ni_syscall
364 .endr
365
diff --git a/arch/m68knommu/kernel/time.c b/arch/m68knommu/kernel/time.c
deleted file mode 100644
index a90acf5b0cde..000000000000
--- a/arch/m68knommu/kernel/time.c
+++ /dev/null
@@ -1,89 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 *
6 * This file contains the m68k-specific time handling details.
7 * Most of the stuff is located in the machine specific files.
8 *
9 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
10 * "A Kernel Model for Precision Timekeeping" by Dave Mills
11 */
12
13#include <linux/errno.h>
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/param.h>
18#include <linux/string.h>
19#include <linux/mm.h>
20#include <linux/profile.h>
21#include <linux/time.h>
22#include <linux/timex.h>
23
24#include <asm/machdep.h>
25#include <asm/irq_regs.h>
26
27#define TICK_SIZE (tick_nsec / 1000)
28
29static inline int set_rtc_mmss(unsigned long nowtime)
30{
31 if (mach_set_clock_mmss)
32 return mach_set_clock_mmss (nowtime);
33 return -1;
34}
35
36#ifndef CONFIG_GENERIC_CLOCKEVENTS
37/*
38 * timer_interrupt() needs to keep up the real-time clock,
39 * as well as call the "do_timer()" routine every clocktick
40 */
41irqreturn_t arch_timer_interrupt(int irq, void *dummy)
42{
43
44 if (current->pid)
45 profile_tick(CPU_PROFILING);
46
47 write_seqlock(&xtime_lock);
48
49 do_timer(1);
50
51 write_sequnlock(&xtime_lock);
52
53#ifndef CONFIG_SMP
54 update_process_times(user_mode(get_irq_regs()));
55#endif
56 return(IRQ_HANDLED);
57}
58#endif
59
60static unsigned long read_rtc_mmss(void)
61{
62 unsigned int year, mon, day, hour, min, sec;
63
64 if (mach_gettod)
65 mach_gettod(&year, &mon, &day, &hour, &min, &sec);
66 else
67 year = mon = day = hour = min = sec = 0;
68
69 if ((year += 1900) < 1970)
70 year += 100;
71
72 return mktime(year, mon, day, hour, min, sec);
73}
74
75void read_persistent_clock(struct timespec *ts)
76{
77 ts->tv_sec = read_rtc_mmss();
78 ts->tv_nsec = 0;
79}
80
81int update_persistent_clock(struct timespec now)
82{
83 return set_rtc_mmss(now.tv_sec);
84}
85
86void time_init(void)
87{
88 hw_timer_init();
89}
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c
deleted file mode 100644
index 3739c8f657d7..000000000000
--- a/arch/m68knommu/kernel/traps.c
+++ /dev/null
@@ -1,375 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68060 fixes by Roman Hodek
9 * 68060 fixes by Jesper Skov
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file COPYING in the main directory of this archive
13 * for more details.
14 */
15
16/*
17 * Sets up all exception vectors
18 */
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/user.h>
26#include <linux/string.h>
27#include <linux/linkage.h>
28#include <linux/init.h>
29#include <linux/ptrace.h>
30#include <linux/kallsyms.h>
31
32#include <asm/setup.h>
33#include <asm/fpu.h>
34#include <asm/system.h>
35#include <asm/uaccess.h>
36#include <asm/traps.h>
37#include <asm/pgtable.h>
38#include <asm/machdep.h>
39#include <asm/siginfo.h>
40
41static char const * const vec_names[] = {
42 "RESET SP", "RESET PC", "BUS ERROR", "ADDRESS ERROR",
43 "ILLEGAL INSTRUCTION", "ZERO DIVIDE", "CHK", "TRAPcc",
44 "PRIVILEGE VIOLATION", "TRACE", "LINE 1010", "LINE 1111",
45 "UNASSIGNED RESERVED 12", "COPROCESSOR PROTOCOL VIOLATION",
46 "FORMAT ERROR", "UNINITIALIZED INTERRUPT",
47 "UNASSIGNED RESERVED 16", "UNASSIGNED RESERVED 17",
48 "UNASSIGNED RESERVED 18", "UNASSIGNED RESERVED 19",
49 "UNASSIGNED RESERVED 20", "UNASSIGNED RESERVED 21",
50 "UNASSIGNED RESERVED 22", "UNASSIGNED RESERVED 23",
51 "SPURIOUS INTERRUPT", "LEVEL 1 INT", "LEVEL 2 INT", "LEVEL 3 INT",
52 "LEVEL 4 INT", "LEVEL 5 INT", "LEVEL 6 INT", "LEVEL 7 INT",
53 "SYSCALL", "TRAP #1", "TRAP #2", "TRAP #3",
54 "TRAP #4", "TRAP #5", "TRAP #6", "TRAP #7",
55 "TRAP #8", "TRAP #9", "TRAP #10", "TRAP #11",
56 "TRAP #12", "TRAP #13", "TRAP #14", "TRAP #15",
57 "FPCP BSUN", "FPCP INEXACT", "FPCP DIV BY 0", "FPCP UNDERFLOW",
58 "FPCP OPERAND ERROR", "FPCP OVERFLOW", "FPCP SNAN",
59 "FPCP UNSUPPORTED OPERATION",
60 "MMU CONFIGURATION ERROR"
61};
62
63void __init trap_init(void)
64{
65}
66
67void die_if_kernel(char *str, struct pt_regs *fp, int nr)
68{
69 if (!(fp->sr & PS_S))
70 return;
71
72 console_verbose();
73 printk(KERN_EMERG "%s: %08x\n",str,nr);
74 printk(KERN_EMERG "PC: [<%08lx>]\nSR: %04x SP: %p a2: %08lx\n",
75 fp->pc, fp->sr, fp, fp->a2);
76 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
77 fp->d0, fp->d1, fp->d2, fp->d3);
78 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
79 fp->d4, fp->d5, fp->a0, fp->a1);
80
81 printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
82 current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
83 show_stack(NULL, (unsigned long *)(fp + 1));
84 add_taint(TAINT_DIE);
85 do_exit(SIGSEGV);
86}
87
88asmlinkage void buserr_c(struct frame *fp)
89{
90 /* Only set esp0 if coming from user mode */
91 if (user_mode(&fp->ptregs))
92 current->thread.esp0 = (unsigned long) fp;
93
94#if defined(DEBUG)
95 printk (KERN_DEBUG "*** Bus Error *** Format is %x\n", fp->ptregs.format);
96#endif
97
98 die_if_kernel("bad frame format",&fp->ptregs,0);
99#if defined(DEBUG)
100 printk(KERN_DEBUG "Unknown SIGSEGV - 4\n");
101#endif
102 force_sig(SIGSEGV, current);
103}
104
105static void print_this_address(unsigned long addr, int i)
106{
107#ifdef CONFIG_KALLSYMS
108 printk(KERN_EMERG " [%08lx] ", addr);
109 print_symbol(KERN_CONT "%s\n", addr);
110#else
111 if (i % 5)
112 printk(KERN_CONT " [%08lx] ", addr);
113 else
114 printk(KERN_EMERG " [%08lx] ", addr);
115 i++;
116#endif
117}
118
119int kstack_depth_to_print = 48;
120
121static void __show_stack(struct task_struct *task, unsigned long *stack)
122{
123 unsigned long *endstack, addr;
124#ifdef CONFIG_FRAME_POINTER
125 unsigned long *last_stack;
126#endif
127 int i;
128
129 if (!stack)
130 stack = (unsigned long *)task->thread.ksp;
131
132 addr = (unsigned long) stack;
133 endstack = (unsigned long *) PAGE_ALIGN(addr);
134
135 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack);
136 for (i = 0; i < kstack_depth_to_print; i++) {
137 if (stack + 1 + i > endstack)
138 break;
139 if (i % 8 == 0)
140 printk(KERN_EMERG " ");
141 printk(KERN_CONT " %08lx", *(stack + i));
142 }
143 printk("\n");
144 i = 0;
145
146#ifdef CONFIG_FRAME_POINTER
147 printk(KERN_EMERG "Call Trace:\n");
148
149 last_stack = stack - 1;
150 while (stack <= endstack && stack > last_stack) {
151
152 addr = *(stack + 1);
153 print_this_address(addr, i);
154 i++;
155
156 last_stack = stack;
157 stack = (unsigned long *)*stack;
158 }
159 printk("\n");
160#else
161 printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n");
162 while (stack <= endstack) {
163 addr = *stack++;
164 /*
165 * If the address is either in the text segment of the kernel,
166 * or in a region which is occupied by a module then it *may*
167 * be the address of a calling routine; if so, print it so that
168 * someone tracing down the cause of the crash will be able to
169 * figure out the call path that was taken.
170 */
171 if (__kernel_text_address(addr)) {
172 print_this_address(addr, i);
173 i++;
174 }
175 }
176 printk(KERN_CONT "\n");
177#endif
178}
179
180void bad_super_trap(struct frame *fp)
181{
182 console_verbose();
183 if (fp->ptregs.vector < 4 * ARRAY_SIZE(vec_names))
184 printk (KERN_WARNING "*** %s *** FORMAT=%X\n",
185 vec_names[(fp->ptregs.vector) >> 2],
186 fp->ptregs.format);
187 else
188 printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n",
189 (fp->ptregs.vector) >> 2,
190 fp->ptregs.format);
191 printk (KERN_WARNING "Current process id is %d\n", current->pid);
192 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
193}
194
195asmlinkage void trap_c(struct frame *fp)
196{
197 int sig;
198 siginfo_t info;
199
200 if (fp->ptregs.sr & PS_S) {
201 if ((fp->ptregs.vector >> 2) == VEC_TRACE) {
202 /* traced a trapping instruction */
203 } else
204 bad_super_trap(fp);
205 return;
206 }
207
208 /* send the appropriate signal to the user program */
209 switch ((fp->ptregs.vector) >> 2) {
210 case VEC_ADDRERR:
211 info.si_code = BUS_ADRALN;
212 sig = SIGBUS;
213 break;
214 case VEC_ILLEGAL:
215 case VEC_LINE10:
216 case VEC_LINE11:
217 info.si_code = ILL_ILLOPC;
218 sig = SIGILL;
219 break;
220 case VEC_PRIV:
221 info.si_code = ILL_PRVOPC;
222 sig = SIGILL;
223 break;
224 case VEC_COPROC:
225 info.si_code = ILL_COPROC;
226 sig = SIGILL;
227 break;
228 case VEC_TRAP1: /* gdbserver breakpoint */
229 fp->ptregs.pc -= 2;
230 info.si_code = TRAP_TRACE;
231 sig = SIGTRAP;
232 break;
233 case VEC_TRAP2:
234 case VEC_TRAP3:
235 case VEC_TRAP4:
236 case VEC_TRAP5:
237 case VEC_TRAP6:
238 case VEC_TRAP7:
239 case VEC_TRAP8:
240 case VEC_TRAP9:
241 case VEC_TRAP10:
242 case VEC_TRAP11:
243 case VEC_TRAP12:
244 case VEC_TRAP13:
245 case VEC_TRAP14:
246 info.si_code = ILL_ILLTRP;
247 sig = SIGILL;
248 break;
249 case VEC_FPBRUC:
250 case VEC_FPOE:
251 case VEC_FPNAN:
252 info.si_code = FPE_FLTINV;
253 sig = SIGFPE;
254 break;
255 case VEC_FPIR:
256 info.si_code = FPE_FLTRES;
257 sig = SIGFPE;
258 break;
259 case VEC_FPDIVZ:
260 info.si_code = FPE_FLTDIV;
261 sig = SIGFPE;
262 break;
263 case VEC_FPUNDER:
264 info.si_code = FPE_FLTUND;
265 sig = SIGFPE;
266 break;
267 case VEC_FPOVER:
268 info.si_code = FPE_FLTOVF;
269 sig = SIGFPE;
270 break;
271 case VEC_ZERODIV:
272 info.si_code = FPE_INTDIV;
273 sig = SIGFPE;
274 break;
275 case VEC_CHK:
276 case VEC_TRAP:
277 info.si_code = FPE_INTOVF;
278 sig = SIGFPE;
279 break;
280 case VEC_TRACE: /* ptrace single step */
281 info.si_code = TRAP_TRACE;
282 sig = SIGTRAP;
283 break;
284 case VEC_TRAP15: /* breakpoint */
285 info.si_code = TRAP_BRKPT;
286 sig = SIGTRAP;
287 break;
288 default:
289 info.si_code = ILL_ILLOPC;
290 sig = SIGILL;
291 break;
292 }
293 info.si_signo = sig;
294 info.si_errno = 0;
295 switch (fp->ptregs.format) {
296 default:
297 info.si_addr = (void *) fp->ptregs.pc;
298 break;
299 case 2:
300 info.si_addr = (void *) fp->un.fmt2.iaddr;
301 break;
302 case 7:
303 info.si_addr = (void *) fp->un.fmt7.effaddr;
304 break;
305 case 9:
306 info.si_addr = (void *) fp->un.fmt9.iaddr;
307 break;
308 case 10:
309 info.si_addr = (void *) fp->un.fmta.daddr;
310 break;
311 case 11:
312 info.si_addr = (void *) fp->un.fmtb.daddr;
313 break;
314 }
315 force_sig_info (sig, &info, current);
316}
317
318asmlinkage void set_esp0(unsigned long ssp)
319{
320 current->thread.esp0 = ssp;
321}
322
323/*
324 * The architecture-independent backtrace generator
325 */
326void dump_stack(void)
327{
328 /*
329 * We need frame pointers for this little trick, which works as follows:
330 *
331 * +------------+ 0x00
332 * | Next SP | -> 0x0c
333 * +------------+ 0x04
334 * | Caller |
335 * +------------+ 0x08
336 * | Local vars | -> our stack var
337 * +------------+ 0x0c
338 * | Next SP | -> 0x18, that is what we pass to show_stack()
339 * +------------+ 0x10
340 * | Caller |
341 * +------------+ 0x14
342 * | Local vars |
343 * +------------+ 0x18
344 * | ... |
345 * +------------+
346 */
347
348 unsigned long *stack;
349
350 stack = (unsigned long *)&stack;
351 stack++;
352 __show_stack(current, stack);
353}
354EXPORT_SYMBOL(dump_stack);
355
356void show_stack(struct task_struct *task, unsigned long *stack)
357{
358 if (!stack && !task)
359 dump_stack();
360 else
361 __show_stack(task, stack);
362}
363
364#ifdef CONFIG_M68KFPU_EMU
365asmlinkage void fpemu_signal(int signal, int code, void *addr)
366{
367 siginfo_t info;
368
369 info.si_signo = signal;
370 info.si_errno = 0;
371 info.si_code = code;
372 info.si_addr = addr;
373 force_sig_info(signal, &info, current);
374}
375#endif
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
deleted file mode 100644
index ef332136f96d..000000000000
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,182 +0,0 @@
1/*
2 * vmlinux.lds.S -- master linker script for m68knommu arch
3 *
4 * (C) Copyright 2002-2006, Greg Ungerer <gerg@snapgear.com>
5 *
6 * This linker script is equiped to build either ROM loaded or RAM
7 * run kernels.
8 */
9
10#include <asm-generic/vmlinux.lds.h>
11#include <asm/page.h>
12#include <asm/thread_info.h>
13
14#if defined(CONFIG_RAMKERNEL)
15#define RAM_START CONFIG_KERNELBASE
16#define RAM_LENGTH (CONFIG_RAMBASE + CONFIG_RAMSIZE - CONFIG_KERNELBASE)
17#define TEXT ram
18#define DATA ram
19#define INIT ram
20#define BSSS ram
21#endif
22#if defined(CONFIG_ROMKERNEL) || defined(CONFIG_HIMEMKERNEL)
23#define RAM_START CONFIG_RAMBASE
24#define RAM_LENGTH CONFIG_RAMSIZE
25#define ROMVEC_START CONFIG_ROMVEC
26#define ROMVEC_LENGTH CONFIG_ROMVECSIZE
27#define ROM_START CONFIG_ROMSTART
28#define ROM_LENGTH CONFIG_ROMSIZE
29#define TEXT rom
30#define DATA ram
31#define INIT ram
32#define BSSS ram
33#endif
34
35#ifndef DATA_ADDR
36#define DATA_ADDR
37#endif
38
39
40OUTPUT_ARCH(m68k)
41ENTRY(_start)
42
43MEMORY {
44 ram : ORIGIN = RAM_START, LENGTH = RAM_LENGTH
45#ifdef ROM_START
46 romvec : ORIGIN = ROMVEC_START, LENGTH = ROMVEC_LENGTH
47 rom : ORIGIN = ROM_START, LENGTH = ROM_LENGTH
48#endif
49}
50
51jiffies = jiffies_64 + 4;
52
53SECTIONS {
54
55#ifdef ROMVEC_START
56 . = ROMVEC_START ;
57 .romvec : {
58 __rom_start = . ;
59 _romvec = .;
60 *(.data..initvect)
61 } > romvec
62#endif
63
64 .text : {
65 _text = .;
66 _stext = . ;
67 HEAD_TEXT
68 TEXT_TEXT
69 SCHED_TEXT
70 LOCK_TEXT
71 *(.text..lock)
72
73 . = ALIGN(16); /* Exception table */
74 __start___ex_table = .;
75 *(__ex_table)
76 __stop___ex_table = .;
77
78 *(.rodata) *(.rodata.*)
79 *(__vermagic) /* Kernel version magic */
80 *(__markers_strings)
81 *(.rodata1)
82 *(.rodata.str1.1)
83
84 /* Kernel symbol table: Normal symbols */
85 . = ALIGN(4);
86 __start___ksymtab = .;
87 *(__ksymtab)
88 __stop___ksymtab = .;
89
90 /* Kernel symbol table: GPL-only symbols */
91 __start___ksymtab_gpl = .;
92 *(__ksymtab_gpl)
93 __stop___ksymtab_gpl = .;
94
95 /* Kernel symbol table: Normal unused symbols */
96 __start___ksymtab_unused = .;
97 *(__ksymtab_unused)
98 __stop___ksymtab_unused = .;
99
100 /* Kernel symbol table: GPL-only unused symbols */
101 __start___ksymtab_unused_gpl = .;
102 *(__ksymtab_unused_gpl)
103 __stop___ksymtab_unused_gpl = .;
104
105 /* Kernel symbol table: GPL-future symbols */
106 __start___ksymtab_gpl_future = .;
107 *(__ksymtab_gpl_future)
108 __stop___ksymtab_gpl_future = .;
109
110 /* Kernel symbol table: Normal symbols */
111 __start___kcrctab = .;
112 *(__kcrctab)
113 __stop___kcrctab = .;
114
115 /* Kernel symbol table: GPL-only symbols */
116 __start___kcrctab_gpl = .;
117 *(__kcrctab_gpl)
118 __stop___kcrctab_gpl = .;
119
120 /* Kernel symbol table: Normal unused symbols */
121 __start___kcrctab_unused = .;
122 *(__kcrctab_unused)
123 __stop___kcrctab_unused = .;
124
125 /* Kernel symbol table: GPL-only unused symbols */
126 __start___kcrctab_unused_gpl = .;
127 *(__kcrctab_unused_gpl)
128 __stop___kcrctab_unused_gpl = .;
129
130 /* Kernel symbol table: GPL-future symbols */
131 __start___kcrctab_gpl_future = .;
132 *(__kcrctab_gpl_future)
133 __stop___kcrctab_gpl_future = .;
134
135 /* Kernel symbol table: strings */
136 *(__ksymtab_strings)
137
138 /* Built-in module parameters */
139 . = ALIGN(4) ;
140 __start___param = .;
141 *(__param)
142 __stop___param = .;
143
144 . = ALIGN(4) ;
145 _etext = . ;
146 } > TEXT
147
148 .data DATA_ADDR : {
149 . = ALIGN(4);
150 _sdata = . ;
151 DATA_DATA
152 CACHELINE_ALIGNED_DATA(32)
153 PAGE_ALIGNED_DATA(PAGE_SIZE)
154 *(.data..shared_aligned)
155 INIT_TASK_DATA(THREAD_SIZE)
156 _edata = . ;
157 } > DATA
158
159 .init.text : {
160 . = ALIGN(PAGE_SIZE);
161 __init_begin = .;
162 } > INIT
163 INIT_TEXT_SECTION(PAGE_SIZE) > INIT
164 INIT_DATA_SECTION(16) > INIT
165 .init.data : {
166 . = ALIGN(PAGE_SIZE);
167 __init_end = .;
168 } > INIT
169
170 .bss : {
171 . = ALIGN(4);
172 _sbss = . ;
173 *(.bss)
174 *(COMMON)
175 . = ALIGN(4) ;
176 _ebss = . ;
177 _end = . ;
178 } > BSSS
179
180 DISCARDS
181}
182