linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: o32 application running on 64bit kernel core dump

To: Yong Zhang <yong.zhang@windriver.com>
Subject: Re: [PATCH] MIPS: o32 application running on 64bit kernel core dump
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 1 Jul 2009 20:19:34 +0100
Cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org
In-reply-to: <16bd35f2910f585740f4764fa1e80bf31c80d576.1242178813.git.yong.zhang@windriver.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <16bd35f2910f585740f4764fa1e80bf31c80d576.1242178813.git.yong.zhang@windriver.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.5.18 (2008-05-17)
On Wed, Jul 01, 2009 at 09:35:39AM +0800, Yong Zhang wrote:

> +/* These MUST be defined before elf.h gets included */

This sort of ordering bug seems to become a tradition.  I think it may be
a good idea to insert a check like this:

#ifdef ELF_CORE_COPY_REGS
#error ELF_CORE_COPY_REGS should not be defined yet!
#endif

> +extern void elf32_core_copy_regs(elf_gregset_t grp, struct pt_regs *regs);
> +#define ELF_CORE_COPY_REGS(_dest, _regs) elf32_core_copy_regs(_dest, _regs);
> +#define ELF_CORE_COPY_TASK_REGS(_tsk, _dest)                         \
> +({                                                                   \
> +     int __res = 1;                                                  \
> +     elf32_core_copy_regs((*_dest), (task_pt_regs(_tsk)));           \

Be very careful with parentheses in macros.  This line should probably
become:

        elf32_core_copy_regs(*(_dest), task_pt_regs(_tsk));             \

The changes to the first argument to bullet prof the macro and the change
to the second one for cosmetic reasons.

  Ralf

<Prev in Thread] Current Thread [Next in Thread>