Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mac68k/mac68k For GCC8, do not omit frame pointer f...



details:   https://anonhg.NetBSD.org/src/rev/3f76024dd535
branches:  trunk
changeset: 936210:3f76024dd535
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Jul 21 06:10:26 2020 +0000

description:
For GCC8, do not omit frame pointer for intr_dispatch() and via1_intr()
(-fomit-frame-pointer is enabled for -O and higher for GCC8).

This is required by rtclock_intr() which unwinds stack frame of caller!

XXXXXX
We need to get rid of this hackest hack for rtclock_intr(). This problem
was discussed back in 2014:

http://mail-index.netbsd.org/port-mac68k/2014/08/15/msg000595.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000600.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000601.html

However, unfortunately, the problem has been left untouched until today.

The patch attached in the third message works around the problem. But,
it adds hard-coded magic numbers to intr_dispatch() and via1_intr().
For real fix, we should probably reconsider whole interrupt handling.

Anyway, now kernel compiled by GCC8 works fine as far as I can see.

diffstat:

 sys/arch/mac68k/mac68k/intr.c   |  14 ++++++++++++--
 sys/arch/mac68k/mac68k/locore.s |   3 ++-
 sys/arch/mac68k/mac68k/via.c    |  14 ++++++++++++--
 3 files changed, 26 insertions(+), 5 deletions(-)

diffs (101 lines):

diff -r 43b87e5122fe -r 3f76024dd535 sys/arch/mac68k/mac68k/intr.c
--- a/sys/arch/mac68k/mac68k/intr.c     Tue Jul 21 06:01:10 2020 +0000
+++ b/sys/arch/mac68k/mac68k/intr.c     Tue Jul 21 06:10:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.30 2019/02/19 00:34:50 mrg Exp $    */
+/*     $NetBSD: intr.c,v 1.31 2020/07/21 06:10:26 rin Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.30 2019/02/19 00:34:50 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.31 2020/07/21 06:10:26 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -206,6 +206,13 @@
  *
  * XXX Note: see the warning in intr_establish()
  */
+#if __GNUC_PREREQ__(8, 0)
+/*
+ * XXX rtclock_intr() requires this for unwinding stack frame.
+ */
+#pragma GCC push_options
+#pragma GCC optimize "-fno-omit-frame-pointer"
+#endif
 void
 intr_dispatch(int evec)                /* format | vector offset */
 {
@@ -225,6 +232,9 @@
        (void)(*intr_func[ipl])(intr_arg[ipl]);
        idepth--;
 }
+#if __GNUC_PREREQ__(8, 0)
+#pragma GCC pop_options
+#endif
 
 /*
  * Default interrupt handler:  do nothing.
diff -r 43b87e5122fe -r 3f76024dd535 sys/arch/mac68k/mac68k/locore.s
--- a/sys/arch/mac68k/mac68k/locore.s   Tue Jul 21 06:01:10 2020 +0000
+++ b/sys/arch/mac68k/mac68k/locore.s   Tue Jul 21 06:10:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.172 2020/07/21 05:45:38 rin Exp $ */
+/*     $NetBSD: locore.s,v 1.173 2020/07/21 06:10:26 rin Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -794,6 +794,7 @@
        movw    _C_LABEL(ipl2psl_table)+IPL_CLOCK*2,%sr
                                        | raise SPL to splclock()
        movl    %a6@,%a1                | unwind to frame in intr_dispatch
+                                       | XXX FIXME
        lea     %a1@(28),%a1            | push pointer to interrupt frame
        movl    %a1,%sp@-                       | 28 = 16 for regs in intrhand,
                                        |    + 4 for args to intr_dispatch
diff -r 43b87e5122fe -r 3f76024dd535 sys/arch/mac68k/mac68k/via.c
--- a/sys/arch/mac68k/mac68k/via.c      Tue Jul 21 06:01:10 2020 +0000
+++ b/sys/arch/mac68k/mac68k/via.c      Tue Jul 21 06:10:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: via.c,v 1.75 2005/12/11 12:18:03 christos Exp $        */
+/*     $NetBSD: via.c,v 1.76 2020/07/21 06:10:26 rin Exp $     */
 
 /*-
  * Copyright (C) 1993  Allen K. Briggs, Chris P. Caputo,
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: via.c,v 1.75 2005/12/11 12:18:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via.c,v 1.76 2020/07/21 06:10:26 rin Exp $");
 
 #include "opt_mac68k.h"
 
@@ -239,6 +239,13 @@
                via_reg(VIA1, vBufA) &= ~DA1O_vSync;
 }
 
+#if __GNUC_PREREQ__(8, 0)
+/*
+ * XXX rtclock_intr() requires this for unwinding stack frame.
+ */
+#pragma GCC push_options
+#pragma GCC optimize "-fno-omit-frame-pointer"
+#endif
 void
 via1_intr(void *intr_arg)
 {
@@ -269,6 +276,9 @@
                ++bitnum;
        } while (intbits >= mask);
 }
+#if __GNUC_PREREQ__(8, 0)
+#pragma GCC pop_options
+#endif
 
 void
 via2_intr(void *intr_arg)



Home | Main Index | Thread Index | Old Index