Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/stand/common Deal with _edata not being 4-byt...



details:   https://anonhg.NetBSD.org/src/rev/21300a5eb8cc
branches:  trunk
changeset: 344029:21300a5eb8cc
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Mar 10 20:22:52 2016 +0000

description:
Deal with _edata not being 4-byte aligned

diffstat:

 sys/arch/sparc/stand/common/srt0.S |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 6b64bdf023b8 -r 21300a5eb8cc sys/arch/sparc/stand/common/srt0.S
--- a/sys/arch/sparc/stand/common/srt0.S        Thu Mar 10 18:53:48 2016 +0000
+++ b/sys/arch/sparc/stand/common/srt0.S        Thu Mar 10 20:22:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: srt0.S,v 1.11 2008/04/28 20:23:36 martin Exp $ */
+/*     $NetBSD: srt0.S,v 1.12 2016/03/10 20:22:52 martin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -106,12 +106,20 @@
         * Clear BSS
         */
        set     _edata, %o0             ! bzero(edata, end - edata)
+1:     ! check if %o0 is well aligned
+       andcc   %o0, 3, %o2
+       bz      2f
+        nop
+       stb     %g0, [%o0]
+       b       1b
+        add    %o0, 1, %o0
+
+2:     ! now we have %o0 4 byte aligned
        set     _end, %o1
-       /* note: bzero() expanded inline for compactness */
        subcc   %o1, %o0, %o1
        bz      2f                      ! in case there is no BSS
 
-       srl     %o1, 2, %o1             ! assume _edata & _end are aligned
+       srl     %o1, 2, %o1             ! we do 4 byte writes now
 1:
        st      %g0, [%o0]              ! while (n--)
        subcc   %o1, 1, %o1             !       *p = 0; etc..



Home | Main Index | Thread Index | Old Index