Adapt for _UC_TLSBASE

This commit is contained in:
martin 2012-09-13 11:53:45 +00:00
parent d8e9a75f44
commit 963ce3eec6
2 changed files with 17 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.269 2012/07/28 19:08:25 matt Exp $ */
/* $NetBSD: machdep.c,v 1.270 2012/09/13 11:53:45 martin Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.269 2012/07/28 19:08:25 matt Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.270 2012/09/13 11:53:45 martin Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@ -2492,7 +2492,7 @@ cpu_getmcontext(struct lwp *l, mcontext_t *mcp, unsigned int *flags)
gr[_REG_nPC] = ras_pc + 4;
}
*flags |= _UC_CPU;
*flags |= (_UC_CPU|_UC_TLSBASE);
mcp->__gwins = NULL;
@ -2581,7 +2581,8 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
tf->tf_global[4] = (uint64_t)gr[_REG_G4];
tf->tf_global[5] = (uint64_t)gr[_REG_G5];
tf->tf_global[6] = (uint64_t)gr[_REG_G6];
tf->tf_global[7] = (uint64_t)gr[_REG_G7];
/* done in lwp_setprivate */
/* tf->tf_global[7] = (uint64_t)gr[_REG_G7]; */
tf->tf_out[0] = (uint64_t)gr[_REG_O0];
tf->tf_out[1] = (uint64_t)gr[_REG_O1];
tf->tf_out[2] = (uint64_t)gr[_REG_O2];
@ -2593,6 +2594,9 @@ cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
/* %asi restored above; %fprs not yet supported. */
/* XXX mcp->__gwins */
if (flags & _UC_TLSBASE)
lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_G7]);
}
/* Restore FP register context, if any. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_machdep.c,v 1.98 2012/05/21 14:15:18 martin Exp $ */
/* $NetBSD: netbsd32_machdep.c,v 1.99 2012/09/13 11:53:45 martin Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.98 2012/05/21 14:15:18 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.99 2012/09/13 11:53:45 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@ -777,7 +777,7 @@ netbsd32_cpu_getmcontext(
gr[_REG_O5] = tf->tf_out[5];
gr[_REG_O6] = tf->tf_out[6];
gr[_REG_O7] = tf->tf_out[7];
*flags |= _UC_CPU;
*flags |= (_UC_CPU|_UC_TLSBASE);
mcp->__gwins = 0;
@ -1186,7 +1186,8 @@ cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
tf->tf_global[4] = (uint64_t)gr[_REG32_G4];
tf->tf_global[5] = (uint64_t)gr[_REG32_G5];
tf->tf_global[6] = (uint64_t)gr[_REG32_G6];
tf->tf_global[7] = (uint64_t)gr[_REG32_G7];
/* done in lwp_setprivate */
/* tf->tf_global[7] = (uint64_t)gr[_REG32_G7]; */
tf->tf_out[0] = (uint64_t)gr[_REG32_O0];
tf->tf_out[1] = (uint64_t)gr[_REG32_O1];
tf->tf_out[2] = (uint64_t)gr[_REG32_O2];
@ -1197,7 +1198,8 @@ cpu_setmcontext32(struct lwp *l, const mcontext32_t *mcp, unsigned int flags)
tf->tf_out[7] = (uint64_t)gr[_REG32_O7];
/* %asi restored above; %fprs not yet supported. */
lwp_setprivate(l, (void *)(uintptr_t)gr[_REG_G7]);
if (flags & _UC_TLSBASE)
lwp_setprivate(l, (void *)(uintptr_t)gr[_REG32_G7]);
/* XXX mcp->__gwins */
}
@ -1281,11 +1283,11 @@ cpu_getmcontext32(struct lwp *l, mcontext32_t *mcp, unsigned int *flags)
gr[_REG32_O5] = tf->tf_out[5];
gr[_REG32_O6] = tf->tf_out[6];
gr[_REG32_O7] = tf->tf_out[7];
*flags |= _UC_CPU;
*flags |= (_UC_CPU|_UC_TLSBASE);
mcp->__gwins = 0;
mcp->__xrs.__xrs_id = 0; /* Solaris extension? */
*flags |= _UC_CPU;
*flags |= (_UC_CPU|_UC_TLSBASE);
/* Save FP register context, if any. */
if (l->l_md.md_fpstate != NULL) {