Source-Changes-HG archive

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

[src/nathanw_sa]: src/sys/arch/sh3 Add support for restartable atomic sequences.



details:   https://anonhg.NetBSD.org/src/rev/c6a4c236798d
branches:  nathanw_sa
changeset: 506323:c6a4c236798d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Oct 07 03:11:02 2002 +0000

description:
Add support for restartable atomic sequences.

diffstat:

 sys/arch/sh3/include/types.h |  69 ++++++++++++++++++++++++++++++++++++++++++++
 sys/arch/sh3/sh3/Locore.c    |  14 ++++++++-
 2 files changed, 82 insertions(+), 1 deletions(-)

diffs (110 lines):

diff -r 4c68b1e4db9b -r c6a4c236798d sys/arch/sh3/include/types.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sh3/include/types.h      Mon Oct 07 03:11:02 2002 +0000
@@ -0,0 +1,69 @@
+/*     $NetBSD: types.h,v 1.10.6.2 2002/10/07 03:11:03 thorpej Exp $   */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)types.h     7.5 (Berkeley) 3/9/91
+ */
+
+#ifndef        _SH3_TYPES_H_
+#define        _SH3_TYPES_H_
+
+#include <sys/cdefs.h>
+#include <sh3/int_types.h>
+
+#if defined(_KERNEL)
+typedef struct label_t {
+       int val[9];
+} label_t;
+#endif
+
+/* NB: This should probably be if defined(_KERNEL) */
+#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
+typedef        unsigned long   vm_offset_t;
+typedef        unsigned long   vm_size_t;
+
+typedef unsigned long  paddr_t;
+typedef unsigned long  psize_t;
+typedef unsigned long  vaddr_t;
+typedef unsigned long  vsize_t;
+#endif
+
+typedef int            register_t;
+
+#define        __SWAP_BROKEN
+#define        __HAVE_AST_PERPROC
+#define        __HAVE_GENERIC_SOFT_INTERRUPTS
+#define        __BROKEN_CONFIG_UNIT_USAGE      /* scif, sci driver */
+#define        __HAVE_RAS
+
+#endif /* !_SH3_TYPES_H_ */
diff -r 4c68b1e4db9b -r c6a4c236798d sys/arch/sh3/sh3/Locore.c
--- a/sys/arch/sh3/sh3/Locore.c Mon Oct 07 03:04:36 2002 +0000
+++ b/sys/arch/sh3/sh3/Locore.c Mon Oct 07 03:11:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: Locore.c,v 1.12.6.3 2002/06/24 22:07:19 nathanw Exp $  */
+/*     $NetBSD: Locore.c,v 1.12.6.4 2002/10/07 03:11:02 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@@ -85,6 +85,7 @@
 #include <sys/user.h>
 #include <sys/sched.h>
 #include <sys/proc.h>
+#include <sys/ras.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -135,8 +136,19 @@
        l->l_stat = LSONPROC;
 
        if (l != oldlwp) {
+               struct proc *p = l->l_proc;
+
                curpcb = l->l_md.md_pcb;
                pmap_activate(l);
+
+               /* Check for Restartable Atomic Sequences. */
+               if (p->p_nras != 0) {
+                       caddr_t pc;
+
+                       pc = ras_lookup(p, (caddr_t) l->l_md.md_regs->tf_spc);
+                       if (pc != (caddr_t) -1)
+                               l->l_md.md_regs->tf_spc = (int) pc;
+               }
        }
        curlwp = l;
 



Home | Main Index | Thread Index | Old Index