smallworld-re 1.0.3__py3-none-any.whl → 2.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. smallworld/analyses/__init__.py +8 -0
  2. smallworld/analyses/analysis.py +8 -67
  3. smallworld/analyses/code_coverage.py +1 -2
  4. smallworld/analyses/colorizer.py +301 -534
  5. smallworld/analyses/colorizer_def_use.py +217 -0
  6. smallworld/analyses/colorizer_summary.py +173 -83
  7. smallworld/analyses/field_detection/field_analysis.py +7 -8
  8. smallworld/analyses/field_detection/hints.py +1 -1
  9. smallworld/analyses/field_detection/malloc.py +2 -2
  10. smallworld/analyses/trace_execution.py +160 -0
  11. smallworld/analyses/trace_execution_types.py +42 -0
  12. smallworld/analyses/unstable/angr/divergence.py +1 -2
  13. smallworld/analyses/unstable/angr/model.py +5 -6
  14. smallworld/analyses/unstable/angr_nwbt.py +3 -4
  15. smallworld/analyses/unstable/code_coverage.py +2 -3
  16. smallworld/analyses/unstable/code_reachable.py +2 -3
  17. smallworld/analyses/unstable/control_flow_tracer.py +2 -3
  18. smallworld/analyses/unstable/pointer_finder.py +2 -3
  19. smallworld/analyses/unstable/utils/tui.py +71 -0
  20. smallworld/emulators/__init__.py +3 -1
  21. smallworld/emulators/angr/angr.py +30 -9
  22. smallworld/emulators/angr/machdefs/__init__.py +2 -0
  23. smallworld/emulators/angr/machdefs/aarch64.py +1 -1
  24. smallworld/emulators/angr/machdefs/amd64.py +0 -4
  25. smallworld/emulators/angr/machdefs/arm.py +0 -2
  26. smallworld/emulators/angr/machdefs/i386.py +0 -2
  27. smallworld/emulators/angr/machdefs/loongarch.py +340 -0
  28. smallworld/emulators/angr/machdefs/machdef.py +1 -8
  29. smallworld/emulators/angr/machdefs/mips.py +0 -2
  30. smallworld/emulators/angr/machdefs/mips64.py +0 -2
  31. smallworld/emulators/angr/machdefs/ppc.py +1 -2
  32. smallworld/emulators/angr/machdefs/riscv.py +8 -10
  33. smallworld/emulators/angr/machdefs/xtensa.py +7 -4
  34. smallworld/emulators/emulator.py +22 -0
  35. smallworld/emulators/ghidra/__init__.py +37 -0
  36. smallworld/emulators/ghidra/ghidra.py +513 -0
  37. smallworld/emulators/ghidra/machdefs/__init__.py +31 -0
  38. smallworld/emulators/ghidra/machdefs/aarch64.py +289 -0
  39. smallworld/emulators/ghidra/machdefs/amd64.py +185 -0
  40. smallworld/emulators/ghidra/machdefs/arm.py +370 -0
  41. smallworld/emulators/ghidra/machdefs/i386.py +109 -0
  42. smallworld/emulators/ghidra/machdefs/loongarch.py +162 -0
  43. smallworld/emulators/ghidra/machdefs/machdef.py +81 -0
  44. smallworld/emulators/ghidra/machdefs/mips.py +163 -0
  45. smallworld/emulators/ghidra/machdefs/mips64.py +186 -0
  46. smallworld/emulators/ghidra/machdefs/ppc.py +98 -0
  47. smallworld/emulators/ghidra/machdefs/riscv.py +208 -0
  48. smallworld/emulators/ghidra/machdefs/xtensa.py +21 -0
  49. smallworld/emulators/ghidra/typing.py +28 -0
  50. smallworld/emulators/hookable.py +18 -4
  51. smallworld/emulators/panda/machdefs/__init__.py +2 -2
  52. smallworld/emulators/panda/machdefs/aarch64.py +186 -11
  53. smallworld/emulators/panda/machdefs/amd64.py +103 -11
  54. smallworld/emulators/panda/machdefs/arm.py +216 -20
  55. smallworld/emulators/panda/machdefs/i386.py +30 -7
  56. smallworld/emulators/panda/machdefs/machdef.py +9 -16
  57. smallworld/emulators/panda/machdefs/mips.py +49 -5
  58. smallworld/emulators/panda/machdefs/mips64.py +57 -5
  59. smallworld/emulators/panda/machdefs/ppc.py +38 -13
  60. smallworld/emulators/panda/panda.py +146 -44
  61. smallworld/emulators/unicorn/__init__.py +2 -0
  62. smallworld/emulators/unicorn/machdefs/aarch64.py +253 -264
  63. smallworld/emulators/unicorn/machdefs/amd64.py +254 -259
  64. smallworld/emulators/unicorn/machdefs/arm.py +200 -212
  65. smallworld/emulators/unicorn/machdefs/i386.py +84 -90
  66. smallworld/emulators/unicorn/machdefs/machdef.py +2 -23
  67. smallworld/emulators/unicorn/machdefs/mips.py +127 -135
  68. smallworld/emulators/unicorn/unicorn.py +52 -13
  69. smallworld/helpers.py +4 -19
  70. smallworld/hinting/hinting.py +22 -192
  71. smallworld/hinting/hints.py +50 -18
  72. smallworld/instructions/bsid.py +8 -8
  73. smallworld/logging.py +4 -2
  74. smallworld/platforms/__init__.py +12 -0
  75. smallworld/platforms/defs/__init__.py +36 -0
  76. smallworld/platforms/defs/aarch64.py +450 -0
  77. smallworld/platforms/defs/amd64.py +463 -0
  78. smallworld/platforms/defs/arm.py +519 -0
  79. smallworld/platforms/defs/i386.py +258 -0
  80. smallworld/platforms/defs/loongarch.py +270 -0
  81. smallworld/platforms/defs/mips.py +321 -0
  82. smallworld/platforms/defs/mips64.py +313 -0
  83. smallworld/platforms/defs/platformdef.py +97 -0
  84. smallworld/platforms/defs/powerpc.py +259 -0
  85. smallworld/platforms/defs/riscv.py +257 -0
  86. smallworld/platforms/defs/xtensa.py +96 -0
  87. smallworld/{platforms.py → platforms/platforms.py} +3 -0
  88. smallworld/state/cpus/__init__.py +2 -0
  89. smallworld/state/cpus/aarch64.py +0 -9
  90. smallworld/state/cpus/amd64.py +6 -28
  91. smallworld/state/cpus/arm.py +0 -11
  92. smallworld/state/cpus/cpu.py +0 -11
  93. smallworld/state/cpus/i386.py +0 -7
  94. smallworld/state/cpus/loongarch.py +299 -0
  95. smallworld/state/cpus/mips.py +4 -47
  96. smallworld/state/cpus/mips64.py +18 -58
  97. smallworld/state/cpus/powerpc.py +2 -9
  98. smallworld/state/cpus/riscv.py +1 -11
  99. smallworld/state/cpus/xtensa.py +0 -5
  100. smallworld/state/memory/code.py +38 -2
  101. smallworld/state/memory/elf/__init__.py +5 -1
  102. smallworld/state/memory/elf/coredump/__init__.py +3 -0
  103. smallworld/state/memory/elf/coredump/coredump.py +46 -0
  104. smallworld/state/memory/elf/coredump/prstatus/__init__.py +27 -0
  105. smallworld/state/memory/elf/coredump/prstatus/aarch64.py +46 -0
  106. smallworld/state/memory/elf/coredump/prstatus/amd64.py +40 -0
  107. smallworld/state/memory/elf/coredump/prstatus/arm.py +53 -0
  108. smallworld/state/memory/elf/coredump/prstatus/i386.py +30 -0
  109. smallworld/state/memory/elf/coredump/prstatus/mips.py +55 -0
  110. smallworld/state/memory/elf/coredump/prstatus/mips64.py +57 -0
  111. smallworld/state/memory/elf/coredump/prstatus/ppc.py +82 -0
  112. smallworld/state/memory/elf/coredump/prstatus/prstatus.py +129 -0
  113. smallworld/state/memory/elf/elf.py +211 -57
  114. smallworld/state/memory/elf/register_state.py +36 -0
  115. smallworld/state/memory/elf/rela/__init__.py +2 -0
  116. smallworld/state/memory/elf/rela/aarch64.py +3 -1
  117. smallworld/state/memory/elf/rela/amd64.py +4 -2
  118. smallworld/state/memory/elf/rela/arm.py +4 -2
  119. smallworld/state/memory/elf/rela/i386.py +4 -2
  120. smallworld/state/memory/elf/rela/loongarch.py +32 -0
  121. smallworld/state/memory/elf/rela/mips.py +39 -18
  122. smallworld/state/memory/elf/rela/ppc.py +31 -14
  123. smallworld/state/memory/elf/structs.py +3 -0
  124. smallworld/state/memory/heap.py +2 -2
  125. smallworld/state/memory/memory.py +18 -0
  126. smallworld/state/memory/pe/__init__.py +3 -0
  127. smallworld/state/memory/pe/pe.py +361 -0
  128. smallworld/state/memory/pe/structs.py +60 -0
  129. smallworld/state/memory/stack/__init__.py +2 -0
  130. smallworld/state/memory/stack/loongarch.py +26 -0
  131. smallworld/state/models/__init__.py +29 -2
  132. smallworld/state/models/aarch64/__init__.py +1 -0
  133. smallworld/state/models/aarch64/systemv/__init__.py +6 -0
  134. smallworld/state/models/aarch64/systemv/c99/__init__.py +12 -0
  135. smallworld/state/models/aarch64/systemv/c99/signal.py +16 -0
  136. smallworld/state/models/aarch64/systemv/c99/stdio.py +265 -0
  137. smallworld/state/models/aarch64/systemv/c99/stdlib.py +169 -0
  138. smallworld/state/models/aarch64/systemv/c99/string.py +139 -0
  139. smallworld/state/models/aarch64/systemv/c99/time.py +61 -0
  140. smallworld/state/models/aarch64/systemv/posix/__init__.py +6 -0
  141. smallworld/state/models/aarch64/systemv/posix/libgen.py +16 -0
  142. smallworld/state/models/aarch64/systemv/posix/signal.py +157 -0
  143. smallworld/state/models/aarch64/systemv/systemv.py +80 -0
  144. smallworld/state/models/amd64/__init__.py +1 -0
  145. smallworld/state/models/amd64/systemv/__init__.py +6 -0
  146. smallworld/state/models/amd64/systemv/c99/__init__.py +12 -0
  147. smallworld/state/models/amd64/systemv/c99/signal.py +16 -0
  148. smallworld/state/models/amd64/systemv/c99/stdio.py +265 -0
  149. smallworld/state/models/amd64/systemv/c99/stdlib.py +169 -0
  150. smallworld/state/models/amd64/systemv/c99/string.py +139 -0
  151. smallworld/state/models/amd64/systemv/c99/time.py +61 -0
  152. smallworld/state/models/amd64/systemv/posix/__init__.py +6 -0
  153. smallworld/state/models/amd64/systemv/posix/libgen.py +16 -0
  154. smallworld/state/models/amd64/systemv/posix/signal.py +157 -0
  155. smallworld/state/models/amd64/systemv/systemv.py +78 -0
  156. smallworld/state/models/armel/__init__.py +1 -0
  157. smallworld/state/models/armel/systemv/__init__.py +6 -0
  158. smallworld/state/models/armel/systemv/c99/__init__.py +12 -0
  159. smallworld/state/models/armel/systemv/c99/signal.py +16 -0
  160. smallworld/state/models/armel/systemv/c99/stdio.py +265 -0
  161. smallworld/state/models/armel/systemv/c99/stdlib.py +169 -0
  162. smallworld/state/models/armel/systemv/c99/string.py +139 -0
  163. smallworld/state/models/armel/systemv/c99/time.py +61 -0
  164. smallworld/state/models/armel/systemv/posix/__init__.py +6 -0
  165. smallworld/state/models/armel/systemv/posix/libgen.py +16 -0
  166. smallworld/state/models/armel/systemv/posix/signal.py +157 -0
  167. smallworld/state/models/armel/systemv/systemv.py +82 -0
  168. smallworld/state/models/armhf/__init__.py +1 -0
  169. smallworld/state/models/armhf/systemv/__init__.py +6 -0
  170. smallworld/state/models/armhf/systemv/c99/__init__.py +12 -0
  171. smallworld/state/models/armhf/systemv/c99/signal.py +16 -0
  172. smallworld/state/models/armhf/systemv/c99/stdio.py +265 -0
  173. smallworld/state/models/armhf/systemv/c99/stdlib.py +169 -0
  174. smallworld/state/models/armhf/systemv/c99/string.py +139 -0
  175. smallworld/state/models/armhf/systemv/c99/time.py +61 -0
  176. smallworld/state/models/armhf/systemv/posix/__init__.py +6 -0
  177. smallworld/state/models/armhf/systemv/posix/libgen.py +16 -0
  178. smallworld/state/models/armhf/systemv/posix/signal.py +157 -0
  179. smallworld/state/models/armhf/systemv/systemv.py +77 -0
  180. smallworld/state/models/c99/__init__.py +12 -0
  181. smallworld/state/models/c99/fmt_print.py +915 -0
  182. smallworld/state/models/c99/fmt_scan.py +864 -0
  183. smallworld/state/models/c99/math.py +362 -0
  184. smallworld/state/models/c99/signal.py +71 -0
  185. smallworld/state/models/c99/stdio.py +1305 -0
  186. smallworld/state/models/c99/stdlib.py +595 -0
  187. smallworld/state/models/c99/string.py +674 -0
  188. smallworld/state/models/c99/time.py +340 -0
  189. smallworld/state/models/c99/utils.py +89 -0
  190. smallworld/state/models/cstd.py +759 -0
  191. smallworld/state/models/errno.py +581 -0
  192. smallworld/state/models/filedesc.py +515 -0
  193. smallworld/state/models/i386/__init__.py +1 -0
  194. smallworld/state/models/i386/systemv/__init__.py +6 -0
  195. smallworld/state/models/i386/systemv/c99/__init__.py +12 -0
  196. smallworld/state/models/i386/systemv/c99/signal.py +16 -0
  197. smallworld/state/models/i386/systemv/c99/stdio.py +265 -0
  198. smallworld/state/models/i386/systemv/c99/stdlib.py +169 -0
  199. smallworld/state/models/i386/systemv/c99/string.py +139 -0
  200. smallworld/state/models/i386/systemv/c99/time.py +61 -0
  201. smallworld/state/models/i386/systemv/posix/__init__.py +6 -0
  202. smallworld/state/models/i386/systemv/posix/libgen.py +16 -0
  203. smallworld/state/models/i386/systemv/posix/signal.py +157 -0
  204. smallworld/state/models/i386/systemv/systemv.py +71 -0
  205. smallworld/state/models/loongarch64/__init__.py +1 -0
  206. smallworld/state/models/loongarch64/systemv/__init__.py +6 -0
  207. smallworld/state/models/loongarch64/systemv/c99/__init__.py +12 -0
  208. smallworld/state/models/loongarch64/systemv/c99/signal.py +16 -0
  209. smallworld/state/models/loongarch64/systemv/c99/stdio.py +265 -0
  210. smallworld/state/models/loongarch64/systemv/c99/stdlib.py +169 -0
  211. smallworld/state/models/loongarch64/systemv/c99/string.py +139 -0
  212. smallworld/state/models/loongarch64/systemv/c99/time.py +61 -0
  213. smallworld/state/models/loongarch64/systemv/posix/__init__.py +6 -0
  214. smallworld/state/models/loongarch64/systemv/posix/libgen.py +16 -0
  215. smallworld/state/models/loongarch64/systemv/posix/signal.py +157 -0
  216. smallworld/state/models/loongarch64/systemv/systemv.py +83 -0
  217. smallworld/state/models/mips/__init__.py +1 -0
  218. smallworld/state/models/mips/systemv/__init__.py +6 -0
  219. smallworld/state/models/mips/systemv/c99/__init__.py +12 -0
  220. smallworld/state/models/mips/systemv/c99/signal.py +16 -0
  221. smallworld/state/models/mips/systemv/c99/stdio.py +265 -0
  222. smallworld/state/models/mips/systemv/c99/stdlib.py +169 -0
  223. smallworld/state/models/mips/systemv/c99/string.py +139 -0
  224. smallworld/state/models/mips/systemv/c99/time.py +61 -0
  225. smallworld/state/models/mips/systemv/posix/__init__.py +6 -0
  226. smallworld/state/models/mips/systemv/posix/libgen.py +16 -0
  227. smallworld/state/models/mips/systemv/posix/signal.py +157 -0
  228. smallworld/state/models/mips/systemv/systemv.py +78 -0
  229. smallworld/state/models/mips64/__init__.py +1 -0
  230. smallworld/state/models/mips64/systemv/__init__.py +6 -0
  231. smallworld/state/models/mips64/systemv/c99/__init__.py +12 -0
  232. smallworld/state/models/mips64/systemv/c99/signal.py +16 -0
  233. smallworld/state/models/mips64/systemv/c99/stdio.py +265 -0
  234. smallworld/state/models/mips64/systemv/c99/stdlib.py +169 -0
  235. smallworld/state/models/mips64/systemv/c99/string.py +139 -0
  236. smallworld/state/models/mips64/systemv/c99/time.py +61 -0
  237. smallworld/state/models/mips64/systemv/posix/__init__.py +6 -0
  238. smallworld/state/models/mips64/systemv/posix/libgen.py +16 -0
  239. smallworld/state/models/mips64/systemv/posix/signal.py +157 -0
  240. smallworld/state/models/mips64/systemv/systemv.py +98 -0
  241. smallworld/state/models/mips64el/__init__.py +1 -0
  242. smallworld/state/models/mips64el/systemv/__init__.py +6 -0
  243. smallworld/state/models/mips64el/systemv/c99/__init__.py +12 -0
  244. smallworld/state/models/mips64el/systemv/c99/signal.py +16 -0
  245. smallworld/state/models/mips64el/systemv/c99/stdio.py +265 -0
  246. smallworld/state/models/mips64el/systemv/c99/stdlib.py +169 -0
  247. smallworld/state/models/mips64el/systemv/c99/string.py +139 -0
  248. smallworld/state/models/mips64el/systemv/c99/time.py +61 -0
  249. smallworld/state/models/mips64el/systemv/posix/__init__.py +6 -0
  250. smallworld/state/models/mips64el/systemv/posix/libgen.py +16 -0
  251. smallworld/state/models/mips64el/systemv/posix/signal.py +157 -0
  252. smallworld/state/models/mips64el/systemv/systemv.py +96 -0
  253. smallworld/state/models/mipsel/__init__.py +1 -0
  254. smallworld/state/models/mipsel/systemv/__init__.py +6 -0
  255. smallworld/state/models/mipsel/systemv/c99/__init__.py +12 -0
  256. smallworld/state/models/mipsel/systemv/c99/signal.py +16 -0
  257. smallworld/state/models/mipsel/systemv/c99/stdio.py +265 -0
  258. smallworld/state/models/mipsel/systemv/c99/stdlib.py +169 -0
  259. smallworld/state/models/mipsel/systemv/c99/string.py +139 -0
  260. smallworld/state/models/mipsel/systemv/c99/time.py +61 -0
  261. smallworld/state/models/mipsel/systemv/posix/__init__.py +6 -0
  262. smallworld/state/models/mipsel/systemv/posix/libgen.py +16 -0
  263. smallworld/state/models/mipsel/systemv/posix/signal.py +157 -0
  264. smallworld/state/models/mipsel/systemv/systemv.py +78 -0
  265. smallworld/state/models/model.py +27 -2
  266. smallworld/state/models/posix/__init__.py +6 -0
  267. smallworld/state/models/posix/libgen.py +123 -0
  268. smallworld/state/models/posix/signal.py +690 -0
  269. smallworld/state/models/powerpc/__init__.py +1 -0
  270. smallworld/state/models/powerpc/systemv/__init__.py +6 -0
  271. smallworld/state/models/powerpc/systemv/c99/__init__.py +12 -0
  272. smallworld/state/models/powerpc/systemv/c99/signal.py +16 -0
  273. smallworld/state/models/powerpc/systemv/c99/stdio.py +265 -0
  274. smallworld/state/models/powerpc/systemv/c99/stdlib.py +169 -0
  275. smallworld/state/models/powerpc/systemv/c99/string.py +139 -0
  276. smallworld/state/models/powerpc/systemv/c99/time.py +61 -0
  277. smallworld/state/models/powerpc/systemv/posix/__init__.py +6 -0
  278. smallworld/state/models/powerpc/systemv/posix/libgen.py +16 -0
  279. smallworld/state/models/powerpc/systemv/posix/signal.py +157 -0
  280. smallworld/state/models/powerpc/systemv/systemv.py +93 -0
  281. smallworld/state/models/riscv64/__init__.py +1 -0
  282. smallworld/state/models/riscv64/systemv/__init__.py +6 -0
  283. smallworld/state/models/riscv64/systemv/c99/__init__.py +12 -0
  284. smallworld/state/models/riscv64/systemv/c99/signal.py +16 -0
  285. smallworld/state/models/riscv64/systemv/c99/stdio.py +265 -0
  286. smallworld/state/models/riscv64/systemv/c99/stdlib.py +169 -0
  287. smallworld/state/models/riscv64/systemv/c99/string.py +139 -0
  288. smallworld/state/models/riscv64/systemv/c99/time.py +61 -0
  289. smallworld/state/models/riscv64/systemv/posix/__init__.py +6 -0
  290. smallworld/state/models/riscv64/systemv/posix/libgen.py +16 -0
  291. smallworld/state/models/riscv64/systemv/posix/signal.py +157 -0
  292. smallworld/state/models/riscv64/systemv/systemv.py +85 -0
  293. smallworld/state/state.py +65 -24
  294. smallworld/state/unstable/elf.py +16 -31
  295. smallworld/utils.py +6 -1
  296. {smallworld_re-1.0.3.dist-info → smallworld_re-2.0.0.dist-info}/METADATA +74 -42
  297. smallworld_re-2.0.0.dist-info/RECORD +374 -0
  298. {smallworld_re-1.0.3.dist-info → smallworld_re-2.0.0.dist-info}/WHEEL +1 -1
  299. smallworld/state/models/x86/__init__.py +0 -2
  300. smallworld/state/models/x86/microsoftcdecl.py +0 -35
  301. smallworld/state/models/x86/systemv.py +0 -240
  302. smallworld_re-1.0.3.dist-info/RECORD +0 -166
  303. /smallworld/state/models/{posix.py → _posix.py} +0 -0
  304. {smallworld_re-1.0.3.dist-info → smallworld_re-2.0.0.dist-info}/entry_points.txt +0 -0
  305. {smallworld_re-1.0.3.dist-info → smallworld_re-2.0.0.dist-info}/licenses/LICENSE.txt +0 -0
  306. {smallworld_re-1.0.3.dist-info → smallworld_re-2.0.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,3 @@
1
- import capstone
2
1
  import unicorn
3
2
 
4
3
  from ....platforms import Architecture, Byteorder
@@ -14,101 +13,96 @@ class i386MachineDef(UnicornMachineDef):
14
13
  uc_arch = unicorn.UC_ARCH_X86
15
14
  uc_mode = unicorn.UC_MODE_32
16
15
 
17
- cs_arch = capstone.CS_ARCH_X86
18
- cs_mode = capstone.CS_MODE_32
19
-
20
- pc_reg = "eip"
21
-
22
16
  _registers = {
23
17
  # *** General Purpose Registers ***
24
- "eax": (unicorn.x86_const.UC_X86_REG_EAX, "eax", 4, 0),
25
- "ax": (unicorn.x86_const.UC_X86_REG_AX, "eax", 2, 0),
26
- "al": (unicorn.x86_const.UC_X86_REG_AL, "eax", 1, 0),
27
- "ah": (unicorn.x86_const.UC_X86_REG_AH, "eax", 1, 1),
28
- "ebx": (unicorn.x86_const.UC_X86_REG_EBX, "ebx", 4, 0),
29
- "bx": (unicorn.x86_const.UC_X86_REG_BX, "ebx", 2, 0),
30
- "bl": (unicorn.x86_const.UC_X86_REG_BL, "ebx", 1, 0),
31
- "bh": (unicorn.x86_const.UC_X86_REG_BH, "ebx", 1, 1),
32
- "ecx": (unicorn.x86_const.UC_X86_REG_ECX, "ecx", 4, 0),
33
- "cx": (unicorn.x86_const.UC_X86_REG_CX, "ecx", 2, 0),
34
- "cl": (unicorn.x86_const.UC_X86_REG_CL, "ecx", 1, 0),
35
- "ch": (unicorn.x86_const.UC_X86_REG_CH, "ecx", 1, 1),
36
- "edx": (unicorn.x86_const.UC_X86_REG_EDX, "edx", 4, 0),
37
- "dx": (unicorn.x86_const.UC_X86_REG_DX, "edx", 2, 0),
38
- "dl": (unicorn.x86_const.UC_X86_REG_DL, "edx", 1, 0),
39
- "dh": (unicorn.x86_const.UC_X86_REG_DH, "edx", 1, 1),
40
- "esi": (unicorn.x86_const.UC_X86_REG_ESI, "esi", 4, 0),
41
- "si": (unicorn.x86_const.UC_X86_REG_SI, "esi", 2, 0),
42
- "sil": (unicorn.x86_const.UC_X86_REG_SIL, "esi", 1, 0),
43
- "edi": (unicorn.x86_const.UC_X86_REG_EDI, "edi", 4, 0),
44
- "di": (unicorn.x86_const.UC_X86_REG_DI, "edi", 2, 0),
45
- "dil": (unicorn.x86_const.UC_X86_REG_DIL, "edi", 1, 0),
46
- "ebp": (unicorn.x86_const.UC_X86_REG_EBP, "ebp", 4, 0),
47
- "bp": (unicorn.x86_const.UC_X86_REG_BP, "ebp", 2, 0),
48
- "bpl": (unicorn.x86_const.UC_X86_REG_BPL, "ebp", 1, 0),
49
- "esp": (unicorn.x86_const.UC_X86_REG_ESP, "esp", 4, 0),
50
- "sp": (unicorn.x86_const.UC_X86_REG_SP, "esp", 2, 0),
51
- "spl": (unicorn.x86_const.UC_X86_REG_SPL, "esp", 1, 0),
18
+ "eax": unicorn.x86_const.UC_X86_REG_EAX,
19
+ "ax": unicorn.x86_const.UC_X86_REG_AX,
20
+ "al": unicorn.x86_const.UC_X86_REG_AL,
21
+ "ah": unicorn.x86_const.UC_X86_REG_AH,
22
+ "ebx": unicorn.x86_const.UC_X86_REG_EBX,
23
+ "bx": unicorn.x86_const.UC_X86_REG_BX,
24
+ "bl": unicorn.x86_const.UC_X86_REG_BL,
25
+ "bh": unicorn.x86_const.UC_X86_REG_BH,
26
+ "ecx": unicorn.x86_const.UC_X86_REG_ECX,
27
+ "cx": unicorn.x86_const.UC_X86_REG_CX,
28
+ "cl": unicorn.x86_const.UC_X86_REG_CL,
29
+ "ch": unicorn.x86_const.UC_X86_REG_CH,
30
+ "edx": unicorn.x86_const.UC_X86_REG_EDX,
31
+ "dx": unicorn.x86_const.UC_X86_REG_DX,
32
+ "dl": unicorn.x86_const.UC_X86_REG_DL,
33
+ "dh": unicorn.x86_const.UC_X86_REG_DH,
34
+ "esi": unicorn.x86_const.UC_X86_REG_ESI,
35
+ "si": unicorn.x86_const.UC_X86_REG_SI,
36
+ "sil": unicorn.x86_const.UC_X86_REG_SIL,
37
+ "edi": unicorn.x86_const.UC_X86_REG_EDI,
38
+ "di": unicorn.x86_const.UC_X86_REG_DI,
39
+ "dil": unicorn.x86_const.UC_X86_REG_DIL,
40
+ "ebp": unicorn.x86_const.UC_X86_REG_EBP,
41
+ "bp": unicorn.x86_const.UC_X86_REG_BP,
42
+ "bpl": unicorn.x86_const.UC_X86_REG_BPL,
43
+ "esp": unicorn.x86_const.UC_X86_REG_ESP,
44
+ "sp": unicorn.x86_const.UC_X86_REG_SP,
45
+ "spl": unicorn.x86_const.UC_X86_REG_SPL,
52
46
  # *** Instruction Pointer ***
53
- "eip": (unicorn.x86_const.UC_X86_REG_EIP, "eip", 4, 0),
54
- "ip": (unicorn.x86_const.UC_X86_REG_IP, "eip", 2, 0),
47
+ "eip": unicorn.x86_const.UC_X86_REG_EIP,
48
+ "ip": unicorn.x86_const.UC_X86_REG_IP,
55
49
  # *** Segment Registers ***
56
- "cs": (unicorn.x86_const.UC_X86_REG_CS, "cs", 2, 0),
57
- "ss": (unicorn.x86_const.UC_X86_REG_SS, "ss", 2, 0),
58
- "ds": (unicorn.x86_const.UC_X86_REG_DS, "ds", 2, 0),
59
- "es": (unicorn.x86_const.UC_X86_REG_ES, "es", 2, 0),
60
- "fs": (unicorn.x86_const.UC_X86_REG_FS, "fs", 2, 0),
61
- "gs": (unicorn.x86_const.UC_X86_REG_GS, "gs", 2, 0),
50
+ "cs": unicorn.x86_const.UC_X86_REG_CS,
51
+ "ss": unicorn.x86_const.UC_X86_REG_SS,
52
+ "ds": unicorn.x86_const.UC_X86_REG_DS,
53
+ "es": unicorn.x86_const.UC_X86_REG_ES,
54
+ "fs": unicorn.x86_const.UC_X86_REG_FS,
55
+ "gs": unicorn.x86_const.UC_X86_REG_GS,
62
56
  # *** Flags Registers ***
63
- "eflags": (unicorn.x86_const.UC_X86_REG_EFLAGS, "eflags", 4, 0),
64
- "flags": (unicorn.x86_const.UC_X86_REG_FLAGS, "eflags", 2, 0),
57
+ "eflags": unicorn.x86_const.UC_X86_REG_EFLAGS,
58
+ "flags": unicorn.x86_const.UC_X86_REG_FLAGS,
65
59
  # *** Control Registers ***
66
- "cr0": (unicorn.x86_const.UC_X86_REG_CR0, "cr0", 4, 0),
67
- "cr1": (unicorn.x86_const.UC_X86_REG_CR1, "cr1", 4, 0),
68
- "cr2": (unicorn.x86_const.UC_X86_REG_CR2, "cr2", 4, 0),
69
- "cr3": (unicorn.x86_const.UC_X86_REG_CR3, "cr3", 4, 0),
70
- "cr4": (unicorn.x86_const.UC_X86_REG_CR4, "cr4", 4, 0),
60
+ "cr0": unicorn.x86_const.UC_X86_REG_CR0,
61
+ "cr1": unicorn.x86_const.UC_X86_REG_CR1,
62
+ "cr2": unicorn.x86_const.UC_X86_REG_CR2,
63
+ "cr3": unicorn.x86_const.UC_X86_REG_CR3,
64
+ "cr4": unicorn.x86_const.UC_X86_REG_CR4,
71
65
  # NOTE: I've got conflicting reports whether cr8 exists in i386.
72
- "cr8": (unicorn.x86_const.UC_X86_REG_INVALID, "cr8", 4, 0),
66
+ "cr8": unicorn.x86_const.UC_X86_REG_INVALID,
73
67
  # *** Debug Registers ***
74
- "dr0": (unicorn.x86_const.UC_X86_REG_DR0, "dr0", 4, 0),
75
- "dr1": (unicorn.x86_const.UC_X86_REG_DR1, "dr1", 4, 0),
76
- "dr2": (unicorn.x86_const.UC_X86_REG_DR2, "dr2", 4, 0),
77
- "dr3": (unicorn.x86_const.UC_X86_REG_DR3, "dr3", 4, 0),
78
- "dr6": (unicorn.x86_const.UC_X86_REG_DR6, "dr6", 4, 0),
79
- "dr7": (unicorn.x86_const.UC_X86_REG_DR7, "dr7", 4, 0),
68
+ "dr0": unicorn.x86_const.UC_X86_REG_DR0,
69
+ "dr1": unicorn.x86_const.UC_X86_REG_DR1,
70
+ "dr2": unicorn.x86_const.UC_X86_REG_DR2,
71
+ "dr3": unicorn.x86_const.UC_X86_REG_DR3,
72
+ "dr6": unicorn.x86_const.UC_X86_REG_DR6,
73
+ "dr7": unicorn.x86_const.UC_X86_REG_DR7,
80
74
  # *** Descriptor Table Registers
81
75
  # NOTE: Yes, this is 6 bytes; 2 byte segment selector plus 4 byte offset
82
- "gdtr": (unicorn.x86_const.UC_X86_REG_GDTR, "gdtr", 6, 0),
83
- "idtr": (unicorn.x86_const.UC_X86_REG_IDTR, "idtr", 6, 0),
84
- "ldtr": (unicorn.x86_const.UC_X86_REG_LDTR, "ldtr", 6, 0),
76
+ "gdtr": unicorn.x86_const.UC_X86_REG_GDTR,
77
+ "idtr": unicorn.x86_const.UC_X86_REG_IDTR,
78
+ "ldtr": unicorn.x86_const.UC_X86_REG_LDTR,
85
79
  # *** Task Register ***
86
80
  # NOTE: Yes, this is 6 bytes; 2 byte segment selector plus 4 byte offset
87
- "tr": (unicorn.x86_const.UC_X86_REG_TR, "tr", 6, 0),
81
+ "tr": unicorn.x86_const.UC_X86_REG_TR,
88
82
  # *** x87 registers ***
89
83
  # NOTE: x87 is supported by Unicorn, but not by SmallWorld.
90
84
  # Values are represented as tuples (exponent: int, mantissa: int).
91
85
  # If you need x87 support, open a ticket.
92
- "fpr0": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr0", 10, 0),
93
- "fpr1": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr1", 10, 0),
94
- "fpr2": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr2", 10, 0),
95
- "fpr3": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr3", 10, 0),
96
- "fpr4": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr4", 10, 0),
97
- "fpr5": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr5", 10, 0),
98
- "fpr6": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr6", 10, 0),
99
- "fpr7": (unicorn.x86_const.UC_X86_REG_INVALID, "fpr7", 10, 0),
86
+ "fpr0": unicorn.x86_const.UC_X86_REG_INVALID,
87
+ "fpr1": unicorn.x86_const.UC_X86_REG_INVALID,
88
+ "fpr2": unicorn.x86_const.UC_X86_REG_INVALID,
89
+ "fpr3": unicorn.x86_const.UC_X86_REG_INVALID,
90
+ "fpr4": unicorn.x86_const.UC_X86_REG_INVALID,
91
+ "fpr5": unicorn.x86_const.UC_X86_REG_INVALID,
92
+ "fpr6": unicorn.x86_const.UC_X86_REG_INVALID,
93
+ "fpr7": unicorn.x86_const.UC_X86_REG_INVALID,
100
94
  # x87 Control Register
101
- "fctrl": (unicorn.x86_const.UC_X86_REG_FPCW, "fctrl", 2, 0),
95
+ "fctrl": unicorn.x86_const.UC_X86_REG_FPCW,
102
96
  # x87 Status Register
103
- "fstat": (unicorn.x86_const.UC_X86_REG_FPSW, "fstat", 2, 0),
97
+ "fstat": unicorn.x86_const.UC_X86_REG_FPSW,
104
98
  # x87 Tag Register
105
- "ftag": (unicorn.x86_const.UC_X86_REG_FPTAG, "ftag", 2, 0),
99
+ "ftag": unicorn.x86_const.UC_X86_REG_FPTAG,
106
100
  # x87 Last Instruction Register
107
- "fip": (unicorn.x86_const.UC_X86_REG_FIP, "fip", 8, 0),
101
+ "fip": unicorn.x86_const.UC_X86_REG_FIP,
108
102
  # x87 Last Operand Pointer
109
- "fdp": (unicorn.x86_const.UC_X86_REG_FDP, "fdp", 8, 0),
103
+ "fdp": unicorn.x86_const.UC_X86_REG_FDP,
110
104
  # x87 Last Opcode
111
- "fop": (unicorn.x86_const.UC_X86_REG_FOP, "fop", 2, 0),
105
+ "fop": unicorn.x86_const.UC_X86_REG_FOP,
112
106
  # NOTE: Docs disagree on the format of fip and fdp.
113
107
  # One source describes them as 48-bit offset-plus-segment,
114
108
  # the other describes them as 64-bit.
@@ -117,21 +111,21 @@ class i386MachineDef(UnicornMachineDef):
117
111
  # *** MMX Registers ***
118
112
  # NOTE: The MMX registers are aliases for the low 8 bytes of the x87 registers.
119
113
  # The two subsystems cannot be used simultaneously.
120
- "mm0": (unicorn.x86_const.UC_X86_REG_MM0, "fpr0", 8, 0),
121
- "mm1": (unicorn.x86_const.UC_X86_REG_MM1, "fpr1", 8, 0),
122
- "mm2": (unicorn.x86_const.UC_X86_REG_MM2, "fpr2", 8, 0),
123
- "mm3": (unicorn.x86_const.UC_X86_REG_MM3, "fpr3", 8, 0),
124
- "mm4": (unicorn.x86_const.UC_X86_REG_MM4, "fpr4", 8, 0),
125
- "mm5": (unicorn.x86_const.UC_X86_REG_MM5, "fpr5", 8, 0),
126
- "mm6": (unicorn.x86_const.UC_X86_REG_MM6, "fpr6", 8, 0),
127
- "mm7": (unicorn.x86_const.UC_X86_REG_MM7, "fpr7", 8, 0),
114
+ "mm0": unicorn.x86_const.UC_X86_REG_MM0,
115
+ "mm1": unicorn.x86_const.UC_X86_REG_MM1,
116
+ "mm2": unicorn.x86_const.UC_X86_REG_MM2,
117
+ "mm3": unicorn.x86_const.UC_X86_REG_MM3,
118
+ "mm4": unicorn.x86_const.UC_X86_REG_MM4,
119
+ "mm5": unicorn.x86_const.UC_X86_REG_MM5,
120
+ "mm6": unicorn.x86_const.UC_X86_REG_MM6,
121
+ "mm7": unicorn.x86_const.UC_X86_REG_MM7,
128
122
  # *** SSE Registers ***
129
- "xmm0": (unicorn.x86_const.UC_X86_REG_XMM0, "xmm0", 16, 0),
130
- "xmm1": (unicorn.x86_const.UC_X86_REG_XMM1, "xmm1", 16, 0),
131
- "xmm2": (unicorn.x86_const.UC_X86_REG_XMM2, "xmm2", 16, 0),
132
- "xmm3": (unicorn.x86_const.UC_X86_REG_XMM3, "xmm3", 16, 0),
133
- "xmm4": (unicorn.x86_const.UC_X86_REG_XMM4, "xmm4", 16, 0),
134
- "xmm5": (unicorn.x86_const.UC_X86_REG_XMM5, "xmm5", 16, 0),
135
- "xmm6": (unicorn.x86_const.UC_X86_REG_XMM6, "xmm6", 16, 0),
136
- "xmm7": (unicorn.x86_const.UC_X86_REG_XMM7, "xmm7", 16, 0),
123
+ "xmm0": unicorn.x86_const.UC_X86_REG_XMM0,
124
+ "xmm1": unicorn.x86_const.UC_X86_REG_XMM1,
125
+ "xmm2": unicorn.x86_const.UC_X86_REG_XMM2,
126
+ "xmm3": unicorn.x86_const.UC_X86_REG_XMM3,
127
+ "xmm4": unicorn.x86_const.UC_X86_REG_XMM4,
128
+ "xmm5": unicorn.x86_const.UC_X86_REG_XMM5,
129
+ "xmm6": unicorn.x86_const.UC_X86_REG_XMM6,
130
+ "xmm7": unicorn.x86_const.UC_X86_REG_XMM7,
137
131
  }
@@ -37,30 +37,9 @@ class UnicornMachineDef(metaclass=abc.ABCMeta):
37
37
  """
38
38
  return 0
39
39
 
40
- @property
41
- @abc.abstractmethod
42
- def cs_arch(self) -> int:
43
- """The capstone arch ID"""
44
- return 0
45
-
46
- @property
47
- @abc.abstractmethod
48
- def cs_mode(self) -> int:
49
- """The capstone mode ID
50
-
51
- This must include an byteorder flag
52
- """
53
- return 0
54
-
55
- @property
56
- @abc.abstractmethod
57
- def pc_reg(self) -> str:
58
- """The name of the Program Counter register for this machine"""
59
- return ""
60
-
61
- _registers: typing.Dict[str, typing.Tuple[typing.Any, str, int, int]] = {}
40
+ _registers: typing.Dict[str, int] = {}
62
41
 
63
- def uc_reg(self, name: str) -> typing.Tuple[typing.Any, str, int, int]:
42
+ def uc_reg(self, name: str) -> int:
64
43
  """Convert a register name to unicorn constant
65
44
 
66
45
  This must cover all names defined in the CPU state model
@@ -1,4 +1,3 @@
1
- import capstone
2
1
  import unicorn
3
2
 
4
3
  from ....platforms import Architecture, Byteorder
@@ -13,134 +12,129 @@ class MIPSMachineDef(UnicornMachineDef):
13
12
  uc_arch = unicorn.UC_ARCH_MIPS
14
13
  uc_mode = unicorn.UC_MODE_MIPS32
15
14
 
16
- cs_arch = capstone.CS_ARCH_MIPS
17
- cs_mode = capstone.CS_MODE_MIPS32
18
-
19
- pc_reg = "pc"
20
-
21
15
  def __init__(self):
22
16
  self._registers = {
23
17
  # *** General-Purpose Registers ***
24
18
  # Assembler Temporary Register
25
- "at": (unicorn.mips_const.UC_MIPS_REG_AT, "at", 0, 4),
26
- "1": (unicorn.mips_const.UC_MIPS_REG_1, "at", 0, 4),
19
+ "at": unicorn.mips_const.UC_MIPS_REG_AT,
20
+ "1": unicorn.mips_const.UC_MIPS_REG_1,
27
21
  # Return Value Registers
28
- "v0": (unicorn.mips_const.UC_MIPS_REG_V0, "v0", 0, 4),
29
- "2": (unicorn.mips_const.UC_MIPS_REG_2, "v0", 0, 4),
30
- "v1": (unicorn.mips_const.UC_MIPS_REG_V1, "v1", 0, 4),
31
- "3": (unicorn.mips_const.UC_MIPS_REG_3, "v1", 0, 4),
22
+ "v0": unicorn.mips_const.UC_MIPS_REG_V0,
23
+ "2": unicorn.mips_const.UC_MIPS_REG_2,
24
+ "v1": unicorn.mips_const.UC_MIPS_REG_V1,
25
+ "3": unicorn.mips_const.UC_MIPS_REG_3,
32
26
  # Argument Registers
33
- "a0": (unicorn.mips_const.UC_MIPS_REG_A0, "a0", 0, 4),
34
- "4": (unicorn.mips_const.UC_MIPS_REG_4, "a0", 0, 4),
35
- "a1": (unicorn.mips_const.UC_MIPS_REG_A1, "a1", 0, 4),
36
- "5": (unicorn.mips_const.UC_MIPS_REG_5, "a1", 0, 4),
37
- "a2": (unicorn.mips_const.UC_MIPS_REG_A2, "a2", 0, 4),
38
- "6": (unicorn.mips_const.UC_MIPS_REG_6, "a2", 0, 4),
39
- "a3": (unicorn.mips_const.UC_MIPS_REG_A3, "a3", 0, 4),
40
- "7": (unicorn.mips_const.UC_MIPS_REG_7, "a3", 0, 4),
27
+ "a0": unicorn.mips_const.UC_MIPS_REG_A0,
28
+ "4": unicorn.mips_const.UC_MIPS_REG_4,
29
+ "a1": unicorn.mips_const.UC_MIPS_REG_A1,
30
+ "5": unicorn.mips_const.UC_MIPS_REG_5,
31
+ "a2": unicorn.mips_const.UC_MIPS_REG_A2,
32
+ "6": unicorn.mips_const.UC_MIPS_REG_6,
33
+ "a3": unicorn.mips_const.UC_MIPS_REG_A3,
34
+ "7": unicorn.mips_const.UC_MIPS_REG_7,
41
35
  # Temporary Registers
42
- "t0": (unicorn.mips_const.UC_MIPS_REG_T0, "t0", 0, 4),
43
- "8": (unicorn.mips_const.UC_MIPS_REG_8, "t0", 0, 4),
44
- "t1": (unicorn.mips_const.UC_MIPS_REG_T1, "t1", 0, 4),
45
- "9": (unicorn.mips_const.UC_MIPS_REG_9, "t1", 0, 4),
46
- "t2": (unicorn.mips_const.UC_MIPS_REG_T2, "t2", 0, 4),
47
- "10": (unicorn.mips_const.UC_MIPS_REG_10, "t2", 0, 4),
48
- "t3": (unicorn.mips_const.UC_MIPS_REG_T3, "t3", 0, 4),
49
- "11": (unicorn.mips_const.UC_MIPS_REG_11, "t3", 0, 4),
50
- "t4": (unicorn.mips_const.UC_MIPS_REG_T4, "t4", 0, 4),
51
- "12": (unicorn.mips_const.UC_MIPS_REG_12, "t4", 0, 4),
52
- "t5": (unicorn.mips_const.UC_MIPS_REG_T5, "t5", 0, 4),
53
- "13": (unicorn.mips_const.UC_MIPS_REG_13, "t5", 0, 4),
54
- "t6": (unicorn.mips_const.UC_MIPS_REG_T6, "t6", 0, 4),
55
- "14": (unicorn.mips_const.UC_MIPS_REG_14, "t6", 0, 4),
56
- "t7": (unicorn.mips_const.UC_MIPS_REG_T7, "t7", 0, 4),
57
- "15": (unicorn.mips_const.UC_MIPS_REG_15, "t7", 0, 4),
58
- "t8": (unicorn.mips_const.UC_MIPS_REG_T8, "t8", 0, 4),
59
- "24": (unicorn.mips_const.UC_MIPS_REG_24, "t8", 0, 4),
60
- "t9": (unicorn.mips_const.UC_MIPS_REG_T9, "t9", 0, 4),
61
- "25": (unicorn.mips_const.UC_MIPS_REG_25, "t9", 0, 4),
36
+ "t0": unicorn.mips_const.UC_MIPS_REG_T0,
37
+ "8": unicorn.mips_const.UC_MIPS_REG_8,
38
+ "t1": unicorn.mips_const.UC_MIPS_REG_T1,
39
+ "9": unicorn.mips_const.UC_MIPS_REG_9,
40
+ "t2": unicorn.mips_const.UC_MIPS_REG_T2,
41
+ "10": unicorn.mips_const.UC_MIPS_REG_10,
42
+ "t3": unicorn.mips_const.UC_MIPS_REG_T3,
43
+ "11": unicorn.mips_const.UC_MIPS_REG_11,
44
+ "t4": unicorn.mips_const.UC_MIPS_REG_T4,
45
+ "12": unicorn.mips_const.UC_MIPS_REG_12,
46
+ "t5": unicorn.mips_const.UC_MIPS_REG_T5,
47
+ "13": unicorn.mips_const.UC_MIPS_REG_13,
48
+ "t6": unicorn.mips_const.UC_MIPS_REG_T6,
49
+ "14": unicorn.mips_const.UC_MIPS_REG_14,
50
+ "t7": unicorn.mips_const.UC_MIPS_REG_T7,
51
+ "15": unicorn.mips_const.UC_MIPS_REG_15,
52
+ "t8": unicorn.mips_const.UC_MIPS_REG_T8,
53
+ "24": unicorn.mips_const.UC_MIPS_REG_24,
54
+ "t9": unicorn.mips_const.UC_MIPS_REG_T9,
55
+ "25": unicorn.mips_const.UC_MIPS_REG_25,
62
56
  # Saved Registers
63
- "s0": (unicorn.mips_const.UC_MIPS_REG_S0, "s0", 0, 4),
64
- "16": (unicorn.mips_const.UC_MIPS_REG_16, "s0", 0, 4),
65
- "s1": (unicorn.mips_const.UC_MIPS_REG_S1, "s1", 0, 4),
66
- "17": (unicorn.mips_const.UC_MIPS_REG_17, "s1", 0, 4),
67
- "s2": (unicorn.mips_const.UC_MIPS_REG_S2, "s2", 0, 4),
68
- "18": (unicorn.mips_const.UC_MIPS_REG_18, "s2", 0, 4),
69
- "s3": (unicorn.mips_const.UC_MIPS_REG_S3, "s3", 0, 4),
70
- "19": (unicorn.mips_const.UC_MIPS_REG_19, "s3", 0, 4),
71
- "s4": (unicorn.mips_const.UC_MIPS_REG_S4, "s4", 0, 4),
72
- "20": (unicorn.mips_const.UC_MIPS_REG_20, "s4", 0, 4),
73
- "s5": (unicorn.mips_const.UC_MIPS_REG_S5, "s5", 0, 4),
74
- "21": (unicorn.mips_const.UC_MIPS_REG_21, "s5", 0, 4),
75
- "s6": (unicorn.mips_const.UC_MIPS_REG_S6, "s6", 0, 4),
76
- "22": (unicorn.mips_const.UC_MIPS_REG_22, "s6", 0, 4),
77
- "s7": (unicorn.mips_const.UC_MIPS_REG_S7, "s7", 0, 4),
78
- "23": (unicorn.mips_const.UC_MIPS_REG_23, "s7", 0, 4),
57
+ "s0": unicorn.mips_const.UC_MIPS_REG_S0,
58
+ "16": unicorn.mips_const.UC_MIPS_REG_16,
59
+ "s1": unicorn.mips_const.UC_MIPS_REG_S1,
60
+ "17": unicorn.mips_const.UC_MIPS_REG_17,
61
+ "s2": unicorn.mips_const.UC_MIPS_REG_S2,
62
+ "18": unicorn.mips_const.UC_MIPS_REG_18,
63
+ "s3": unicorn.mips_const.UC_MIPS_REG_S3,
64
+ "19": unicorn.mips_const.UC_MIPS_REG_19,
65
+ "s4": unicorn.mips_const.UC_MIPS_REG_S4,
66
+ "20": unicorn.mips_const.UC_MIPS_REG_20,
67
+ "s5": unicorn.mips_const.UC_MIPS_REG_S5,
68
+ "21": unicorn.mips_const.UC_MIPS_REG_21,
69
+ "s6": unicorn.mips_const.UC_MIPS_REG_S6,
70
+ "22": unicorn.mips_const.UC_MIPS_REG_22,
71
+ "s7": unicorn.mips_const.UC_MIPS_REG_S7,
72
+ "23": unicorn.mips_const.UC_MIPS_REG_23,
79
73
  # NOTE: Register 30 used to be FP, is now also s8
80
- "s8": (unicorn.mips_const.UC_MIPS_REG_S8, "s8", 0, 4),
81
- "fp": (unicorn.mips_const.UC_MIPS_REG_FP, "s8", 0, 4),
82
- "30": (unicorn.mips_const.UC_MIPS_REG_30, "s8", 0, 4),
74
+ "s8": unicorn.mips_const.UC_MIPS_REG_S8,
75
+ "fp": unicorn.mips_const.UC_MIPS_REG_FP,
76
+ "30": unicorn.mips_const.UC_MIPS_REG_30,
83
77
  # Kernel-reserved registers
84
- "k0": (unicorn.mips_const.UC_MIPS_REG_K0, "k0", 0, 4),
85
- "26": (unicorn.mips_const.UC_MIPS_REG_26, "k0", 0, 4),
86
- "k1": (unicorn.mips_const.UC_MIPS_REG_K1, "k1", 0, 4),
87
- "27": (unicorn.mips_const.UC_MIPS_REG_27, "k1", 0, 4),
78
+ "k0": unicorn.mips_const.UC_MIPS_REG_K0,
79
+ "26": unicorn.mips_const.UC_MIPS_REG_26,
80
+ "k1": unicorn.mips_const.UC_MIPS_REG_K1,
81
+ "27": unicorn.mips_const.UC_MIPS_REG_27,
88
82
  # *** Pointer Registers ***
89
83
  # Zero Register
90
- "zero": (unicorn.mips_const.UC_MIPS_REG_ZERO, "zero", 0, 4),
91
- "0": (unicorn.mips_const.UC_MIPS_REG_0, "zero", 0, 4),
84
+ "zero": unicorn.mips_const.UC_MIPS_REG_ZERO,
85
+ "0": unicorn.mips_const.UC_MIPS_REG_0,
92
86
  # Global Pointer Register
93
- "gp": (unicorn.mips_const.UC_MIPS_REG_GP, "gp", 0, 4),
94
- "28": (unicorn.mips_const.UC_MIPS_REG_28, "gp", 0, 4),
87
+ "gp": unicorn.mips_const.UC_MIPS_REG_GP,
88
+ "28": unicorn.mips_const.UC_MIPS_REG_28,
95
89
  # Stack Pointer Register
96
- "sp": (unicorn.mips_const.UC_MIPS_REG_SP, "sp", 0, 4),
97
- "29": (unicorn.mips_const.UC_MIPS_REG_29, "sp", 0, 4),
90
+ "sp": unicorn.mips_const.UC_MIPS_REG_SP,
91
+ "29": unicorn.mips_const.UC_MIPS_REG_29,
98
92
  # Return Address Register
99
- "ra": (unicorn.mips_const.UC_MIPS_REG_RA, "ra", 0, 4),
100
- "31": (unicorn.mips_const.UC_MIPS_REG_31, "ra", 0, 4),
93
+ "ra": unicorn.mips_const.UC_MIPS_REG_RA,
94
+ "31": unicorn.mips_const.UC_MIPS_REG_31,
101
95
  # Program Counter
102
- "pc": (unicorn.mips_const.UC_MIPS_REG_PC, "pc", 0, 4),
96
+ "pc": unicorn.mips_const.UC_MIPS_REG_PC,
103
97
  # *** Floating-point Registers ***
104
- "f0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f0", 0, 4),
105
- "f1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f1", 0, 4),
106
- "f2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f2", 0, 4),
107
- "f3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f3", 0, 4),
108
- "f4": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f4", 0, 4),
109
- "f5": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f5", 0, 4),
110
- "f6": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f6", 0, 4),
111
- "f7": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f7", 0, 4),
112
- "f8": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f8", 0, 4),
113
- "f9": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f9", 0, 4),
114
- "f10": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f10", 0, 4),
115
- "f11": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f11", 0, 4),
116
- "f12": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f12", 0, 4),
117
- "f13": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f13", 0, 4),
118
- "f14": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f14", 0, 4),
119
- "f15": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f15", 0, 4),
120
- "f16": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f16", 0, 4),
121
- "f17": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f17", 0, 4),
122
- "f18": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f18", 0, 4),
123
- "f19": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f19", 0, 4),
124
- "f20": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f20", 0, 4),
125
- "f21": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f21", 0, 4),
126
- "f22": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f22", 0, 4),
127
- "f23": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f23", 0, 4),
128
- "f24": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f24", 0, 4),
129
- "f25": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f25", 0, 4),
130
- "f26": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f26", 0, 4),
131
- "f27": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f27", 0, 4),
132
- "f28": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f28", 0, 4),
133
- "f29": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f29", 0, 4),
134
- "f30": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f30", 0, 4),
135
- "f31": (unicorn.mips_const.UC_MIPS_REG_INVALID, "f31", 0, 4),
98
+ "f0": unicorn.mips_const.UC_MIPS_REG_INVALID,
99
+ "f1": unicorn.mips_const.UC_MIPS_REG_INVALID,
100
+ "f2": unicorn.mips_const.UC_MIPS_REG_INVALID,
101
+ "f3": unicorn.mips_const.UC_MIPS_REG_INVALID,
102
+ "f4": unicorn.mips_const.UC_MIPS_REG_INVALID,
103
+ "f5": unicorn.mips_const.UC_MIPS_REG_INVALID,
104
+ "f6": unicorn.mips_const.UC_MIPS_REG_INVALID,
105
+ "f7": unicorn.mips_const.UC_MIPS_REG_INVALID,
106
+ "f8": unicorn.mips_const.UC_MIPS_REG_INVALID,
107
+ "f9": unicorn.mips_const.UC_MIPS_REG_INVALID,
108
+ "f10": unicorn.mips_const.UC_MIPS_REG_INVALID,
109
+ "f11": unicorn.mips_const.UC_MIPS_REG_INVALID,
110
+ "f12": unicorn.mips_const.UC_MIPS_REG_INVALID,
111
+ "f13": unicorn.mips_const.UC_MIPS_REG_INVALID,
112
+ "f14": unicorn.mips_const.UC_MIPS_REG_INVALID,
113
+ "f15": unicorn.mips_const.UC_MIPS_REG_INVALID,
114
+ "f16": unicorn.mips_const.UC_MIPS_REG_INVALID,
115
+ "f17": unicorn.mips_const.UC_MIPS_REG_INVALID,
116
+ "f18": unicorn.mips_const.UC_MIPS_REG_INVALID,
117
+ "f19": unicorn.mips_const.UC_MIPS_REG_INVALID,
118
+ "f20": unicorn.mips_const.UC_MIPS_REG_INVALID,
119
+ "f21": unicorn.mips_const.UC_MIPS_REG_INVALID,
120
+ "f22": unicorn.mips_const.UC_MIPS_REG_INVALID,
121
+ "f23": unicorn.mips_const.UC_MIPS_REG_INVALID,
122
+ "f24": unicorn.mips_const.UC_MIPS_REG_INVALID,
123
+ "f25": unicorn.mips_const.UC_MIPS_REG_INVALID,
124
+ "f26": unicorn.mips_const.UC_MIPS_REG_INVALID,
125
+ "f27": unicorn.mips_const.UC_MIPS_REG_INVALID,
126
+ "f28": unicorn.mips_const.UC_MIPS_REG_INVALID,
127
+ "f29": unicorn.mips_const.UC_MIPS_REG_INVALID,
128
+ "f30": unicorn.mips_const.UC_MIPS_REG_INVALID,
129
+ "f31": unicorn.mips_const.UC_MIPS_REG_INVALID,
136
130
  # *** Floating Point Control Registers ***
137
131
  # NOTE: These are taken from Sleigh, and the MIPS docs.
138
132
  # Unicorn doesn't use these names, and has a different number of registers.
139
- "fir": (unicorn.mips_const.UC_MIPS_REG_INVALID, "fir", 0, 4),
140
- "fcsr": (unicorn.mips_const.UC_MIPS_REG_INVALID, "fcsr", 0, 4),
141
- "fexr": (unicorn.mips_const.UC_MIPS_REG_INVALID, "fexr", 0, 4),
142
- "fenr": (unicorn.mips_const.UC_MIPS_REG_INVALID, "fenr", 0, 4),
143
- "fccr": (unicorn.mips_const.UC_MIPS_REG_INVALID, "fccr", 0, 4),
133
+ "fir": unicorn.mips_const.UC_MIPS_REG_INVALID,
134
+ "fcsr": unicorn.mips_const.UC_MIPS_REG_INVALID,
135
+ "fexr": unicorn.mips_const.UC_MIPS_REG_INVALID,
136
+ "fenr": unicorn.mips_const.UC_MIPS_REG_INVALID,
137
+ "fccr": unicorn.mips_const.UC_MIPS_REG_INVALID,
144
138
  }
145
139
 
146
140
 
@@ -155,18 +149,18 @@ class MIPSELMachineDef(MIPSMachineDef):
155
149
  {
156
150
  # *** Accumulator Registers ***
157
151
  # TODO: Unicorn broke support for these in 2.0.2
158
- "ac0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 0, 8),
159
- "lo0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 0, 4),
160
- "hi0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 4, 4),
161
- "ac1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 0, 8),
162
- "lo1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 0, 4),
163
- "hi1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 4, 4),
164
- "ac2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 0, 8),
165
- "lo2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 0, 4),
166
- "hi2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 4, 4),
167
- "ac3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 0, 8),
168
- "lo3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 0, 4),
169
- "hi3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 4, 4),
152
+ "ac0": unicorn.mips_const.UC_MIPS_REG_INVALID,
153
+ "lo0": unicorn.mips_const.UC_MIPS_REG_INVALID,
154
+ "hi0": unicorn.mips_const.UC_MIPS_REG_INVALID,
155
+ "ac1": unicorn.mips_const.UC_MIPS_REG_INVALID,
156
+ "lo1": unicorn.mips_const.UC_MIPS_REG_INVALID,
157
+ "hi1": unicorn.mips_const.UC_MIPS_REG_INVALID,
158
+ "ac2": unicorn.mips_const.UC_MIPS_REG_INVALID,
159
+ "lo2": unicorn.mips_const.UC_MIPS_REG_INVALID,
160
+ "hi2": unicorn.mips_const.UC_MIPS_REG_INVALID,
161
+ "ac3": unicorn.mips_const.UC_MIPS_REG_INVALID,
162
+ "lo3": unicorn.mips_const.UC_MIPS_REG_INVALID,
163
+ "hi3": unicorn.mips_const.UC_MIPS_REG_INVALID,
170
164
  }
171
165
  )
172
166
 
@@ -178,25 +172,23 @@ class MIPSBEMachineDef(MIPSMachineDef):
178
172
 
179
173
  uc_mode = unicorn.UC_MODE_MIPS32 | unicorn.UC_MODE_BIG_ENDIAN
180
174
 
181
- cs_mode = capstone.CS_MODE_MIPS32 | capstone.CS_MODE_BIG_ENDIAN
182
-
183
175
  def __init__(self):
184
176
  super().__init__()
185
177
  self._registers.update(
186
178
  {
187
179
  # *** Accumulator Registers ***
188
180
  # TODO: Unicorn broke support for these in 2.0.2
189
- "ac0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 0, 8),
190
- "hi0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 0, 4),
191
- "lo0": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac0", 4, 4),
192
- "ac1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 0, 8),
193
- "hi1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 0, 4),
194
- "lo1": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac1", 4, 4),
195
- "ac2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 0, 8),
196
- "hi2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 0, 4),
197
- "lo2": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac2", 4, 4),
198
- "ac3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 0, 8),
199
- "hi3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 0, 4),
200
- "lo3": (unicorn.mips_const.UC_MIPS_REG_INVALID, "ac3", 4, 4),
181
+ "ac0": unicorn.mips_const.UC_MIPS_REG_INVALID,
182
+ "hi0": unicorn.mips_const.UC_MIPS_REG_INVALID,
183
+ "lo0": unicorn.mips_const.UC_MIPS_REG_INVALID,
184
+ "ac1": unicorn.mips_const.UC_MIPS_REG_INVALID,
185
+ "hi1": unicorn.mips_const.UC_MIPS_REG_INVALID,
186
+ "lo1": unicorn.mips_const.UC_MIPS_REG_INVALID,
187
+ "ac2": unicorn.mips_const.UC_MIPS_REG_INVALID,
188
+ "hi2": unicorn.mips_const.UC_MIPS_REG_INVALID,
189
+ "lo2": unicorn.mips_const.UC_MIPS_REG_INVALID,
190
+ "ac3": unicorn.mips_const.UC_MIPS_REG_INVALID,
191
+ "hi3": unicorn.mips_const.UC_MIPS_REG_INVALID,
192
+ "lo3": unicorn.mips_const.UC_MIPS_REG_INVALID,
201
193
  }
202
194
  )