diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2015-06-09 14:54:09 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-06-10 02:42:13 -0400 |
commit | a92fde25231a89d7d10895482556260c1b63767d (patch) | |
tree | 1bc361bd96e906d27879bbbb0983db164fa3037b | |
parent | 1536bb46fac7672ef04aaaa6a3b07848314263bc (diff) |
x86/asm/entry/32: Shorten __audit_syscall_entry() args preparation
We use three MOVs to swap edx and ecx. We can use one XCHG
instead.
Expand the comments. It's difficult to keep track which arg#
every register corresponds to, so spell it out.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
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: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Drewry <wad@chromium.org>
Link: http://lkml.kernel.org/r/1433876051-26604-3-git-send-email-dvlasenk@redhat.com
[ Expanded the comments some more. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/entry/entry_64_compat.S | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 0fa108cdf182..bb187a6a877c 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
@@ -178,17 +178,26 @@ sysexit_from_sys_call: | |||
178 | 178 | ||
179 | #ifdef CONFIG_AUDITSYSCALL | 179 | #ifdef CONFIG_AUDITSYSCALL |
180 | .macro auditsys_entry_common | 180 | .macro auditsys_entry_common |
181 | movl %esi, %r8d /* 5th arg: 4th syscall arg */ | 181 | /* |
182 | movl %ecx, %r9d /* swap with edx */ | 182 | * At this point, registers hold syscall args in the 32-bit syscall ABI: |
183 | movl %edx, %ecx /* 4th arg: 3rd syscall arg */ | 183 | * EAX is syscall number, the 6 args are in EBX,ECX,EDX,ESI,EDI,EBP. |
184 | movl %r9d, %edx /* 3rd arg: 2nd syscall arg */ | 184 | * |
185 | movl %ebx, %esi /* 2nd arg: 1st syscall arg */ | 185 | * We want to pass them to __audit_syscall_entry(), which is a 64-bit |
186 | movl %eax, %edi /* 1st arg: syscall number */ | 186 | * C function with 5 parameters, so shuffle them to match what |
187 | * the function expects: RDI,RSI,RDX,RCX,R8. | ||
188 | */ | ||
189 | movl %esi, %r8d /* arg5 (R8 ) <= 4th syscall arg (ESI) */ | ||
190 | xchg %ecx, %edx /* arg4 (RCX) <= 3rd syscall arg (EDX) */ | ||
191 | /* arg3 (RDX) <= 2nd syscall arg (ECX) */ | ||
192 | movl %ebx, %esi /* arg2 (RSI) <= 1st syscall arg (EBX) */ | ||
193 | movl %eax, %edi /* arg1 (RDI) <= syscall number (EAX) */ | ||
187 | call __audit_syscall_entry | 194 | call __audit_syscall_entry |
195 | |||
188 | /* | 196 | /* |
189 | * We are going to jump back to syscall dispatch. | 197 | * We are going to jump back to the syscall dispatch code. |
190 | * Prepare syscall args as required by 64-bit C ABI. | 198 | * Prepare syscall args as required by the 64-bit C ABI. |
191 | * Clobbered registers are loaded from pt_regs on stack. | 199 | * Registers clobbered by __audit_syscall_entry() are |
200 | * loaded from pt_regs on stack: | ||
192 | */ | 201 | */ |
193 | movl ORIG_RAX(%rsp), %eax /* syscall number */ | 202 | movl ORIG_RAX(%rsp), %eax /* syscall number */ |
194 | movl %ebx, %edi /* arg1 */ | 203 | movl %ebx, %edi /* arg1 */ |