Re: [PATCH] sparc64: Handle additional cases of no fault loads

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/08/2017 09:03 AM, Sam Ravnborg wrote:
Hi Rob.

diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index ad31af1..c49949c 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -265,6 +265,34 @@ void sun4v_insn_access_exception_tl1(struct pt_regs *regs, unsigned long addr, u
  	sun4v_insn_access_exception(regs, addr, type_ctx);
  }
+bool is_no_fault_exception(struct pt_regs *regs)
+{
+	unsigned char asi;
+	u32 insn;
+
+	if (get_user(insn, (u32 __user *)regs->tpc) == -EFAULT)
+		return false;
+
+	if ((insn & 0xc0800000) == 0xc0800000) {
+		if (insn & 0x2000)
+			asi = (regs->tstate >> 24);
+		else
+			asi = (insn >> 5);
The constants used in the above code is pure magic
for peopel without any initimate knowledge of sparc.
Could at a abre minimum add a few comments that explains
what is going on.

Thanks for pointing this out. I was trying to keep the code close to that found in do_kernel_fault(), but I agree it would be better to add some explanatory comments. Will revise.

Rob




+		if ((asi & 0xf2) == ASI_PNF) {
+			if (insn & 0x1000000) {
+				handle_ldf_stq(insn, regs);
+				return true;
+			} else if (insn & 0x200000) {
+				/* store instruction, do not handle */
+				return false;
+			}
Likewise

+			handle_ld_nf(insn, regs);
+			return true;
+		}
+	}
+	return false;
+}
	Sam
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux