Module Name: src Committed By: matt Date: Tue Mar 15 07:40:18 UTC 2011
Modified Files: src/lib/libc/arch/mips/gen: Makefile.inc _lwp.c Log Message: Properly support the MIPS TLS ABI. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/lib/libc/arch/mips/gen/Makefile.inc cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/mips/gen/_lwp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/arch/mips/gen/Makefile.inc diff -u src/lib/libc/arch/mips/gen/Makefile.inc:1.32 src/lib/libc/arch/mips/gen/Makefile.inc:1.33 --- src/lib/libc/arch/mips/gen/Makefile.inc:1.32 Mon Jan 17 23:53:03 2011 +++ src/lib/libc/arch/mips/gen/Makefile.inc Tue Mar 15 07:40:18 2011 @@ -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} Index: src/lib/libc/arch/mips/gen/_lwp.c diff -u src/lib/libc/arch/mips/gen/_lwp.c:1.6 src/lib/libc/arch/mips/gen/_lwp.c:1.7 --- src/lib/libc/arch/mips/gen/_lwp.c:1.6 Thu Feb 24 04:28:42 2011 +++ src/lib/libc/arch/mips/gen/_lwp.c Tue Mar 15 07:40:18 2011 @@ -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; }