On 18.02.2016 21:47, Tony Luck wrote:
> Make use of the EXTABLE_FAULT exception table entries to write
> a kernel copy routine that doesn't crash the system if it
> encounters a machine check. Prime use case for this is to copy
> from large arrays of non-volatile memory used as storage.
>
> We have to use an unrolled copy loop for now because current
> hardware implementations treat a machine check in "rep mov"
> as fatal. When that is fixed we can simplify.
>
> Signed-off-by: Tony Luck <tony.l...@intel.com>
> ---
>
> Is this what we want now?  Return type is a "bool". True means
> that we copied OK, false means that it didn't (this is all that
> Dan says that he needs).  Dropped all the complex code to figure
> out how many bytes we didn't copy as Linus says this isn't the
> right place to do this (and besides we should just make "rep mov"
>
> +
> +     /* Copy successful. Return true */
> +.L_done_memcpy_trap:
> +     xorq %rax, %rax
> +     ret
> +ENDPROC(memcpy_mcsafe)
> +
> +     .section .fixup, "ax"
> +     /* Return false for any failure */
> +.L_memcpy_mcsafe_fail:
> +     mov     $1, %rax
> +     ret
> +
>
But you return 0 == false for success and 1 == true for failure.

--Mika

Reply via email to