public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/asm/entry/32: Open-code CLEAR_RREGS. No code changes.
@ 2015-06-02 19:04 Denys Vlasenko
  2015-06-02 19:04 ` [PATCH 2/2] x86/asm/entry/32: Open-code LOAD_ARGS32. " Denys Vlasenko
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Denys Vlasenko @ 2015-06-02 19:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Denys Vlasenko, Linus Torvalds, Steven Rostedt, Borislav Petkov,
	H. Peter Anvin, Andy Lutomirski, Oleg Nesterov,
	Frederic Weisbecker, Alexei Starovoitov, Will Drewry, Kees Cook,
	x86, linux-kernel

This macro is small, has only four callsites, and one of them is
slightly different using a conditional parameter.

A few saved lines aren't worth the resulting obfuscation.

Generated machine code is identical.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
CC: Linus Torvalds <torvalds@linux-foundation.org>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@kernel.org>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andy Lutomirski <luto@amacapital.net>
CC: Oleg Nesterov <oleg@redhat.com>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Alexei Starovoitov <ast@plumgrid.com>
CC: Will Drewry <wad@chromium.org>
CC: Kees Cook <keescook@chromium.org>
CC: x86@kernel.org
CC: linux-kernel@vger.kernel.org
---

These two patches are on top of "Simplify zeroing of pt_regs->r8..r11" patch.

 arch/x86/ia32/ia32entry.S | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 2801cbe..86cbfe6 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -29,15 +29,6 @@
 
 	.section .entry.text, "ax"
 
-	/* clobbers %rax */
-	.macro  CLEAR_RREGS _r9=rax
-	xorl 	%eax,%eax
-	movq	%rax,R11(%rsp)
-	movq	%rax,R10(%rsp)
-	movq	%\_r9,R9(%rsp)
-	movq	%rax,R8(%rsp)
-	.endm
-
 	/*
 	 * Reload arg registers from stack in case ptrace changed them.
 	 * We don't reload %eax because syscall_trace_enter() returned
@@ -243,7 +234,11 @@ sysexit_from_sys_call:
 	TRACE_IRQS_OFF
 	testl %edi, ASM_THREAD_INFO(TI_flags, %rsp, SIZEOF_PTREGS)
 	jz \exit
-	CLEAR_RREGS
+	xorl	%eax, %eax
+	movq	%rax, R11(%rsp)
+	movq	%rax, R10(%rsp)
+	movq	%rax, R9(%rsp)
+	movq	%rax, R8(%rsp)
 	jmp int_with_check
 	.endm
 
@@ -267,7 +262,11 @@ sysenter_tracesys:
 	jz	sysenter_auditsys
 #endif
 	SAVE_EXTRA_REGS
-	CLEAR_RREGS
+	xorl	%eax, %eax
+	movq	%rax, R11(%rsp)
+	movq	%rax, R10(%rsp)
+	movq	%rax, R9(%rsp)
+	movq	%rax, R8(%rsp)
 	movq	%rsp,%rdi        /* &pt_regs -> arg1 */
 	call	syscall_trace_enter
 	LOAD_ARGS32  /* reload args from stack in case ptrace changed it */
@@ -407,7 +406,11 @@ cstar_tracesys:
 #endif
 	xchgl %r9d,%ebp
 	SAVE_EXTRA_REGS
-	CLEAR_RREGS r9
+	xorl	%eax, %eax
+	movq	%rax, R11(%rsp)
+	movq	%rax, R10(%rsp)
+	movq	%r9, R9(%rsp)
+	movq	%rax, R8(%rsp)
 	movq %rsp,%rdi        /* &pt_regs -> arg1 */
 	call syscall_trace_enter
 	LOAD_ARGS32 1	/* reload args from stack in case ptrace changed it */
@@ -422,7 +425,11 @@ ia32_badarg:
 	jmp ia32_sysret
 
 ia32_ret_from_sys_call:
-	CLEAR_RREGS
+	xorl	%eax, %eax
+	movq	%rax, R11(%rsp)
+	movq	%rax, R10(%rsp)
+	movq	%rax, R9(%rsp)
+	movq	%rax, R8(%rsp)
 	jmp int_ret_from_sys_call
 
 /*
-- 
1.8.1.4


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

end of thread, other threads:[~2015-06-07  8:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 19:04 [PATCH 1/2] x86/asm/entry/32: Open-code CLEAR_RREGS. No code changes Denys Vlasenko
2015-06-02 19:04 ` [PATCH 2/2] x86/asm/entry/32: Open-code LOAD_ARGS32. " Denys Vlasenko
2015-06-02 19:27   ` Borislav Petkov
2015-06-07  8:31   ` [tip:x86/asm] x86/asm/entry/32: Open-code LOAD_ARGS32 tip-bot for Denys Vlasenko
2015-06-02 19:34 ` [PATCH 1/2] x86/asm/entry/32: Open-code CLEAR_RREGS. No code changes Steven Rostedt
2015-06-02 20:25   ` Denys Vlasenko
2015-06-03  7:04   ` Ingo Molnar
2015-06-07  8:31 ` [tip:x86/asm] x86/asm/entry/32: Open-code CLEAR_RREGS tip-bot for Denys Vlasenko

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