public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org,
	Glauber de Oliveira Costa <glommer@gmail.com>
Subject: Re: [PATCH] Add asm-compat.h to x86
Date: Tue, 30 Oct 2007 18:27:47 -0700	[thread overview]
Message-ID: <4727DA13.9080904@goop.org> (raw)
In-Reply-To: <20071030145523.GA28026@Krystal>

Mathieu Desnoyers wrote:
> Add asm-compat.h to x86
>
> In assembly code and in gcc inline assembly, we need .long to express a "c long"
> type on i386 and a .quad to express the same on x86_64. Use macros similar to
> powerpc "PPC_LONG" to express those. Name chosen: ASM_LONG. (didn't feel like
> X86_LONG was required).
>
> This is useful in inline assembly within code shared between 32 and 64
> bits architectures in x86.
>
> More compatible assembly macros could be added in this header later when
> needed.
>
> I had to create this to implement a merged optimized immediate values
> header for x86.
>   

Seems sound to me, and this header might be a useful place to put other
things, like macros to emit exceptions, etc...

    J
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
> CC: Thomas Gleixner <tglx@linutronix.de>
> CC: Ingo Molnar <mingo@elte.hu>
> CC: "H. Peter Anvin" <hpa@zytor.com>
> ---
>  include/asm-x86/asm-compat.h |   29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> Index: linux-2.6-lttng/include/asm-x86/asm-compat.h
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6-lttng/include/asm-x86/asm-compat.h	2007-10-24 09:41:09.000000000 -0400
> @@ -0,0 +1,29 @@
> +#ifndef _ASM_X86_ASM_COMPAT_H
> +#define _ASM_X86_ASM_COMPAT_H
> +
> +#include <asm/types.h>
> +
> +#ifdef __ASSEMBLY__
> +#  define stringify_in_c(...)	__VA_ARGS__
> +#  define ASM_CONST(x)		x
> +#else
> +/* This version of stringify will deal with commas... */
> +#  define __stringify_in_c(...)	#__VA_ARGS__
> +#  define stringify_in_c(...)	__stringify_in_c(__VA_ARGS__) " "
> +#  define __ASM_CONST(x)	x##UL
> +#  define ASM_CONST(x)		__ASM_CONST(x)
> +#endif
> +
> +#ifdef CONFIG_X86_64
> +
> +/* operations for longs and pointers */
> +#define ASM_LONG	stringify_in_c(.quad)
> +
> +#else /* 32-bit */
> +
> +/* operations for longs and pointers */
> +#define ASM_LONG	stringify_in_c(.long)
> +
> +#endif
> +
> +#endif /* _ASM_X86_ASM_COMPAT_H */
>
>   


  reply	other threads:[~2007-10-31  1:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 14:55 [PATCH] Add asm-compat.h to x86 Mathieu Desnoyers
2007-10-31  1:27 ` Jeremy Fitzhardinge [this message]
2007-10-31  1:30   ` Glauber de Oliveira Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4727DA13.9080904@goop.org \
    --to=jeremy@goop.org \
    --cc=glommer@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox