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
@@ -0,0 +1,157 @@
1
+ from ....posix.signal import (
2
+ BsdSignal,
3
+ Kill,
4
+ Killpg,
5
+ PthreadKill,
6
+ PthreadSigmask,
7
+ Sigaction,
8
+ Sigaddset,
9
+ Sigaltstack,
10
+ Sigdelset,
11
+ Sigemptyset,
12
+ Sigfillset,
13
+ Sighold,
14
+ Sigignore,
15
+ Siginterrupt,
16
+ Sigismember,
17
+ Sigpause,
18
+ Sigpending,
19
+ Sigprocmask,
20
+ Sigqueue,
21
+ Sigrelse,
22
+ Sigset,
23
+ Sigsuspend,
24
+ Sigtimedwait,
25
+ Sigwait,
26
+ Sigwaitinfo,
27
+ )
28
+ from ..systemv import MIPS64ELSysVModel
29
+
30
+
31
+ class MIPS64ELSysVBsdSignal(BsdSignal, MIPS64ELSysVModel):
32
+ pass
33
+
34
+
35
+ class MIPS64ELSysVKill(Kill, MIPS64ELSysVModel):
36
+ pass
37
+
38
+
39
+ class MIPS64ELSysVKillpg(Killpg, MIPS64ELSysVModel):
40
+ pass
41
+
42
+
43
+ class MIPS64ELSysVPthreadKill(PthreadKill, MIPS64ELSysVModel):
44
+ pass
45
+
46
+
47
+ class MIPS64ELSysVPthreadSigmask(PthreadSigmask, MIPS64ELSysVModel):
48
+ pass
49
+
50
+
51
+ class MIPS64ELSysVSigaction(Sigaction, MIPS64ELSysVModel):
52
+ pass
53
+
54
+
55
+ class MIPS64ELSysVSigaddset(Sigaddset, MIPS64ELSysVModel):
56
+ pass
57
+
58
+
59
+ class MIPS64ELSysVSigaltstack(Sigaltstack, MIPS64ELSysVModel):
60
+ pass
61
+
62
+
63
+ class MIPS64ELSysVSigdelset(Sigdelset, MIPS64ELSysVModel):
64
+ pass
65
+
66
+
67
+ class MIPS64ELSysVSigemptyset(Sigemptyset, MIPS64ELSysVModel):
68
+ pass
69
+
70
+
71
+ class MIPS64ELSysVSigfillset(Sigfillset, MIPS64ELSysVModel):
72
+ pass
73
+
74
+
75
+ class MIPS64ELSysVSighold(Sighold, MIPS64ELSysVModel):
76
+ pass
77
+
78
+
79
+ class MIPS64ELSysVSigignore(Sigignore, MIPS64ELSysVModel):
80
+ pass
81
+
82
+
83
+ class MIPS64ELSysVSiginterrupt(Siginterrupt, MIPS64ELSysVModel):
84
+ pass
85
+
86
+
87
+ class MIPS64ELSysVSigismember(Sigismember, MIPS64ELSysVModel):
88
+ pass
89
+
90
+
91
+ class MIPS64ELSysVSigpause(Sigpause, MIPS64ELSysVModel):
92
+ pass
93
+
94
+
95
+ class MIPS64ELSysVSigpending(Sigpending, MIPS64ELSysVModel):
96
+ pass
97
+
98
+
99
+ class MIPS64ELSysVSigprocmask(Sigprocmask, MIPS64ELSysVModel):
100
+ pass
101
+
102
+
103
+ class MIPS64ELSysVSigqueue(Sigqueue, MIPS64ELSysVModel):
104
+ pass
105
+
106
+
107
+ class MIPS64ELSysVSigrelse(Sigrelse, MIPS64ELSysVModel):
108
+ pass
109
+
110
+
111
+ class MIPS64ELSysVSigset(Sigset, MIPS64ELSysVModel):
112
+ pass
113
+
114
+
115
+ class MIPS64ELSysVSigsuspend(Sigsuspend, MIPS64ELSysVModel):
116
+ pass
117
+
118
+
119
+ class MIPS64ELSysVSigtimedwait(Sigtimedwait, MIPS64ELSysVModel):
120
+ pass
121
+
122
+
123
+ class MIPS64ELSysVSigwait(Sigwait, MIPS64ELSysVModel):
124
+ pass
125
+
126
+
127
+ class MIPS64ELSysVSigwaitinfo(Sigwaitinfo, MIPS64ELSysVModel):
128
+ pass
129
+
130
+
131
+ __all__ = [
132
+ "MIPS64ELSysVBsdSignal",
133
+ "MIPS64ELSysVKill",
134
+ "MIPS64ELSysVKillpg",
135
+ "MIPS64ELSysVPthreadKill",
136
+ "MIPS64ELSysVPthreadSigmask",
137
+ "MIPS64ELSysVSigaction",
138
+ "MIPS64ELSysVSigaddset",
139
+ "MIPS64ELSysVSigaltstack",
140
+ "MIPS64ELSysVSigdelset",
141
+ "MIPS64ELSysVSigemptyset",
142
+ "MIPS64ELSysVSigfillset",
143
+ "MIPS64ELSysVSighold",
144
+ "MIPS64ELSysVSigignore",
145
+ "MIPS64ELSysVSiginterrupt",
146
+ "MIPS64ELSysVSigismember",
147
+ "MIPS64ELSysVSigpause",
148
+ "MIPS64ELSysVSigpending",
149
+ "MIPS64ELSysVSigprocmask",
150
+ "MIPS64ELSysVSigqueue",
151
+ "MIPS64ELSysVSigrelse",
152
+ "MIPS64ELSysVSigset",
153
+ "MIPS64ELSysVSigsuspend",
154
+ "MIPS64ELSysVSigtimedwait",
155
+ "MIPS64ELSysVSigwait",
156
+ "MIPS64ELSysVSigwaitinfo",
157
+ ]
@@ -0,0 +1,96 @@
1
+ import struct
2
+
3
+ from ..... import emulators, platforms
4
+ from ...cstd import ArgumentType, CStdModel
5
+
6
+
7
+ class MIPS64ELSysVModel(CStdModel):
8
+ """Base class for C models using the AArch64 System V ABI"""
9
+
10
+ platform = platforms.Platform(
11
+ platforms.Architecture.MIPS64, platforms.Byteorder.LITTLE
12
+ )
13
+ abi = platforms.ABI.SYSTEMV
14
+
15
+ _int_sign_mask = 0x80000000
16
+ _int_inv_mask = 0xFFFFFFFF
17
+ _long_sign_mask = 0x8000000000000000
18
+ _long_inv_mask = 0xFFFFFFFFFFFFFFFF
19
+ _long_long_sign_mask = 0x8000000000000000
20
+ _long_long_inv_mask = 0xFFFFFFFFFFFFFFFF
21
+
22
+ _four_byte_types = {ArgumentType.INT, ArgumentType.UINT}
23
+
24
+ _eight_byte_types = {
25
+ ArgumentType.LONG,
26
+ ArgumentType.ULONG,
27
+ ArgumentType.LONGLONG,
28
+ ArgumentType.ULONGLONG,
29
+ ArgumentType.SIZE_T,
30
+ ArgumentType.SSIZE_T,
31
+ ArgumentType.POINTER,
32
+ }
33
+
34
+ _four_byte_arg_regs = ["a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7"]
35
+
36
+ _eight_byte_arg_regs = [
37
+ "a0",
38
+ "a1",
39
+ "a2",
40
+ "a3",
41
+ "a4",
42
+ "a5",
43
+ "a6",
44
+ "a7",
45
+ ]
46
+
47
+ _soft_float = False
48
+ _variadic_soft_float = True
49
+ _floats_are_doubles = False
50
+ _float_arg_regs = [
51
+ "f13",
52
+ "f14",
53
+ "f15",
54
+ "f16",
55
+ "f17",
56
+ ]
57
+
58
+ _double_arg_regs = [
59
+ "f13",
60
+ "f14",
61
+ "f15",
62
+ "f16",
63
+ "f17",
64
+ ]
65
+
66
+ _init_stack_offset = 0
67
+ _align_stack = True
68
+ _eight_byte_reg_size = 1
69
+ _double_reg_size = 1
70
+ _four_byte_stack_size = 4
71
+ _eight_byte_stack_size = 8
72
+ _float_stack_size = 4
73
+ _double_stack_size = 8
74
+
75
+ def _return_4_byte(self, emulator: emulators.Emulator, val: int) -> None:
76
+ """Return a four-byte type"""
77
+ val &= self._int_inv_mask
78
+ if val & self._int_sign_mask != 0:
79
+ val |= self._int_signext_mask
80
+ emulator.write_register("v0", val)
81
+
82
+ def _return_8_byte(self, emulator: emulators.Emulator, val: int) -> None:
83
+ """Return an eight-byte type"""
84
+ emulator.write_register("v0", val)
85
+
86
+ def _return_float(self, emulator: emulators.Emulator, val: float) -> None:
87
+ """Return a float"""
88
+ data = struct.pack("<f", val)
89
+ intval = int.from_bytes(data, "little")
90
+ emulator.write_register("f0", intval)
91
+
92
+ def _return_double(self, emulator: emulators.Emulator, val: float) -> None:
93
+ """Return a double"""
94
+ data = struct.pack("<d", val)
95
+ intval = int.from_bytes(data, "little")
96
+ emulator.write_register("f0", intval)
@@ -0,0 +1 @@
1
+ from .systemv import __all__ as __sysv__ # noqa: F401
@@ -0,0 +1,6 @@
1
+ from .c99 import * # noqa: F401,F403
2
+ from .c99 import __all__ as __c99__
3
+ from .posix import * # noqa: F401,F403
4
+ from .posix import __all__ as __posix__
5
+
6
+ __all__ = __c99__ + __posix__
@@ -0,0 +1,12 @@
1
+ from .signal import * # noqa F401,F403
2
+ from .signal import __all__ as __signal__
3
+ from .stdio import * # noqa F401,F403
4
+ from .stdio import __all__ as __stdio__
5
+ from .stdlib import * # noqa F401,F403
6
+ from .stdlib import __all__ as __stdlib__
7
+ from .string import * # noqa F401,F403
8
+ from .string import __all__ as __string__
9
+ from .time import * # noqa F401,F403
10
+ from .time import __all__ as __time__
11
+
12
+ __all__ = __signal__ + __stdlib__ + __string__ + __stdio__ + __time__
@@ -0,0 +1,16 @@
1
+ from ....c99.signal import Raise, Signal
2
+ from ..systemv import MIPSELSysVModel
3
+
4
+
5
+ class MIPSELSysVRaise(Raise, MIPSELSysVModel):
6
+ pass
7
+
8
+
9
+ class MIPSELSysVSignal(Signal, MIPSELSysVModel):
10
+ pass
11
+
12
+
13
+ __all__ = [
14
+ "MIPSELSysVRaise",
15
+ "MIPSELSysVSignal",
16
+ ]
@@ -0,0 +1,265 @@
1
+ from ....c99 import (
2
+ Clearerr,
3
+ Fclose,
4
+ Feof,
5
+ Ferror,
6
+ Fflush,
7
+ Fgetc,
8
+ Fgetpos,
9
+ Fgets,
10
+ Fopen,
11
+ Fprintf,
12
+ Fputc,
13
+ Fputs,
14
+ Fread,
15
+ Freopen,
16
+ Fscanf,
17
+ Fseek,
18
+ Fsetpos,
19
+ Ftell,
20
+ Fwrite,
21
+ Getc,
22
+ Getchar,
23
+ Gets,
24
+ Printf,
25
+ Putc,
26
+ Putchar,
27
+ Puts,
28
+ Remove,
29
+ Rename,
30
+ Rewind,
31
+ Scanf,
32
+ Snprintf,
33
+ Sprintf,
34
+ Sscanf,
35
+ Tmpfile,
36
+ Tmpnam,
37
+ Ungetc,
38
+ Vfprintf,
39
+ Vfscanf,
40
+ Vprintf,
41
+ Vscanf,
42
+ Vsnprintf,
43
+ Vsprintf,
44
+ Vsscanf,
45
+ )
46
+ from ..systemv import MIPSELSysVModel
47
+
48
+
49
+ class MIPSELSysVFclose(Fclose, MIPSELSysVModel):
50
+ pass
51
+
52
+
53
+ class MIPSELSysVFeof(Feof, MIPSELSysVModel):
54
+ pass
55
+
56
+
57
+ class MIPSELSysVFerror(Ferror, MIPSELSysVModel):
58
+ pass
59
+
60
+
61
+ class MIPSELSysVFgetc(Fgetc, MIPSELSysVModel):
62
+ pass
63
+
64
+
65
+ class MIPSELSysVFgets(Fgets, MIPSELSysVModel):
66
+ pass
67
+
68
+
69
+ class MIPSELSysVFopen(Fopen, MIPSELSysVModel):
70
+ pass
71
+
72
+
73
+ class MIPSELSysVFprintf(Fprintf, MIPSELSysVModel):
74
+ pass
75
+
76
+
77
+ class MIPSELSysVFputc(Fputc, MIPSELSysVModel):
78
+ pass
79
+
80
+
81
+ class MIPSELSysVFputs(Fputs, MIPSELSysVModel):
82
+ pass
83
+
84
+
85
+ class MIPSELSysVFread(Fread, MIPSELSysVModel):
86
+ pass
87
+
88
+
89
+ class MIPSELSysVFscanf(Fscanf, MIPSELSysVModel):
90
+ pass
91
+
92
+
93
+ class MIPSELSysVFseek(Fseek, MIPSELSysVModel):
94
+ pass
95
+
96
+
97
+ class MIPSELSysVFtell(Ftell, MIPSELSysVModel):
98
+ pass
99
+
100
+
101
+ class MIPSELSysVFwrite(Fwrite, MIPSELSysVModel):
102
+ pass
103
+
104
+
105
+ class MIPSELSysVGetc(Getc, MIPSELSysVModel):
106
+ pass
107
+
108
+
109
+ class MIPSELSysVGetchar(Getchar, MIPSELSysVModel):
110
+ pass
111
+
112
+
113
+ class MIPSELSysVGets(Gets, MIPSELSysVModel):
114
+ pass
115
+
116
+
117
+ class MIPSELSysVPrintf(Printf, MIPSELSysVModel):
118
+ pass
119
+
120
+
121
+ class MIPSELSysVPutc(Putc, MIPSELSysVModel):
122
+ pass
123
+
124
+
125
+ class MIPSELSysVPutchar(Putchar, MIPSELSysVModel):
126
+ pass
127
+
128
+
129
+ class MIPSELSysVPuts(Puts, MIPSELSysVModel):
130
+ pass
131
+
132
+
133
+ class MIPSELSysVRemove(Remove, MIPSELSysVModel):
134
+ pass
135
+
136
+
137
+ class MIPSELSysVRename(Rename, MIPSELSysVModel):
138
+ pass
139
+
140
+
141
+ class MIPSELSysVRewind(Rewind, MIPSELSysVModel):
142
+ pass
143
+
144
+
145
+ class MIPSELSysVScanf(Scanf, MIPSELSysVModel):
146
+ pass
147
+
148
+
149
+ class MIPSELSysVSnprintf(Snprintf, MIPSELSysVModel):
150
+ pass
151
+
152
+
153
+ class MIPSELSysVSprintf(Sprintf, MIPSELSysVModel):
154
+ pass
155
+
156
+
157
+ class MIPSELSysVSscanf(Sscanf, MIPSELSysVModel):
158
+ pass
159
+
160
+
161
+ class MIPSELSysVClearerr(Clearerr, MIPSELSysVModel):
162
+ pass
163
+
164
+
165
+ class MIPSELSysVFflush(Fflush, MIPSELSysVModel):
166
+ pass
167
+
168
+
169
+ class MIPSELSysVFreopen(Freopen, MIPSELSysVModel):
170
+ pass
171
+
172
+
173
+ class MIPSELSysVFgetpos(Fgetpos, MIPSELSysVModel):
174
+ pass
175
+
176
+
177
+ class MIPSELSysVFsetpos(Fsetpos, MIPSELSysVModel):
178
+ pass
179
+
180
+
181
+ class MIPSELSysVTmpfile(Tmpfile, MIPSELSysVModel):
182
+ pass
183
+
184
+
185
+ class MIPSELSysVTmpnam(Tmpnam, MIPSELSysVModel):
186
+ pass
187
+
188
+
189
+ class MIPSELSysVUngetc(Ungetc, MIPSELSysVModel):
190
+ pass
191
+
192
+
193
+ class MIPSELSysVVfprintf(Vfprintf, MIPSELSysVModel):
194
+ pass
195
+
196
+
197
+ class MIPSELSysVVfscanf(Vfscanf, MIPSELSysVModel):
198
+ pass
199
+
200
+
201
+ class MIPSELSysVVprintf(Vprintf, MIPSELSysVModel):
202
+ pass
203
+
204
+
205
+ class MIPSELSysVVscanf(Vscanf, MIPSELSysVModel):
206
+ pass
207
+
208
+
209
+ class MIPSELSysVVsnprintf(Vsnprintf, MIPSELSysVModel):
210
+ pass
211
+
212
+
213
+ class MIPSELSysVVsprintf(Vsprintf, MIPSELSysVModel):
214
+ pass
215
+
216
+
217
+ class MIPSELSysVVsscanf(Vsscanf, MIPSELSysVModel):
218
+ pass
219
+
220
+
221
+ __all__ = [
222
+ "MIPSELSysVFclose",
223
+ "MIPSELSysVFeof",
224
+ "MIPSELSysVFerror",
225
+ "MIPSELSysVFgetc",
226
+ "MIPSELSysVFgets",
227
+ "MIPSELSysVFopen",
228
+ "MIPSELSysVFprintf",
229
+ "MIPSELSysVFputc",
230
+ "MIPSELSysVFputs",
231
+ "MIPSELSysVFread",
232
+ "MIPSELSysVFscanf",
233
+ "MIPSELSysVFseek",
234
+ "MIPSELSysVFtell",
235
+ "MIPSELSysVFwrite",
236
+ "MIPSELSysVGetc",
237
+ "MIPSELSysVGetchar",
238
+ "MIPSELSysVGets",
239
+ "MIPSELSysVPrintf",
240
+ "MIPSELSysVPutc",
241
+ "MIPSELSysVPutchar",
242
+ "MIPSELSysVPuts",
243
+ "MIPSELSysVRemove",
244
+ "MIPSELSysVRename",
245
+ "MIPSELSysVRewind",
246
+ "MIPSELSysVScanf",
247
+ "MIPSELSysVSnprintf",
248
+ "MIPSELSysVSprintf",
249
+ "MIPSELSysVSscanf",
250
+ "MIPSELSysVClearerr",
251
+ "MIPSELSysVFflush",
252
+ "MIPSELSysVFreopen",
253
+ "MIPSELSysVFgetpos",
254
+ "MIPSELSysVFsetpos",
255
+ "MIPSELSysVTmpfile",
256
+ "MIPSELSysVTmpnam",
257
+ "MIPSELSysVUngetc",
258
+ "MIPSELSysVVfprintf",
259
+ "MIPSELSysVVfscanf",
260
+ "MIPSELSysVVprintf",
261
+ "MIPSELSysVVscanf",
262
+ "MIPSELSysVVsnprintf",
263
+ "MIPSELSysVVsprintf",
264
+ "MIPSELSysVVsscanf",
265
+ ]
@@ -0,0 +1,169 @@
1
+ from ....c99 import (
2
+ Abort,
3
+ Abs,
4
+ Atexit,
5
+ Atof,
6
+ Atoi,
7
+ Atol,
8
+ Atoll,
9
+ Calloc,
10
+ Div,
11
+ Exit,
12
+ Free,
13
+ Getenv,
14
+ LAbs,
15
+ LDiv,
16
+ LLAbs,
17
+ LLDiv,
18
+ Malloc,
19
+ Mblen,
20
+ Mbstowcs,
21
+ Mbtowc,
22
+ QSort,
23
+ Rand,
24
+ Realloc,
25
+ Srand,
26
+ System,
27
+ Wcstombs,
28
+ Wctomb,
29
+ )
30
+ from ..systemv import MIPSELSysVModel
31
+
32
+
33
+ class MIPSELSysVAbs(Abs, MIPSELSysVModel):
34
+ pass
35
+
36
+
37
+ class MIPSELSysVLAbs(LAbs, MIPSELSysVModel):
38
+ pass
39
+
40
+
41
+ class MIPSELSysVLLAbs(LLAbs, MIPSELSysVModel):
42
+ pass
43
+
44
+
45
+ class MIPSELSysVAtof(Atof, MIPSELSysVModel):
46
+ pass
47
+
48
+
49
+ class MIPSELSysVAtoi(Atoi, MIPSELSysVModel):
50
+ pass
51
+
52
+
53
+ class MIPSELSysVAtol(Atol, MIPSELSysVModel):
54
+ pass
55
+
56
+
57
+ class MIPSELSysVAtoll(Atoll, MIPSELSysVModel):
58
+ pass
59
+
60
+
61
+ class MIPSELSysVCalloc(Calloc, MIPSELSysVModel):
62
+ pass
63
+
64
+
65
+ class MIPSELSysVDiv(Div, MIPSELSysVModel):
66
+ pass
67
+
68
+
69
+ class MIPSELSysVLDiv(LDiv, MIPSELSysVModel):
70
+ pass
71
+
72
+
73
+ class MIPSELSysVLLDiv(LLDiv, MIPSELSysVModel):
74
+ pass
75
+
76
+
77
+ class MIPSELSysVExit(Exit, MIPSELSysVModel):
78
+ pass
79
+
80
+
81
+ class MIPSELSysVFree(Free, MIPSELSysVModel):
82
+ pass
83
+
84
+
85
+ class MIPSELSysVMalloc(Malloc, MIPSELSysVModel):
86
+ pass
87
+
88
+
89
+ class MIPSELSysVQSort(QSort, MIPSELSysVModel):
90
+ pass
91
+
92
+
93
+ class MIPSELSysVRand(Rand, MIPSELSysVModel):
94
+ pass
95
+
96
+
97
+ class MIPSELSysVRealloc(Realloc, MIPSELSysVModel):
98
+ pass
99
+
100
+
101
+ class MIPSELSysVSrand(Srand, MIPSELSysVModel):
102
+ pass
103
+
104
+
105
+ class MIPSELSysVAbort(Abort, MIPSELSysVModel):
106
+ pass
107
+
108
+
109
+ class MIPSELSysVAtexit(Atexit, MIPSELSysVModel):
110
+ pass
111
+
112
+
113
+ class MIPSELSysVGetenv(Getenv, MIPSELSysVModel):
114
+ pass
115
+
116
+
117
+ class MIPSELSysVMblen(Mblen, MIPSELSysVModel):
118
+ pass
119
+
120
+
121
+ class MIPSELSysVMbstowcs(Mbstowcs, MIPSELSysVModel):
122
+ pass
123
+
124
+
125
+ class MIPSELSysVMbtowc(Mbtowc, MIPSELSysVModel):
126
+ pass
127
+
128
+
129
+ class MIPSELSysVSystem(System, MIPSELSysVModel):
130
+ pass
131
+
132
+
133
+ class MIPSELSysVWcstombs(Wcstombs, MIPSELSysVModel):
134
+ pass
135
+
136
+
137
+ class MIPSELSysVWctomb(Wctomb, MIPSELSysVModel):
138
+ pass
139
+
140
+
141
+ __all__ = [
142
+ "MIPSELSysVAbs",
143
+ "MIPSELSysVLAbs",
144
+ "MIPSELSysVLLAbs",
145
+ "MIPSELSysVAtof",
146
+ "MIPSELSysVAtoi",
147
+ "MIPSELSysVAtol",
148
+ "MIPSELSysVAtoll",
149
+ "MIPSELSysVCalloc",
150
+ "MIPSELSysVDiv",
151
+ "MIPSELSysVLDiv",
152
+ "MIPSELSysVLLDiv",
153
+ "MIPSELSysVExit",
154
+ "MIPSELSysVFree",
155
+ "MIPSELSysVMalloc",
156
+ "MIPSELSysVQSort",
157
+ "MIPSELSysVRand",
158
+ "MIPSELSysVRealloc",
159
+ "MIPSELSysVSrand",
160
+ "MIPSELSysVAbort",
161
+ "MIPSELSysVAtexit",
162
+ "MIPSELSysVGetenv",
163
+ "MIPSELSysVMblen",
164
+ "MIPSELSysVMbstowcs",
165
+ "MIPSELSysVMbtowc",
166
+ "MIPSELSysVSystem",
167
+ "MIPSELSysVWcstombs",
168
+ "MIPSELSysVWctomb",
169
+ ]