Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac022954 authored by Marc Zyngier's avatar Marc Zyngier Committed by Neeraj Upadhyay
Browse files

arm64: compat: Add cp15_32 and cp15_64 handler arrays



We're now ready to start handling CP15 access. Let's add (empty)
arrays for both 32 and 64bit accessors, and the code that deals
with them.

Change-Id: I9be58d3cb42e631924ba739ce34421bbeb6452b5
Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Git-commit: 2a8905e18c55d5576d7a53da495b4de0cfcbc459
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/


Signed-off-by: default avatarNeeraj Upadhyay <neeraju@codeaurora.org>
parent 361efef2
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -612,8 +612,18 @@ static void arm64_compat_skip_faulting_instruction(struct pt_regs *regs,
	arm64_skip_faulting_instruction(regs, sz);
}

static struct sys64_hook cp15_32_hooks[] = {
	{},
};

static struct sys64_hook cp15_64_hooks[] = {
	{},
};

asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
{
	struct sys64_hook *hook, *hook_base;

	if (!cp15_cond_valid(esr, regs)) {
		/*
		 * There is no T16 variant of a CP access, so we
@@ -623,6 +633,24 @@ asmlinkage void __exception do_cp15instr(unsigned int esr, struct pt_regs *regs)
		return;
	}

	switch (ESR_ELx_EC(esr)) {
	case ESR_ELx_EC_CP15_32:
		hook_base = cp15_32_hooks;
		break;
	case ESR_ELx_EC_CP15_64:
		hook_base = cp15_64_hooks;
		break;
	default:
		do_undefinstr(regs);
		return;
	}

	for (hook = hook_base; hook->handler; hook++)
		if ((hook->esr_mask & esr) == hook->esr_val) {
			hook->handler(esr, regs);
			return;
		}

	/*
	 * New cp15 instructions may previously have been undefined at
	 * EL0. Fall back to our usual undefined instruction handler