|
@@ -0,0 +1,65 @@
|
|
|
|
+/*
|
|
|
|
+ * linux/arch/arm/mm/alignment.c
|
|
|
|
+ *
|
|
|
|
+ * Copyright (C) 1995 Linus Torvalds
|
|
|
|
+ * Modifications for ARM processor (c) 1995-2001 Russell King
|
|
|
|
+ * Thumb alignment fault fixups (c) 2004 MontaVista Software, Inc.
|
|
|
|
+ * - Adapted from gdb/sim/arm/thumbemu.c -- Thumb instruction emulation.
|
|
|
|
+ * Copyright (C) 1996, Cygnus Software Technologies Ltd.
|
|
|
|
+ *
|
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License version 2 as
|
|
|
|
+ * published by the Free Software Foundation.
|
|
|
|
+ */
|
|
|
|
+#include <linux/moduleparam.h>
|
|
|
|
+#include <linux/compiler.h>
|
|
|
|
+#include <linux/kernel.h>
|
|
|
|
+#include <linux/errno.h>
|
|
|
|
+#include <linux/string.h>
|
|
|
|
+#include <linux/proc_fs.h>
|
|
|
|
+#include <linux/seq_file.h>
|
|
|
|
+#include <linux/init.h>
|
|
|
|
+#include <linux/sched.h>
|
|
|
|
+#include <linux/uaccess.h>
|
|
|
|
+
|
|
|
|
+#include <asm/cp15.h>
|
|
|
|
+#include <asm/system_info.h>
|
|
|
|
+#include <asm/unaligned.h>
|
|
|
|
+
|
|
|
|
+#include "fault.h"
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * 32-bit misaligned trap handler (c) 1998 San Mehat (CCC) -July 1998
|
|
|
|
+ * /proc/sys/debug/alignment, modified and integrated into
|
|
|
|
+ * Linux 2.1 by Russell King
|
|
|
|
+ *
|
|
|
|
+ * Speed optimisations and better fault handling by Russell King.
|
|
|
|
+ *
|
|
|
|
+ * *** NOTE ***
|
|
|
|
+ * This code is not portable to processors with late data abort handling.
|
|
|
|
+ */
|
|
|
|
+#define CODING_BITS(i) (i & 0x0e000000)
|
|
|
|
+
|
|
|
|
+#define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
|
|
|
|
+#define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
|
|
|
|
+#define LDST_U_BIT(i) (i & (1 << 23)) /* Add offset */
|
|
|
|
+#define LDST_W_BIT(i) (i & (1 << 21)) /* Writeback */
|
|
|
|
+#define LDST_L_BIT(i) (i & (1 << 20)) /* Load */
|
|
|
|
+
|
|
|
|
+#define LDST_P_EQ_U(i) ((((i) ^ ((i) >> 1)) & (1 << 23)) == 0)
|
|
|
|
+
|
|
|
|
+#define LDSTHD_I_BIT(i) (i & (1 << 22)) /* double/half-word immed */
|
|
|
|
+#define LDM_S_BIT(i) (i & (1 << 22)) /* write CPSR from SPSR */
|
|
|
|
+
|
|
|
|
+#define RN_BITS(i) ((i >> 16) & 15) /* Rn */
|
|
|
|
+#define RD_BITS(i) ((i >> 12) & 15) /* Rd */
|
|
|
|
+#define RM_BITS(i) (i & 15) /* Rm */
|
|
|
|
+
|
|
|
|
+#define REGMASK_BITS(i) (i & 0xffff)
|
|
|
|
+#define OFFSET_BITS(i) (i & 0x0fff)
|
|
|
|
+
|
|
|
|
+#define IS_SHIFT(i) (i & 0x0ff0)
|
|
|
|
+#define SHIFT_BITS(i) ((i >> 7) & 0x1f)
|
|
|
|
+#define SHIFT_TYPE(i) (i & 0x60)
|
|
|
|
+#define SHIFT_LSL 0x00
|
|
|
|
+#define SHIFT_LSR 0x20
|