0001
0002
0003
0004 #include <linux/linkage.h>
0005 #include <asm/asm.h>
0006
0007 #ifndef CONFIG_UML
0008
0009 #ifdef CONFIG_X86_MCE
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 SYM_FUNC_START(copy_mc_fragile)
0021 cmpl $8, %edx
0022
0023 jb .L_no_whole_words
0024
0025
0026 testl $7, %esi
0027
0028 jz .L_8byte_aligned
0029
0030
0031 movl %esi, %ecx
0032 andl $7, %ecx
0033 subl $8, %ecx
0034 negl %ecx
0035 subl %ecx, %edx
0036 .L_read_leading_bytes:
0037 movb (%rsi), %al
0038 .L_write_leading_bytes:
0039 movb %al, (%rdi)
0040 incq %rsi
0041 incq %rdi
0042 decl %ecx
0043 jnz .L_read_leading_bytes
0044
0045 .L_8byte_aligned:
0046 movl %edx, %ecx
0047 andl $7, %edx
0048 shrl $3, %ecx
0049 jz .L_no_whole_words
0050
0051 .L_read_words:
0052 movq (%rsi), %r8
0053 .L_write_words:
0054 movq %r8, (%rdi)
0055 addq $8, %rsi
0056 addq $8, %rdi
0057 decl %ecx
0058 jnz .L_read_words
0059
0060
0061 .L_no_whole_words:
0062 andl %edx, %edx
0063 jz .L_done_memcpy_trap
0064
0065
0066 movl %edx, %ecx
0067 .L_read_trailing_bytes:
0068 movb (%rsi), %al
0069 .L_write_trailing_bytes:
0070 movb %al, (%rdi)
0071 incq %rsi
0072 incq %rdi
0073 decl %ecx
0074 jnz .L_read_trailing_bytes
0075
0076
0077 .L_done_memcpy_trap:
0078 xorl %eax, %eax
0079 .L_done:
0080 RET
0081
0082
0083
0084
0085
0086
0087 .E_read_words:
0088 shll $3, %ecx
0089 .E_leading_bytes:
0090 addl %edx, %ecx
0091 .E_trailing_bytes:
0092 mov %ecx, %eax
0093 jmp .L_done
0094
0095
0096
0097
0098
0099
0100 .E_write_words:
0101 shll $3, %ecx
0102 addl %edx, %ecx
0103 movl %ecx, %edx
0104 jmp copy_mc_fragile_handle_tail
0105
0106 _ASM_EXTABLE_TYPE(.L_read_leading_bytes, .E_leading_bytes, EX_TYPE_DEFAULT_MCE_SAFE)
0107 _ASM_EXTABLE_TYPE(.L_read_words, .E_read_words, EX_TYPE_DEFAULT_MCE_SAFE)
0108 _ASM_EXTABLE_TYPE(.L_read_trailing_bytes, .E_trailing_bytes, EX_TYPE_DEFAULT_MCE_SAFE)
0109 _ASM_EXTABLE(.L_write_leading_bytes, .E_leading_bytes)
0110 _ASM_EXTABLE(.L_write_words, .E_write_words)
0111 _ASM_EXTABLE(.L_write_trailing_bytes, .E_trailing_bytes)
0112
0113 SYM_FUNC_END(copy_mc_fragile)
0114 #endif
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126 SYM_FUNC_START(copy_mc_enhanced_fast_string)
0127 movq %rdi, %rax
0128 movq %rdx, %rcx
0129 .L_copy:
0130 rep movsb
0131
0132 xorl %eax, %eax
0133 RET
0134
0135 .E_copy:
0136
0137
0138
0139
0140
0141
0142
0143 movq %rcx, %rax
0144 RET
0145
0146 _ASM_EXTABLE_TYPE(.L_copy, .E_copy, EX_TYPE_DEFAULT_MCE_SAFE)
0147
0148 SYM_FUNC_END(copy_mc_enhanced_fast_string)
0149 #endif