aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2015-02-26 17:40:35 -0500
committerIngo Molnar <mingo@kernel.org>2015-03-04 16:50:52 -0500
commit14f6e9532dda399a7b789f744dc045f8865a9e42 (patch)
tree6b293be6798770ae65e9dbe4fdf37175240e3682 /arch/x86
parentebfc453e27c676e104378366a0b027e5c6918631 (diff)
x86/asm/entry/64/compat: Fold the IA32_ARG_FIXUP macro into its callers
Use of a small macro - one with conditional expansion - does more harm than good. It obfuscates code, with minimal code reuse. For example, because of obfuscation it's not obvious that in 'ia32_sysenter_target', we can optimize loading of r9 - currently it is loaded with a detour through ebp. This patch folds the IA32_ARG_FIXUP macro into its callers. No code changes. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> Signed-off-by: Andy Lutomirski <luto@amacapital.net> Cc: Alexei Starovoitov <ast@plumgrid.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Will Drewry <wad@chromium.org> Link: http://lkml.kernel.org/r/4da092094cd78734384ac31e0d4ec1d8f69145a2.1424989793.git.luto@amacapital.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/ia32/ia32entry.S32
1 files changed, 18 insertions, 14 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index b5670564a1fb..6dcd37256979 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -30,17 +30,6 @@
30 30
31 .section .entry.text, "ax" 31 .section .entry.text, "ax"
32 32
33 .macro IA32_ARG_FIXUP noebp=0
34 movl %edi,%r8d
35 .if \noebp
36 .else
37 movl %ebp,%r9d
38 .endif
39 xchg %ecx,%esi
40 movl %ebx,%edi
41 movl %edx,%edx /* zero extension */
42 .endm
43
44 /* clobbers %rax */ 33 /* clobbers %rax */
45 .macro CLEAR_RREGS _r9=rax 34 .macro CLEAR_RREGS _r9=rax
46 xorl %eax,%eax 35 xorl %eax,%eax
@@ -178,7 +167,12 @@ sysenter_flags_fixed:
178 cmpq $(IA32_NR_syscalls-1),%rax 167 cmpq $(IA32_NR_syscalls-1),%rax
179 ja ia32_badsys 168 ja ia32_badsys
180sysenter_do_call: 169sysenter_do_call:
181 IA32_ARG_FIXUP 170 /* 32bit syscall -> 64bit C ABI argument conversion */
171 movl %edi,%r8d /* arg5 */
172 movl %ebp,%r9d /* arg6 */
173 xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */
174 movl %ebx,%edi /* arg1 */
175 movl %edx,%edx /* arg3 (zero extension) */
182sysenter_dispatch: 176sysenter_dispatch:
183 call *ia32_sys_call_table(,%rax,8) 177 call *ia32_sys_call_table(,%rax,8)
184 movq %rax,RAX(%rsp) 178 movq %rax,RAX(%rsp)
@@ -360,7 +354,12 @@ ENTRY(ia32_cstar_target)
360 cmpq $IA32_NR_syscalls-1,%rax 354 cmpq $IA32_NR_syscalls-1,%rax
361 ja ia32_badsys 355 ja ia32_badsys
362cstar_do_call: 356cstar_do_call:
363 IA32_ARG_FIXUP 1 357 /* 32bit syscall -> 64bit C ABI argument conversion */
358 movl %edi,%r8d /* arg5 */
359 /* r9 already loaded */ /* arg6 */
360 xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */
361 movl %ebx,%edi /* arg1 */
362 movl %edx,%edx /* arg3 (zero extension) */
364cstar_dispatch: 363cstar_dispatch:
365 call *ia32_sys_call_table(,%rax,8) 364 call *ia32_sys_call_table(,%rax,8)
366 movq %rax,RAX(%rsp) 365 movq %rax,RAX(%rsp)
@@ -477,7 +476,12 @@ ENTRY(ia32_syscall)
477 cmpq $(IA32_NR_syscalls-1),%rax 476 cmpq $(IA32_NR_syscalls-1),%rax
478 ja ia32_badsys 477 ja ia32_badsys
479ia32_do_call: 478ia32_do_call:
480 IA32_ARG_FIXUP 479 /* 32bit syscall -> 64bit C ABI argument conversion */
480 movl %edi,%r8d /* arg5 */
481 movl %ebp,%r9d /* arg6 */
482 xchg %ecx,%esi /* rsi:arg2, rcx:arg4 */
483 movl %ebx,%edi /* arg1 */
484 movl %edx,%edx /* arg3 (zero extension) */
481 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative 485 call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
482ia32_sysret: 486ia32_sysret:
483 movq %rax,RAX(%rsp) 487 movq %rax,RAX(%rsp)