Deal with _edata not being 4-byte aligned

This commit is contained in:
martin 2016-03-10 20:22:52 +00:00
parent 2a4b16ea45
commit 8d92fc86f0
1 changed files with 11 additions and 3 deletions

View File

@ -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 @@ start:
* 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..