[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdX44A6+BNByuvbCC2gcM5vAipbaGAK7L8Vh8q3tMynBbQ@mail.gmail.com>
Date: Mon, 8 Jan 2024 10:56:37 +0100
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Daniel Palmer <daniel@...f.com>
Cc: gerg@...ux-m68k.org, fthain@...ux-m68k.org,
linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] m68k: Fix interrupt stack frames for 68000
Hi Daniel,
Thanks for your patch!
On Mon, Jan 8, 2024 at 10:32 AM Daniel Palmer <daniel@...f.com> wrote:
> The plain old 68000 does not push the frame type/vector on the
> stack when an interrupt starts like the brand new 68010 does.
;-)
> This means that currently everything in struct pt_regs is
> a bit off because it expects the processor to push an extra
> short before the kernel interrupt code adds the rest.
>
> In entry.S for the 68000 we already need to manually put
> the vector number on the stack to work out what interrupt
> is being handled because the cpu doesn't push that to the
> stack.
>
> So we can jiggle this around a bit to fix the issue:
> - For 68000 use the same struct pt_regs layout as coldfire
> where frame/vector is after pc and sp.
> - In entry.S push the vector number first, the stack pointer
> now lines up with the sktadj field in pt_regs and when saving
> the remaining registers the offsets match the fields in the
> struct.
> - Remove the vec argument from the DragonBall interrupt
> decoding logic as it's not pushed on the stack anymore
> and not used either way.
>
> Signed-off-by: Daniel Palmer <daniel@...f.com>
> --- a/arch/m68k/include/uapi/asm/ptrace.h
> +++ b/arch/m68k/include/uapi/asm/ptrace.h
> @@ -39,7 +39,7 @@ struct pt_regs {
> long d0;
> long orig_d0;
> long stkadj;
> -#ifdef CONFIG_COLDFIRE
> +#if defined(CONFIG_COLDFIRE) || defined(CONFIG_M68000)
> unsigned format : 4; /* frame format specifier */
> unsigned vector : 12; /* vector offset */
> unsigned short sr;
I think it would be better to use the classic m68k stack frame.
That would pave the way for building a single nommu kernel for
MC680[012346]0 that runs on e.g. any Amiga.
MC68000 and Coldfire are incompatible anyway.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Powered by blists - more mailing lists