Skip to content

Commit bd13154

Browse files
djbwIngo Molnar
authored andcommitted
x86/asm/memcpy_mcsafe: Add labels for __memcpy_mcsafe() write fault handling
The memcpy_mcsafe() implementation handles CPU exceptions when reading from the source address. Before it can be used for user copies it needs to grow support for handling write faults. In preparation for adding that exception handling update the labels for the read cache word X case (.L_cache_rX) and write cache word X case (.L_cache_wX). Reported-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: hch@lst.de Cc: linux-fsdevel@vger.kernel.org Cc: linux-nvdimm@lists.01.org Link: http://lkml.kernel.org/r/152539237606.31796.6719743548991782264.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent da7bc9c commit bd13154

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

arch/x86/lib/memcpy_64.S

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,27 +204,29 @@ ENTRY(__memcpy_mcsafe)
204204
subl $8, %ecx
205205
negl %ecx
206206
subl %ecx, %edx
207-
.L_copy_leading_bytes:
207+
.L_read_leading_bytes:
208208
movb (%rsi), %al
209+
.L_write_leading_bytes:
209210
movb %al, (%rdi)
210211
incq %rsi
211212
incq %rdi
212213
decl %ecx
213-
jnz .L_copy_leading_bytes
214+
jnz .L_read_leading_bytes
214215

215216
.L_8byte_aligned:
216217
movl %edx, %ecx
217218
andl $7, %edx
218219
shrl $3, %ecx
219220
jz .L_no_whole_words
220221

221-
.L_copy_words:
222+
.L_read_words:
222223
movq (%rsi), %r8
224+
.L_write_words:
223225
movq %r8, (%rdi)
224226
addq $8, %rsi
225227
addq $8, %rdi
226228
decl %ecx
227-
jnz .L_copy_words
229+
jnz .L_read_words
228230

229231
/* Any trailing bytes? */
230232
.L_no_whole_words:
@@ -233,13 +235,14 @@ ENTRY(__memcpy_mcsafe)
233235

234236
/* Copy trailing bytes */
235237
movl %edx, %ecx
236-
.L_copy_trailing_bytes:
238+
.L_read_trailing_bytes:
237239
movb (%rsi), %al
240+
.L_write_trailing_bytes:
238241
movb %al, (%rdi)
239242
incq %rsi
240243
incq %rdi
241244
decl %ecx
242-
jnz .L_copy_trailing_bytes
245+
jnz .L_read_trailing_bytes
243246

244247
/* Copy successful. Return zero */
245248
.L_done_memcpy_trap:
@@ -256,7 +259,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
256259

257260
.previous
258261

259-
_ASM_EXTABLE_FAULT(.L_copy_leading_bytes, .L_memcpy_mcsafe_fail)
260-
_ASM_EXTABLE_FAULT(.L_copy_words, .L_memcpy_mcsafe_fail)
261-
_ASM_EXTABLE_FAULT(.L_copy_trailing_bytes, .L_memcpy_mcsafe_fail)
262+
_ASM_EXTABLE_FAULT(.L_read_leading_bytes, .L_memcpy_mcsafe_fail)
263+
_ASM_EXTABLE_FAULT(.L_read_words, .L_memcpy_mcsafe_fail)
264+
_ASM_EXTABLE_FAULT(.L_read_trailing_bytes, .L_memcpy_mcsafe_fail)
262265
#endif

0 commit comments

Comments
 (0)