Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/alpha/alpha Fix a problem with kcopy()/copyin()/cop...



details:   https://anonhg.NetBSD.org/src/rev/4c9a87e8930a
branches:  trunk
changeset: 508695:4c9a87e8930a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Apr 18 00:38:10 2001 +0000

description:
Fix a problem with kcopy()/copyin()/copyout() on MP systems
that became apparent when UBC was added: store a pointer to
the process itself, not a pointer to ci->ci_curproc.

This gets us back to where we were before UBC went in: MP
kernels get to single-user mode, and can run processes on
both CPUs, but things go south when we try to come into
multi-user mode.

diffstat:

 sys/arch/alpha/alpha/locore.s |  119 +++++++++++++++--------------------------
 1 files changed, 45 insertions(+), 74 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r e4ce01e8b061 -r 4c9a87e8930a sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Tue Apr 17 23:51:07 2001 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Wed Apr 18 00:38:10 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.90 2001/04/15 23:07:34 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.91 2001/04/18 00:38:10 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.90 2001/04/15 23:07:34 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.91 2001/04/18 00:38:10 thorpej Exp $");
 
 #include "assym.h"
 
@@ -1332,18 +1332,16 @@
        stq     s1, (32-24)(sp)                 /* save s1                   */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, s1
+       ldq     s1, 0(v0)                       /* s1 = curproc              */
        lda     v0, kcopyerr                    /* set up fault handler.     */
        .set noat
-       ldq     at_reg, 0(s1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s1)
        ldq     s0, U_PCB_ONFAULT(at_reg)       /* save old handler.         */
        stq     v0, U_PCB_ONFAULT(at_reg)
        .set at
        CALL(bcopy)                             /* do the copy.              */
        .set noat
-       ldq     at_reg, 0(s1)                   /* restore the old handler.  */
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s1)              /* restore the old handler.  */
        stq     s0, U_PCB_ONFAULT(at_reg)
        .set at
        ldq     ra, (32-8)(sp)                  /* restore ra.               */
@@ -1357,8 +1355,7 @@
 LEAF(kcopyerr, 0)
        LDGP(pv)
        .set noat
-       ldq     at_reg, 0(s1)                   /* restore the old handler.  */
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s1)              /* restore the old handler.  */
        stq     s0, U_PCB_ONFAULT(at_reg)
        .set at
        ldq     ra, (32-8)(sp)                  /* restore ra.               */
@@ -1379,17 +1376,15 @@
        beq     t1, copyerr                     /* if it's not, error out.   */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, s0
+       ldq     s0, 0(v0)                       /* s0 = curproc              */
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
-       ldq     at_reg, 0(s0)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s0)
        stq     v0, U_PCB_ONFAULT(at_reg)
        .set at
        CALL(bcopy)                             /* do the copy.              */
        .set noat
-       ldq     at_reg, 0(s0)                   /* kill the fault handler.   */
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s0)              /* kill the fault handler.   */
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        ldq     ra, (16-8)(sp)                  /* restore ra.               */
@@ -1409,17 +1404,15 @@
        beq     t1, copyerr                     /* if it's not, error out.   */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, s0
+       ldq     s0, 0(v0)                       /* s0 = curproc              */
        lda     v0, copyerr                     /* set up fault handler.     */
        .set noat
-       ldq     at_reg, 0(s0)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s0)
        stq     v0, U_PCB_ONFAULT(at_reg)
        .set at
        CALL(bcopy)                             /* do the copy.              */
        .set noat
-       ldq     at_reg, 0(s0)                   /* kill the fault handler.   */
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(s0)              /* kill the fault handler.   */
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        ldq     ra, (16-8)(sp)                  /* restore ra.               */
@@ -1454,18 +1447,16 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        ldq     v0, 0(a0)
        zap     v0, 0xf0, v0
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        RET
@@ -1479,17 +1470,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        /* XXX FETCH IT */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        RET
@@ -1503,17 +1492,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        /* XXX FETCH IT */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        RET
@@ -1526,17 +1513,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        stq     a1, 0(a0)                       /* do the store. */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        mov     zero, v0
@@ -1551,17 +1536,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        /* XXX STORE IT */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        call_pal PAL_OSF1_imb                   /* sync instruction stream */
@@ -1576,17 +1559,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        /* XXX STORE IT */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        mov     zero, v0
@@ -1600,17 +1581,15 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        /* XXX STORE IT */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        call_pal PAL_OSF1_imb                   /* sync instruction stream */
@@ -1626,11 +1605,10 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        zap     a1, 0xfe, a1                    /* kill arg's high bytes */
@@ -1640,8 +1618,7 @@
        or      t0, a1, a1                      /* put the result together */
        stq_u   a1, 0(a0)                       /* and store it. */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        mov     zero, v0
@@ -1655,11 +1632,10 @@
        beq     t1, fswberr                     /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)
        .set at
        zap     a1, 0xfe, a1                    /* kill arg's high bytes */
@@ -1669,8 +1645,7 @@
        or      t0, a1, a1                      /* put the result together */
        stq_u   a1, 0(a0)                       /* and store it. */
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     zero, U_PCB_ONFAULT(at_reg)
        .set at
        call_pal PAL_OSF1_imb                   /* sync instruction stream */
@@ -1700,18 +1675,16 @@
        beq     t1, fswintrberr                 /* if it's not, error out. */
        /* Note: GET_CURPROC clobbers v0, t0, t8...t11. */
        GET_CURPROC
-       mov     v0, t1
+       ldq     t1, 0(v0)
        lda     t0, fswintrberr
        .set noat
-       ldq     at_reg, 0(t1)
-       ldq     at_reg, P_ADDR(at_reg)
+       ldq     at_reg, P_ADDR(t1)
        stq     t0, U_PCB_ONFAULT(at_reg)



Home | Main Index | Thread Index | Old Index