Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha Add support for restartable atomic sequences....



details:   https://anonhg.NetBSD.org/src/rev/17df8ddd4773
branches:  trunk
changeset: 536533:17df8ddd4773
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Sep 18 02:35:08 2002 +0000

description:
Add support for restartable atomic sequences.  Rearragne the tail
of cpu_switch() slightly so we can reenable interrupts a little
earlier.

diffstat:

 sys/arch/alpha/alpha/genassym.cf |   4 ++-
 sys/arch/alpha/alpha/locore.s    |  47 ++++++++++++++++++++++++++-------------
 sys/arch/alpha/include/types.h   |   3 +-
 3 files changed, 36 insertions(+), 18 deletions(-)

diffs (110 lines):

diff -r 524b99718693 -r 17df8ddd4773 sys/arch/alpha/alpha/genassym.cf
--- a/sys/arch/alpha/alpha/genassym.cf  Wed Sep 18 02:34:53 2002 +0000
+++ b/sys/arch/alpha/alpha/genassym.cf  Wed Sep 18 02:35:08 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.4 2001/04/29 06:54:03 thorpej Exp $
+# $NetBSD: genassym.cf,v 1.5 2002/09/18 02:35:08 thorpej Exp $
 
 #
 # Copyright (c) 1994, 1995 Gordon W. Ross
@@ -121,10 +121,12 @@
 define P_VMSPACE               offsetof(struct proc, p_vmspace)
 define P_STAT                  offsetof(struct proc, p_stat)
 define P_CPU                   offsetof(struct proc, p_cpu)
+define P_NRAS                  offsetof(struct proc, p_nras)
 define P_MD_FLAGS              offsetof(struct proc, p_md.md_flags)
 define P_MD_PCBPADDR           offsetof(struct proc, p_md.md_pcbpaddr)
 define P_MD_SYSCALL            offsetof(struct proc, p_md.md_syscall)
 define P_MD_ASTPENDING         offsetof(struct proc, p_md.md_astpending)
+define P_MD_TF                 offsetof(struct proc, p_md.md_tf)
 define PH_LINK                 offsetof(struct prochd, ph_link)
 define PH_RLINK                offsetof(struct prochd, ph_rlink)
 
diff -r 524b99718693 -r 17df8ddd4773 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Wed Sep 18 02:34:53 2002 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Wed Sep 18 02:35:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.101 2002/07/01 03:10:01 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.102 2002/09/18 02:35:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.101 2002/07/01 03:10:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.102 2002/09/18 02:35:08 thorpej Exp $");
 
 #include "assym.h"
 
@@ -903,24 +903,39 @@
 
        /*
         * Now running on the new u struct.
-        * Restore registers and return.
         */
-       ldq     t0, P_ADDR(s2)
-
-       /* NOTE: ksp is restored by the swpctx */
-       ldq     s0, U_PCB_CONTEXT+(0 * 8)(t0)           /* restore s0 - s6 */
-       ldq     s1, U_PCB_CONTEXT+(1 * 8)(t0)
-       ldq     s2, U_PCB_CONTEXT+(2 * 8)(t0)
-       ldq     s3, U_PCB_CONTEXT+(3 * 8)(t0)
-       ldq     s4, U_PCB_CONTEXT+(4 * 8)(t0)
-       ldq     s5, U_PCB_CONTEXT+(5 * 8)(t0)
-       ldq     s6, U_PCB_CONTEXT+(6 * 8)(t0)
-       ldq     ra, U_PCB_CONTEXT+(7 * 8)(t0)           /* restore ra */
-       ldq     a0, U_PCB_CONTEXT+(8 * 8)(t0)           /* restore ipl */
+       ldq     s0, P_ADDR(s2)
+       ldq     a0, U_PCB_CONTEXT+(8 * 8)(s0)   /* restore ipl */
        and     a0, ALPHA_PSL_IPL_MASK, a0
        call_pal PAL_OSF1_swpipl
 
-       ldiq    v0, 1                           /* possible ret to savectx() */
+       /*
+        * Check for restartable atomic sequences (RAS).
+        */
+       ldl     t0, P_NRAS(s2)                  /* p->p_nras == 0? */
+       beq     t0, 1f                          /* yes, skip */
+       ldq     s1, P_MD_TF(s2)                 /* s1 = p->p_md.md_tf */
+       mov     s2, a0                          /* first ras_lookup() arg */
+       ldq     a1, (FRAME_PC*8)(s1)            /* second ras_lookup() arg */
+       CALL(ras_lookup)                        /* ras_lookup(p, PC) */
+       addq    v0, 1, t0                       /* -1 means "not in ras" */
+       beq     t0, 1f
+       stq     v0, (FRAME_PC*8)(s1)
+
+1:
+       /*
+        * Restore registers and return.
+        * NOTE: ksp is restored by the swpctx.
+        */
+       ldq     s1, U_PCB_CONTEXT+(1 * 8)(s0)           /* restore s1-s6 */
+       ldq     s2, U_PCB_CONTEXT+(2 * 8)(s0)
+       ldq     s3, U_PCB_CONTEXT+(3 * 8)(s0)
+       ldq     s4, U_PCB_CONTEXT+(4 * 8)(s0)
+       ldq     s5, U_PCB_CONTEXT+(5 * 8)(s0)
+       ldq     s6, U_PCB_CONTEXT+(6 * 8)(s0)
+       ldq     ra, U_PCB_CONTEXT+(7 * 8)(s0)           /* restore ra */
+       ldq     s0, U_PCB_CONTEXT+(0 * 8)(s0)           /* restore s0 */
+
        RET
        END(cpu_switch)
 
diff -r 524b99718693 -r 17df8ddd4773 sys/arch/alpha/include/types.h
--- a/sys/arch/alpha/include/types.h    Wed Sep 18 02:34:53 2002 +0000
+++ b/sys/arch/alpha/include/types.h    Wed Sep 18 02:35:08 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.24 2002/05/03 17:50:19 thorpej Exp $ */
+/* $NetBSD: types.h,v 1.25 2002/09/18 02:35:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -65,5 +65,6 @@
 #define        __HAVE_SYSCALL_INTERN
 #define        __HAVE_MINIMAL_EMUL
 #define        __HAVE_AST_PERPROC
+#define        __HAVE_RAS
 
 #endif /* _MACHTYPES_H_ */



Home | Main Index | Thread Index | Old Index