Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3/sh3 db_cachedump_cmd - call the dump function v...



details:   https://anonhg.NetBSD.org/src/rev/5c0c51e8d0f0
branches:  trunk
changeset: 936746:5c0c51e8d0f0
user:      uwe <uwe%NetBSD.org@localhost>
date:      Mon Aug 03 01:14:26 2020 +0000

description:
db_cachedump_cmd - call the dump function via P2 directly.

Instead of calling RUN_P2 at the very beginning of both cpu-specific
cache dump functions just call them via P2 pointers.  This effectively
just makes db_cachedump_cmd into a shared RUN_P2 code for both of
them.  Drop RUN_P1 at the end as we are getting back to P1 anyway
because that's where the return address is.  Any necessary padding is
provided by the sh_icache_sync_all() call.

diffstat:

 sys/arch/sh3/sh3/db_interface.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (81 lines):

diff -r 53cb6818015e -r 5c0c51e8d0f0 sys/arch/sh3/sh3/db_interface.c
--- a/sys/arch/sh3/sh3/db_interface.c   Sun Aug 02 23:20:25 2020 +0000
+++ b/sys/arch/sh3/sh3/db_interface.c   Mon Aug 03 01:14:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $    */
+/*     $NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $    */
 
 /*-
  * Copyright (C) 2002 UCHIYAMA Yasushi.  All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.61 2011/01/28 21:06:07 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.62 2020/08/03 01:14:26 uwe Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -447,25 +447,27 @@
 db_cachedump_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
     const char *modif)
 {
+       void (*cachedump_p2)(vaddr_t);
+
 #ifdef SH3
        if (CPU_IS_SH3)
-               __db_cachedump_sh3(have_addr ? addr : 0);
+               cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh3);
 #endif
 #ifdef SH4
        if (CPU_IS_SH4)
-               __db_cachedump_sh4(have_addr ? addr : 0);
+               cachedump_p2 = (void *)SH3_P1SEG_TO_P2SEG(__db_cachedump_sh4);
 #endif
+       (*cachedump_p2)(have_addr ? addr : 0);
 }
 
 #ifdef SH3
-static void
+static __noinline void
 __db_cachedump_sh3(vaddr_t va_start)
 {
        uint32_t r;
        vaddr_t va, va_end, cca;
        int entry, way;
 
-       RUN_P2;
        /* disable cache */
        _reg_write_4(SH3_CCR,
            _reg_read_4(SH3_CCR) & ~SH3_CCR_CE);
@@ -497,20 +499,16 @@
        /* enable cache */
        _reg_bset_4(SH3_CCR, SH3_CCR_CE);
        sh_icache_sync_all();
-
-       RUN_P1;
 }
 #endif /* SH3 */
 
 #ifdef SH4
-static void
+static __noinline void
 __db_cachedump_sh4(vaddr_t va)
 {
        uint32_t r, e;
        int i, istart, iend;
 
-       RUN_P2; /* must access from P2 */
-
        /* disable I/D-cache */
        _reg_write_4(SH4_CCR,
            _reg_read_4(SH4_CCR) & ~(SH4_CCR_ICE | SH4_CCR_OCE));
@@ -548,8 +546,6 @@
        _reg_write_4(SH4_CCR,
            _reg_read_4(SH4_CCR) | SH4_CCR_ICE | SH4_CCR_OCE);
        sh_icache_sync_all();
-
-       RUN_P1;
 }
 #endif /* SH4 */
 



Home | Main Index | Thread Index | Old Index