Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Make cpu_getmcontext() run the PC through ras_looku...
details: https://anonhg.NetBSD.org/src/rev/8e8e14cfa420
branches: trunk
changeset: 545610:8e8e14cfa420
user: nathanw <nathanw%NetBSD.org@localhost>
date: Fri Apr 11 22:02:28 2003 +0000
description:
Make cpu_getmcontext() run the PC through ras_lookup() so that kernel
getcontext() plus userlevel setcontext() (as used in libpthread) respects
the atomicity of RAS regions.
diffstat:
sys/arch/alpha/alpha/machdep.c | 11 +++++++++--
sys/arch/arm/arm/sig_machdep.c | 13 ++++++++++---
sys/arch/i386/i386/machdep.c | 11 +++++++++--
sys/arch/m68k/m68k/sig_machdep.c | 9 ++++++++-
sys/arch/mips/mips/mips_machdep.c | 10 ++++++++--
sys/arch/sh3/sh3/sh3_machdep.c | 9 ++++++++-
sys/arch/sh5/sh5/sig_machdep.c | 9 ++++++++-
sys/arch/x86_64/x86_64/machdep.c | 9 ++++++++-
8 files changed, 68 insertions(+), 13 deletions(-)
diffs (truncated from 322 to 300 lines):
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.263 2003/04/08 23:35:48 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.264 2003/04/11 22:02:28 nathanw Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -75,13 +75,14 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.263 2003/04/08 23:35:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.264 2003/04/11 22:02:28 nathanw Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/kernel.h>
#include <sys/proc.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/sched.h>
@@ -2088,6 +2089,7 @@
{
struct trapframe *frame = l->l_md.md_tf;
__greg_t *gr = mcp->__gregs;
+ __greg_t ras_pc;
/* Save register context. */
frametoreg(frame, (struct reg *)gr);
@@ -2104,6 +2106,11 @@
}
gr[_REG_PC] = frame->tf_regs[FRAME_PC];
gr[_REG_PS] = frame->tf_regs[FRAME_PS];
+
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_PC])) != -1)
+ gr[_REG_PC] = ras_pc;
+
*flags |= _UC_CPU | _UC_UNIQUE;
/* Save floating point register context, if any, and copy it. */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/arm/arm/sig_machdep.c
--- a/sys/arch/arm/arm/sig_machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/arm/arm/sig_machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.16 2003/01/17 22:28:48 thorpej Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.17 2003/04/11 22:02:30 nathanw Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
#include <sys/param.h>
-__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.16 2003/01/17 22:28:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.17 2003/04/11 22:02:30 nathanw Exp $");
#include <sys/mount.h> /* XXX only needed by syscallargs.h */
#include <sys/proc.h>
@@ -52,6 +52,7 @@
#include <sys/syscallargs.h>
#include <sys/systm.h>
#include <sys/user.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
@@ -278,7 +279,8 @@
{
struct trapframe *tf = process_frame(l);
__greg_t *gr = mcp->__gregs;
-
+ __greg_t ras_pc;
+
/* Save General Register context. */
gr[_REG_R0] = tf->tf_r0;
gr[_REG_R1] = tf->tf_r1;
@@ -297,6 +299,11 @@
gr[_REG_LR] = tf->tf_usr_lr;
gr[_REG_PC] = tf->tf_pc;
gr[_REG_CPSR] = tf->tf_spsr;
+
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_PC])) != -1)
+ gr[_REG_PC] = ras_pc;
+
*flags |= _UC_CPU;
#ifdef ARMFPE
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/i386/i386/machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.518 2003/04/01 20:54:23 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.519 2003/04/11 22:02:30 nathanw Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.518 2003/04/01 20:54:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.519 2003/04/11 22:02:30 nathanw Exp $");
#include "opt_cputype.h"
#include "opt_ddb.h"
@@ -115,6 +115,7 @@
#include <sys/kcore.h>
#include <sys/ucontext.h>
#include <machine/kcore.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
@@ -2220,6 +2221,7 @@
{
const struct trapframe *tf = l->l_md.md_regs;
__greg_t *gr = mcp->__gregs;
+ __greg_t ras_eip;
/* Save register context. */
#ifdef VM86
@@ -2252,6 +2254,11 @@
gr[_REG_SS] = tf->tf_ss;
gr[_REG_TRAPNO] = tf->tf_trapno;
gr[_REG_ERR] = tf->tf_err;
+
+ if ((ras_eip = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_EIP])) != -1)
+ gr[_REG_EIP] = ras_eip;
+
*flags |= _UC_CPU;
/* Save floating point register context, if any. */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/m68k/m68k/sig_machdep.c
--- a/sys/arch/m68k/m68k/sig_machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/m68k/m68k/sig_machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.18 2003/01/17 23:18:29 thorpej Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.19 2003/04/11 22:02:31 nathanw Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -51,6 +51,7 @@
#include <sys/pool.h>
#include <sys/proc.h>
#include <sys/user.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/signal.h>
@@ -465,6 +466,7 @@
__greg_t *gr = mcp->__gregs;
struct frame *frame = (struct frame *)l->l_md.md_regs;
unsigned int format = frame->f_format;
+ __greg_t ras_pc;
/* Save general registers. */
gr[_REG_D0] = frame->f_regs[D0];
@@ -485,6 +487,11 @@
gr[_REG_A7] = frame->f_regs[SP];
gr[_REG_PS] = frame->f_sr;
gr[_REG_PC] = frame->f_pc;
+
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_PC])) != -1)
+ gr[_REG_PC] = ras_pc;
+
*flags |= _UC_CPU;
/* Save exception frame information. */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/mips/mips/mips_machdep.c
--- a/sys/arch/mips/mips/mips_machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/mips/mips/mips_machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_machdep.c,v 1.159 2003/04/02 03:27:35 thorpej Exp $ */
+/* $NetBSD: mips_machdep.c,v 1.160 2003/04/11 22:02:32 nathanw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -119,7 +119,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.159 2003/04/02 03:27:35 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.160 2003/04/11 22:02:32 nathanw Exp $");
#include "opt_cputype.h"
@@ -139,6 +139,7 @@
#include <sys/device.h>
#include <sys/kcore.h>
#include <sys/pool.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
@@ -1689,6 +1690,7 @@
{
const struct frame *f = (struct frame *)l->l_md.md_regs;
__greg_t *gr = mcp->__gregs;
+ __greg_t ras_pc;
/* Save register context. Dont copy R0 - it is always 0 */
memcpy(&gr[_REG_AT], &f->f_regs[AST], sizeof(mips_reg_t) * 31);
@@ -1699,6 +1701,10 @@
gr[_REG_EPC] = f->f_regs[PC];
gr[_REG_SR] = f->f_regs[SR];
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_EPC])) != -1)
+ gr[_REG_EPC] = ras_pc;
+
*flags |= _UC_CPU;
/* Save floating point register context, if any. */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/sh3/sh3/sh3_machdep.c
--- a/sys/arch/sh3/sh3/sh3_machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/sh3/sh3/sh3_machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sh3_machdep.c,v 1.47 2003/04/02 02:56:41 thorpej Exp $ */
+/* $NetBSD: sh3_machdep.c,v 1.48 2003/04/11 22:02:33 nathanw Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2002 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscallargs.h>
@@ -585,6 +586,7 @@
{
const struct trapframe *tf = l->l_md.md_regs;
__greg_t *gr = mcp->__gregs;
+ __greg_t ras_pc;
/* Save register context. */
gr[_REG_EXPEVT] = tf->tf_expevt;
@@ -609,6 +611,11 @@
gr[_REG_R1] = tf->tf_r1;
gr[_REG_R0] = tf->tf_r0;
gr[_REG_R15] = tf->tf_r15;
+
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_PC])) != -1)
+ gr[_REG_PC] = ras_pc;
+
*flags |= _UC_CPU;
/* FPU context is currently not handled by the kernel. */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/sh5/sh5/sig_machdep.c
--- a/sys/arch/sh5/sh5/sig_machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/sh5/sh5/sig_machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.12 2003/01/22 13:40:57 scw Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.13 2003/04/11 22:02:33 nathanw Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@@ -44,6 +44,7 @@
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/mount.h>
+#include <sys/ras.h>
#include <sys/sa.h>
#include <sys/savar.h>
#include <sys/syscallargs.h>
@@ -259,8 +260,14 @@
{
struct trapframe *tf = l->l_md.md_regs;
__greg_t *gr = mcp->__gregs;
+ __greg_t ras_pc;
process_read_regs(l, (struct reg *)(void *)gr);
+
+ if ((ras_pc = (__greg_t)ras_lookup(l->l_proc,
+ (caddr_t) gr[_REG_PC])) != -1)
+ gr[_REG_PC] = ras_pc;
+
*flags |= _UC_CPU;
/* Save FP state if necessary */
diff -r d2e906727d12 -r 8e8e14cfa420 sys/arch/x86_64/x86_64/machdep.c
--- a/sys/arch/x86_64/x86_64/machdep.c Fri Apr 11 21:20:45 2003 +0000
+++ b/sys/arch/x86_64/x86_64/machdep.c Fri Apr 11 22:02:28 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.34 2003/04/01 15:08:29 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.35 2003/04/11 22:02:34 nathanw Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -105,6 +105,7 @@
Home |
Main Index |
Thread Index |
Old Index