Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/mips/gen Properly support the MIPS TLS ABI.



details:   https://anonhg.NetBSD.org/src/rev/0a56d6ad2db8
branches:  trunk
changeset: 763251:0a56d6ad2db8
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Mar 15 07:40:18 2011 +0000

description:
Properly support the MIPS TLS ABI.

diffstat:

 lib/libc/arch/mips/gen/Makefile.inc |   4 +++-
 lib/libc/arch/mips/gen/_lwp.c       |  22 ++++++++++++----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diffs (67 lines):

diff -r 7383d6e2da06 -r 0a56d6ad2db8 lib/libc/arch/mips/gen/Makefile.inc
--- a/lib/libc/arch/mips/gen/Makefile.inc       Tue Mar 15 07:39:22 2011 +0000
+++ b/lib/libc/arch/mips/gen/Makefile.inc       Tue Mar 15 07:40:18 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.32 2011/01/17 23:53:03 matt Exp $
+#      $NetBSD: Makefile.inc,v 1.33 2011/03/15 07:40:18 matt Exp $
 
 .if ${MKSOFTFLOAT} == "no"
 SRCS+= fabs.S ldexp.S modf.S
@@ -32,6 +32,8 @@
 # mips abi builtin extensions (used by GCC for lexical-closure trampoline)
 SRCS+= cacheflush.c
 
+CPPFLAGS._lwp.c        += -D_LIBC_SOURCE
+
 LSRCS.mips.gen=        Lint__setjmp.c Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
 LSRCS+=                ${LSRCS.mips.gen}
 DPSRCS+=       ${LSRCS.mips.gen}
diff -r 7383d6e2da06 -r 0a56d6ad2db8 lib/libc/arch/mips/gen/_lwp.c
--- a/lib/libc/arch/mips/gen/_lwp.c     Tue Mar 15 07:39:22 2011 +0000
+++ b/lib/libc/arch/mips/gen/_lwp.c     Tue Mar 15 07:40:18 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _lwp.c,v 1.6 2011/02/24 04:28:42 joerg Exp $   */
+/*     $NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $    */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _lwp.c,v 1.6 2011/02/24 04:28:42 joerg Exp $");
+__RCSID("$NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -42,8 +42,9 @@
 
 #define CALLFRAME_SIZ  24
 
-void _lwp_makecontext(ucontext_t *u, void (*start)(void *),
-       void *arg, void *private, caddr_t stack_base, size_t stack_size)
+void
+_lwp_makecontext(ucontext_t *u, void (*start)(void *),
+       void *arg, void *tcb, caddr_t stack_base, size_t stack_size)
 {
        caddr_t sp;
        __greg_t *gr;
@@ -56,11 +57,12 @@
        u->uc_stack.ss_size = stack_size;
        sp = stack_base + stack_size - CALLFRAME_SIZ;
 
-       gr[_REG_EPC] = (unsigned long) start;
-       gr[_REG_T9] = (unsigned long) start; /* required for .abicalls */
-       gr[_REG_RA] = (unsigned long) _lwp_exit;
-       gr[_REG_A0] = (unsigned long) arg;
-       gr[_REG_SP] = (unsigned long) sp;
-       u->uc_mcontext._mc_tlsbase = (uintptr_t)private;
+       gr[_REG_EPC] = (uintptr_t) start;
+       gr[_REG_T9] = (uintptr_t) start; /* required for .abicalls */
+       gr[_REG_RA] = (uintptr_t) _lwp_exit;
+       gr[_REG_A0] = (uintptr_t) arg;
+       gr[_REG_SP] = (uintptr_t) sp;
+       u->uc_mcontext._mc_tlsbase =
+           (uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb);
        u->uc_flags |= _UC_TLSBASE;
 }



Home | Main Index | Thread Index | Old Index