[kernel] r16287 - in dists/sid/linux-2.6/debian: . patches/bugfix/m68k patches/series

Stephen Marenka smarenka at alioth.debian.org
Thu Sep 16 00:51:42 UTC 2010


Author: smarenka
Date: Thu Sep 16 00:51:38 2010
New Revision: 16287

Log:
m68k: add NPTL support and switch to generic siginfo layout

Added:
   dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-5da3a65d2d1ba333d61999640ef241f150c69c6b.patch
   dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-9674cdc74d63f346870943ef966a034f8c71ee57.patch
Modified:
   dists/sid/linux-2.6/debian/changelog
   dists/sid/linux-2.6/debian/patches/series/23

Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog	Thu Sep 16 00:31:04 2010	(r16286)
+++ dists/sid/linux-2.6/debian/changelog	Thu Sep 16 00:51:38 2010	(r16287)
@@ -10,6 +10,10 @@
   [ maximilian attems ]
   * openvz: cfq-iosched: do not force idling for sync workload.
 
+  [ Stephen R. Marenka ]
+  * m68k: switch to generic siginfo layout.
+  * m68k: NPTL support.
+
  -- Ben Hutchings <ben at decadent.org.uk>  Wed, 15 Sep 2010 11:21:18 +0100
 
 linux-2.6 (2.6.32-22) unstable; urgency=low

Added: dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-5da3a65d2d1ba333d61999640ef241f150c69c6b.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-5da3a65d2d1ba333d61999640ef241f150c69c6b.patch	Thu Sep 16 00:51:38 2010	(r16287)
@@ -0,0 +1,121 @@
+From 5da3a65d2d1ba333d61999640ef241f150c69c6b Mon Sep 17 00:00:00 2001
+From: Maxim Kuvyrkov <maxim at codesourcery.com>
+Date: Wed, 23 Dec 2009 11:28:42 -0800
+Subject: [PATCH] m68k: Switch to generic siginfo layout
+
+This patch switches m68k to generic siginfo layout.  The custom layout
+of m68k's `struct siginfo' had several issues due to not considering
+aliasing of members in the union, e.g., _uid32 was at different offsets
+in ._kill, ._rt and ._sigchld.
+
+Signed-off-by: Maxim Kuvyrkov <maxim at codesourcery.com>
+Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
+---
+ arch/m68k/include/asm/siginfo.h |   91 ---------------------------------------
+ 1 files changed, 0 insertions(+), 91 deletions(-)
+
+diff --git a/arch/m68k/include/asm/siginfo.h b/arch/m68k/include/asm/siginfo.h
+index ca7dde8..851d3d7 100644
+--- a/arch/m68k/include/asm/siginfo.h
++++ b/arch/m68k/include/asm/siginfo.h
+@@ -1,97 +1,6 @@
+ #ifndef _M68K_SIGINFO_H
+ #define _M68K_SIGINFO_H
+ 
+-#ifndef __uClinux__
+-#define HAVE_ARCH_SIGINFO_T
+-#define HAVE_ARCH_COPY_SIGINFO
+-#endif
+-
+ #include <asm-generic/siginfo.h>
+ 
+-#ifndef __uClinux__
+-
+-typedef struct siginfo {
+-	int si_signo;
+-	int si_errno;
+-	int si_code;
+-
+-	union {
+-		int _pad[SI_PAD_SIZE];
+-
+-		/* kill() */
+-		struct {
+-			__kernel_pid_t _pid;	/* sender's pid */
+-			__kernel_uid_t _uid;	/* backwards compatibility */
+-			__kernel_uid32_t _uid32; /* sender's uid */
+-		} _kill;
+-
+-		/* POSIX.1b timers */
+-		struct {
+-			timer_t _tid;		/* timer id */
+-			int _overrun;		/* overrun count */
+-			char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
+-			sigval_t _sigval;	/* same as below */
+-			int _sys_private;       /* not to be passed to user */
+-		} _timer;
+-
+-		/* POSIX.1b signals */
+-		struct {
+-			__kernel_pid_t _pid;	/* sender's pid */
+-			__kernel_uid_t _uid;	/* backwards compatibility */
+-			sigval_t _sigval;
+-			__kernel_uid32_t _uid32; /* sender's uid */
+-		} _rt;
+-
+-		/* SIGCHLD */
+-		struct {
+-			__kernel_pid_t _pid;	/* which child */
+-			__kernel_uid_t _uid;	/* backwards compatibility */
+-			int _status;		/* exit code */
+-			clock_t _utime;
+-			clock_t _stime;
+-			__kernel_uid32_t _uid32; /* sender's uid */
+-		} _sigchld;
+-
+-		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
+-		struct {
+-			void *_addr; /* faulting insn/memory ref. */
+-		} _sigfault;
+-
+-		/* SIGPOLL */
+-		struct {
+-			int _band;	/* POLL_IN, POLL_OUT, POLL_MSG */
+-			int _fd;
+-		} _sigpoll;
+-	} _sifields;
+-} siginfo_t;
+-
+-#define UID16_SIGINFO_COMPAT_NEEDED
+-
+-/*
+- * How these fields are to be accessed.
+- */
+-#undef si_uid
+-#ifdef __KERNEL__
+-#define si_uid		_sifields._kill._uid32
+-#define si_uid16	_sifields._kill._uid
+-#else
+-#define si_uid		_sifields._kill._uid
+-#endif
+-
+-#ifdef __KERNEL__
+-
+-#include <linux/string.h>
+-
+-static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
+-{
+-	if (from->si_code < 0)
+-		memcpy(to, from, sizeof(*to));
+-	else
+-		/* _sigchld is currently the largest know union member */
+-		memcpy(to, from, 3*sizeof(int) + sizeof(from->_sifields._sigchld));
+-}
+-
+-#endif /* __KERNEL__ */
+-#endif /* !__uClinux__ */
+-
+ #endif
+-- 
+1.7.2.3
+

Added: dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-9674cdc74d63f346870943ef966a034f8c71ee57.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/bugfix/m68k/linux-2.6.git-9674cdc74d63f346870943ef966a034f8c71ee57.patch	Thu Sep 16 00:51:38 2010	(r16287)
@@ -0,0 +1,214 @@
+From 9674cdc74d63f346870943ef966a034f8c71ee57 Mon Sep 17 00:00:00 2001
+From: Maxim Kuvyrkov <maxim at codesourcery.com>
+Date: Mon, 7 Dec 2009 00:24:27 -0800
+Subject: [PATCH] m68k: Add NPTL support
+
+This patch adds several syscalls, that provide necessary
+functionality to support NPTL on m68k/ColdFire.
+The syscalls are get_thread_area, set_thread_area, atomic_cmpxchg_32 and
+atomic_barrier.
+The cmpxchg syscall is required for ColdFire as it doesn't support 'cas'
+instruction.
+
+Also a ptrace call PTRACE_GET_THREAD_AREA is added to allow debugger to
+inspect the TLS storage.
+
+Signed-off-by: Maxim Kuvyrkov <maxim at codesourcery.com>
+Signed-off-by: Geert Uytterhoeven <geert at linux-m68k.org>
+---
+ arch/m68k/include/asm/ptrace.h         |    2 +
+ arch/m68k/include/asm/thread_info_mm.h |    1 +
+ arch/m68k/include/asm/unistd.h         |    6 ++-
+ arch/m68k/kernel/entry.S               |    4 ++
+ arch/m68k/kernel/process.c             |    4 ++
+ arch/m68k/kernel/ptrace.c              |    5 ++
+ arch/m68k/kernel/sys_m68k.c            |   81 ++++++++++++++++++++++++++++++++
+ 7 files changed, 102 insertions(+), 1 deletions(-)
+
+diff --git a/arch/m68k/include/asm/ptrace.h b/arch/m68k/include/asm/ptrace.h
+index ee4011c..21605c7 100644
+--- a/arch/m68k/include/asm/ptrace.h
++++ b/arch/m68k/include/asm/ptrace.h
+@@ -71,5 +71,7 @@ struct switch_stack {
+ #define PTRACE_GETFPREGS          14
+ #define PTRACE_SETFPREGS          15
+ 
++#define PTRACE_GET_THREAD_AREA    25
++
+ #ifdef __KERNEL__
+ 
+diff --git a/arch/m68k/include/asm/thread_info_mm.h b/arch/m68k/include/asm/thread_info_mm.h
+index 167e518..67266c6 100644
+--- a/arch/m68k/include/asm/thread_info_mm.h
++++ b/arch/m68k/include/asm/thread_info_mm.h
+@@ -16,6 +16,7 @@ struct thread_info {
+ 	struct exec_domain	*exec_domain;	/* execution domain */
+ 	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
+ 	__u32 cpu; /* should always be 0 on m68k */
++	unsigned long		tp_value;	/* thread pointer */
+ 	struct restart_block    restart_block;
+ };
+ #endif /* __ASSEMBLY__ */
+diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h
+index 48b87f5..d72a71d 100644
+--- a/arch/m68k/include/asm/unistd.h
++++ b/arch/m68k/include/asm/unistd.h
+@@ -336,10 +336,14 @@
+ #define __NR_pwritev		330
+ #define __NR_rt_tgsigqueueinfo	331
+ #define __NR_perf_event_open	332
++#define __NR_get_thread_area	333
++#define __NR_set_thread_area	334
++#define __NR_atomic_cmpxchg_32	335
++#define __NR_atomic_barrier	336
+ 
+ #ifdef __KERNEL__
+ 
+-#define NR_syscalls		333
++#define NR_syscalls		337
+ 
+ #define __ARCH_WANT_IPC_PARSE_VERSION
+ #define __ARCH_WANT_OLD_READDIR
+diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
+index 77fc7c1..e136b8c 100644
+--- a/arch/m68k/kernel/entry.S
++++ b/arch/m68k/kernel/entry.S
+@@ -761,4 +761,8 @@ sys_call_table:
+ 	.long sys_pwritev		/* 330 */
+ 	.long sys_rt_tgsigqueueinfo
+ 	.long sys_perf_event_open
++	.long sys_get_thread_area
++	.long sys_set_thread_area
++	.long sys_atomic_cmpxchg_32	/* 335 */
++	.long sys_atomic_barrier
+ 
+diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
+index 0529659..17c3f32 100644
+--- a/arch/m68k/kernel/process.c
++++ b/arch/m68k/kernel/process.c
+@@ -251,6 +251,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
+ 
+ 	p->thread.usp = usp;
+ 	p->thread.ksp = (unsigned long)childstack;
++
++	if (clone_flags & CLONE_SETTLS)
++		task_thread_info(p)->tp_value = regs->d5;
++
+ 	/*
+ 	 * Must save the current SFC/DFC value, NOT the value when
+ 	 * the parent was last descheduled - RGH  10-08-96
+diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c
+index 1fc217e..616e597 100644
+--- a/arch/m68k/kernel/ptrace.c
++++ b/arch/m68k/kernel/ptrace.c
+@@ -245,6 +245,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
+ 			ret = -EFAULT;
+ 		break;
+ 
++	case PTRACE_GET_THREAD_AREA:
++		ret = put_user(task_thread_info(child)->tp_value,
++			       (unsigned long __user *)data);
++		break;
++
+ 	default:
+ 		ret = ptrace_request(child, request, addr, data);
+ 		break;
+diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
+index 218f441..e3ad2d6 100644
+--- a/arch/m68k/kernel/sys_m68k.c
++++ b/arch/m68k/kernel/sys_m68k.c
+@@ -28,6 +28,11 @@
+ #include <asm/traps.h>
+ #include <asm/page.h>
+ #include <asm/unistd.h>
++#include <linux/elf.h>
++#include <asm/tlb.h>
++
++asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
++			     unsigned long error_code);
+ 
+ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
+ 	unsigned long prot, unsigned long flags,
+@@ -595,3 +600,79 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[])
+ 			: "d" (__a), "d" (__b), "d" (__c));
+ 	return __res;
+ }
++
++asmlinkage unsigned long sys_get_thread_area(void)
++{
++	return current_thread_info()->tp_value;
++}
++
++asmlinkage int sys_set_thread_area(unsigned long tp)
++{
++	current_thread_info()->tp_value = tp;
++	return 0;
++}
++
++/* This syscall gets its arguments in A0 (mem), D2 (oldval) and
++   D1 (newval).  */
++asmlinkage int
++sys_atomic_cmpxchg_32(unsigned long newval, int oldval, int d3, int d4, int d5,
++		      unsigned long __user * mem)
++{
++	/* This was borrowed from ARM's implementation.  */
++	for (;;) {
++		struct mm_struct *mm = current->mm;
++		pgd_t *pgd;
++		pmd_t *pmd;
++		pte_t *pte;
++		spinlock_t *ptl;
++		unsigned long mem_value;
++
++		down_read(&mm->mmap_sem);
++		pgd = pgd_offset(mm, (unsigned long)mem);
++		if (!pgd_present(*pgd))
++			goto bad_access;
++		pmd = pmd_offset(pgd, (unsigned long)mem);
++		if (!pmd_present(*pmd))
++			goto bad_access;
++		pte = pte_offset_map_lock(mm, pmd, (unsigned long)mem, &ptl);
++		if (!pte_present(*pte) || !pte_dirty(*pte)
++		    || !pte_write(*pte)) {
++			pte_unmap_unlock(pte, ptl);
++			goto bad_access;
++		}
++
++		mem_value = *mem;
++		if (mem_value == oldval)
++			*mem = newval;
++
++		pte_unmap_unlock(pte, ptl);
++		up_read(&mm->mmap_sem);
++		return mem_value;
++
++	      bad_access:
++		up_read(&mm->mmap_sem);
++		/* This is not necessarily a bad access, we can get here if
++		   a memory we're trying to write to should be copied-on-write.
++		   Make the kernel do the necessary page stuff, then re-iterate.
++		   Simulate a write access fault to do that.  */
++		{
++			/* The first argument of the function corresponds to
++			   D1, which is the first field of struct pt_regs.  */
++			struct pt_regs *fp = (struct pt_regs *)&newval;
++
++			/* '3' is an RMW flag.  */
++			if (do_page_fault(fp, (unsigned long)mem, 3))
++				/* If the do_page_fault() failed, we don't
++				   have anything meaningful to return.
++				   There should be a SIGSEGV pending for
++				   the process.  */
++				return 0xdeadbeef;
++		}
++	}
++}
++
++asmlinkage int sys_atomic_barrier(void)
++{
++	/* no code needed for uniprocs */
++	return 0;
++}
+-- 
+1.7.2.3
+

Modified: dists/sid/linux-2.6/debian/patches/series/23
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/23	Thu Sep 16 00:31:04 2010	(r16286)
+++ dists/sid/linux-2.6/debian/patches/series/23	Thu Sep 16 00:51:38 2010	(r16287)
@@ -5,3 +5,6 @@
 - bugfix/all/vgaarb-fix-target-default-passing.patch
 - bugfix/all/vgaarb-fix-incorrect-dereference-of-userspace-pointe.patch
 + bugfix/all/stable/2.6.32.12-vgaarb.patch
+
++ bugfix/m68k/linux-2.6.git-5da3a65d2d1ba333d61999640ef241f150c69c6b.patch
++ bugfix/m68k/linux-2.6.git-9674cdc74d63f346870943ef966a034f8c71ee57.patch



More information about the Kernel-svn-changes mailing list