Only skip the copy if we are already relocated; always clear

the BSS.
This commit is contained in:
thorpej 2002-11-05 06:16:21 +00:00
parent 80369ce3c8
commit e0f2bd703f

View File

@ -1,4 +1,4 @@
/* $NetBSD: srt0.S,v 1.2 2002/03/31 00:11:14 matt Exp $ */
/* $NetBSD: srt0.S,v 1.3 2002/11/05 06:16:21 thorpej Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -45,19 +45,21 @@
.set nisse,0
ALTENTRY(start)
nop;nop;
movl $_C_LABEL(start), %sp # Probably safe place for stack
pushr $0x1fff # save for later usage
nop; nop
subl3 $_C_LABEL(start), $_C_LABEL(edata), %r0
movab _C_LABEL(start), %r1 # get where we are
movl $_C_LABEL(start), %r3 # get where we want to be
cmpl %r1,%r3 # are we where we want to be?
beql relocated # already relocated, skip copy
beql 1f # already relocated, skip copy
movc3 %r0,(%r1),(%r3) # copy
1:
subl3 $_C_LABEL(edata), $_C_LABEL(end), %r2
movc5 $0,(%r3),$0,%r2,(%r3) # Zero bss
movl $_C_LABEL(start), %sp # set up boot stack
pushr $0x1fff # save for later usage
movpsl -(%sp)
pushl $relocated
rei