From 8390d1903a011c8ec5627e61efe3568629216066 Mon Sep 17 00:00:00 2001 From: uwe Date: Wed, 21 Nov 2001 21:38:00 +0000 Subject: [PATCH] Skip relocation if OpenFirmware already loaded us at the right address. --- sys/arch/sparc/stand/common/srt0.S | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/arch/sparc/stand/common/srt0.S b/sys/arch/sparc/stand/common/srt0.S index e2e95678a845..a97c5b478311 100644 --- a/sys/arch/sparc/stand/common/srt0.S +++ b/sys/arch/sparc/stand/common/srt0.S @@ -1,4 +1,4 @@ -/* $NetBSD: srt0.S,v 1.6 2001/05/20 17:28:16 uwe Exp $ */ +/* $NetBSD: srt0.S,v 1.7 2001/11/21 21:38:00 uwe Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -63,11 +63,19 @@ start: save %o1, -CCFSZ, %sp /* - * Relocate. + * Find which address we are at. */ 1: call 2f + sethi %hi(1b), %l0 +2: or %l0, %lo(1b), %l0 + cmp %l0, %o7 ! %o7 contains actual address of 1b + beq 4f ! already there, no need to relocate nop -2: add %o7, (start-1b), %l0 + + /* + * Relocate. + */ + add %o7, (start-1b), %l0 set start, %l1 set _edata, %o0 sub %o0, %l1, %l2 ! length @@ -78,6 +86,9 @@ start: bg 3b add %l1, 4, %l1 + /* + * Jump to our relocated self. + */ set 4f, %g1 jmp %g1 nop