Module Name: src Committed By: rin Date: Tue Jul 21 06:10:26 UTC 2020
Modified Files: src/sys/arch/mac68k/mac68k: intr.c locore.s via.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/mac68k/mac68k/intr.c cvs rdiff -u -r1.172 -r1.173 src/sys/arch/mac68k/mac68k/locore.s cvs rdiff -u -r1.75 -r1.76 src/sys/arch/mac68k/mac68k/via.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mac68k/mac68k/intr.c diff -u src/sys/arch/mac68k/mac68k/intr.c:1.30 src/sys/arch/mac68k/mac68k/intr.c:1.31 --- src/sys/arch/mac68k/mac68k/intr.c:1.30 Tue Feb 19 00:34:50 2019 +++ src/sys/arch/mac68k/mac68k/intr.c Tue Jul 21 06:10:26 2020 @@ -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 @@ intr_disestablish(int ipl) * * 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 @@ intr_dispatch(int evec) /* format | vec (void)(*intr_func[ipl])(intr_arg[ipl]); idepth--; } +#if __GNUC_PREREQ__(8, 0) +#pragma GCC pop_options +#endif /* * Default interrupt handler: do nothing. Index: src/sys/arch/mac68k/mac68k/locore.s diff -u src/sys/arch/mac68k/mac68k/locore.s:1.172 src/sys/arch/mac68k/mac68k/locore.s:1.173 --- src/sys/arch/mac68k/mac68k/locore.s:1.172 Tue Jul 21 05:45:38 2020 +++ src/sys/arch/mac68k/mac68k/locore.s Tue Jul 21 06:10:26 2020 @@ -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 @@ ENTRY_NOPROFILE(rtclock_intr) 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 Index: src/sys/arch/mac68k/mac68k/via.c diff -u src/sys/arch/mac68k/mac68k/via.c:1.75 src/sys/arch/mac68k/mac68k/via.c:1.76 --- src/sys/arch/mac68k/mac68k/via.c:1.75 Sun Dec 11 12:18:03 2005 +++ src/sys/arch/mac68k/mac68k/via.c Tue Jul 21 06:10:26 2020 @@ -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_set_modem(int onoff) 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 @@ via1_intr(void *intr_arg) ++bitnum; } while (intbits >= mask); } +#if __GNUC_PREREQ__(8, 0) +#pragma GCC pop_options +#endif void via2_intr(void *intr_arg)