mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86_64: Work around old gas bug
@ 2012-09-26  8:28 Tao Guo
  2012-09-26 10:17 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Tao Guo @ 2012-09-26  8:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Tao Guo, Jan Beulich, Ingo Molnar, stable, hpa

gas in binutils(2.16.91) could not parse parentheses within macro
parameters unless fully parenthesized, and this is a workaround to
make old gas work without generating below errors:
arch/x86/kernel/entry_64.S: Assembler messages:
arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
arch/x86/kernel/entry_64.S:394: Error: too many positional arguments

Signed-off-by: Tao Guo <glorioustao@gmail.com>
---
 arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
 arch/x86/kernel/entry_64.S     |   20 ++++++++--------
 2 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h
index a9e3a74..7f8422a 100644
--- a/arch/x86/include/asm/calling.h
+++ b/arch/x86/include/asm/calling.h
@@ -49,38 +49,36 @@ For 32-bit we have the following conventions - kernel is built with
 #include "dwarf2.h"
 
 /*
- * 64-bit system call stack frame layout defines and helpers, for
- * assembly code (note that the seemingly unnecessary parentheses
- * are to prevent cpp from inserting spaces in expressions that get
- * passed to macros):
+ * 64-bit system call stack frame layout defines and helpers,
+ * for assembly code:
  */
 
-#define R15		  (0)
-#define R14		  (8)
-#define R13		 (16)
-#define R12		 (24)
-#define RBP		 (32)
-#define RBX		 (40)
+#define R15		  0
+#define R14		  8
+#define R13		 16
+#define R12		 24
+#define RBP		 32
+#define RBX		 40
 
 /* arguments: interrupts/non tracing syscalls only save up to here: */
-#define R11		 (48)
-#define R10		 (56)
-#define R9		 (64)
-#define R8		 (72)
-#define RAX		 (80)
-#define RCX		 (88)
-#define RDX		 (96)
-#define RSI		(104)
-#define RDI		(112)
-#define ORIG_RAX	(120)       /* + error_code */
+#define R11		 48
+#define R10		 56
+#define R9		 64
+#define R8		 72
+#define RAX		 80
+#define RCX		 88
+#define RDX		 96
+#define RSI		104
+#define RDI		112
+#define ORIG_RAX	120       /* + error_code */
 /* end of arguments */
 
 /* cpu exception frame or undefined in case of fast syscall: */
-#define RIP		(128)
-#define CS		(136)
-#define EFLAGS		(144)
-#define RSP		(152)
-#define SS		(160)
+#define RIP		128
+#define CS		136
+#define EFLAGS		144
+#define RSP		152
+#define SS		160
 
 #define ARGOFFSET	R11
 #define SWFRAME		ORIG_RAX
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 69babd8..bf77e70 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -342,15 +342,15 @@ ENDPROC(native_usergs_sysret64)
 	.macro SAVE_ARGS_IRQ
 	cld
 	/* start from rbp in pt_regs and jump over */
-	movq_cfi rdi, RDI-RBP
-	movq_cfi rsi, RSI-RBP
-	movq_cfi rdx, RDX-RBP
-	movq_cfi rcx, RCX-RBP
-	movq_cfi rax, RAX-RBP
-	movq_cfi  r8,  R8-RBP
-	movq_cfi  r9,  R9-RBP
-	movq_cfi r10, R10-RBP
-	movq_cfi r11, R11-RBP
+	movq_cfi rdi, (RDI-RBP)
+	movq_cfi rsi, (RSI-RBP)
+	movq_cfi rdx, (RDX-RBP)
+	movq_cfi rcx, (RCX-RBP)
+	movq_cfi rax, (RAX-RBP)
+	movq_cfi  r8,  (R8-RBP)
+	movq_cfi  r9,  (R9-RBP)
+	movq_cfi r10, (R10-RBP)
+	movq_cfi r11, (R11-RBP)
 
 	/* Save rbp so that we can unwind from get_irq_regs() */
 	movq_cfi rbp, 0
@@ -384,7 +384,7 @@ ENDPROC(native_usergs_sysret64)
 	.endm
 
 ENTRY(save_rest)
-	PARTIAL_FRAME 1 REST_SKIP+8
+	PARTIAL_FRAME 1 (REST_SKIP+8)
 	movq 5*8+16(%rsp), %r11	/* save return address */
 	movq_cfi rbx, RBX+16
 	movq_cfi rbp, RBP+16
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26  8:28 [PATCH] x86_64: Work around old gas bug Tao Guo
@ 2012-09-26 10:17 ` Jan Beulich
  2012-09-26 11:16   ` Ingo Molnar
  2012-09-26 13:25 ` Greg KH
  2012-09-27  6:09 ` [tip:x86/asm] x86_64: Work around old GAS bug tip-bot for Tao Guo
  2 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2012-09-26 10:17 UTC (permalink / raw)
  To: Tao Guo; +Cc: Ingo Molnar, linux-kernel, stable, hpa

>>> On 26.09.12 at 10:28, Tao Guo <glorioustao@gmail.com> wrote:
> gas in binutils(2.16.91) could not parse parentheses within macro
> parameters unless fully parenthesized, and this is a workaround to
> make old gas work without generating below errors:
> arch/x86/kernel/entry_64.S: Assembler messages:
> arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
> 
> Signed-off-by: Tao Guo <glorioustao@gmail.com>

This looks okay now to me, but I'm somewhat reluctant to formally
ack it given that we know how broken those particular gas
versions are.

Jan

> ---
>  arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
>  arch/x86/kernel/entry_64.S     |   20 ++++++++--------
>  2 files changed, 33 insertions(+), 35 deletions(-)
> 
> diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h
> index a9e3a74..7f8422a 100644
> --- a/arch/x86/include/asm/calling.h
> +++ b/arch/x86/include/asm/calling.h
> @@ -49,38 +49,36 @@ For 32-bit we have the following conventions - kernel is 
> built with
>  #include "dwarf2.h"
>  
>  /*
> - * 64-bit system call stack frame layout defines and helpers, for
> - * assembly code (note that the seemingly unnecessary parentheses
> - * are to prevent cpp from inserting spaces in expressions that get
> - * passed to macros):
> + * 64-bit system call stack frame layout defines and helpers,
> + * for assembly code:
>   */
>  
> -#define R15		  (0)
> -#define R14		  (8)
> -#define R13		 (16)
> -#define R12		 (24)
> -#define RBP		 (32)
> -#define RBX		 (40)
> +#define R15		  0
> +#define R14		  8
> +#define R13		 16
> +#define R12		 24
> +#define RBP		 32
> +#define RBX		 40
>  
>  /* arguments: interrupts/non tracing syscalls only save up to here: */
> -#define R11		 (48)
> -#define R10		 (56)
> -#define R9		 (64)
> -#define R8		 (72)
> -#define RAX		 (80)
> -#define RCX		 (88)
> -#define RDX		 (96)
> -#define RSI		(104)
> -#define RDI		(112)
> -#define ORIG_RAX	(120)       /* + error_code */
> +#define R11		 48
> +#define R10		 56
> +#define R9		 64
> +#define R8		 72
> +#define RAX		 80
> +#define RCX		 88
> +#define RDX		 96
> +#define RSI		104
> +#define RDI		112
> +#define ORIG_RAX	120       /* + error_code */
>  /* end of arguments */
>  
>  /* cpu exception frame or undefined in case of fast syscall: */
> -#define RIP		(128)
> -#define CS		(136)
> -#define EFLAGS		(144)
> -#define RSP		(152)
> -#define SS		(160)
> +#define RIP		128
> +#define CS		136
> +#define EFLAGS		144
> +#define RSP		152
> +#define SS		160
>  
>  #define ARGOFFSET	R11
>  #define SWFRAME		ORIG_RAX
> diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
> index 69babd8..bf77e70 100644
> --- a/arch/x86/kernel/entry_64.S
> +++ b/arch/x86/kernel/entry_64.S
> @@ -342,15 +342,15 @@ ENDPROC(native_usergs_sysret64)
>  	.macro SAVE_ARGS_IRQ
>  	cld
>  	/* start from rbp in pt_regs and jump over */
> -	movq_cfi rdi, RDI-RBP
> -	movq_cfi rsi, RSI-RBP
> -	movq_cfi rdx, RDX-RBP
> -	movq_cfi rcx, RCX-RBP
> -	movq_cfi rax, RAX-RBP
> -	movq_cfi  r8,  R8-RBP
> -	movq_cfi  r9,  R9-RBP
> -	movq_cfi r10, R10-RBP
> -	movq_cfi r11, R11-RBP
> +	movq_cfi rdi, (RDI-RBP)
> +	movq_cfi rsi, (RSI-RBP)
> +	movq_cfi rdx, (RDX-RBP)
> +	movq_cfi rcx, (RCX-RBP)
> +	movq_cfi rax, (RAX-RBP)
> +	movq_cfi  r8,  (R8-RBP)
> +	movq_cfi  r9,  (R9-RBP)
> +	movq_cfi r10, (R10-RBP)
> +	movq_cfi r11, (R11-RBP)
>  
>  	/* Save rbp so that we can unwind from get_irq_regs() */
>  	movq_cfi rbp, 0
> @@ -384,7 +384,7 @@ ENDPROC(native_usergs_sysret64)
>  	.endm
>  
>  ENTRY(save_rest)
> -	PARTIAL_FRAME 1 REST_SKIP+8
> +	PARTIAL_FRAME 1 (REST_SKIP+8)
>  	movq 5*8+16(%rsp), %r11	/* save return address */
>  	movq_cfi rbx, RBX+16
>  	movq_cfi rbp, RBP+16
> -- 
> 1.7.7.6



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26 10:17 ` Jan Beulich
@ 2012-09-26 11:16   ` Ingo Molnar
  2012-09-26 11:28     ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2012-09-26 11:16 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Tao Guo, Ingo Molnar, linux-kernel, stable, hpa


* Jan Beulich <JBeulich@suse.com> wrote:

> >>> On 26.09.12 at 10:28, Tao Guo <glorioustao@gmail.com> wrote:
> > gas in binutils(2.16.91) could not parse parentheses within macro
> > parameters unless fully parenthesized, and this is a workaround to
> > make old gas work without generating below errors:
> > arch/x86/kernel/entry_64.S: Assembler messages:
> > arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
> > arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
> > 
> > Signed-off-by: Tao Guo <glorioustao@gmail.com>
> 
> This looks okay now to me, but I'm somewhat reluctant to 
> formally ack it given that we know how broken those particular 
> gas versions are.

Well, assuming Tao Guo test-booted a kernel build with this old 
GAS version, we could apply this patch on a best-effort basis - 
the changes don't look particularly ugly. If other, unacceptable 
uglies or fragilities come up then we might balk.

Agreed?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26 11:16   ` Ingo Molnar
@ 2012-09-26 11:28     ` Jan Beulich
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Beulich @ 2012-09-26 11:28 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Ingo Molnar, Tao Guo, linux-kernel, stable, hpa

>>> On 26.09.12 at 13:16, Ingo Molnar <mingo@kernel.org> wrote:

> * Jan Beulich <JBeulich@suse.com> wrote:
> 
>> >>> On 26.09.12 at 10:28, Tao Guo <glorioustao@gmail.com> wrote:
>> > gas in binutils(2.16.91) could not parse parentheses within macro
>> > parameters unless fully parenthesized, and this is a workaround to
>> > make old gas work without generating below errors:
>> > arch/x86/kernel/entry_64.S: Assembler messages:
>> > arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
>> > arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
>> > 
>> > Signed-off-by: Tao Guo <glorioustao@gmail.com>
>> 
>> This looks okay now to me, but I'm somewhat reluctant to 
>> formally ack it given that we know how broken those particular 
>> gas versions are.
> 
> Well, assuming Tao Guo test-booted a kernel build with this old 
> GAS version, we could apply this patch on a best-effort basis - 
> the changes don't look particularly ugly. If other, unacceptable 
> uglies or fragilities come up then we might balk.
> 
> Agreed?

Fine with me.

Jan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26  8:28 [PATCH] x86_64: Work around old gas bug Tao Guo
  2012-09-26 10:17 ` Jan Beulich
@ 2012-09-26 13:25 ` Greg KH
  2012-09-26 14:29   ` Tao Guo
  2012-09-27  6:09 ` [tip:x86/asm] x86_64: Work around old GAS bug tip-bot for Tao Guo
  2 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2012-09-26 13:25 UTC (permalink / raw)
  To: Tao Guo; +Cc: linux-kernel, Jan Beulich, Ingo Molnar, stable, hpa

On Wed, Sep 26, 2012 at 04:28:22AM -0400, Tao Guo wrote:
> gas in binutils(2.16.91) could not parse parentheses within macro
> parameters unless fully parenthesized, and this is a workaround to
> make old gas work without generating below errors:
> arch/x86/kernel/entry_64.S: Assembler messages:
> arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
> arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
> 
> Signed-off-by: Tao Guo <glorioustao@gmail.com>
> ---
>  arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
>  arch/x86/kernel/entry_64.S     |   20 ++++++++--------
>  2 files changed, 33 insertions(+), 35 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26 13:25 ` Greg KH
@ 2012-09-26 14:29   ` Tao Guo
  2012-09-27  4:12     ` Ingo Molnar
  0 siblings, 1 reply; 8+ messages in thread
From: Tao Guo @ 2012-09-26 14:29 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, Jan Beulich, Ingo Molnar, stable, hpa

On Wed, Sep 26, 2012 at 9:25 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Sep 26, 2012 at 04:28:22AM -0400, Tao Guo wrote:
>> gas in binutils(2.16.91) could not parse parentheses within macro
>> parameters unless fully parenthesized, and this is a workaround to
>> make old gas work without generating below errors:
>> arch/x86/kernel/entry_64.S: Assembler messages:
>> arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
>> arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
>>
>> Signed-off-by: Tao Guo <glorioustao@gmail.com>
>> ---
>>  arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
>>  arch/x86/kernel/entry_64.S     |   20 ++++++++--------
>>  2 files changed, 33 insertions(+), 35 deletions(-)
>
> <formletter>
>
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
> for how to do this properly.
>
> </formletter>

Thanks Greg, I just realized that I followed the old rules in an old
Documentation/stable_kernel_rules.txt file. Since the patches for
other stable branches will be a little different from this one, I will
send them later to stable@vger.kernel.org after this patch gets
accepted.

Thanks,
-Tao

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] x86_64: Work around old gas bug
  2012-09-26 14:29   ` Tao Guo
@ 2012-09-27  4:12     ` Ingo Molnar
  0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2012-09-27  4:12 UTC (permalink / raw)
  To: Tao Guo; +Cc: Greg KH, linux-kernel, Jan Beulich, Ingo Molnar, stable, hpa


* Tao Guo <glorioustao@gmail.com> wrote:

> On Wed, Sep 26, 2012 at 9:25 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Wed, Sep 26, 2012 at 04:28:22AM -0400, Tao Guo wrote:
> >> gas in binutils(2.16.91) could not parse parentheses within macro
> >> parameters unless fully parenthesized, and this is a workaround to
> >> make old gas work without generating below errors:
> >> arch/x86/kernel/entry_64.S: Assembler messages:
> >> arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:390: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:391: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:392: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:393: Error: too many positional arguments
> >> arch/x86/kernel/entry_64.S:394: Error: too many positional arguments
> >>
> >> Signed-off-by: Tao Guo <glorioustao@gmail.com>
> >> ---
> >>  arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
> >>  arch/x86/kernel/entry_64.S     |   20 ++++++++--------
> >>  2 files changed, 33 insertions(+), 35 deletions(-)
> >
> > <formletter>
> >
> > This is not the correct way to submit patches for inclusion in the
> > stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
> > for how to do this properly.
> >
> > </formletter>
> 
> Thanks Greg, I just realized that I followed the old rules in 
> an old Documentation/stable_kernel_rules.txt file. Since the 
> patches for other stable branches will be a little different 
> from this one, I will send them later to 
> stable@vger.kernel.org after this patch gets accepted.

Please don't send this to -stale yet (or at all).

I have queued up the patch for v3.7, not even for v3.6. It needs 
more testing - old GAS users are probably better off having a 
non-building kernel than a subtly broken one. v3.7 and onwards 
stable kernels will have the fix - hopefully by the time it's 
released any more subtle bugs are found and fixed.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:x86/asm] x86_64: Work around old GAS bug
  2012-09-26  8:28 [PATCH] x86_64: Work around old gas bug Tao Guo
  2012-09-26 10:17 ` Jan Beulich
  2012-09-26 13:25 ` Greg KH
@ 2012-09-27  6:09 ` tip-bot for Tao Guo
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Tao Guo @ 2012-09-27  6:09 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, torvalds, glorioustao, jbeulich, akpm, tglx

Commit-ID:  1b2b23d8573076a587ed2081e0d2b69691079e0e
Gitweb:     http://git.kernel.org/tip/1b2b23d8573076a587ed2081e0d2b69691079e0e
Author:     Tao Guo <glorioustao@gmail.com>
AuthorDate: Wed, 26 Sep 2012 04:28:22 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 26 Sep 2012 13:35:32 +0200

x86_64: Work around old GAS bug

GAS in binutils(2.16.91) could not parse parentheses within
macro parameters unless fully parenthesized, and this is a
workaround to make old gas work without generating below errors:

 arch/x86/kernel/entry_64.S: Assembler messages:
 arch/x86/kernel/entry_64.S:387: Error: too many positional arguments
 arch/x86/kernel/entry_64.S:389: Error: too many positional arguments
 [...]

Signed-off-by: Tao Guo <glorioustao@gmail.com>
Reluctantly-Acked-by: Jan Beulich <jbeulich@novell.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/1348648102-12653-1-git-send-email-glorioustao@gmail.com
[ Jan argues that these old GAS versions are fragile - which is so, but lets give them a chance. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/calling.h |   48 +++++++++++++++++++--------------------
 arch/x86/kernel/entry_64.S     |   20 ++++++++--------
 2 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h
index a9e3a74..7f8422a 100644
--- a/arch/x86/include/asm/calling.h
+++ b/arch/x86/include/asm/calling.h
@@ -49,38 +49,36 @@ For 32-bit we have the following conventions - kernel is built with
 #include "dwarf2.h"
 
 /*
- * 64-bit system call stack frame layout defines and helpers, for
- * assembly code (note that the seemingly unnecessary parentheses
- * are to prevent cpp from inserting spaces in expressions that get
- * passed to macros):
+ * 64-bit system call stack frame layout defines and helpers,
+ * for assembly code:
  */
 
-#define R15		  (0)
-#define R14		  (8)
-#define R13		 (16)
-#define R12		 (24)
-#define RBP		 (32)
-#define RBX		 (40)
+#define R15		  0
+#define R14		  8
+#define R13		 16
+#define R12		 24
+#define RBP		 32
+#define RBX		 40
 
 /* arguments: interrupts/non tracing syscalls only save up to here: */
-#define R11		 (48)
-#define R10		 (56)
-#define R9		 (64)
-#define R8		 (72)
-#define RAX		 (80)
-#define RCX		 (88)
-#define RDX		 (96)
-#define RSI		(104)
-#define RDI		(112)
-#define ORIG_RAX	(120)       /* + error_code */
+#define R11		 48
+#define R10		 56
+#define R9		 64
+#define R8		 72
+#define RAX		 80
+#define RCX		 88
+#define RDX		 96
+#define RSI		104
+#define RDI		112
+#define ORIG_RAX	120       /* + error_code */
 /* end of arguments */
 
 /* cpu exception frame or undefined in case of fast syscall: */
-#define RIP		(128)
-#define CS		(136)
-#define EFLAGS		(144)
-#define RSP		(152)
-#define SS		(160)
+#define RIP		128
+#define CS		136
+#define EFLAGS		144
+#define RSP		152
+#define SS		160
 
 #define ARGOFFSET	R11
 #define SWFRAME		ORIG_RAX
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index b1dac12..2c67061 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -342,15 +342,15 @@ ENDPROC(native_usergs_sysret64)
 	.macro SAVE_ARGS_IRQ
 	cld
 	/* start from rbp in pt_regs and jump over */
-	movq_cfi rdi, RDI-RBP
-	movq_cfi rsi, RSI-RBP
-	movq_cfi rdx, RDX-RBP
-	movq_cfi rcx, RCX-RBP
-	movq_cfi rax, RAX-RBP
-	movq_cfi  r8,  R8-RBP
-	movq_cfi  r9,  R9-RBP
-	movq_cfi r10, R10-RBP
-	movq_cfi r11, R11-RBP
+	movq_cfi rdi, (RDI-RBP)
+	movq_cfi rsi, (RSI-RBP)
+	movq_cfi rdx, (RDX-RBP)
+	movq_cfi rcx, (RCX-RBP)
+	movq_cfi rax, (RAX-RBP)
+	movq_cfi  r8,  (R8-RBP)
+	movq_cfi  r9,  (R9-RBP)
+	movq_cfi r10, (R10-RBP)
+	movq_cfi r11, (R11-RBP)
 
 	/* Save rbp so that we can unwind from get_irq_regs() */
 	movq_cfi rbp, 0
@@ -384,7 +384,7 @@ ENDPROC(native_usergs_sysret64)
 	.endm
 
 ENTRY(save_rest)
-	PARTIAL_FRAME 1 REST_SKIP+8
+	PARTIAL_FRAME 1 (REST_SKIP+8)
 	movq 5*8+16(%rsp), %r11	/* save return address */
 	movq_cfi rbx, RBX+16
 	movq_cfi rbp, RBP+16

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-09-27  6:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-26  8:28 [PATCH] x86_64: Work around old gas bug Tao Guo
2012-09-26 10:17 ` Jan Beulich
2012-09-26 11:16   ` Ingo Molnar
2012-09-26 11:28     ` Jan Beulich
2012-09-26 13:25 ` Greg KH
2012-09-26 14:29   ` Tao Guo
2012-09-27  4:12     ` Ingo Molnar
2012-09-27  6:09 ` [tip:x86/asm] x86_64: Work around old GAS bug tip-bot for Tao Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome