[PATCH] D37788: [ARM] builtins: Do not abort in clear_cache.

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 16:01:11 PDT 2017


manojgupta added a comment.

The reason linux kernel is returning an error is because the mcr instruction is indeed raising a fault when operating on read only memory. Kernel's fault handler catches it and so it ends up returning -EFAULT.

http://elixir.free-electrons.com/linux/v3.18.71/source/arch/arm/mm/cache-v7.S#L259

ENTRY(v7_coherent_user_range)
 UNWIND(.fnstart		)
	dcache_line_size r2, r3
	sub	r3, r2, #1
	bic	r12, r0, r3
#ifdef CONFIG_ARM_ERRATA_764369
	ALT_SMP(W(dsb))
	ALT_UP(W(nop))
#endif
1:
 USER(	mcr	p15, 0, r12, c7, c11, 1	)	@ clean D line to the point of unification // This instruction raises a fault if memory is read only.

This code is unchanged between Linux kernel 3.xx to the current kernel 4.14 .


https://reviews.llvm.org/D37788





More information about the llvm-commits mailing list