Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha - Make the GET_CURLWP actually return curlwp,...



details:   https://anonhg.NetBSD.org/src/rev/fac5730610d1
branches:  trunk
changeset: 1013703:fac5730610d1
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Sep 04 02:54:56 2020 +0000

description:
- Make the GET_CURLWP actually return curlwp, not &curlwp.
- exception_return(): Use GET_CURLWP directly, rather than a dance
  acount GET_CPUINFO.
- Introduce SET_CURLWP(), to set the curlwp value.
- Garbage-collect GET_FPCURLWP.

diffstat:

 sys/arch/alpha/alpha/lock_stubs.s |   9 +++----
 sys/arch/alpha/alpha/locore.s     |  42 ++++++++++++++++----------------------
 sys/arch/alpha/include/asm.h      |  15 ++++++++++---
 3 files changed, 33 insertions(+), 33 deletions(-)

diffs (210 lines):

diff -r 7594d8066f46 -r fac5730610d1 sys/arch/alpha/alpha/lock_stubs.s
--- a/sys/arch/alpha/alpha/lock_stubs.s Fri Sep 04 02:30:44 2020 +0000
+++ b/sys/arch/alpha/alpha/lock_stubs.s Fri Sep 04 02:54:56 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock_stubs.s,v 1.3 2008/04/28 20:23:10 martin Exp $    */
+/*     $NetBSD: lock_stubs.s,v 1.4 2020/09/04 02:54:56 thorpej Exp $   */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.3 2008/04/28 20:23:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.4 2020/09/04 02:54:56 thorpej Exp $");
 
 #include "assym.h"
 
@@ -74,7 +74,7 @@
        LDGP(pv)
        GET_CURLWP
 1:
-       ldq     t1, 0(v0)
+       mov     v0, t1
        ldq_l   t2, 0(a0)
        bne     t2, 2f
        stq_c   t1, 0(a0)
@@ -95,11 +95,10 @@
        LDGP(pv)
        MB
        GET_CURLWP
-       ldq     t1, 0(v0)
        mov     zero, t3
 1:
        ldq_l   t2, 0(a0)
-       cmpeq   t1, t2, t2
+       cmpeq   v0, t2, t2
        beq     t2, 2f
        stq_c   t3, 0(a0)
        beq     t3, 3f
diff -r 7594d8066f46 -r fac5730610d1 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Fri Sep 04 02:30:44 2020 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Fri Sep 04 02:54:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.128 2020/09/03 15:38:17 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.129 2020/09/04 02:54:56 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.128 2020/09/03 15:38:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.129 2020/09/04 02:54:56 thorpej Exp $");
 
 #include "assym.h"
 
@@ -258,17 +258,16 @@
        beq     t0, 5f                          /* no: just return */
        /* yes */
 
-       /* GET_CPUINFO clobbers v0, t0, t8...t11. */
-3:     GET_CPUINFO
+       /* GET_CURLWP clobbers v0, t0, t8...t11. */
+3:     GET_CURLWP
 
        /* check for AST */
-       ldq     t1, CPU_INFO_CURLWP(v0)
-       ldl     t3, L_MD_ASTPENDING(t1)         /* AST pending? */
+       ldl     t3, L_MD_ASTPENDING(v0)         /* AST pending? */
        bne     t3, 7f                          /* yes */
        /* no: headed back to user space */
 
        /* Enable the FPU based on whether MDLWP_FPACTIVE is set. */
-4:     ldq     t2, L_MD_FLAGS(t1)
+4:     ldq     t2, L_MD_FLAGS(v0)
        cmplt   t2, zero, a0
        call_pal PAL_OSF1_wrfen
 
@@ -295,7 +294,7 @@
        br      2b
 
        /* We've got an AST */
-7:     stl     zero, L_MD_ASTPENDING(t1)       /* no AST pending */
+7:     stl     zero, L_MD_ASTPENDING(v0)       /* no AST pending */
 
        ldiq    a0, ALPHA_PSL_IPL_0             /* drop IPL to zero */
        call_pal PAL_OSF1_swpipl
@@ -460,7 +459,7 @@
        /* syscall number, passed in v0, is first arg, frame pointer second */
        mov     v0,a1
        GET_CURLWP
-       ldq     a0,0(v0)
+       mov     v0,a0
        mov     sp,a2                   ; .loc 1 __LINE__
        ldq     t11,L_PROC(a0)
        ldq     t12,P_MD_SYSCALL(t11)
@@ -676,8 +675,7 @@
        ldq     a0, L_MD_PCBPADDR(s2)
        call_pal PAL_OSF1_swpctx        /* clobbers a0, t0, t8-t11, a0 */
 
-       GET_CPUINFO
-       stq     s2, CPU_INFO_CURLWP(v0)         /* curlwp = l */
+       SET_CURLWP(s2)                  /* curlwp = l */
 
        /*
         * Now running on the new PCB.
@@ -786,15 +784,13 @@
        mov     v0, s0
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
-       ldq     at_reg, 0(s0)
-       ldq     at_reg, L_PCB(at_reg)
+       ldq     at_reg, L_PCB(s0)
        stq     v0, PCB_ONFAULT(at_reg)
        .set at
        CALL(alpha_copystr)                     /* do the copy.              */
        .set noat
-       ldq     at_reg, 0(s0)                   /* kill the fault handler.   */
-       ldq     at_reg, L_PCB(at_reg)
-       stq     zero, PCB_ONFAULT(at_reg)
+       ldq     at_reg, L_PCB(s0)
+       stq     zero, PCB_ONFAULT(at_reg)       /* kill the fault handler.   */
        .set at
        ldq     ra, (16-8)(sp)                  /* restore ra.               */
        ldq     s0, (16-16)(sp)                 /* restore s0.               */
@@ -815,15 +811,13 @@
        mov     v0, s0
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
-       ldq     at_reg, 0(s0)
-       ldq     at_reg, L_PCB(at_reg)
+       ldq     at_reg, L_PCB(s0)
        stq     v0, PCB_ONFAULT(at_reg)
        .set at
        CALL(alpha_copystr)                     /* do the copy.              */
        .set noat
-       ldq     at_reg, 0(s0)                   /* kill the fault handler.   */
-       ldq     at_reg, L_PCB(at_reg)
-       stq     zero, PCB_ONFAULT(at_reg)
+       ldq     at_reg, L_PCB(s0)
+       stq     zero, PCB_ONFAULT(at_reg)       /* kill the fault handler.   */
        .set at
        ldq     ra, (16-8)(sp)                  /* restore ra.               */
        ldq     s0, (16-16)(sp)                 /* restore s0.               */
@@ -853,7 +847,7 @@
        mov     v0, a0
        /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
        GET_CURLWP
-       ldq     s1, 0(v0)                       /* s1 = curlwp               */
+       mov     v0, s1                          /* s1 = curlwp               */
        lda     v0, kcopyerr                    /* set up fault handler.     */
        .set noat
        ldq     at_reg, L_PCB(s1)
@@ -900,7 +894,7 @@
        mov     v0, a0
        /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
        GET_CURLWP
-       ldq     s0, 0(v0)                       /* s0 = curlwp               */
+       mov     v0, s0                          /* s0 = curlwp               */
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
        ldq     at_reg, L_PCB(s0)
@@ -932,7 +926,7 @@
        mov     v0, a0
        /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
        GET_CURLWP
-       ldq     s0, 0(v0)                       /* s0 = curlwp               */
+       mov     v0, s0                          /* s0 = curlwp               */
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
        ldq     at_reg, L_PCB(s0)
diff -r 7594d8066f46 -r fac5730610d1 sys/arch/alpha/include/asm.h
--- a/sys/arch/alpha/include/asm.h      Fri Sep 04 02:30:44 2020 +0000
+++ b/sys/arch/alpha/include/asm.h      Fri Sep 04 02:54:56 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.40 2020/09/03 04:18:30 thorpej Exp $ */
+/* $NetBSD: asm.h,v 1.41 2020/09/04 02:54:56 thorpej Exp $ */
 
 /*
  * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -669,7 +669,11 @@
 
 #define        GET_CURLWP                                                      \
        call_pal PAL_OSF1_rdval                                 ;       \
-       addq    v0, CPU_INFO_CURLWP, v0
+       ldq     v0, CPU_INFO_CURLWP(v0)
+
+#define        SET_CURLWP(r)                                                   \
+       call_pal PAL_OSF1_rdval                                 ;       \
+       stq     r, CPU_INFO_CURLWP(v0)
 
 #define        GET_FPCURLWP                                                    \
        call_pal PAL_OSF1_rdval                                 ;       \
@@ -681,9 +685,12 @@
 
 #define        GET_CPUINFO             lda v0, cpu_info_primary
 
-#define        GET_CURLWP              lda v0, cpu_info_primary + CPU_INFO_CURLWP
+#define        GET_CURLWP              lda v0, cpu_info_primary        ;       \
+                               ldq v0, CPU_INFO_CURLWP(v0)
 
-#define        GET_FPCURLWP            lda v0, cpu_info_primary + CPU_INFO_FPCURLWP
+#define        SET_CURLWP(r)           lda v0, cpu_info_primary        ;       \
+                               stq r, CPU_INFO_CURLWP(v0)
+
 #endif /* MULTIPROCESSOR */
 #else
 #define        RCSID(_s)               __SECTIONSTRING(.ident, _s)



Home | Main Index | Thread Index | Old Index