Skip to content

Commit acba44d

Browse files
author
Peter Zijlstra
committed
x86/copy_user_64: Remove .fixup usage
Place the anonymous .fixup code at the tail of the regular functions. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Josh Poimboeuf <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c6dbd3e commit acba44d

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

arch/x86/lib/copy_user_64.S

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,10 @@
3232
decl %ecx
3333
jnz 100b
3434
102:
35-
.section .fixup,"ax"
36-
103: addl %ecx,%edx /* ecx is zerorest also */
37-
jmp .Lcopy_user_handle_tail
38-
.previous
3935

40-
_ASM_EXTABLE_CPY(100b, 103b)
41-
_ASM_EXTABLE_CPY(101b, 103b)
42-
.endm
36+
_ASM_EXTABLE_CPY(100b, .Lcopy_user_handle_align)
37+
_ASM_EXTABLE_CPY(101b, .Lcopy_user_handle_align)
38+
.endm
4339

4440
/*
4541
* copy_user_generic_unrolled - memory copy with exception handling.
@@ -107,15 +103,13 @@ SYM_FUNC_START(copy_user_generic_unrolled)
107103
ASM_CLAC
108104
RET
109105

110-
.section .fixup,"ax"
111106
30: shll $6,%ecx
112107
addl %ecx,%edx
113108
jmp 60f
114109
40: leal (%rdx,%rcx,8),%edx
115110
jmp 60f
116111
50: movl %ecx,%edx
117112
60: jmp .Lcopy_user_handle_tail /* ecx is zerorest also */
118-
.previous
119113

120114
_ASM_EXTABLE_CPY(1b, 30b)
121115
_ASM_EXTABLE_CPY(2b, 30b)
@@ -166,20 +160,16 @@ SYM_FUNC_START(copy_user_generic_string)
166160
movl %edx,%ecx
167161
shrl $3,%ecx
168162
andl $7,%edx
169-
1: rep
170-
movsq
163+
1: rep movsq
171164
2: movl %edx,%ecx
172-
3: rep
173-
movsb
165+
3: rep movsb
174166
xorl %eax,%eax
175167
ASM_CLAC
176168
RET
177169

178-
.section .fixup,"ax"
179170
11: leal (%rdx,%rcx,8),%ecx
180171
12: movl %ecx,%edx /* ecx is zerorest also */
181172
jmp .Lcopy_user_handle_tail
182-
.previous
183173

184174
_ASM_EXTABLE_CPY(1b, 11b)
185175
_ASM_EXTABLE_CPY(3b, 12b)
@@ -203,16 +193,13 @@ SYM_FUNC_START(copy_user_enhanced_fast_string)
203193
cmpl $64,%edx
204194
jb .L_copy_short_string /* less then 64 bytes, avoid the costly 'rep' */
205195
movl %edx,%ecx
206-
1: rep
207-
movsb
196+
1: rep movsb
208197
xorl %eax,%eax
209198
ASM_CLAC
210199
RET
211200

212-
.section .fixup,"ax"
213201
12: movl %ecx,%edx /* ecx is zerorest also */
214202
jmp .Lcopy_user_handle_tail
215-
.previous
216203

217204
_ASM_EXTABLE_CPY(1b, 12b)
218205
SYM_FUNC_END(copy_user_enhanced_fast_string)
@@ -240,6 +227,11 @@ SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail)
240227
RET
241228

242229
_ASM_EXTABLE_CPY(1b, 2b)
230+
231+
.Lcopy_user_handle_align:
232+
addl %ecx,%edx /* ecx is zerorest also */
233+
jmp .Lcopy_user_handle_tail
234+
243235
SYM_CODE_END(.Lcopy_user_handle_tail)
244236

245237
/*
@@ -350,7 +342,6 @@ SYM_FUNC_START(__copy_user_nocache)
350342
sfence
351343
RET
352344

353-
.section .fixup,"ax"
354345
.L_fixup_4x8b_copy:
355346
shll $6,%ecx
356347
addl %ecx,%edx
@@ -366,7 +357,6 @@ SYM_FUNC_START(__copy_user_nocache)
366357
.L_fixup_handle_tail:
367358
sfence
368359
jmp .Lcopy_user_handle_tail
369-
.previous
370360

371361
_ASM_EXTABLE_CPY(1b, .L_fixup_4x8b_copy)
372362
_ASM_EXTABLE_CPY(2b, .L_fixup_4x8b_copy)

0 commit comments

Comments
 (0)