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 an error introduced in rev 1.130 wh...



details:   https://anonhg.NetBSD.org/src/rev/b5d614f9f313
branches:  trunk
changeset: 379245:b5d614f9f313
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun May 23 01:00:53 2021 +0000

description:
Fix an error introduced in rev 1.130 where the previous pcb_onfault
handler was not restored properly in the kcopyerr case.  Also add a
comment explaining why it's save for these routines to be wrappers
around memcpy().

Fixes port-alpha/56197.

diffstat:

 sys/arch/alpha/alpha/locore.s |  14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r e23b7d3eef0d -r b5d614f9f313 sys/arch/alpha/alpha/locore.s
--- a/sys/arch/alpha/alpha/locore.s     Sun May 23 00:36:36 2021 +0000
+++ b/sys/arch/alpha/alpha/locore.s     Sun May 23 01:00:53 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.136 2020/09/19 01:32:16 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 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.136 2020/09/19 01:32:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.137 2021/05/23 01:00:53 thorpej Exp $");
 
 #include "assym.h"
 
@@ -987,6 +987,11 @@ NESTED(copyoutstr, 4, 16, ra, IM_RA|IM_S
  * kcopy() _must_ save and restore the old fault handler since it is
  * called by uiomove(), which may be in the path of servicing a non-fatal
  * page fault.
+ *
+ * N.B. This implementation is a wrapper around memcpy(), which is
+ * implemented in src/common/lib/libc/arch/alpha/string/bcopy.S.
+ * This is safe ONLY because we know that, as implemented, it is
+ * a LEAF function (and thus does not use any callee-saved registers).
  */
 NESTED(kcopy, 3, 32, ra, IM_RA|IM_S0|IM_S1, 0)
        LDGP(pv)
@@ -1016,10 +1021,7 @@ NESTED(kcopy, 3, 32, ra, IM_RA|IM_S0|IM_
 
 LEAF(kcopyerr, 0)
        LDGP(pv)
-       .set noat
-       ldq     at_reg, L_PCB(s1)               /* restore the old handler.  */
-       stq     s0, PCB_ONFAULT(at_reg)
-       .set at
+       stq     s0, PCB_ONFAULT(s1)             /* s1 == pcb (from above)    */
        ldq     ra, (32-8)(sp)                  /* restore ra.               */
        ldq     s0, (32-16)(sp)                 /* restore s0.               */
        ldq     s1, (32-24)(sp)                 /* restore s1.               */



Home | Main Index | Thread Index | Old Index