提交 bd131544 编写于 作者: D Dan Williams 提交者: Ingo Molnar

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: NTony Luck <tony.luck@intel.com>
Signed-off-by: NDan 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.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
上级 da7bc9c5
...@@ -204,13 +204,14 @@ ENTRY(__memcpy_mcsafe) ...@@ -204,13 +204,14 @@ ENTRY(__memcpy_mcsafe)
subl $8, %ecx subl $8, %ecx
negl %ecx negl %ecx
subl %ecx, %edx subl %ecx, %edx
.L_copy_leading_bytes: .L_read_leading_bytes:
movb (%rsi), %al movb (%rsi), %al
.L_write_leading_bytes:
movb %al, (%rdi) movb %al, (%rdi)
incq %rsi incq %rsi
incq %rdi incq %rdi
decl %ecx decl %ecx
jnz .L_copy_leading_bytes jnz .L_read_leading_bytes
.L_8byte_aligned: .L_8byte_aligned:
movl %edx, %ecx movl %edx, %ecx
...@@ -218,13 +219,14 @@ ENTRY(__memcpy_mcsafe) ...@@ -218,13 +219,14 @@ ENTRY(__memcpy_mcsafe)
shrl $3, %ecx shrl $3, %ecx
jz .L_no_whole_words jz .L_no_whole_words
.L_copy_words: .L_read_words:
movq (%rsi), %r8 movq (%rsi), %r8
.L_write_words:
movq %r8, (%rdi) movq %r8, (%rdi)
addq $8, %rsi addq $8, %rsi
addq $8, %rdi addq $8, %rdi
decl %ecx decl %ecx
jnz .L_copy_words jnz .L_read_words
/* Any trailing bytes? */ /* Any trailing bytes? */
.L_no_whole_words: .L_no_whole_words:
...@@ -233,13 +235,14 @@ ENTRY(__memcpy_mcsafe) ...@@ -233,13 +235,14 @@ ENTRY(__memcpy_mcsafe)
/* Copy trailing bytes */ /* Copy trailing bytes */
movl %edx, %ecx movl %edx, %ecx
.L_copy_trailing_bytes: .L_read_trailing_bytes:
movb (%rsi), %al movb (%rsi), %al
.L_write_trailing_bytes:
movb %al, (%rdi) movb %al, (%rdi)
incq %rsi incq %rsi
incq %rdi incq %rdi
decl %ecx decl %ecx
jnz .L_copy_trailing_bytes jnz .L_read_trailing_bytes
/* Copy successful. Return zero */ /* Copy successful. Return zero */
.L_done_memcpy_trap: .L_done_memcpy_trap:
...@@ -256,7 +259,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe) ...@@ -256,7 +259,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe)
.previous .previous
_ASM_EXTABLE_FAULT(.L_copy_leading_bytes, .L_memcpy_mcsafe_fail) _ASM_EXTABLE_FAULT(.L_read_leading_bytes, .L_memcpy_mcsafe_fail)
_ASM_EXTABLE_FAULT(.L_copy_words, .L_memcpy_mcsafe_fail) _ASM_EXTABLE_FAULT(.L_read_words, .L_memcpy_mcsafe_fail)
_ASM_EXTABLE_FAULT(.L_copy_trailing_bytes, .L_memcpy_mcsafe_fail) _ASM_EXTABLE_FAULT(.L_read_trailing_bytes, .L_memcpy_mcsafe_fail)
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册