xref: /OK3568_Linux_fs/kernel/arch/arm/mm/abort-ev6.S (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun/* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun#include <linux/linkage.h>
3*4882a593Smuzhiyun#include <asm/assembler.h>
4*4882a593Smuzhiyun#include "abort-macro.S"
5*4882a593Smuzhiyun/*
6*4882a593Smuzhiyun * Function: v6_early_abort
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * Params  : r2 = pt_regs
9*4882a593Smuzhiyun *	   : r4 = aborted context pc
10*4882a593Smuzhiyun *	   : r5 = aborted context psr
11*4882a593Smuzhiyun *
12*4882a593Smuzhiyun * Returns : r4 - r11, r13 preserved
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * Purpose : obtain information about current aborted instruction.
15*4882a593Smuzhiyun * Note: we read user space.  This means we might cause a data
16*4882a593Smuzhiyun * abort here if the I-TLB and D-TLB aren't seeing the same
17*4882a593Smuzhiyun * picture.  Unfortunately, this does happen.  We live with it.
18*4882a593Smuzhiyun */
19*4882a593Smuzhiyun	.align	5
20*4882a593SmuzhiyunENTRY(v6_early_abort)
21*4882a593Smuzhiyun	mrc	p15, 0, r1, c5, c0, 0		@ get FSR
22*4882a593Smuzhiyun	mrc	p15, 0, r0, c6, c0, 0		@ get FAR
23*4882a593Smuzhiyun/*
24*4882a593Smuzhiyun * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR.
25*4882a593Smuzhiyun */
26*4882a593Smuzhiyun#ifdef CONFIG_ARM_ERRATA_326103
27*4882a593Smuzhiyun	ldr	ip, =0x4107b36
28*4882a593Smuzhiyun	mrc	p15, 0, r3, c0, c0, 0		@ get processor id
29*4882a593Smuzhiyun	teq	ip, r3, lsr #4			@ r0 ARM1136?
30*4882a593Smuzhiyun	bne	1f
31*4882a593Smuzhiyun	tst	r5, #PSR_J_BIT			@ Java?
32*4882a593Smuzhiyun	tsteq	r5, #PSR_T_BIT			@ Thumb?
33*4882a593Smuzhiyun	bne	1f
34*4882a593Smuzhiyun	bic	r1, r1, #1 << 11		@ clear bit 11 of FSR
35*4882a593Smuzhiyun	ldr	r3, [r4]			@ read aborted ARM instruction
36*4882a593Smuzhiyun ARM_BE8(rev	r3, r3)
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun	teq_ldrd tmp=ip, insn=r3		@ insn was LDRD?
39*4882a593Smuzhiyun	beq	1f				@ yes
40*4882a593Smuzhiyun	tst	r3, #1 << 20			@ L = 0 -> write
41*4882a593Smuzhiyun	orreq	r1, r1, #1 << 11		@ yes.
42*4882a593Smuzhiyun#endif
43*4882a593Smuzhiyun1:	uaccess_disable ip			@ disable userspace access
44*4882a593Smuzhiyun	b	do_DataAbort
45