preliminaryDataProcessing.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * linux/arch/arm/mm/alignment.c
  3. *
  4. * Copyright (C) 1995 Linus Torvalds
  5. * Modifications for ARM processor (c) 1995-2001 Russell King
  6. * Thumb alignment fault fixups (c) 2004 MontaVista Software, Inc.
  7. * - Adapted from gdb/sim/arm/thumbemu.c -- Thumb instruction emulation.
  8. * Copyright (C) 1996, Cygnus Software Technologies Ltd.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/moduleparam.h>
  15. #include <linux/compiler.h>
  16. #include <linux/kernel.h>
  17. #include <linux/errno.h>
  18. #include <linux/string.h>
  19. #include <linux/proc_fs.h>
  20. #include <linux/seq_file.h>
  21. #include <linux/init.h>
  22. #include <linux/sched.h>
  23. #include <linux/uaccess.h>
  24. #include <asm/cp15.h>
  25. #include <asm/system_info.h>
  26. #include <asm/unaligned.h>
  27. #include "fault.h"
  28. /*
  29. * 32-bit misaligned trap handler (c) 1998 San Mehat (CCC) -July 1998
  30. * /proc/sys/debug/alignment, modified and integrated into
  31. * Linux 2.1 by Russell King
  32. *
  33. * Speed optimisations and better fault handling by Russell King.
  34. *
  35. * *** NOTE ***
  36. * This code is not portable to processors with late data abort handling.
  37. */
  38. #define CODING_BITS(i) (i & 0x0e000000)
  39. #define LDST_I_BIT(i) (i & (1 << 26)) /* Immediate constant */
  40. #define LDST_P_BIT(i) (i & (1 << 24)) /* Preindex */
  41. #define LDST_U_BIT(i) (i & (1 << 23)) /* Add offset */
  42. #define LDST_W_BIT(i) (i & (1 << 21)) /* Writeback */
  43. #define LDST_L_BIT(i) (i & (1 << 20)) /* Load */
  44. #define LDST_P_EQ_U(i) ((((i) ^ ((i) >> 1)) & (1 << 23)) == 0)
  45. #define LDSTHD_I_BIT(i) (i & (1 << 22)) /* double/half-word immed */
  46. #define LDM_S_BIT(i) (i & (1 << 22)) /* write CPSR from SPSR */
  47. #define RN_BITS(i) ((i >> 16) & 15) /* Rn */
  48. #define RD_BITS(i) ((i >> 12) & 15) /* Rd */
  49. #define RM_BITS(i) (i & 15) /* Rm */
  50. #define REGMASK_BITS(i) (i & 0xffff)
  51. #define OFFSET_BITS(i) (i & 0x0fff)
  52. #define IS_SHIFT(i) (i & 0x0ff0)
  53. #define SHIFT_BITS(i) ((i >> 7) & 0x1f)
  54. #define SHIFT_TYPE(i) (i & 0x60)
  55. #define SHIFT_LSL 0x00
  56. #define SHIFT_LSR 0x20