aarch64_defs.M1 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ## Copyright (C) 2020 deesix <deesix@tuta.io>
  2. ## Copyright (C) 2020 Sanne Wouda
  3. ## This file is part of M2-Planet.
  4. ##
  5. ## M2-Planet is free software: you can redistribute it and/or modify
  6. ## it under the terms of the GNU General Public License as published by
  7. ## the Free Software Foundation, either version 3 of the License, or
  8. ## (at your option) any later version.
  9. ##
  10. ## M2-Planet is distributed in the hope that it will be useful,
  11. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ## GNU General Public License for more details.
  14. ##
  15. ## You should have received a copy of the GNU General Public License
  16. ## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
  17. DEFINE NULL 0000000000000000
  18. # Stack (x18 as SP, 64 bits per element)
  19. DEFINE PUSH_X0 408e1ff8
  20. DEFINE PUSH_X1 418e1ff8
  21. DEFINE PUSH_X16 508e1ff8
  22. DEFINE PUSH_BP 518e1ff8
  23. DEFINE PUSH_LR 5e8e1ff8
  24. DEFINE POP_X0 408640f8
  25. DEFINE POP_X1 418640f8
  26. DEFINE POP_X16 508640f8
  27. DEFINE POP_BP 518640f8
  28. DEFINE POP_LR 5e8640f8
  29. DEFINE INIT_SP f2030091 # mov x18, sp
  30. # Jump/branch/call/return
  31. DEFINE BR_X16 00021fd6
  32. DEFINE BLR_X16 00023fd6
  33. DEFINE RETURN c0035fd6
  34. DEFINE CBZ_X0_PAST_BR a00000b4
  35. DEFINE CBNZ_X0_PAST_BR a00000b5
  36. DEFINE SKIP_INST_EQ 40000054
  37. DEFINE SKIP_INST_NE 41000054
  38. DEFINE SKIP_INST_LT 4b000054
  39. DEFINE SKIP_INST_LE 4d000054
  40. DEFINE SKIP_INST_GT 4c000054
  41. DEFINE SKIP_INST_GE 4a000054
  42. DEFINE SKIP_INST_LO 43000054
  43. DEFINE SKIP_INST_LS 49000054
  44. DEFINE SKIP_INST_HS 42000054
  45. DEFINE SKIP_INST_HI 48000054
  46. DEFINE SKIP_32_DATA 02000014
  47. # Load literals (PC-relative)
  48. DEFINE LOAD_W0_AHEAD 40000098
  49. DEFINE LOAD_W1_AHEAD 41000018
  50. DEFINE LOAD_W2_AHEAD 42000018
  51. DEFINE LOAD_W16_AHEAD 50000018
  52. # Load/store/dereference
  53. DEFINE LDR_X0_[SP] 400240f9
  54. DEFINE STR_X0_[X1] 200000f9
  55. DEFINE STR_BYTE_W0_[X1] 20000039
  56. DEFINE DEREF_X0 000040f9
  57. DEFINE DEREF_X0_BYTE 00004039
  58. # Move data between registers
  59. DEFINE SET_X0_FROM_BP e00311aa
  60. DEFINE SET_X1_FROM_X0 e10300aa
  61. DEFINE SET_X1_FROM_SP e10312aa
  62. DEFINE SET_X2_FROM_X0 e20300aa
  63. DEFINE SET_X3_FROM_X0 e30300aa
  64. DEFINE SET_X4_FROM_X0 e40300aa
  65. DEFINE SET_X5_FROM_X0 e50300aa
  66. DEFINE SET_X6_FROM_X0 e60300aa
  67. DEFINE SET_X16_FROM_X0 f00300aa
  68. DEFINE SET_X16_FROM_SP f00312aa
  69. DEFINE SET_BP_FROM_X16 f10310aa
  70. DEFINE SET_BP_FROM_SP f10312aa
  71. # Move constant to register
  72. DEFINE SET_X0_TO_0 000080d2
  73. DEFINE SET_X0_TO_1 200080d2
  74. DEFINE SET_X0_TO_17 200280d2
  75. DEFINE SET_X0_TO_MINUS_1 00008092
  76. DEFINE SET_W0_TO_MINUS_1 00008012
  77. DEFINE SET_X1_TO_0 010080d2
  78. DEFINE SET_X1_TO_2 410080d2
  79. DEFINE SET_X1_TO_8 010180d2
  80. DEFINE SET_X2_TO_1 220080d2
  81. DEFINE SET_X0_TO_FCNTL_H_AT_FDCWD 600c8092
  82. # Arith/logic/relational
  83. DEFINE ADD_X0_X1_X0 2000008b
  84. DEFINE ADD_X0_BP_X0 2002008b
  85. DEFINE ADD_X1_SP_8 41220091
  86. DEFINE SUB_X0_X1_X0 200000cb
  87. DEFINE SUB_X0_X0_X1 000001cb
  88. DEFINE SUB_X0_8 002000d1
  89. DEFINE SUB_X0_16 004000d1
  90. DEFINE SUB_X0_24 006000d1
  91. DEFINE MSUB_X0_X0_X2_X1 0084029b
  92. DEFINE MUL_X0_X1_X0 207c009b
  93. DEFINE SDIV_X0_X1_X0 200cc09a
  94. DEFINE SDIV_X2_X1_X0 220cc09a
  95. DEFINE UDIV_X0_X1_X0 2008c09a
  96. DEFINE UDIV_X2_X1_X0 2208c09a
  97. DEFINE LSHIFT_X0_X0_X2 0020c29a
  98. DEFINE LSHIFT_X0_X1_X0 2020c09a
  99. DEFINE LOGICAL_RSHIFT_X0_X1_X0 2024c09a
  100. DEFINE ARITH_RSHIFT_X0_X1_X0 2028c09a
  101. DEFINE MVN_X0 e00320aa
  102. DEFINE AND_X0_X1_X0 2000008a
  103. DEFINE OR_X0_X1_X0 200000aa
  104. DEFINE XOR_X0_X1_X0 000001ca
  105. DEFINE CMP_X1_X0 3f0000eb
  106. # Syscall
  107. DEFINE SET_X8_TO_SYS_BRK c81a80d2
  108. DEFINE SET_X8_TO_SYS_CHDIR 280680d2
  109. DEFINE SET_X8_TO_SYS_CLONE 881b80d2
  110. DEFINE SET_X8_TO_SYS_CLOSE 280780d2
  111. DEFINE SET_X8_TO_SYS_EXECVE a81b80d2
  112. DEFINE SET_X8_TO_SYS_EXIT a80b80d2
  113. DEFINE SET_X8_TO_SYS_FACCESSAT 080680d2
  114. DEFINE SET_X8_TO_SYS_FCHDIR 480680d2
  115. DEFINE SET_X8_TO_SYS_FCHMODAT a80680d2
  116. DEFINE SET_X8_TO_SYS_GETCWD 280280d2
  117. DEFINE SET_X8_TO_SYS_LSEEK c80780d2
  118. DEFINE SET_X8_TO_SYS_OPENAT 080780d2
  119. DEFINE SET_X8_TO_SYS_READ e80780d2
  120. DEFINE SET_X8_TO_SYS_UNAME 081480d2
  121. DEFINE SET_X8_TO_SYS_WAIT4 882080d2
  122. DEFINE SET_X8_TO_SYS_WRITE 080880d2
  123. DEFINE SYSCALL 010000d4