aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@alien8.de>2011-05-31 16:21:53 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2011-06-03 17:38:53 -0400
commit838feb47549a9b73534c6c1d7da4a9639a0750f4 (patch)
tree8a8bba854694e69fc010f5dad6911949c1649384
parentcac0e0a78f722abd85b7f8d614ee0820f7672f58 (diff)
x86, asm: Flip RESTORE_ARGS arguments logic
... thus getting rid of the "else" part of the conditional statement in the macro. No functionality change. Signed-off-by: Borislav Petkov <bp@alien8.de> Link: http://lkml.kernel.org/r/1306873314-32523-4-git-send-email-bp@alien8.de Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r--arch/x86/ia32/ia32entry.S4
-rw-r--r--arch/x86/include/asm/calling.h21
-rw-r--r--arch/x86/kernel/entry_64.S4
3 files changed, 12 insertions, 17 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index c5435dcea15c..a0e866d233ee 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -173,7 +173,7 @@ sysexit_from_sys_call:
173 andl $~0x200,EFLAGS-R11(%rsp) 173 andl $~0x200,EFLAGS-R11(%rsp)
174 movl RIP-R11(%rsp),%edx /* User %eip */ 174 movl RIP-R11(%rsp),%edx /* User %eip */
175 CFI_REGISTER rip,rdx 175 CFI_REGISTER rip,rdx
176 RESTORE_ARGS 1,24,1,1,1,1 176 RESTORE_ARGS 0,24,0,0,0,0
177 xorq %r8,%r8 177 xorq %r8,%r8
178 xorq %r9,%r9 178 xorq %r9,%r9
179 xorq %r10,%r10 179 xorq %r10,%r10
@@ -328,7 +328,7 @@ cstar_dispatch:
328 jnz sysretl_audit 328 jnz sysretl_audit
329sysretl_from_sys_call: 329sysretl_from_sys_call:
330 andl $~TS_COMPAT,TI_status(%r10) 330 andl $~TS_COMPAT,TI_status(%r10)
331 RESTORE_ARGS 1,-ARG_SKIP,1,1,1 331 RESTORE_ARGS 0,-ARG_SKIP,0,0,0
332 movl RIP-ARGOFFSET(%rsp),%ecx 332 movl RIP-ARGOFFSET(%rsp),%ecx
333 CFI_REGISTER rip,rcx 333 CFI_REGISTER rip,rcx
334 movl EFLAGS-ARGOFFSET(%rsp),%r11d 334 movl EFLAGS-ARGOFFSET(%rsp),%r11d
diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h
index b0b7d90d3054..a9e3a740f697 100644
--- a/arch/x86/include/asm/calling.h
+++ b/arch/x86/include/asm/calling.h
@@ -109,32 +109,27 @@ For 32-bit we have the following conventions - kernel is built with
109 109
110#define ARG_SKIP (9*8) 110#define ARG_SKIP (9*8)
111 111
112 .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \ 112 .macro RESTORE_ARGS rstor_rax=1, addskip=0, rstor_rcx=1, rstor_r11=1, \
113 skipr8910=0, skiprdx=0 113 rstor_r8910=1, rstor_rdx=1
114 .if \skipr11 114 .if \rstor_r11
115 .else
116 movq_cfi_restore 0*8, r11 115 movq_cfi_restore 0*8, r11
117 .endif 116 .endif
118 117
119 .if \skipr8910 118 .if \rstor_r8910
120 .else
121 movq_cfi_restore 1*8, r10 119 movq_cfi_restore 1*8, r10
122 movq_cfi_restore 2*8, r9 120 movq_cfi_restore 2*8, r9
123 movq_cfi_restore 3*8, r8 121 movq_cfi_restore 3*8, r8
124 .endif 122 .endif
125 123
126 .if \skiprax 124 .if \rstor_rax
127 .else
128 movq_cfi_restore 4*8, rax 125 movq_cfi_restore 4*8, rax
129 .endif 126 .endif
130 127
131 .if \skiprcx 128 .if \rstor_rcx
132 .else
133 movq_cfi_restore 5*8, rcx 129 movq_cfi_restore 5*8, rcx
134 .endif 130 .endif
135 131
136 .if \skiprdx 132 .if \rstor_rdx
137 .else
138 movq_cfi_restore 6*8, rdx 133 movq_cfi_restore 6*8, rdx
139 .endif 134 .endif
140 135
@@ -193,7 +188,7 @@ For 32-bit we have the following conventions - kernel is built with
193 188
194 .macro RESTORE_ALL addskip=0 189 .macro RESTORE_ALL addskip=0
195 RESTORE_REST 190 RESTORE_REST
196 RESTORE_ARGS 0, \addskip 191 RESTORE_ARGS 1, \addskip
197 .endm 192 .endm
198 193
199 .macro icebp 194 .macro icebp
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e5ece6b6e716..0412bcbe171c 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -508,7 +508,7 @@ sysret_check:
508 TRACE_IRQS_ON 508 TRACE_IRQS_ON
509 movq RIP-ARGOFFSET(%rsp),%rcx 509 movq RIP-ARGOFFSET(%rsp),%rcx
510 CFI_REGISTER rip,rcx 510 CFI_REGISTER rip,rcx
511 RESTORE_ARGS 0,-ARG_SKIP,1 511 RESTORE_ARGS 1,-ARG_SKIP,0
512 /*CFI_REGISTER rflags,r11*/ 512 /*CFI_REGISTER rflags,r11*/
513 movq PER_CPU_VAR(old_rsp), %rsp 513 movq PER_CPU_VAR(old_rsp), %rsp
514 USERGS_SYSRET64 514 USERGS_SYSRET64
@@ -858,7 +858,7 @@ retint_restore_args: /* return to kernel space */
858 */ 858 */
859 TRACE_IRQS_IRETQ 859 TRACE_IRQS_IRETQ
860restore_args: 860restore_args:
861 RESTORE_ARGS 0,8,0 861 RESTORE_ARGS 1,8,1
862 862
863irq_return: 863irq_return:
864 INTERRUPT_RETURN 864 INTERRUPT_RETURN