Commit 838feb47549a9b73534c6c1d7da4a9639a0750f4

Authored by Borislav Petkov
Committed by H. Peter Anvin
1 parent cac0e0a78f

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>

Showing 3 changed files with 12 additions and 17 deletions Side-by-side Diff

arch/x86/ia32/ia32entry.S
... ... @@ -173,7 +173,7 @@
173 173 andl $~0x200,EFLAGS-R11(%rsp)
174 174 movl RIP-R11(%rsp),%edx /* User %eip */
175 175 CFI_REGISTER rip,rdx
176   - RESTORE_ARGS 1,24,1,1,1,1
  176 + RESTORE_ARGS 0,24,0,0,0,0
177 177 xorq %r8,%r8
178 178 xorq %r9,%r9
179 179 xorq %r10,%r10
... ... @@ -328,7 +328,7 @@
328 328 jnz sysretl_audit
329 329 sysretl_from_sys_call:
330 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 332 movl RIP-ARGOFFSET(%rsp),%ecx
333 333 CFI_REGISTER rip,rcx
334 334 movl EFLAGS-ARGOFFSET(%rsp),%r11d
arch/x86/include/asm/calling.h
... ... @@ -109,32 +109,27 @@
109 109  
110 110 #define ARG_SKIP (9*8)
111 111  
112   - .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \
113   - skipr8910=0, skiprdx=0
114   - .if \skipr11
115   - .else
  112 + .macro RESTORE_ARGS rstor_rax=1, addskip=0, rstor_rcx=1, rstor_r11=1, \
  113 + rstor_r8910=1, rstor_rdx=1
  114 + .if \rstor_r11
116 115 movq_cfi_restore 0*8, r11
117 116 .endif
118 117  
119   - .if \skipr8910
120   - .else
  118 + .if \rstor_r8910
121 119 movq_cfi_restore 1*8, r10
122 120 movq_cfi_restore 2*8, r9
123 121 movq_cfi_restore 3*8, r8
124 122 .endif
125 123  
126   - .if \skiprax
127   - .else
  124 + .if \rstor_rax
128 125 movq_cfi_restore 4*8, rax
129 126 .endif
130 127  
131   - .if \skiprcx
132   - .else
  128 + .if \rstor_rcx
133 129 movq_cfi_restore 5*8, rcx
134 130 .endif
135 131  
136   - .if \skiprdx
137   - .else
  132 + .if \rstor_rdx
138 133 movq_cfi_restore 6*8, rdx
139 134 .endif
140 135  
... ... @@ -193,7 +188,7 @@
193 188  
194 189 .macro RESTORE_ALL addskip=0
195 190 RESTORE_REST
196   - RESTORE_ARGS 0, \addskip
  191 + RESTORE_ARGS 1, \addskip
197 192 .endm
198 193  
199 194 .macro icebp
arch/x86/kernel/entry_64.S
... ... @@ -508,7 +508,7 @@
508 508 TRACE_IRQS_ON
509 509 movq RIP-ARGOFFSET(%rsp),%rcx
510 510 CFI_REGISTER rip,rcx
511   - RESTORE_ARGS 0,-ARG_SKIP,1
  511 + RESTORE_ARGS 1,-ARG_SKIP,0
512 512 /*CFI_REGISTER rflags,r11*/
513 513 movq PER_CPU_VAR(old_rsp), %rsp
514 514 USERGS_SYSRET64
... ... @@ -858,7 +858,7 @@
858 858 */
859 859 TRACE_IRQS_IRETQ
860 860 restore_args:
861   - RESTORE_ARGS 0,8,0
  861 + RESTORE_ARGS 1,8,1
862 862  
863 863 irq_return:
864 864 INTERRUPT_RETURN