NetBSD 1.2 and earlier sparc bootblocks have KERNBASE compiled in. This

prevents booting DDB kernels that are built with a different value of KERNBASE.

Apply a correction based on the magic number passed in by the bootblocks.

New bootblocks without the hard-coded KERNBASE reference will be assigned
a new magic number.
This commit is contained in:
pk 1997-09-13 20:36:48 +00:00
parent c635b25325
commit a3140bf9f2
1 changed files with 27 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.72 1997/07/07 20:06:42 pk Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
* Copyright (c) 1996 Paul Kranenburg
@ -3221,7 +3221,7 @@ dostart:
*
* We have been loaded in low RAM, at some address which
* is page aligned (0x4000 actually) rather than where we
* want to run (0xf8004000). Until we get everything set,
* want to run (KERNBASE+0x4000). Until we get everything set,
* we have to be sure to use only pc-relative addressing.
*/
@ -3232,16 +3232,36 @@ dostart:
* that know nothing about DDB symbol loading conventions.
* Note: we don't touch %o1-%o3; SunOS bootloaders seem to use them
* for their own mirky business.
*
* Pre-NetBSD 1.3 bootblocks had KERNBASE compiled in, and used
* it to compute the value of `_esym'. In order to successfully
* boot a kernel built with a different value for KERNBASE using
* old bootblocks, we fixup `_esym' here by the difference between
* KERNBASE and the old value (known to be 0xf8000000) compiled
* into pre-1.3 bootblocks.
* We use the magic number passed as the sixth argument to
* distinguish bootblock versions.
*/
set 0x44444230, %l3
mov %g0, %l4
set 0x44444231, %l3
cmp %o5, %l3 ! chk magic
bne 1f
be 1f
set 0x44444230, %l3
cmp %o5, %l3 ! chk compat magic
bne 2f
set KERNBASE, %l4 ! compat magic found
set 0xf8000000, %l5 ! compute correction term:
sub %l5, %l4, %l4 ! old KERNBASE (0xf8000000 ) - KERNBASE
1:
tst %o4 ! do we have the symbols?
bz 1f
nop
bz 2f
sub %o4, %l4, %o4 ! apply compat correction
sethi %hi(_esym - KERNBASE), %l3 ! store _esym
st %o4, [%l3 + %lo(_esym - KERNBASE)]
1:
2:
#endif
/*
* Sun4 passes in the `load address'. Although possible, its highly