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 Skip relocation if OpenFirmware ...



details:   https://anonhg.NetBSD.org/src/rev/258a77e09505
branches:  trunk
changeset: 517945:258a77e09505
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Nov 21 21:38:00 2001 +0000

description:
Skip relocation if OpenFirmware already loaded us at the right address.

diffstat:

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

diffs (41 lines):

diff -r 622ef61b115b -r 258a77e09505 sys/arch/sparc/stand/common/srt0.S
--- a/sys/arch/sparc/stand/common/srt0.S        Wed Nov 21 21:05:41 2001 +0000
+++ b/sys/arch/sparc/stand/common/srt0.S        Wed Nov 21 21:38:00 2001 +0000
@@ -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 @@
        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 @@
        bg      3b
         add    %l1, 4, %l1
 
+       /*
+        * Jump to our relocated self.
+        */
        set     4f, %g1
        jmp     %g1
         nop



Home | Main Index | Thread Index | Old Index