All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors
@ 2004-09-11 20:24 Hirokazu Takata
  2004-09-11 20:43 ` [PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling Hirokazu Takata
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

Hello, 

I made patches to fix compile errors for m32r architecture port.
These patches are against 2.6.9-rc1-mm4.
Please apply them.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

[PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling
  This patch is for profiling support. 
  profile_tick() is used instead of m32r_do_profile().

 arch/m32r/kernel/smp.c    |   10 ++++------
 arch/m32r/kernel/time.c   |    5 ++---
 include/asm-m32r/hw_irq.h |   33 +--------------------------------
 include/asm-m32r/ptrace.h |   14 ++++++++------
 4 files changed, 15 insertions(+), 47 deletions(-)

--
[PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init()
  This patch upgrades zone_sizes_init() function.
  This patch is required because free_area_init_node()'s interface 
  has been changed.

 arch/m32r/mm/discontig.c |    2 +-
 arch/m32r/mm/init.c      |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

--
[PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors
  This patch updates code to fix compile errors, and so on.

 arch/m32r/kernel/Makefile  |    2 -
 arch/m32r/kernel/process.c |    5 +--
 arch/m32r/kernel/signal.c  |   68 +++++++++++++++++++++++++--------------------
 include/asm-m32r/hardirq.h |   18 -----------
 include/asm-m32r/page.h    |    4 +-
 5 files changed, 43 insertions(+), 54 deletions(-)

--
[PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h
  This patch updates asm-m32r/uaccess.h.

 include/asm-m32r/uaccess.h |  349 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 290 insertions(+), 59 deletions(-)

--
[PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions
  This patch update checksum routines.
  And EXPORT_SYMBOL() is moved from m32r_ksyms.c to csum_partial_copy.c.

 arch/m32r/kernel/m32r_ksyms.c     |    2 
 arch/m32r/lib/csum_partial_copy.c |   39 ++--------
 include/asm-m32r/checksum.h       |  136 +++++++++++---------------------------
 3 files changed, 52 insertions(+), 125 deletions(-)

--
[PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
  This patch updates m32r-specific CF/PCMCIA drivers and 
  fixes compile errors.

 arch/m32r/drivers/m32r_cfc.c |   14 +++++++-------
 arch/m32r/drivers/m32r_pcc.c |   25 ++++++++++++++-----------
 2 files changed, 21 insertions(+), 18 deletions(-)
-----

Thank you.
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
@ 2004-09-11 20:43 ` Hirokazu Takata
  2004-09-11 20:48 ` [PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init() Hirokazu Takata
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling
  This patch is for profiling support. 
  profile_tick() is used instead of m32r_do_profile().

	* arch/m32r/kernel/smp.c
	(smp_local_timer_interrupt): Change profile API, use profile_tick()
	instead of m32r_do_profile().

	* arch/m32r/kernel/time.c: ditto.

	* include/asm-m32r/hw_irq.h (m32r_do_profile): Removed.

	* include/asm-m32r/ptrace.h (profile_pc): Add profile_pc() macro.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 arch/m32r/kernel/smp.c    |   10 ++++------
 arch/m32r/kernel/time.c   |    5 ++---
 include/asm-m32r/hw_irq.h |   33 +--------------------------------
 include/asm-m32r/ptrace.h |   14 ++++++++------
 4 files changed, 15 insertions(+), 47 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/smp.c linux-2.6.9-rc1-mm4/arch/m32r/kernel/smp.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/smp.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/smp.c	2004-09-09 23:07:43.000000000 +0900
@@ -1,8 +1,7 @@
 /*
  *  linux/arch/m32r/kernel/smp.c
- *    orig : i386 2.4.10
  *
- *  MITSUBISHI M32R SMP support routines.
+ *  M32R SMP support routines.
  *
  *  Copyright (c) 2001, 2002  Hitoshi Yamamoto
  *
@@ -14,8 +13,6 @@
  *  later.
  */
 
-/* $Id$ */
-
 #undef DEBUG_SMP
 
 #include <linux/irq.h>
@@ -23,6 +20,7 @@
 #include <linux/spinlock.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
+#include <linux/profile.h>
 
 #include <asm/cacheflush.h>
 #include <asm/pgalloc.h>
@@ -109,7 +107,7 @@ static void send_IPI_mask(cpumask_t, int
 unsigned long send_IPI_mask_phys(cpumask_t, int, int);
 
 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
-/* Rescheduling request Routins                                              */
+/* Rescheduling request Routines                                             */
 /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
 
 /*==========================================================================*
@@ -762,7 +760,7 @@ void smp_local_timer_interrupt(struct pt
 	 * useful with a profiling multiplier != 1
 	 */
 
-	m32r_do_profile(regs);
+	profile_tick(CPU_PROFILING, regs);
 
 	if (--per_cpu(prof_counter, cpu_id) <= 0) {
 		/*
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/time.c linux-2.6.9-rc1-mm4/arch/m32r/kernel/time.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/time.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/time.c	2004-09-09 23:07:56.000000000 +0900
@@ -15,8 +15,6 @@
  *    Copyright (C) 2000  Philipp Rumpf <prumpf@tux.org>
  */
 
-/* $Id$ */
-
 #undef  DEBUG_TIMER
 
 #include <linux/config.h>
@@ -29,6 +27,7 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
+#include <linux/profile.h>
 
 #include <asm/io.h>
 #include <asm/m32r.h>
@@ -243,7 +242,7 @@ irqreturn_t timer_interrupt(int irq, voi
 	write_sequnlock(&xtime_lock);
 
 #ifndef CONFIG_SMP
-	m32r_do_profile(regs);
+	profile_tick(CPU_PROFILING, regs);
 #endif
 
 	return IRQ_HANDLED;
diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/hw_irq.h linux-2.6.9-rc1-mm4/include/asm-m32r/hw_irq.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/hw_irq.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/hw_irq.h	2004-09-09 21:10:28.000000000 +0900
@@ -1,40 +1,9 @@
 #ifndef _ASM_M32R_HW_IRQ_H
 #define _ASM_M32R_HW_IRQ_H
 
-/* $Id$ */
-
-#include <linux/profile.h>
-#include <linux/sched.h>
-#include <asm/sections.h>
-
-static __inline__ void hw_resend_irq(struct hw_interrupt_type *h,
-				     unsigned int i)
+static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
 {
 	/* Nothing to do */
 }
 
-static __inline__ void m32r_do_profile (struct pt_regs *regs)
-{
-        unsigned long pc = regs->bpc;
-
-        profile_hook(regs);
-
-        if (user_mode(regs))
-                return;
-
-        if (!prof_buffer)
-                return;
-
-        pc -= (unsigned long) &_stext;
-        pc >>= prof_shift;
-        /*
-         * Don't ignore out-of-bounds PC values silently,
-         * put them into the last histogram slot, so if
-         * present, they will show up as a sharp peak.
-         */
-        if (pc > prof_len - 1)
-                pc = prof_len - 1;
-        atomic_inc((atomic_t *)&prof_buffer[pc]);
-}
-
 #endif /* _ASM_M32R_HW_IRQ_H */
diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/ptrace.h linux-2.6.9-rc1-mm4/include/asm-m32r/ptrace.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/ptrace.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/ptrace.h	2004-09-12 04:41:01.000000000 +0900
@@ -1,14 +1,15 @@
-#ifndef _M32R_PTRACE_H
-#define _M32R_PTRACE_H
-
-/* $Id$ */
+#ifndef _ASM_M32R_PTRACE_H
+#define _ASM_M32R_PTRACE_H
 
 /*
+ * linux/include/asm-m32r/ptrace.h
+ *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001, 2002, 2004  Hirokazu Takata
+ * M32R version:
+ *   Copyright (C) 2001-2002, 2004  Hirokazu Takata <takata at linux-m32r.org>
  */
 
 #include <linux/config.h>
@@ -153,6 +154,7 @@ struct pt_regs {
 #endif
 
 #define instruction_pointer(regs) ((regs)->bpc)
+#define profile_pc(regs) instruction_pointer(regs)
 
 extern void show_regs(struct pt_regs *);
 
@@ -160,4 +162,4 @@ extern void withdraw_debug_trap(struct p
 
 #endif /* __KERNEL */
 
-#endif /* _M32R_PTRACE_H */
+#endif /* _ASM_M32R_PTRACE_H */
 
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init()
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
  2004-09-11 20:43 ` [PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling Hirokazu Takata
@ 2004-09-11 20:48 ` Hirokazu Takata
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors Hirokazu Takata
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init()
  This patch upgrades zone_sizes_init() function.
  This patch is required because free_area_init_node()'s interface 
  has been changed.

	* arch/m32r/mm/discontig.c (zone_sizes_init): 
	Change free_area_init_node() interface.

	* arch/m32r/mm/init.c: ditto.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 arch/m32r/mm/discontig.c |    2 +-
 arch/m32r/mm/init.c      |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/mm/discontig.c linux-2.6.9-rc1-mm4/arch/m32r/mm/discontig.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/mm/discontig.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/mm/discontig.c	2004-09-09 01:47:12.000000000 +0900
@@ -152,7 +152,7 @@ unsigned long __init zone_sizes_init(voi
 		zholes_size[ZONE_DMA] = mp->holes;
 		holes += zholes_size[ZONE_DMA];
 
-		free_area_init_node(nid, NODE_DATA(nid), NULL, zones_size,
+		free_area_init_node(nid, NODE_DATA(nid), zones_size,
 			start_pfn, zholes_size);
 	}
 
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/mm/init.c linux-2.6.9-rc1-mm4/arch/m32r/mm/init.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/mm/init.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/mm/init.c	2004-09-09 01:39:58.000000000 +0900
@@ -120,8 +120,7 @@ unsigned long __init zone_sizes_init(voi
 	start_pfn = __MEMORY_START >> PAGE_SHIFT;
 #endif /* CONFIG_MMU */
 
-	free_area_init_node(0, NODE_DATA(0), 0, zones_size,
-		start_pfn, 0);
+	free_area_init_node(0, NODE_DATA(0), zones_size, start_pfn, 0);
 
 	mem_map = contig_page_data.node_mem_map;
 
--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
  2004-09-11 20:43 ` [PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling Hirokazu Takata
  2004-09-11 20:48 ` [PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init() Hirokazu Takata
@ 2004-09-11 20:51 ` Hirokazu Takata
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h Hirokazu Takata
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors
  This patch updates code to fix compile errors, and so on.

	* arch/m32r/kernel/Makefile:
	Change linker script's name from vmlinux.lds.s to vmlinux.lds.

	* arch/m32r/kernel/process.c (sys_clone):
	Fix the first parameter of do_fork() call.

	* arch/m32r/kernel/signal.c: 
	(handle_signal): Add a new second argument, struct k_sigaction *ka.
	(do_signal): Change get_signal_to_deliver() interface.

	* include/asm-m32r/hardirq.h:
	Some declarations are moved to linux/hardirq.h.

	* include/asm-m32r/page.h:
	Add devmem_is_allowed() macro.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 arch/m32r/kernel/Makefile  |    2 -
 arch/m32r/kernel/process.c |    5 +--
 arch/m32r/kernel/signal.c  |   68 +++++++++++++++++++++++++--------------------
 include/asm-m32r/hardirq.h |   18 -----------
 include/asm-m32r/page.h    |    4 +-
 5 files changed, 43 insertions(+), 54 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/Makefile linux-2.6.9-rc1-mm4/arch/m32r/kernel/Makefile
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/Makefile	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/Makefile	2004-09-09 01:39:58.000000000 +0900
@@ -2,7 +2,7 @@
 # Makefile for the Linux/M32R kernel.
 #
 
-extra-y	:= head.o init_task.o vmlinux.lds.s
+extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y	:= process.o entry.o traps.o align.o irq.o setup.o time.o \
 	m32r_ksyms.o sys_m32r.o semaphore.o signal.o ptrace.o
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/process.c linux-2.6.9-rc1-mm4/arch/m32r/kernel/process.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/process.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/process.c	2004-09-09 01:39:58.000000000 +0900
@@ -27,8 +27,8 @@
 #include <linux/ptrace.h>
 #include <linux/unistd.h>
 #include <linux/slab.h>
+#include <linux/hardirq.h>
 
-#include <asm/hardirq.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -298,8 +298,7 @@ asmlinkage int sys_clone(unsigned long c
 	if (!newsp)
 		newsp = regs.spu;
 
-	return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, &regs, 0, NULL,
-			NULL);
+	return do_fork(clone_flags, newsp, &regs, 0, NULL, NULL);
 }
 
 /*
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/signal.c linux-2.6.9-rc1-mm4/arch/m32r/kernel/signal.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/signal.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/signal.c	2004-09-09 01:39:58.000000000 +0900
@@ -1,6 +1,5 @@
 /*
  *  linux/arch/m32r/kernel/signal.c
- *    orig : i386 2.5.67
  *
  *  Copyright (c) 2003  Hitoshi Yamamoto
  *
@@ -37,9 +36,10 @@ int do_signal(struct pt_regs *, sigset_t
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
-asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r1,
-	unsigned long r2, unsigned long r3, unsigned long r4,
-	unsigned long r5, unsigned long r6, struct pt_regs regs)
+asmlinkage int
+sys_sigsuspend(old_sigset_t mask, unsigned long r1,
+	       unsigned long r2, unsigned long r3, unsigned long r4,
+	       unsigned long r5, unsigned long r6, struct pt_regs regs)
 {
 	sigset_t saveset;
 
@@ -59,9 +59,10 @@ asmlinkage int sys_sigsuspend(old_sigset
 	}
 }
 
-asmlinkage int sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
-	unsigned long r2, unsigned long r3, unsigned long r4,
-	unsigned long r5, unsigned long r6, struct pt_regs regs)
+asmlinkage int
+sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize,
+		  unsigned long r2, unsigned long r3, unsigned long r4,
+		  unsigned long r5, unsigned long r6, struct pt_regs regs)
 {
 	sigset_t saveset, newset;
 
@@ -88,7 +89,8 @@ asmlinkage int sys_rt_sigsuspend(sigset_
 	}
 }
 
-asmlinkage int sys_sigaction(int sig, const struct old_sigaction __user *act,
+asmlinkage int
+sys_sigaction(int sig, const struct old_sigaction __user *act,
 	      struct old_sigaction __user *oact)
 {
 	struct k_sigaction new_ka, old_ka;
@@ -119,9 +121,10 @@ asmlinkage int sys_sigaction(int sig, co
 	return ret;
 }
 
-asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
-	unsigned long r2, unsigned long r3, unsigned long r4,
-	unsigned long r5, unsigned long r6, struct pt_regs regs)
+asmlinkage int
+sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+		unsigned long r2, unsigned long r3, unsigned long r4,
+		unsigned long r5, unsigned long r6, struct pt_regs regs)
 {
 	return do_sigaltstack(uss, uoss, regs.spu);
 }
@@ -153,8 +156,9 @@ struct rt_sigframe
 	char retcode[8];
 };
 
-static int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
-	int *r0_p)
+static int
+restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc,
+		   int *r0_p)
 {
 	unsigned int err = 0;
 
@@ -203,9 +207,10 @@ static int restore_sigcontext(struct pt_
 	return err;
 }
 
-asmlinkage int sys_sigreturn(unsigned long r0, unsigned long r1,
-	unsigned long r2, unsigned long r3, unsigned long r4,
-	unsigned long r5, unsigned long r6, struct pt_regs regs)
+asmlinkage int
+sys_sigreturn(unsigned long r0, unsigned long r1,
+	      unsigned long r2, unsigned long r3, unsigned long r4,
+	      unsigned long r5, unsigned long r6, struct pt_regs regs)
 {
 	struct sigframe __user *frame = (struct sigframe __user *)regs.spu;
 	sigset_t set;
@@ -234,9 +239,10 @@ badframe:
 	return 0;
 }
 
-asmlinkage int sys_rt_sigreturn(unsigned long r0, unsigned long r1,
-	unsigned long r2, unsigned long r3, unsigned long r4,
-	unsigned long r5, unsigned long r6, struct pt_regs regs)
+asmlinkage int
+sys_rt_sigreturn(unsigned long r0, unsigned long r1,
+		 unsigned long r2, unsigned long r3, unsigned long r4,
+		 unsigned long r5, unsigned long r6, struct pt_regs regs)
 {
 	struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs.spu;
 	sigset_t set;
@@ -274,8 +280,9 @@ badframe:
  * Set up a signal frame.
  */
 
-static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
-	unsigned long mask)
+static int
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
+	         unsigned long mask)
 {
 	int err = 0;
 
@@ -323,8 +330,8 @@ static int setup_sigcontext(struct sigco
 /*
  * Determine which stack to use..
  */
-static __inline__ void __user *get_sigframe(struct k_sigaction *ka, unsigned long sp,
-	size_t frame_size)
+static inline void __user *
+get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
 	/* This is the X/Open sanctioned signal stack switching.  */
 	if (ka->sa.sa_flags & SA_ONSTACK) {
@@ -336,7 +343,7 @@ static __inline__ void __user *get_sigfr
 }
 
 static void setup_frame(int sig, struct k_sigaction *ka,
-	sigset_t *set, struct pt_regs *regs)
+			sigset_t *set, struct pt_regs *regs)
 {
 	struct sigframe __user *frame;
 	int err = 0;
@@ -403,7 +410,7 @@ give_sigsegv:
 }
 
 static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
-	sigset_t *set, struct pt_regs *regs)
+			   sigset_t *set, struct pt_regs *regs)
 {
 	struct rt_sigframe __user *frame;
 	int err = 0;
@@ -484,10 +491,10 @@ give_sigsegv:
  * OK, we're invoking a handler
  */
 
-static void handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
-	struct pt_regs *regs)
+static void
+handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info,
+	      sigset_t *oldset, struct pt_regs *regs)
 {
-	struct k_sigaction *ka = &current->sighand->action[sig-1];
 	unsigned short inst;
 
 	/* Are we from a system call? */
@@ -542,6 +549,7 @@ int do_signal(struct pt_regs *regs, sigs
 {
 	siginfo_t info;
 	int signr;
+	struct k_sigaction ka;
 	unsigned short inst;
 
 	/*
@@ -561,7 +569,7 @@ int do_signal(struct pt_regs *regs, sigs
 	if (!oldset)
 		oldset = &current->blocked;
 
-	signr = get_signal_to_deliver(&info, regs, NULL);
+	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
 	if (signr > 0) {
 		/* Reenable any watchpoints before delivering the
 		 * signal to user space. The processor register will
@@ -570,7 +578,7 @@ int do_signal(struct pt_regs *regs, sigs
 		 */
 
 		/* Whee!  Actually deliver the signal.  */
-		handle_signal(signr, &info, oldset, regs);
+		handle_signal(signr, &ka, &info, oldset, regs);
 		return 1;
 	}
 
diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/hardirq.h linux-2.6.9-rc1-mm4/include/asm-m32r/hardirq.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/hardirq.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/hardirq.h	2004-09-12 04:33:43.000000000 +0900
@@ -1,10 +1,6 @@
 #ifndef __ASM_HARDIRQ_H
 #define __ASM_HARDIRQ_H
 
-/* $Id$ */
-
-/* orig : i386 2.5.67 */
-
 #include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/irq.h>
@@ -40,20 +36,6 @@ typedef struct {
 #define SOFTIRQ_SHIFT	(PREEMPT_SHIFT + PREEMPT_BITS)
 #define HARDIRQ_SHIFT	(SOFTIRQ_SHIFT + SOFTIRQ_BITS)
 
-#define __MASK(x)	((1UL << (x))-1)
-
-#define PREEMPT_MASK	(__MASK(PREEMPT_BITS) << PREEMPT_SHIFT)
-#define HARDIRQ_MASK	(__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT)
-#define SOFTIRQ_MASK	(__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT)
-
-#define hardirq_count()	(preempt_count() & HARDIRQ_MASK)
-#define softirq_count()	(preempt_count() & SOFTIRQ_MASK)
-#define irq_count()	(preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK))
-
-#define PREEMPT_OFFSET	(1UL << PREEMPT_SHIFT)
-#define SOFTIRQ_OFFSET	(1UL << SOFTIRQ_SHIFT)
-#define HARDIRQ_OFFSET	(1UL << HARDIRQ_SHIFT)
-
 /*
  * The hardirq mask has to be large enough to have
  * space for potentially all IRQ sources in the system
diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/page.h linux-2.6.9-rc1-mm4/include/asm-m32r/page.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/page.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/page.h	2004-09-12 04:34:07.000000000 +0900
@@ -1,8 +1,6 @@
 #ifndef _ASM_M32R_PAGE_H
 #define _ASM_M32R_PAGE_H
 
-/* $Id$ */
-
 #include <linux/config.h>
 
 /* PAGE_SHIFT determines the page size */
@@ -106,6 +104,8 @@ static __inline__ int get_order(unsigned
 #define VM_DATA_DEFAULT_FLAGS	(VM_READ | VM_WRITE | VM_EXEC | \
 				 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC )
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _ASM_M32R_PAGE_H */

--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
                   ` (2 preceding siblings ...)
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors Hirokazu Takata
@ 2004-09-11 20:51 ` Hirokazu Takata
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions Hirokazu Takata
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers Hirokazu Takata
  5 siblings, 0 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h
  This patch updates asm-m32r/uaccess.h.

	* include/asm-m32r/uaccess.h:
	(__copy_to_user_inatomic): Added.
	(__copy_from_user_inatomic): Added.
	Update comments.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 include/asm-m32r/uaccess.h |  349 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 290 insertions(+), 59 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/uaccess.h linux-2.6.9-rc1-mm4/include/asm-m32r/uaccess.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/uaccess.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/uaccess.h	2004-09-12 04:46:32.000000000 +0900
@@ -1,7 +1,12 @@
 #ifndef _ASM_M32R_UACCESS_H
 #define _ASM_M32R_UACCESS_H
 
-/* $Id$ */
+/*
+ *  linux/include/asm-m32r/uaccess.h
+ *
+ *  M32R version.
+ *    Copyright (C) 2004  Hirokazu Takata <takata at linux-m32r.org>
+ */
 
 #undef UACCESS_DEBUG
 
@@ -61,7 +66,13 @@ static inline void set_fs(mm_segment_t s
 	((unsigned long)(addr) < (current_thread_info()->addr_limit.seg))
 
 /*
- * Uhhuh, this needs 33-bit arithmetic. We have a carry..
+ * Test whether a block of memory is a valid user space address.
+ * Returns 0 if the range is valid, nonzero otherwise.
+ *
+ * This is equivalent to the following test:
+ * (u33)addr + (u33)size >= (u33)current->addr_limit.seg
+ *
+ * This needs 33-bit arithmetic. We have a carry...
  */
 #define __range_ok(addr,size) ({					\
 	unsigned long flag, sum; 					\
@@ -78,8 +89,27 @@ static inline void set_fs(mm_segment_t s
 		: "cbit" );						\
 	flag; })
 
+/**
+ * access_ok: - Checks if a user space pointer is valid
+ * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE.  Note that
+ *        %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
+ *        to write to a block, it is always safe to read from it.
+ * @addr: User space pointer to start of block to check
+ * @size: Size of block to check
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Checks if a pointer to a block of memory in user space is valid.
+ *
+ * Returns true (nonzero) if the memory block may be valid, false (zero)
+ * if it is definitely invalid.
+ *
+ * Note that, depending on architecture, this function probably just
+ * checks that the pointer is in the user space range - after calling
+ * this function, memory access functions may still return -EFAULT.
+ */
 #ifdef CONFIG_MMU
-#define access_ok(type,addr,size) (__range_ok(addr,size) == 0)
+#define access_ok(type,addr,size) (likely(__range_ok(addr,size) == 0))
 #else
 static inline int access_ok(int type, const void *addr, unsigned long size)
 {
@@ -90,8 +120,25 @@ static inline int access_ok(int type, co
 }
 #endif /* CONFIG_MMU */
 
-static __inline__ int verify_area(int type, const void __user *addr,
-	unsigned long size)
+/**
+ * verify_area: - Obsolete, use access_ok()
+ * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE
+ * @addr: User space pointer to start of block to check
+ * @size: Size of block to check
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * This function has been replaced by access_ok().
+ *
+ * Checks if a pointer to a block of memory in user space is valid.
+ *
+ * Returns zero if the memory block may be valid, -EFAULT
+ * if it is definitely invalid.
+ *
+ * See access_ok() for more details.
+ */
+static inline int verify_area(int type, const void __user *addr,
+			      unsigned long size)
 {
 	return access_ok(type, addr, size) ? 0 : -EFAULT;
 }
@@ -167,6 +214,23 @@ extern void __get_user_4(void);
 
 /* Careful: we have to cast the result to the type of the pointer for sign
    reasons */
+/**
+ * get_user: - Get a simple variable from user space.
+ * @x:   Variable to store result.
+ * @ptr: Source address, in user space.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * This macro copies a single simple variable from user space to kernel
+ * space.  It supports simple types like char and int, but not larger
+ * data types like structures or arrays.
+ *
+ * @ptr must have pointer-to-simple-variable type, and the result of
+ * dereferencing @ptr must be assignable to @x without a cast.
+ *
+ * Returns zero on success, or -EFAULT on error.
+ * On error, the variable @x is set to zero.
+ */
 #define get_user(x,ptr)							\
 ({	int __ret_gu,__val_gu;						\
 	__chk_user_ptr(ptr);						\
@@ -182,11 +246,69 @@ extern void __get_user_4(void);
 
 extern void __put_user_bad(void);
 
+/**
+ * put_user: - Write a simple value into user space.
+ * @x:   Value to copy to user space.
+ * @ptr: Destination address, in user space.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * This macro copies a single simple value from kernel space to user
+ * space.  It supports simple types like char and int, but not larger
+ * data types like structures or arrays.
+ *
+ * @ptr must have pointer-to-simple-variable type, and @x must be assignable
+ * to the result of dereferencing @ptr.
+ *
+ * Returns zero on success, or -EFAULT on error.
+ */
 #define put_user(x,ptr)							\
   __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
+
+/**
+ * __get_user: - Get a simple variable from user space, with less checking.
+ * @x:   Variable to store result.
+ * @ptr: Source address, in user space.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * This macro copies a single simple variable from user space to kernel
+ * space.  It supports simple types like char and int, but not larger
+ * data types like structures or arrays.
+ *
+ * @ptr must have pointer-to-simple-variable type, and the result of
+ * dereferencing @ptr must be assignable to @x without a cast.
+ *
+ * Caller must check the pointer with access_ok() before calling this
+ * function.
+ *
+ * Returns zero on success, or -EFAULT on error.
+ * On error, the variable @x is set to zero.
+ */
 #define __get_user(x,ptr) \
   __get_user_nocheck((x),(ptr),sizeof(*(ptr)))
+
+
+/**
+ * __put_user: - Write a simple value into user space, with less checking.
+ * @x:   Value to copy to user space.
+ * @ptr: Destination address, in user space.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * This macro copies a single simple value from kernel space to user
+ * space.  It supports simple types like char and int, but not larger
+ * data types like structures or arrays.
+ *
+ * @ptr must have pointer-to-simple-variable type, and @x must be assignable
+ * to the result of dereferencing @ptr.
+ *
+ * Caller must check the pointer with access_ok() before calling this
+ * function.
+ *
+ * Returns zero on success, or -EFAULT on error.
+ */
 #define __put_user(x,ptr) \
   __put_user_nocheck((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
 
@@ -208,48 +330,6 @@ extern void __put_user_bad(void);
 	__pu_err;							\
 })
 
-#define __put_user_size(x,ptr,size,retval)				\
-do {									\
-	retval = 0;							\
-	__chk_user_ptr(ptr);						\
-	switch (size) {							\
-	  case 1: __put_user_asm(x,ptr,retval,"b"); break;		\
-	  case 2: __put_user_asm(x,ptr,retval,"h"); break;		\
-	  case 4: __put_user_asm(x,ptr,retval,""); break;		\
-	  case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\
-	  default: __put_user_bad();					\
-	}								\
-} while (0)
-
-struct __large_struct { unsigned long buf[100]; };
-#define __m(x) (*(struct __large_struct *)(x))
-
-/*
- * Tell gcc we read from memory instead of writing: this is because
- * we do not write to any memory gcc knows about, so there are no
- * aliasing issues.
- */
-#define __put_user_asm(x, addr, err, itype)				\
-	__asm__ __volatile__(						\
-		"	.fillinsn\n"					\
-		"1:	st"itype" %1,@%2\n"				\
-		"	.fillinsn\n"					\
-		"2:\n"							\
-		".section .fixup,\"ax\"\n"				\
-		"	.balign 4\n"					\
-		"3:	ldi %0,%3\n"					\
-		"	seth r14,#high(2b)\n"				\
-		"	or3 r14,r14,#low(2b)\n"				\
-		"	jmp r14\n"					\
-		".previous\n"						\
-		".section __ex_table,\"a\"\n"				\
-		"	.balign 4\n"					\
-		"	.long 1b,3b\n"					\
-		".previous"						\
-		: "=r"(err)						\
-		: "r"(x), "r"(addr), "i"(-EFAULT), "0"(err)		\
-		: "r14", "memory")
-
 #if defined(__LITTLE_ENDIAN__)
 #define __put_user_u64(x, addr, err)                                    \
         __asm__ __volatile__(                                           \
@@ -303,6 +383,48 @@ struct __large_struct { unsigned long bu
 #error no endian defined
 #endif
 
+#define __put_user_size(x,ptr,size,retval)				\
+do {									\
+	retval = 0;							\
+	__chk_user_ptr(ptr);						\
+	switch (size) {							\
+	  case 1: __put_user_asm(x,ptr,retval,"b"); break;		\
+	  case 2: __put_user_asm(x,ptr,retval,"h"); break;		\
+	  case 4: __put_user_asm(x,ptr,retval,""); break;		\
+	  case 8: __put_user_u64((__typeof__(*ptr))(x),ptr,retval); break;\
+	  default: __put_user_bad();					\
+	}								\
+} while (0)
+
+struct __large_struct { unsigned long buf[100]; };
+#define __m(x) (*(struct __large_struct *)(x))
+
+/*
+ * Tell gcc we read from memory instead of writing: this is because
+ * we do not write to any memory gcc knows about, so there are no
+ * aliasing issues.
+ */
+#define __put_user_asm(x, addr, err, itype)				\
+	__asm__ __volatile__(						\
+		"	.fillinsn\n"					\
+		"1:	st"itype" %1,@%2\n"				\
+		"	.fillinsn\n"					\
+		"2:\n"							\
+		".section .fixup,\"ax\"\n"				\
+		"	.balign 4\n"					\
+		"3:	ldi %0,%3\n"					\
+		"	seth r14,#high(2b)\n"				\
+		"	or3 r14,r14,#low(2b)\n"				\
+		"	jmp r14\n"					\
+		".previous\n"						\
+		".section __ex_table,\"a\"\n"				\
+		"	.balign 4\n"					\
+		"	.long 1b,3b\n"					\
+		".previous"						\
+		: "=r"(err)						\
+		: "r"(x), "r"(addr), "i"(-EFAULT), "0"(err)		\
+		: "r14", "memory")
+
 #define __get_user_nocheck(x,ptr,size)					\
 ({									\
 	long __gu_err, __gu_val;					\
@@ -346,6 +468,13 @@ do {									\
 		: "r"(addr), "i"(-EFAULT), "0"(err)			\
 		: "r14", "memory")
 
+/*
+ * Here we special-case 1, 2 and 4-byte copy_*_user invocations.  On a fault
+ * we return the initial request size (1, 2 or 4), as copy_*_user should do.
+ * If a store crosses a page boundary and gets a fault, the m32r will not write
+ * anything, so this is accurate.
+ */
+
 
 /*
  * Copy To/From Userspace
@@ -475,14 +604,14 @@ do {									\
 /* We let the __ versions of copy_from/to_user inline, because they're often
  * used in fast paths and have only a small space overhead.
  */
-static __inline__ unsigned long __generic_copy_from_user_nocheck(void *to,
+static inline unsigned long __generic_copy_from_user_nocheck(void *to,
 	const void __user *from, unsigned long n)
 {
 	__copy_user_zeroing(to,from,n);
 	return n;
 }
 
-static __inline__ unsigned long __generic_copy_to_user_nocheck(void __user *to,
+static inline unsigned long __generic_copy_to_user_nocheck(void __user *to,
 	const void *from, unsigned long n)
 {
 	__copy_user(to,from,n);
@@ -492,30 +621,132 @@ static __inline__ unsigned long __generi
 unsigned long __generic_copy_to_user(void *, const void *, unsigned long);
 unsigned long __generic_copy_from_user(void *, const void *, unsigned long);
 
+/**
+ * __copy_to_user: - Copy a block of data into user space, with less checking.
+ * @to:   Destination address, in user space.
+ * @from: Source address, in kernel space.
+ * @n:    Number of bytes to copy.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Copy data from kernel space to user space.  Caller must check
+ * the specified block with access_ok() before calling this function.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
+#define __copy_to_user(to,from,n)			\
+	__generic_copy_to_user_nocheck((to),(from),(n))
+
+#define __copy_to_user_inatomic __copy_to_user
+#define __copy_from_user_inatomic __copy_from_user
+
+/**
+ * copy_to_user: - Copy a block of data into user space.
+ * @to:   Destination address, in user space.
+ * @from: Source address, in kernel space.
+ * @n:    Number of bytes to copy.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Copy data from kernel space to user space.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ */
 #define copy_to_user(to,from,n)				\
 ({							\
 	might_sleep();					\
 	__generic_copy_to_user((to),(from),(n));	\
 })
 
+/**
+ * __copy_from_user: - Copy a block of data from user space, with less checking. * @to:   Destination address, in kernel space.
+ * @from: Source address, in user space.
+ * @n:    Number of bytes to copy.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Copy data from user space to kernel space.  Caller must check
+ * the specified block with access_ok() before calling this function.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ *
+ * If some data could not be copied, this function will pad the copied
+ * data to the requested size using zero bytes.
+ */
+#define __copy_from_user(to,from,n)			\
+	__generic_copy_from_user_nocheck((to),(from),(n))
+
+/**
+ * copy_from_user: - Copy a block of data from user space.
+ * @to:   Destination address, in kernel space.
+ * @from: Source address, in user space.
+ * @n:    Number of bytes to copy.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Copy data from user space to kernel space.
+ *
+ * Returns number of bytes that could not be copied.
+ * On success, this will be zero.
+ *
+ * If some data could not be copied, this function will pad the copied
+ * data to the requested size using zero bytes.
+ */
 #define copy_from_user(to,from,n)			\
 ({							\
 	might_sleep();					\
-	__generic_copy_from_user((to),(from),(n));	\
+__generic_copy_from_user((to),(from),(n));	\
 })
 
-#define __copy_to_user(to,from,n)			\
-	__generic_copy_to_user_nocheck((to),(from),(n))
+long __must_check strncpy_from_user(char *dst, const char __user *src, 
+				long count);
+long __must_check __strncpy_from_user(char *dst, 
+				const char __user *src, long count);
+
+/**
+ * __clear_user: - Zero a block of memory in user space, with less checking.
+ * @to:   Destination address, in user space.
+ * @n:    Number of bytes to zero.
+ *
+ * Zero a block of memory in user space.  Caller must check
+ * the specified block with access_ok() before calling this function.
+ *
+ * Returns number of bytes that could not be cleared.
+ * On success, this will be zero.
+ */
+unsigned long __clear_user(void __user *mem, unsigned long len);
 
-#define __copy_from_user(to,from,n)			\
-	__generic_copy_from_user_nocheck((to),(from),(n))
+/**
+ * clear_user: - Zero a block of memory in user space.
+ * @to:   Destination address, in user space.
+ * @n:    Number of bytes to zero.
+ *
+ * Zero a block of memory in user space.  Caller must check
+ * the specified block with access_ok() before calling this function.
+ *
+ * Returns number of bytes that could not be cleared.
+ * On success, this will be zero.
+ */
+unsigned long clear_user(void __user *mem, unsigned long len);
 
-long strncpy_from_user(char *dst, const char __user *src, long count);
-long __strncpy_from_user(char *dst, const char __user *src, long count);
+/**
+ * strlen_user: - Get the size of a string in user space.
+ * @str: The string to measure.
+ *
+ * Context: User context only.  This function may sleep.
+ *
+ * Get the size of a NUL-terminated string in user space.
+ *
+ * Returns the size of the string INCLUDING the terminating NUL.
+ * On exception, returns 0.
+ *
+ * If there is a limit on the length of a valid string, you may wish to
+ * consider using strnlen_user() instead.
+ */
 #define strlen_user(str) strnlen_user(str, ~0UL >> 1)
 long strnlen_user(const char __user *str, long n);
-unsigned long clear_user(void __user *mem, unsigned long len);
-unsigned long __clear_user(void __user *mem, unsigned long len);
 
 #endif /* _ASM_M32R_UACCESS_H */
-

--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
                   ` (3 preceding siblings ...)
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h Hirokazu Takata
@ 2004-09-11 20:51 ` Hirokazu Takata
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers Hirokazu Takata
  5 siblings, 0 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions
  This patch update checksum routines.
  And EXPORT_SYMBOL() is moved from m32r_ksyms.c to csum_partial_copy.c.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 arch/m32r/kernel/m32r_ksyms.c     |    2 
 arch/m32r/lib/csum_partial_copy.c |   39 ++--------
 include/asm-m32r/checksum.h       |  136 +++++++++++---------------------------
 3 files changed, 52 insertions(+), 125 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/m32r_ksyms.c linux-2.6.9-rc1-mm4/arch/m32r/kernel/m32r_ksyms.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/kernel/m32r_ksyms.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/kernel/m32r_ksyms.c	2004-09-09 01:39:58.000000000 +0900
@@ -14,7 +14,6 @@
 #include <asm/uaccess.h>
 #include <asm/checksum.h>
 #include <asm/io.h>
-#include <asm/hardirq.h>
 #include <asm/delay.h>
 #include <asm/irq.h>
 #include <asm/tlbflush.h>
@@ -42,7 +41,6 @@ EXPORT_SYMBOL(__up);
 EXPORT_SYMBOL(__down_trylock);
 
 /* Networking helper routines. */
-EXPORT_SYMBOL(csum_partial_copy);
 /* Delay loops */
 EXPORT_SYMBOL(__udelay);
 EXPORT_SYMBOL(__delay);
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/lib/csum_partial_copy.c linux-2.6.9-rc1-mm4/arch/m32r/lib/csum_partial_copy.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/lib/csum_partial_copy.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/lib/csum_partial_copy.c	2004-09-09 23:06:24.000000000 +0900
@@ -14,38 +14,34 @@
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
  *
- * $Id$
  */
-#include <net/checksum.h>
+
+#include <linux/module.h>
 #include <linux/types.h>
+
+#include <net/checksum.h>
 #include <asm/byteorder.h>
 #include <asm/string.h>
 #include <asm/uaccess.h>
 
 /*
- * copy while checksumming, otherwise like csum_partial
+ * Copy while checksumming, otherwise like csum_partial
  */
-unsigned int csum_partial_copy(const char *src, char *dst,
-                               int len, int sum)
+unsigned int csum_partial_copy_nocheck (const char *src, char *dst,
+                                        int len, unsigned int sum)
 {
-	/*
-	 * It's 2:30 am and I don't feel like doing it real ...
-	 * This is lots slower than the real thing (tm)
-	 */
 	sum = csum_partial(src, len, sum);
 	memcpy(dst, src, len);
 
 	return sum;
 }
+EXPORT_SYMBOL(csum_partial_copy_nocheck);
 
 /*
  * Copy from userspace and compute checksum.  If we catch an exception
  * then zero the rest of the buffer.
-unsigned int csum_partial_copy_from_user (const char *src, char *dst,
-                                          int len, unsigned int sum,
-                                          int *err_ptr)
  */
-unsigned int csum_partial_copy_generic_from (const char *src, char *dst,
+unsigned int csum_partial_copy_from_user (const char __user *src, char *dst,
                                           int len, unsigned int sum,
                                           int *err_ptr)
 {
@@ -59,19 +55,4 @@ unsigned int csum_partial_copy_generic_f
 
 	return csum_partial(dst, len-missing, sum);
 }
-unsigned int csum_partial_copy_generic_to (const char *src, char *dst,
-                                          int len, unsigned int sum,
-                                          int *err_ptr)
-{
-	int missing;
-
-	missing = copy_to_user(dst, src, len);
-	if (missing) {
-/*
-		memset(dst + len - missing, 0, missing);
-*/
-		*err_ptr = -EFAULT;
-	}
-
-	return csum_partial(src, len-missing, sum);
-}
+EXPORT_SYMBOL(csum_partial_copy_from_user);
diff -ruNp linux-2.6.9-rc1-mm4.orig/include/asm-m32r/checksum.h linux-2.6.9-rc1-mm4/include/asm-m32r/checksum.h
--- linux-2.6.9-rc1-mm4.orig/include/asm-m32r/checksum.h	2004-09-08 08:14:17.000000000 +0900
+++ linux-2.6.9-rc1-mm4/include/asm-m32r/checksum.h	2004-09-09 21:05:16.000000000 +0900
@@ -1,14 +1,20 @@
+#ifdef __KERNEL__
 #ifndef _ASM_M32R_CHECKSUM_H
 #define _ASM_M32R_CHECKSUM_H
 
-/* $Id$ */
-
 /*
- *  linux/include/asm-m32r/atomic.h
- *    orig : i386 2.4.10
+ * include/asm-m32r/checksum.h
+ *
+ * IP/TCP/UDP checksum routines
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Some code taken from mips and parisc architecture.
  *
- *  M32R version:
  *    Copyright (C) 2001, 2002  Hiroyuki Kondo, Hirokazu Takata
+ *    Copyright (C) 2004  Hirokazu Takata <takata at linux-m32r.org>
  */
 
 #include <linux/in6.h>
@@ -25,71 +31,31 @@
  *
  * it's best to have buff aligned on a 32-bit boundary
  */
-asmlinkage unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
+asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
 
 /*
- * the same as csum_partial, but copies from src while it
- * checksums, and handles user-space pointer exceptions correctly, when needed.
+ * The same as csum_partial, but copies from src while it checksums.
  *
- * here even more important to align src and dst on a 32-bit (or even
+ * Here even more important to align src and dst on a 32-bit (or even
  * better 64-bit) boundary
  */
-
-asmlinkage unsigned int csum_partial_copy_generic(const char *src, char *dst,
-		int len, int sum, int *src_err_ptr, int *dst_err_ptr);
+extern unsigned int csum_partial_copy_nocheck(const char *src, char *dst,
+                                              int len, unsigned int sum);
 
 /*
- *	Note: when you get a NULL pointer exception here this means someone
- *	passed in an incorrect kernel address to one of these functions.
- *
- *	If you use these functions directly please don't forget the
- *	verify_area().
+ * This is a new version of the above that records errors it finds in *errp,
+ * but continues and zeros thre rest of the buffer.
  */
-
-extern unsigned int csum_partial_copy(const char *src, char *dst,
-		int len, int sum);
-extern unsigned int csum_partial_copy_generic_from(const char *src,
-		char *dst, int len, unsigned int sum, int *err_ptr);
-extern unsigned int csum_partial_copy_generic_to (const char *src,
-		char *dst, int len, unsigned int sum, int *err_ptr);
-
-extern __inline__
-unsigned int csum_partial_copy_nocheck ( const char *src, char *dst,
-					int len, int sum)
-{
-#if 0
-	return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL);
-#else
-	return  csum_partial_copy( src, dst, len, sum);
-#endif
-}
-
-extern __inline__
-unsigned int csum_partial_copy_from_user ( const char __user *src, char *dst,
-						int len, int sum, int *err_ptr)
-{
-#if 0
-	return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL);
-#else
-	return csum_partial_copy_generic_from ( src, dst, len, sum, err_ptr);
-#endif
-}
-
-/*
- * These are the old (and unsafe) way of doing checksums, a warning message will be
- * printed if they are used and an exeption occurs.
- *
- * these functions should go away after some time.
- */
-
-#define csum_partial_copy_fromuser csum_partial_copy
-unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum);
+extern unsigned int csum_partial_copy_from_user(const char __user *src,
+                                                char *dst,
+                                                int len, unsigned int sum,
+                                                int *err_ptr);
 
 /*
  *	Fold a partial checksum
  */
 
-static __inline__ unsigned int csum_fold(unsigned int sum)
+static inline unsigned int csum_fold(unsigned int sum)
 {
 	unsigned long tmpreg;
 	__asm__(
@@ -106,15 +72,12 @@ static __inline__ unsigned int csum_fold
 	);
 	return sum;
 }
-
+
 /*
- *	This is a version of ip_compute_csum() optimized for IP headers,
- *	which always checksum on 4 octet boundaries.
- *
- *	By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
- *	Arnt Gulbrandsen.
+ * This is a version of ip_compute_csum() optimized for IP headers,
+ * which always checksum on 4 octet boundaries.
  */
-static __inline__ unsigned short ip_fast_csum(unsigned char * iph,
+static inline unsigned short ip_fast_csum(unsigned char * iph,
 					  unsigned int ihl) {
 	unsigned long sum, tmpreg0, tmpreg1;
 
@@ -150,11 +113,11 @@ static __inline__ unsigned short ip_fast
 	return csum_fold(sum);
 }
 
-static __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr,
-						   unsigned long daddr,
-						   unsigned short len,
-						   unsigned short proto,
-						   unsigned int sum)
+static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
+					       unsigned long daddr,
+					       unsigned short len,
+					       unsigned short proto,
+					       unsigned int sum)
 {
 #if defined(__LITTLE_ENDIAN)
 	unsigned long len_proto = (ntohs(len)<<16)+proto*256;
@@ -182,11 +145,11 @@ static __inline__ unsigned long csum_tcp
  * computes the checksum of the TCP/UDP pseudo-header
  * returns a 16-bit checksum, already complemented
  */
-static __inline__ unsigned short int csum_tcpudp_magic(unsigned long saddr,
+static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
 						   unsigned long daddr,
 						   unsigned short len,
 						   unsigned short proto,
-						   unsigned int sum)
+						   unsigned int sum)
 {
 	return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
@@ -196,16 +159,16 @@ static __inline__ unsigned short int csu
  * in icmp.c
  */
 
-static __inline__ unsigned short ip_compute_csum(unsigned char * buff, int len) {
+static inline unsigned short ip_compute_csum(unsigned char * buff, int len) {
 	return csum_fold (csum_partial(buff, len, 0));
 }
 
 #define _HAVE_ARCH_IPV6_CSUM
-static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
-						     struct in6_addr *daddr,
-						     __u16 len,
-						     unsigned short proto,
-						     unsigned int sum)
+static inline unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+						 struct in6_addr *daddr,
+						 __u16 len,
+						 unsigned short proto,
+						 unsigned int sum)
 {
 	unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3;
 	__asm__(
@@ -231,7 +194,7 @@ static __inline__ unsigned short int csu
 		"	addx	%0, %1 \n"
 		: "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1),
 		  "=&r" (tmpreg2), "=&r" (tmpreg3)
-		: "r" (saddr), "r" (daddr),
+		: "r" (saddr), "r" (daddr),
 		  "r" (htonl((__u32) (len))), "r" (htonl(proto)), "0" (sum)
 		: "cbit"
 	);
@@ -239,20 +202,5 @@ static __inline__ unsigned short int csu
 	return csum_fold(sum);
 }
 
-/*
- *	Copy and checksum to user
- */
-#define HAVE_CSUM_COPY_USER
-static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst,
-				    int len, int sum, int *err_ptr)
-{
-	if (access_ok(VERIFY_WRITE, dst, len))
-		return csum_partial_copy_generic_to(src, dst, len, sum, err_ptr);
-
-	if (len)
-		*err_ptr = -EFAULT;
-
-	return -1; /* invalid checksum */
-}
-
 #endif /* _ASM_M32R_CHECKSUM_H */
+#endif /* __KERNEL__ */

--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
  2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
                   ` (4 preceding siblings ...)
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions Hirokazu Takata
@ 2004-09-11 20:51 ` Hirokazu Takata
  2004-09-11 21:02   ` Christoph Hellwig
  2004-09-11 21:05   ` Arjan van de Ven
  5 siblings, 2 replies; 9+ messages in thread
From: Hirokazu Takata @ 2004-09-11 20:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, takata

[PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
  This patch updates m32r-specific CF/PCMCIA drivers and 
  fixes compile errors.

Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
---

 arch/m32r/drivers/m32r_cfc.c |   14 +++++++-------
 arch/m32r/drivers/m32r_pcc.c |   25 ++++++++++++++-----------
 2 files changed, 21 insertions(+), 18 deletions(-)


diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/drivers/m32r_cfc.c linux-2.6.9-rc1-mm4/arch/m32r/drivers/m32r_cfc.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/drivers/m32r_cfc.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/drivers/m32r_cfc.c	2004-09-12 01:53:40.000000000 +0900
@@ -4,7 +4,7 @@
  *  Device driver for the CFC functionality of M32R.
  *
  *  Copyright (c) 2001, 2002, 2003, 2004
- *   Hiroyuki Kondo, Sugai Naotom, Hayato Fujiwara
+ *    Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara
  */
 
 #include <linux/module.h>
@@ -592,15 +592,15 @@ static int _pcc_set_mem_map(u_short sock
 	u_long addr;
 	pcc_socket_t *t = &socket[sock];
 
-	DEBUG(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5"
-		  "lx, %#5.5x)\n", sock, map, mem->flags, mem->speed,
-		  mem->sys_start, mem->sys_stop, mem->card_start);
+	DEBUG(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, "
+		 "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags,
+		 mem->speed, mem->res->start, mem->res->end, mem->card_start);
 
 	/*
 	 * sanity check
 	 */
 	if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) ||
-		(mem->sys_start > mem->sys_stop)) {
+		(mem->res->start > mem->res->end)) {
 		return -EINVAL;
 	}
 
@@ -635,8 +635,8 @@ static int _pcc_set_mem_map(u_short sock
 	addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK);
 //	pcc_set(sock, PCADR, addr);
 
-	mem->sys_start = addr + mem->card_start;
-	mem->sys_stop = mem->sys_start + (M32R_PCC_MAPSIZE - 1);
+	mem->res->start = addr + mem->card_start;
+	mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1);
 
 	/*
 	 * Set timing
diff -ruNp linux-2.6.9-rc1-mm4.orig/arch/m32r/drivers/m32r_pcc.c linux-2.6.9-rc1-mm4/arch/m32r/drivers/m32r_pcc.c
--- linux-2.6.9-rc1-mm4.orig/arch/m32r/drivers/m32r_pcc.c	2004-09-08 08:14:03.000000000 +0900
+++ linux-2.6.9-rc1-mm4/arch/m32r/drivers/m32r_pcc.c	2004-09-12 01:53:54.000000000 +0900
@@ -1,8 +1,11 @@
-/*======================================================================
-
-	Device driver for the PCMCIA functionality of M32R.
-
-======================================================================*/
+/*
+ *  linux/arch/m32r/drivers/m32r_pcc.c
+ *
+ *  Device driver for the PCMCIA functionality of M32R.
+ *
+ *  Copyright (c) 2001, 2002, 2003, 2004
+ *    Hiroyuki Kondo, Naoto Sugai, Hayato Fujiwara
+ */
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -524,15 +527,15 @@ static int _pcc_set_mem_map(u_short sock
 #endif
 #endif
 
-	DEBUG(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5"
-		  "lx, %#5.5x)\n", sock, map, mem->flags, mem->speed,
-		  mem->sys_start, mem->sys_stop, mem->card_start);
+	DEBUG(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, "
+		 "%#5.5lx-%#5.5lx, %#5.5x)\n", sock, map, mem->flags,
+		 mem->speed, mem->res->start,  mem->res->end, mem->card_start);
 
 	/*
 	 * sanity check
 	 */
 	if ((map > MAX_WIN) || (mem->card_start > 0x3ffffff) ||
-		(mem->sys_start > mem->sys_stop)) {
+		(mem->res->start > mem->res->end)) {
 		return -EINVAL;
 	}
 
@@ -567,8 +570,8 @@ static int _pcc_set_mem_map(u_short sock
 	addr = t->mapaddr + (mem->card_start & M32R_PCC_MAPMASK);
 	pcc_set(sock, PCADR, addr);
 
-	mem->sys_start = addr + mem->card_start;
-	mem->sys_stop = mem->sys_start + (M32R_PCC_MAPSIZE - 1);
+	mem->res->start = addr + mem->card_start;
+	mem->res->end = mem->res->start + (M32R_PCC_MAPSIZE - 1);
 
 	/*
 	 * Enable again

--
Hirokazu Takata <takata@linux-m32r.org>
Linux/M32R Project:  http://www.linux-m32r.org/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers Hirokazu Takata
@ 2004-09-11 21:02   ` Christoph Hellwig
  2004-09-11 21:05   ` Arjan van de Ven
  1 sibling, 0 replies; 9+ messages in thread
From: Christoph Hellwig @ 2004-09-11 21:02 UTC (permalink / raw)
  To: Hirokazu Takata; +Cc: Andrew Morton, linux-kernel

On Sun, Sep 12, 2004 at 05:51:23AM +0900, Hirokazu Takata wrote:
> [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
>   This patch updates m32r-specific CF/PCMCIA drivers and 
>   fixes compile errors.

Note that these really should be in drivers/pcmcia/

Please also send them to linux-pcmcia@lists.infradead.org for review.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
  2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers Hirokazu Takata
  2004-09-11 21:02   ` Christoph Hellwig
@ 2004-09-11 21:05   ` Arjan van de Ven
  1 sibling, 0 replies; 9+ messages in thread
From: Arjan van de Ven @ 2004-09-11 21:05 UTC (permalink / raw)
  To: Hirokazu Takata; +Cc: Andrew Morton, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

On Sat, 2004-09-11 at 22:51, Hirokazu Takata wrote:
> [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers
>   This patch updates m32r-specific CF/PCMCIA drivers and 
>   fixes compile errors.

why are these still in arch/m32r/drivers ??
please move them to drivers/pcmcia

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-09-11 21:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-11 20:24 [PATCH 2.6.9-rc1-mm4 0/6] [m32r] Update to fix compile errors Hirokazu Takata
2004-09-11 20:43 ` [PATCH 2.6.9-rc1-mm4 1/6] [m32r] Update for profiling Hirokazu Takata
2004-09-11 20:48 ` [PATCH 2.6.9-rc1-mm4 2/6] [m32r] Update zone_sizes_init() Hirokazu Takata
2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 3/6] [m32r] Update to fix compile errors Hirokazu Takata
2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 4/6] [m32r] Update uaccess.h Hirokazu Takata
2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 5/6] [m32r] Update checksum functions Hirokazu Takata
2004-09-11 20:51 ` [PATCH 2.6.9-rc1-mm4 6/6] [m32r] Update CF/PCMCIA drivers Hirokazu Takata
2004-09-11 21:02   ` Christoph Hellwig
2004-09-11 21:05   ` Arjan van de Ven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.