aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m32r
diff options
context:
space:
mode:
Diffstat (limited to 'arch/m32r')
-rw-r--r--arch/m32r/Kconfig.debug2
-rw-r--r--arch/m32r/Makefile6
-rw-r--r--arch/m32r/kernel/irq.c10
-rw-r--r--arch/m32r/kernel/signal.c24
-rw-r--r--arch/m32r/kernel/sys_m32r.c61
-rw-r--r--arch/m32r/lib/usercopy.c4
-rw-r--r--arch/m32r/mm/init.c4
7 files changed, 56 insertions, 55 deletions
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug
index bbf711bab69e..2e1019ddbb22 100644
--- a/arch/m32r/Kconfig.debug
+++ b/arch/m32r/Kconfig.debug
@@ -19,7 +19,7 @@ config DEBUG_STACK_USAGE
19 This option will slow down process creation somewhat. 19 This option will slow down process creation somewhat.
20 20
21config DEBUG_PAGEALLOC 21config DEBUG_PAGEALLOC
22 bool "Page alloc debugging" 22 bool "Debug page memory allocations"
23 depends on DEBUG_KERNEL && BROKEN 23 depends on DEBUG_KERNEL && BROKEN
24 help 24 help
25 Unmap pages from the kernel linear mapping after free_pages(). 25 Unmap pages from the kernel linear mapping after free_pages().
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 229f66fc8e5e..f219c47d334f 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -15,14 +15,14 @@ CFLAGS_MODULE += -mmodel=large
15 15
16ifdef CONFIG_CHIP_VDEC2 16ifdef CONFIG_CHIP_VDEC2
17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 17cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst
18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 18aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -O2 -Wa,-bitinst -Wa,-no-parallel
19else 19else
20cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 20cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2
21aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 21aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -O2
22endif 22endif
23 23
24cflags-$(CONFIG_ISA_M32R) += -DNO_FPU 24cflags-$(CONFIG_ISA_M32R) += -DNO_FPU
25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -Wa,-no-bitinst 25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst
26 26
27CFLAGS += $(cflags-y) 27CFLAGS += $(cflags-y)
28AFLAGS += $(aflags-y) 28AFLAGS += $(aflags-y)
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index 1ce63926a3c0..a4634b06f675 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -37,9 +37,8 @@ int show_interrupts(struct seq_file *p, void *v)
37 37
38 if (i == 0) { 38 if (i == 0) {
39 seq_printf(p, " "); 39 seq_printf(p, " ");
40 for (j=0; j<NR_CPUS; j++) 40 for_each_online_cpu(j)
41 if (cpu_online(j)) 41 seq_printf(p, "CPU%d ",j);
42 seq_printf(p, "CPU%d ",j);
43 seq_putc(p, '\n'); 42 seq_putc(p, '\n');
44 } 43 }
45 44
@@ -52,9 +51,8 @@ int show_interrupts(struct seq_file *p, void *v)
52#ifndef CONFIG_SMP 51#ifndef CONFIG_SMP
53 seq_printf(p, "%10u ", kstat_irqs(i)); 52 seq_printf(p, "%10u ", kstat_irqs(i));
54#else 53#else
55 for (j = 0; j < NR_CPUS; j++) 54 for_each_online_cpu(j)
56 if (cpu_online(j)) 55 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
57 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
58#endif 56#endif
59 seq_printf(p, " %14s", irq_desc[i].handler->typename); 57 seq_printf(p, " %14s", irq_desc[i].handler->typename);
60 seq_printf(p, " %s", action->name); 58 seq_printf(p, " %s", action->name);
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c
index 71763f7a1d19..cb33097fefc4 100644
--- a/arch/m32r/kernel/signal.c
+++ b/arch/m32r/kernel/signal.c
@@ -36,7 +36,7 @@ int do_signal(struct pt_regs *, sigset_t *);
36asmlinkage int 36asmlinkage int
37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, 37sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
38 unsigned long r2, unsigned long r3, unsigned long r4, 38 unsigned long r2, unsigned long r3, unsigned long r4,
39 unsigned long r5, unsigned long r6, struct pt_regs regs) 39 unsigned long r5, unsigned long r6, struct pt_regs *regs)
40{ 40{
41 sigset_t saveset, newset; 41 sigset_t saveset, newset;
42 42
@@ -54,21 +54,21 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
54 recalc_sigpending(); 54 recalc_sigpending();
55 spin_unlock_irq(&current->sighand->siglock); 55 spin_unlock_irq(&current->sighand->siglock);
56 56
57 regs.r0 = -EINTR; 57 regs->r0 = -EINTR;
58 while (1) { 58 while (1) {
59 current->state = TASK_INTERRUPTIBLE; 59 current->state = TASK_INTERRUPTIBLE;
60 schedule(); 60 schedule();
61 if (do_signal(&regs, &saveset)) 61 if (do_signal(regs, &saveset))
62 return regs.r0; 62 return regs->r0;
63 } 63 }
64} 64}
65 65
66asmlinkage int 66asmlinkage int
67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 67sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
68 unsigned long r2, unsigned long r3, unsigned long r4, 68 unsigned long r2, unsigned long r3, unsigned long r4,
69 unsigned long r5, unsigned long r6, struct pt_regs regs) 69 unsigned long r5, unsigned long r6, struct pt_regs *regs)
70{ 70{
71 return do_sigaltstack(uss, uoss, regs.spu); 71 return do_sigaltstack(uss, uoss, regs->spu);
72} 72}
73 73
74 74
@@ -140,11 +140,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
140asmlinkage int 140asmlinkage int
141sys_rt_sigreturn(unsigned long r0, unsigned long r1, 141sys_rt_sigreturn(unsigned long r0, unsigned long r1,
142 unsigned long r2, unsigned long r3, unsigned long r4, 142 unsigned long r2, unsigned long r3, unsigned long r4,
143 unsigned long r5, unsigned long r6, struct pt_regs regs) 143 unsigned long r5, unsigned long r6, struct pt_regs *regs)
144{ 144{
145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu; 145 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu;
146 sigset_t set; 146 sigset_t set;
147 stack_t st;
148 int result; 147 int result;
149 148
150 if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) 149 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
@@ -158,14 +157,11 @@ sys_rt_sigreturn(unsigned long r0, unsigned long r1,
158 recalc_sigpending(); 157 recalc_sigpending();
159 spin_unlock_irq(&current->sighand->siglock); 158 spin_unlock_irq(&current->sighand->siglock);
160 159
161 if (restore_sigcontext(&regs, &frame->uc.uc_mcontext, &result)) 160 if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result))
162 goto badframe; 161 goto badframe;
163 162
164 if (__copy_from_user(&st, &frame->uc.uc_stack, sizeof(st))) 163 if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->spu) == -EFAULT)
165 goto badframe; 164 goto badframe;
166 /* It is more difficult to avoid calling this function than to
167 call it and ignore errors. */
168 do_sigaltstack(&st, NULL, regs.spu);
169 165
170 return result; 166 return result;
171 167
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index fe55b28d3725..670cb49210af 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -29,28 +29,7 @@
29 29
30/* 30/*
31 * sys_tas() - test-and-set 31 * sys_tas() - test-and-set
32 * linuxthreads testing version
33 */ 32 */
34#ifndef CONFIG_SMP
35asmlinkage int sys_tas(int *addr)
36{
37 int oldval;
38 unsigned long flags;
39
40 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
41 return -EFAULT;
42 local_irq_save(flags);
43 oldval = *addr;
44 if (!oldval)
45 *addr = 1;
46 local_irq_restore(flags);
47 return oldval;
48}
49#else /* CONFIG_SMP */
50#include <linux/spinlock.h>
51
52static DEFINE_SPINLOCK(tas_lock);
53
54asmlinkage int sys_tas(int *addr) 33asmlinkage int sys_tas(int *addr)
55{ 34{
56 int oldval; 35 int oldval;
@@ -58,15 +37,43 @@ asmlinkage int sys_tas(int *addr)
58 if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) 37 if (!access_ok(VERIFY_WRITE, addr, sizeof (int)))
59 return -EFAULT; 38 return -EFAULT;
60 39
61 _raw_spin_lock(&tas_lock); 40 /* atomic operation:
62 oldval = *addr; 41 * oldval = *addr; *addr = 1;
63 if (!oldval) 42 */
64 *addr = 1; 43 __asm__ __volatile__ (
65 _raw_spin_unlock(&tas_lock); 44 DCACHE_CLEAR("%0", "r4", "%1")
45 " .fillinsn\n"
46 "1:\n"
47 " lock %0, @%1 -> unlock %2, @%1\n"
48 "2:\n"
49 /* NOTE:
50 * The m32r processor can accept interrupts only
51 * at the 32-bit instruction boundary.
52 * So, in the above code, the "unlock" instruction
53 * can be executed continuously after the "lock"
54 * instruction execution without any interruptions.
55 */
56 ".section .fixup,\"ax\"\n"
57 " .balign 4\n"
58 "3: ldi %0, #%3\n"
59 " seth r14, #high(2b)\n"
60 " or3 r14, r14, #low(2b)\n"
61 " jmp r14\n"
62 ".previous\n"
63 ".section __ex_table,\"a\"\n"
64 " .balign 4\n"
65 " .long 1b,3b\n"
66 ".previous\n"
67 : "=&r" (oldval)
68 : "r" (addr), "r" (1), "i"(-EFAULT)
69 : "r14", "memory"
70#ifdef CONFIG_CHIP_M32700_TS1
71 , "r4"
72#endif /* CONFIG_CHIP_M32700_TS1 */
73 );
66 74
67 return oldval; 75 return oldval;
68} 76}
69#endif /* CONFIG_SMP */
70 77
71/* 78/*
72 * sys_pipe() is the normal C calling standard for creating 79 * sys_pipe() is the normal C calling standard for creating
diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c
index ce16bbe26a52..2d1dd2106c4d 100644
--- a/arch/m32r/lib/usercopy.c
+++ b/arch/m32r/lib/usercopy.c
@@ -64,7 +64,7 @@ do { \
64 " .balign 4\n" \ 64 " .balign 4\n" \
65 " .long 0b,3b\n" \ 65 " .long 0b,3b\n" \
66 ".previous" \ 66 ".previous" \
67 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 67 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
68 "=&r" (__d2) \ 68 "=&r" (__d2) \
69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 69 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
70 "4"(dst) \ 70 "4"(dst) \
@@ -101,7 +101,7 @@ do { \
101 " .balign 4\n" \ 101 " .balign 4\n" \
102 " .long 0b,3b\n" \ 102 " .long 0b,3b\n" \
103 ".previous" \ 103 ".previous" \
104 : "=r"(res), "=r"(count), "=&r" (__d0), "=&r" (__d1), \ 104 : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \
105 "=&r" (__d2) \ 105 "=&r" (__d2) \
106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ 106 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \
107 "4"(dst) \ 107 "4"(dst) \
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index 6facf15b04f3..c9e7dad860b7 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -226,7 +226,7 @@ void free_initmem(void)
226 addr = (unsigned long)(&__init_begin); 226 addr = (unsigned long)(&__init_begin);
227 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { 227 for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
228 ClearPageReserved(virt_to_page(addr)); 228 ClearPageReserved(virt_to_page(addr));
229 set_page_count(virt_to_page(addr), 1); 229 init_page_count(virt_to_page(addr));
230 free_page(addr); 230 free_page(addr);
231 totalram_pages++; 231 totalram_pages++;
232 } 232 }
@@ -244,7 +244,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
244 unsigned long p; 244 unsigned long p;
245 for (p = start; p < end; p += PAGE_SIZE) { 245 for (p = start; p < end; p += PAGE_SIZE) {
246 ClearPageReserved(virt_to_page(p)); 246 ClearPageReserved(virt_to_page(p));
247 set_page_count(virt_to_page(p), 1); 247 init_page_count(virt_to_page(p));
248 free_page(p); 248 free_page(p);
249 totalram_pages++; 249 totalram_pages++;
250 } 250 }