Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Document the register state on entry per the OpenFi...



details:   https://anonhg.NetBSD.org/src/rev/b0d5d6c23ff8
branches:  trunk
changeset: 952800:b0d5d6c23ff8
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Feb 17 23:21:46 2021 +0000

description:
Document the register state on entry per the OpenFirmware PowerPC CPU
bindings.  Ensure we save off %r6 and %r7 before calling any other
functions.

diffstat:

 sys/arch/macppc/macppc/locore.S |  17 ++++++++++++++---
 sys/arch/ofppc/ofppc/locore.S   |  15 +++++++++++++--
 2 files changed, 27 insertions(+), 5 deletions(-)

diffs (77 lines):

diff -r 8e900ef678c2 -r b0d5d6c23ff8 sys/arch/macppc/macppc/locore.S
--- a/sys/arch/macppc/macppc/locore.S   Wed Feb 17 22:55:20 2021 +0000
+++ b/sys/arch/macppc/macppc/locore.S   Wed Feb 17 23:21:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.77 2021/02/13 02:17:02 thorpej Exp $      */
+/*     $NetBSD: locore.S,v 1.78 2021/02/17 23:21:46 thorpej Exp $      */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -77,10 +77,23 @@
 /*
  * Startup entry.  Note, this must be the first thing in the text
  * segment!
+ *
+ * Register state as transfer is passed from OpenFirmware / boot loader:
+ *
+ *     %r1     Stack provided by OpenFirmware / boot loader
+ *     %r3     Reserved for platform binding (unused here)
+ *     %r4     Reserved for platform binding (unused here)
+ *     %r5     OpenFirmware client entry point
+ *     %r6     Arguments
+ *     %r7     Arguments length
  */
        .text
        .globl  __start
 __start:
+       /* Save off arguments that we need preserved. */
+       mr      %r13,%r6
+       mr      %r14,%r7
+
        bl      _C_LABEL(ofwinit)               /* init OF */
 
        li      %r0,0
@@ -89,8 +102,6 @@
 #endif
        isync
 
-       mr      %r13,%r6
-       mr      %r14,%r7
        bl      _C_LABEL(cpu_model_init)        /* init oeacpufeat */
 
 /* compute end of kernel memory */
diff -r 8e900ef678c2 -r b0d5d6c23ff8 sys/arch/ofppc/ofppc/locore.S
--- a/sys/arch/ofppc/ofppc/locore.S     Wed Feb 17 22:55:20 2021 +0000
+++ b/sys/arch/ofppc/ofppc/locore.S     Wed Feb 17 23:21:46 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.50 2018/07/15 05:16:43 maxv Exp $ */
+/*     $NetBSD: locore.S,v 1.51 2021/02/17 23:21:47 thorpej Exp $      */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -75,13 +75,24 @@
 /*
  * Startup entry.  Note, this must be the first thing in the text
  * segment!
+ *
+ * Register state as transfer is passed from OpenFirmware / boot loader:
+ *
+ *     %r1     Stack provided by OpenFirmware / boot loader
+ *     %r3     Reserved for platform binding (unused here)
+ *     %r4     Reserved for platform binding (unused here)
+ *     %r5     OpenFirmware client entry point
+ *     %r6     Arguments
+ *     %r7     Arguments length
  */
        .text
        .globl  __start
 __start:
+       /* Save off arguments that we need preserved. */
        mr      %r13,%r6
        mr      %r14,%r7
-       bl      _C_LABEL(ofwinit)       /* init our OF hooks */
+
+       bl      _C_LABEL(ofwinit)       /* init OF */
 
        li      %r0,0
        mtmsr   %r0                     /* Disable FPU/MMU/exceptions */



Home | Main Index | Thread Index | Old Index