Re: [PATCH v5 01/10] x86/asm: Add FP_SAVE/RESTORE frame pointer macros

From: Josh Poimboeuf
Date: Thu Jun 11 2015 - 10:18:14 EST


On Thu, Jun 11, 2015 at 08:46:33AM +0200, Pavel Machek wrote:
> On Thu 2015-06-11 06:22:49, Jiri Kosina wrote:
> > On Wed, 10 Jun 2015, Pavel Machek wrote:
> >
> > > > diff --git a/arch/x86/include/asm/func.h b/arch/x86/include/asm/func.h
> > > > new file mode 100644
> > > > index 0000000..4d62782
> > > > --- /dev/null
> > > > +++ b/arch/x86/include/asm/func.h
> > > > @@ -0,0 +1,24 @@
> > > > +#ifndef _ASM_X86_FUNC_H
> > > > +#define _ASM_X86_FUNC_H
> > > > +
> > > > +#include <linux/linkage.h>
> > > > +#include <asm/asm.h>
> > > > +
> > > > +/*
> > > > + * These are frame pointer save and restore macros. They should be used by
> > > > + * every callable non-leaf asm function.
> > > > + */
> > > > +.macro FP_SAVE name
> > > > + .if CONFIG_FRAME_POINTER
> > > > + push %_ASM_BP
> > > > + _ASM_MOV %_ASM_SP, %_ASM_BP
> > > > + .endif
> > > > +.endm
> > >
> > > Hmm. This will not compile when included into .c file. Should it have
> > > other extension than .h? (Or can the macros be done in different way?
> >
> > We have quite a few of .h headers in the kernel already which are supposed
> > to be included only by .S files, so what exactly is the problem you are
> > seeing here?
>
> Such as...? Can this be merged into one of them so that we don't have
> a separate file? For example "frame.h"?
>
> (I thought asm includes traditionally had different extension, but I
> may be mistaken).
>
> And at the very least, dwarf2.h includes
>
> #ifndef __ASSEMBLY__
> #warning "asm/dwarf2.h should be only included in pure assembly files"
> #endif
>
> and guards stuff that would not compile in C with
>
> #ifdef __ASSEMBLY__
> ....

Ok, I'll move the FP_SAVE/RESTORE stuff into frame.h (which seems to be
completely unused). And I'll make sure to use "#ifdef __ASSEMBLY__".

--
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/