Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/booke Make this assemble correctly with clang.



details:   https://anonhg.NetBSD.org/src/rev/570d5b64ecd3
branches:  trunk
changeset: 365963:570d5b64ecd3
user:      rin <rin%NetBSD.org@localhost>
date:      Sat May 07 04:19:22 2022 +0000

description:
Make this assemble correctly with clang.

At the moment, clang wrongly handles m[ft]sprgN (N >= 4);
use m[ft]spr for SPR_SPRGN instead.

Now, clang-compiled kernel seems working just fine on my RB800!

diffstat:

 sys/arch/powerpc/booke/trap_subr.S |  29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diffs (91 lines):

diff -r c5a538409957 -r 570d5b64ecd3 sys/arch/powerpc/booke/trap_subr.S
--- a/sys/arch/powerpc/booke/trap_subr.S        Sat May 07 04:12:54 2022 +0000
+++ b/sys/arch/powerpc/booke/trap_subr.S        Sat May 07 04:19:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $       */
+/*     $NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $       */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-RCSID("$NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $")
+RCSID("$NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $")
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -68,15 +68,20 @@
         * needed, saves sprg3, and then refers to the save using a
         * displacement of -amount.
         */
+       /*
+        * XXXclang
+        * At the moment, clang cannot correctly assemble m[ft]sprgN
+        * (N >= 4); use m[ft]spr for SPR_SPRGN instead.
+        */
 #define        FRAME_EXC_PROLOGUE(start, sprg, srr)                            \
-       mt##sprg %r2;                   /* save r2 */                   \
+       mtspr   sprg,%r2;               /* save r2 */                   \
        mfsprg3 %r2;                    /* get save_area pointer */     \
        addi    %r2,%r2,4*(32-start);                                   \
                                        /* allocate save area */        \
        mtsprg3 %r2;                    /* save updated pointer */      \
        stmw    %r##start,-4*(32-start)(%r2);                           \
                                        /* free r24-r31 for use */      \
-       mf##sprg %r26;                  /* get saved r2 */              \
+       mfspr   %r26,sprg;              /* get saved r2 */              \
        mfcr    %r27;                   /* get Condition Register */    \
        mfxer   %r28;                   /* get XER */                   \
        mfspr   %r30, SPR_##srr##0;     /* get SRR0 */                  \
@@ -103,41 +108,41 @@
                                mtsrr1  r
 
 #define        FRAME_PROLOGUE          \
-       FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+       FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 #define        FRAME_PROLOGUE_DEAR_ESR \
-       FRAME_EXC_PROLOGUE(24, sprg1, SRR); \
+       FRAME_EXC_PROLOGUE(24, SPR_SPRG1, SRR); \
        PROLOGUE_GET_ESR; \
        PROLOGUE_GET_DEAR
 
 #define        FRAME_PROLOGUE_ESR      \
-       FRAME_EXC_PROLOGUE(25, sprg1, SRR); \
+       FRAME_EXC_PROLOGUE(25, SPR_SPRG1, SRR); \
        PROLOGUE_GET_ESR
 
 #define        FRAME_TLBPROLOGUE       \
-       FRAME_EXC_PROLOGUE(20, sprg1, SRR); \
+       FRAME_EXC_PROLOGUE(20, SPR_SPRG1, SRR); \
        PROLOGUE_GET_ESR; \
        PROLOGUE_GET_DEAR
 
 #define        FRAME_INTR_PROLOGUE     \
-       FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+       FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 /*
  * These need to save SRR0/SRR1 as well their SRR0/SRR1 in case normal
  * exceptions happened during their execution.
  */
 #define        FRAME_CRIT_PROLOGUE     \
-       FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+       FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
        PROLOGUE_GET_SPRG1; \
        PROLOGUE_GET_SRRS
 
 #define        FRAME_MCHK_PROLOGUE     \
-       FRAME_EXC_PROLOGUE(24, sprg5, MCSRR); \
+       FRAME_EXC_PROLOGUE(24, SPR_SPRG5, MCSRR); \
        PROLOGUE_GET_SPRG1; \
        PROLOGUE_GET_SRRS
 
 #define        FRAME_DEBUG_PROLOGUE    \
-       FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+       FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
        PROLOGUE_GET_SPRG1; \
        PROLOGUE_GET_SRRS
 



Home | Main Index | Thread Index | Old Index