assembler.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * arch/arm/include/asm/assembler.h
  3. *
  4. * Copyright (C) 1996-2000 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * This file contains arm architecture specific defines
  11. * for the different processors.
  12. *
  13. * Do not include any C declarations in this file - it is included by
  14. * assembler source.
  15. */
  16. #include <config.h>
  17. #include <asm/unified.h>
  18. /*
  19. * Endian independent macros for shifting bytes within registers.
  20. */
  21. #ifndef __ARMEB__
  22. #define lspull lsr
  23. #define lspush lsl
  24. #define get_byte_0 lsl #0
  25. #define get_byte_1 lsr #8
  26. #define get_byte_2 lsr #16
  27. #define get_byte_3 lsr #24
  28. #define put_byte_0 lsl #0
  29. #define put_byte_1 lsl #8
  30. #define put_byte_2 lsl #16
  31. #define put_byte_3 lsl #24
  32. #else
  33. #define lspull lsl
  34. #define lspush lsr
  35. #define get_byte_0 lsr #24
  36. #define get_byte_1 lsr #16
  37. #define get_byte_2 lsr #8
  38. #define get_byte_3 lsl #0
  39. #define put_byte_0 lsl #24
  40. #define put_byte_1 lsl #16
  41. #define put_byte_2 lsl #8
  42. #define put_byte_3 lsl #0
  43. #endif
  44. /*
  45. * Data preload for architectures that support it
  46. */
  47. #if defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) || \
  48. defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \
  49. defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || \
  50. defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_7A__) || \
  51. defined(__ARM_ARCH_7R__)
  52. #define PLD(code...) code
  53. #else
  54. #define PLD(code...)
  55. #endif
  56. /*
  57. * We only support cores that support at least Thumb-1 and thus we use
  58. * 'bx lr'
  59. */
  60. .irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
  61. .macro ret\c, reg
  62. .ifeqs "\reg", "lr"
  63. bx\c \reg
  64. .else
  65. mov\c pc, \reg
  66. .endif
  67. .endm
  68. .endr
  69. /*
  70. * Cache aligned, used for optimized memcpy/memset
  71. * In the kernel this is only enabled for Feroceon CPU's...
  72. * We disable it especially for Thumb builds since those instructions
  73. * are not made in a Thumb ready way...
  74. */
  75. #if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
  76. #define CALGN(code...)
  77. #else
  78. #define CALGN(code...) code
  79. #endif