diff mbox series

[12/19] nptl: m68k: Fix Race conditions in pthread cancellation (BZ#12683)

Message ID 1513019223-7603-13-git-send-email-adhemerval.zanella@linaro.org
State Superseded
Headers show
Series nptl: Fix Race conditions in pthread cancellation (BZ#12683) | expand

Commit Message

Adhemerval Zanella Dec. 11, 2017, 7:06 p.m. UTC
This patch adds the m68k modifications required for the BZ#12683.
It basically adds the required ucontext_get_pc function

The default syscall_cancel.c should is as expected for m68k with
GCC 6.2.1.  It generates the following code for syscall_cancel.os:

---
00000000 <__GI___syscall_cancel_arch>:
   0:   4e56 0000       linkw %fp,#0
   4:   48e7 3c00       moveml %d2-%d5,%sp@-

00000008 <__syscall_cancel_arch_start>:
   8:   206e 0008       moveal %fp@(8),%a0
   c:   2010            movel %a0@,%d0
   e:   0800 0002       btst #2,%d0
  12:   6628            bnes 3c <__syscall_cancel_arch_end+0xa>
  14:   206e 0024       moveal %fp@(36),%a0
  18:   2a2e 0020       movel %fp@(32),%d5
  1c:   282e 001c       movel %fp@(28),%d4
  20:   262e 0018       movel %fp@(24),%d3
  24:   242e 0014       movel %fp@(20),%d2
  28:   222e 0010       movel %fp@(16),%d1
  2c:   202e 000c       movel %fp@(12),%d0
  30:   4e40            trap #0

00000032 <__syscall_cancel_arch_end>:
  32:   4cee 003c fff0  moveml %fp@(-16),%d2-%d5
  38:   4e5e            unlk %fp
  3a:   4e75            rts
  3c:   61ff 0000 0000  bsrl 3e <__syscall_cancel_arch_end+0xc>
---

Checked against a build and make check run-built-tests=no for
m68k-linux-gnu.

	* sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h (ucontext_get_pc):
	New function.

Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

---
 ChangeLog                                     |  3 +++
 sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h | 13 +++++++++++++
 2 files changed, 16 insertions(+)

-- 
2.7.4
diff mbox series

Patch

diff --git a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
index 3c43e55..f39009f 100644
--- a/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
+++ b/sysdeps/unix/sysv/linux/m68k/sigcontextinfo.h
@@ -16,6 +16,11 @@ 
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
+#ifndef _SIGCONTEXTINFO_H
+#define _SIGCONTEXTINFO_H
+
+#include <stdint.h>
+
 #define SIGCONTEXT int _code, struct sigcontext *
 #define SIGCONTEXT_EXTRA_ARGS _code,
 #define GET_PC(ctx)	((void *) (ctx)->sc_pc)
@@ -23,3 +28,11 @@ 
 #define GET_STACK(ctx)	((void *) (ctx)->sc_usp)
 #define CALL_SIGHANDLER(handler, signo, ctx) \
   (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+static inline uintptr_t
+ucontext_get_pc (const ucontext_t *uc)
+{
+  return uc->uc_mcontext.gregs[R_PC];
+}
+
+#endif /* _SIGCONTEXTINFO_H  */