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 I386SysVModel
29
+
30
+
31
+ class I386SysVBsdSignal(BsdSignal, I386SysVModel):
32
+ pass
33
+
34
+
35
+ class I386SysVKill(Kill, I386SysVModel):
36
+ pass
37
+
38
+
39
+ class I386SysVKillpg(Killpg, I386SysVModel):
40
+ pass
41
+
42
+
43
+ class I386SysVPthreadKill(PthreadKill, I386SysVModel):
44
+ pass
45
+
46
+
47
+ class I386SysVPthreadSigmask(PthreadSigmask, I386SysVModel):
48
+ pass
49
+
50
+
51
+ class I386SysVSigaction(Sigaction, I386SysVModel):
52
+ pass
53
+
54
+
55
+ class I386SysVSigaddset(Sigaddset, I386SysVModel):
56
+ pass
57
+
58
+
59
+ class I386SysVSigaltstack(Sigaltstack, I386SysVModel):
60
+ pass
61
+
62
+
63
+ class I386SysVSigdelset(Sigdelset, I386SysVModel):
64
+ pass
65
+
66
+
67
+ class I386SysVSigemptyset(Sigemptyset, I386SysVModel):
68
+ pass
69
+
70
+
71
+ class I386SysVSigfillset(Sigfillset, I386SysVModel):
72
+ pass
73
+
74
+
75
+ class I386SysVSighold(Sighold, I386SysVModel):
76
+ pass
77
+
78
+
79
+ class I386SysVSigignore(Sigignore, I386SysVModel):
80
+ pass
81
+
82
+
83
+ class I386SysVSiginterrupt(Siginterrupt, I386SysVModel):
84
+ pass
85
+
86
+
87
+ class I386SysVSigismember(Sigismember, I386SysVModel):
88
+ pass
89
+
90
+
91
+ class I386SysVSigpause(Sigpause, I386SysVModel):
92
+ pass
93
+
94
+
95
+ class I386SysVSigpending(Sigpending, I386SysVModel):
96
+ pass
97
+
98
+
99
+ class I386SysVSigprocmask(Sigprocmask, I386SysVModel):
100
+ pass
101
+
102
+
103
+ class I386SysVSigqueue(Sigqueue, I386SysVModel):
104
+ pass
105
+
106
+
107
+ class I386SysVSigrelse(Sigrelse, I386SysVModel):
108
+ pass
109
+
110
+
111
+ class I386SysVSigset(Sigset, I386SysVModel):
112
+ pass
113
+
114
+
115
+ class I386SysVSigsuspend(Sigsuspend, I386SysVModel):
116
+ pass
117
+
118
+
119
+ class I386SysVSigtimedwait(Sigtimedwait, I386SysVModel):
120
+ pass
121
+
122
+
123
+ class I386SysVSigwait(Sigwait, I386SysVModel):
124
+ pass
125
+
126
+
127
+ class I386SysVSigwaitinfo(Sigwaitinfo, I386SysVModel):
128
+ pass
129
+
130
+
131
+ __all__ = [
132
+ "I386SysVBsdSignal",
133
+ "I386SysVKill",
134
+ "I386SysVKillpg",
135
+ "I386SysVPthreadKill",
136
+ "I386SysVPthreadSigmask",
137
+ "I386SysVSigaction",
138
+ "I386SysVSigaddset",
139
+ "I386SysVSigaltstack",
140
+ "I386SysVSigdelset",
141
+ "I386SysVSigemptyset",
142
+ "I386SysVSigfillset",
143
+ "I386SysVSighold",
144
+ "I386SysVSigignore",
145
+ "I386SysVSiginterrupt",
146
+ "I386SysVSigismember",
147
+ "I386SysVSigpause",
148
+ "I386SysVSigpending",
149
+ "I386SysVSigprocmask",
150
+ "I386SysVSigqueue",
151
+ "I386SysVSigrelse",
152
+ "I386SysVSigset",
153
+ "I386SysVSigsuspend",
154
+ "I386SysVSigtimedwait",
155
+ "I386SysVSigwait",
156
+ "I386SysVSigwaitinfo",
157
+ ]
@@ -0,0 +1,71 @@
1
+ from ..... import emulators, platforms
2
+ from ...cstd import ArgumentType, CStdModel
3
+
4
+
5
+ class I386SysVModel(CStdModel):
6
+ """Base class for C models using the AMD64 System V ABI"""
7
+
8
+ platform = platforms.Platform(
9
+ platforms.Architecture.X86_32, platforms.Byteorder.LITTLE
10
+ )
11
+ abi = platforms.ABI.SYSTEMV
12
+
13
+ _int_sign_mask = 0x80000000
14
+ _int_inv_mask = 0xFFFFFFFF
15
+ _long_sign_mask = 0x80000000
16
+ _long_inv_mask = 0xFFFFFFFF
17
+ _long_long_sign_mask = 0x8000000000000000
18
+ _long_long_inv_mask = 0xFFFFFFFFFFFFFFFF
19
+
20
+ _four_byte_types = {
21
+ ArgumentType.INT,
22
+ ArgumentType.UINT,
23
+ ArgumentType.LONG,
24
+ ArgumentType.ULONG,
25
+ ArgumentType.SIZE_T,
26
+ ArgumentType.SSIZE_T,
27
+ ArgumentType.POINTER,
28
+ }
29
+
30
+ _eight_byte_types = {
31
+ ArgumentType.LONGLONG,
32
+ ArgumentType.ULONGLONG,
33
+ }
34
+
35
+ _four_byte_arg_regs = []
36
+ _eight_byte_arg_regs = []
37
+
38
+ _soft_float = False
39
+ _variadic_soft_float = False
40
+ _floats_are_doubles = False
41
+ _float_arg_regs = []
42
+ _double_arg_regs = []
43
+
44
+ _init_stack_offset = 4
45
+ _align_stack = False
46
+ _eight_byte_reg_size = 1
47
+ _double_reg_size = 1
48
+ _four_byte_stack_size = 4
49
+ _eight_byte_stack_size = 8
50
+ _float_stack_size = 4
51
+ _double_stack_size = 8
52
+
53
+ def _return_4_byte(self, emulator: emulators.Emulator, val: int) -> None:
54
+ """Return a four-byte type"""
55
+ emulator.write_register("eax", val)
56
+
57
+ def _return_8_byte(self, emulator: emulators.Emulator, val: int) -> None:
58
+ """Return an eight-byte type"""
59
+ hi = (val >> 32) & self._int_inv_mask
60
+ lo = val & self._int_inv_mask
61
+
62
+ emulator.write_register("eax", lo)
63
+ emulator.write_register("edx", hi)
64
+
65
+ def _return_float(self, emulator: emulators.Emulator, val: float) -> None:
66
+ """Return a float"""
67
+ raise NotImplementedError("i386 System-V uses x87 registers to return floats")
68
+
69
+ def _return_double(self, emulator: emulators.Emulator, val: float) -> None:
70
+ """Return a double"""
71
+ raise NotImplementedError("i386 System-V uses x87 registers to return doubles")
@@ -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 LoongArch64SysVModel
3
+
4
+
5
+ class LoongArch64SysVRaise(Raise, LoongArch64SysVModel):
6
+ pass
7
+
8
+
9
+ class LoongArch64SysVSignal(Signal, LoongArch64SysVModel):
10
+ pass
11
+
12
+
13
+ __all__ = [
14
+ "LoongArch64SysVRaise",
15
+ "LoongArch64SysVSignal",
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 LoongArch64SysVModel
47
+
48
+
49
+ class LoongArch64SysVFclose(Fclose, LoongArch64SysVModel):
50
+ pass
51
+
52
+
53
+ class LoongArch64SysVFeof(Feof, LoongArch64SysVModel):
54
+ pass
55
+
56
+
57
+ class LoongArch64SysVFerror(Ferror, LoongArch64SysVModel):
58
+ pass
59
+
60
+
61
+ class LoongArch64SysVFgetc(Fgetc, LoongArch64SysVModel):
62
+ pass
63
+
64
+
65
+ class LoongArch64SysVFgets(Fgets, LoongArch64SysVModel):
66
+ pass
67
+
68
+
69
+ class LoongArch64SysVFopen(Fopen, LoongArch64SysVModel):
70
+ pass
71
+
72
+
73
+ class LoongArch64SysVFprintf(Fprintf, LoongArch64SysVModel):
74
+ pass
75
+
76
+
77
+ class LoongArch64SysVFputc(Fputc, LoongArch64SysVModel):
78
+ pass
79
+
80
+
81
+ class LoongArch64SysVFputs(Fputs, LoongArch64SysVModel):
82
+ pass
83
+
84
+
85
+ class LoongArch64SysVFread(Fread, LoongArch64SysVModel):
86
+ pass
87
+
88
+
89
+ class LoongArch64SysVFscanf(Fscanf, LoongArch64SysVModel):
90
+ pass
91
+
92
+
93
+ class LoongArch64SysVFseek(Fseek, LoongArch64SysVModel):
94
+ pass
95
+
96
+
97
+ class LoongArch64SysVFtell(Ftell, LoongArch64SysVModel):
98
+ pass
99
+
100
+
101
+ class LoongArch64SysVFwrite(Fwrite, LoongArch64SysVModel):
102
+ pass
103
+
104
+
105
+ class LoongArch64SysVGetc(Getc, LoongArch64SysVModel):
106
+ pass
107
+
108
+
109
+ class LoongArch64SysVGetchar(Getchar, LoongArch64SysVModel):
110
+ pass
111
+
112
+
113
+ class LoongArch64SysVGets(Gets, LoongArch64SysVModel):
114
+ pass
115
+
116
+
117
+ class LoongArch64SysVPrintf(Printf, LoongArch64SysVModel):
118
+ pass
119
+
120
+
121
+ class LoongArch64SysVPutc(Putc, LoongArch64SysVModel):
122
+ pass
123
+
124
+
125
+ class LoongArch64SysVPutchar(Putchar, LoongArch64SysVModel):
126
+ pass
127
+
128
+
129
+ class LoongArch64SysVPuts(Puts, LoongArch64SysVModel):
130
+ pass
131
+
132
+
133
+ class LoongArch64SysVRemove(Remove, LoongArch64SysVModel):
134
+ pass
135
+
136
+
137
+ class LoongArch64SysVRename(Rename, LoongArch64SysVModel):
138
+ pass
139
+
140
+
141
+ class LoongArch64SysVRewind(Rewind, LoongArch64SysVModel):
142
+ pass
143
+
144
+
145
+ class LoongArch64SysVScanf(Scanf, LoongArch64SysVModel):
146
+ pass
147
+
148
+
149
+ class LoongArch64SysVSnprintf(Snprintf, LoongArch64SysVModel):
150
+ pass
151
+
152
+
153
+ class LoongArch64SysVSprintf(Sprintf, LoongArch64SysVModel):
154
+ pass
155
+
156
+
157
+ class LoongArch64SysVSscanf(Sscanf, LoongArch64SysVModel):
158
+ pass
159
+
160
+
161
+ class LoongArch64SysVClearerr(Clearerr, LoongArch64SysVModel):
162
+ pass
163
+
164
+
165
+ class LoongArch64SysVFflush(Fflush, LoongArch64SysVModel):
166
+ pass
167
+
168
+
169
+ class LoongArch64SysVFreopen(Freopen, LoongArch64SysVModel):
170
+ pass
171
+
172
+
173
+ class LoongArch64SysVFgetpos(Fgetpos, LoongArch64SysVModel):
174
+ pass
175
+
176
+
177
+ class LoongArch64SysVFsetpos(Fsetpos, LoongArch64SysVModel):
178
+ pass
179
+
180
+
181
+ class LoongArch64SysVTmpfile(Tmpfile, LoongArch64SysVModel):
182
+ pass
183
+
184
+
185
+ class LoongArch64SysVTmpnam(Tmpnam, LoongArch64SysVModel):
186
+ pass
187
+
188
+
189
+ class LoongArch64SysVUngetc(Ungetc, LoongArch64SysVModel):
190
+ pass
191
+
192
+
193
+ class LoongArch64SysVVfprintf(Vfprintf, LoongArch64SysVModel):
194
+ pass
195
+
196
+
197
+ class LoongArch64SysVVfscanf(Vfscanf, LoongArch64SysVModel):
198
+ pass
199
+
200
+
201
+ class LoongArch64SysVVprintf(Vprintf, LoongArch64SysVModel):
202
+ pass
203
+
204
+
205
+ class LoongArch64SysVVscanf(Vscanf, LoongArch64SysVModel):
206
+ pass
207
+
208
+
209
+ class LoongArch64SysVVsnprintf(Vsnprintf, LoongArch64SysVModel):
210
+ pass
211
+
212
+
213
+ class LoongArch64SysVVsprintf(Vsprintf, LoongArch64SysVModel):
214
+ pass
215
+
216
+
217
+ class LoongArch64SysVVsscanf(Vsscanf, LoongArch64SysVModel):
218
+ pass
219
+
220
+
221
+ __all__ = [
222
+ "LoongArch64SysVFclose",
223
+ "LoongArch64SysVFeof",
224
+ "LoongArch64SysVFerror",
225
+ "LoongArch64SysVFgetc",
226
+ "LoongArch64SysVFgets",
227
+ "LoongArch64SysVFopen",
228
+ "LoongArch64SysVFprintf",
229
+ "LoongArch64SysVFputc",
230
+ "LoongArch64SysVFputs",
231
+ "LoongArch64SysVFread",
232
+ "LoongArch64SysVFscanf",
233
+ "LoongArch64SysVFseek",
234
+ "LoongArch64SysVFtell",
235
+ "LoongArch64SysVFwrite",
236
+ "LoongArch64SysVGetc",
237
+ "LoongArch64SysVGetchar",
238
+ "LoongArch64SysVGets",
239
+ "LoongArch64SysVPrintf",
240
+ "LoongArch64SysVPutc",
241
+ "LoongArch64SysVPutchar",
242
+ "LoongArch64SysVPuts",
243
+ "LoongArch64SysVRemove",
244
+ "LoongArch64SysVRename",
245
+ "LoongArch64SysVRewind",
246
+ "LoongArch64SysVScanf",
247
+ "LoongArch64SysVSnprintf",
248
+ "LoongArch64SysVSprintf",
249
+ "LoongArch64SysVSscanf",
250
+ "LoongArch64SysVClearerr",
251
+ "LoongArch64SysVFflush",
252
+ "LoongArch64SysVFreopen",
253
+ "LoongArch64SysVFgetpos",
254
+ "LoongArch64SysVFsetpos",
255
+ "LoongArch64SysVTmpfile",
256
+ "LoongArch64SysVTmpnam",
257
+ "LoongArch64SysVUngetc",
258
+ "LoongArch64SysVVfprintf",
259
+ "LoongArch64SysVVfscanf",
260
+ "LoongArch64SysVVprintf",
261
+ "LoongArch64SysVVscanf",
262
+ "LoongArch64SysVVsnprintf",
263
+ "LoongArch64SysVVsprintf",
264
+ "LoongArch64SysVVsscanf",
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 LoongArch64SysVModel
31
+
32
+
33
+ class LoongArch64SysVAbs(Abs, LoongArch64SysVModel):
34
+ pass
35
+
36
+
37
+ class LoongArch64SysVLAbs(LAbs, LoongArch64SysVModel):
38
+ pass
39
+
40
+
41
+ class LoongArch64SysVLLAbs(LLAbs, LoongArch64SysVModel):
42
+ pass
43
+
44
+
45
+ class LoongArch64SysVAtof(Atof, LoongArch64SysVModel):
46
+ pass
47
+
48
+
49
+ class LoongArch64SysVAtoi(Atoi, LoongArch64SysVModel):
50
+ pass
51
+
52
+
53
+ class LoongArch64SysVAtol(Atol, LoongArch64SysVModel):
54
+ pass
55
+
56
+
57
+ class LoongArch64SysVAtoll(Atoll, LoongArch64SysVModel):
58
+ pass
59
+
60
+
61
+ class LoongArch64SysVCalloc(Calloc, LoongArch64SysVModel):
62
+ pass
63
+
64
+
65
+ class LoongArch64SysVDiv(Div, LoongArch64SysVModel):
66
+ pass
67
+
68
+
69
+ class LoongArch64SysVLDiv(LDiv, LoongArch64SysVModel):
70
+ pass
71
+
72
+
73
+ class LoongArch64SysVLLDiv(LLDiv, LoongArch64SysVModel):
74
+ pass
75
+
76
+
77
+ class LoongArch64SysVExit(Exit, LoongArch64SysVModel):
78
+ pass
79
+
80
+
81
+ class LoongArch64SysVFree(Free, LoongArch64SysVModel):
82
+ pass
83
+
84
+
85
+ class LoongArch64SysVMalloc(Malloc, LoongArch64SysVModel):
86
+ pass
87
+
88
+
89
+ class LoongArch64SysVQSort(QSort, LoongArch64SysVModel):
90
+ pass
91
+
92
+
93
+ class LoongArch64SysVRand(Rand, LoongArch64SysVModel):
94
+ pass
95
+
96
+
97
+ class LoongArch64SysVRealloc(Realloc, LoongArch64SysVModel):
98
+ pass
99
+
100
+
101
+ class LoongArch64SysVSrand(Srand, LoongArch64SysVModel):
102
+ pass
103
+
104
+
105
+ class LoongArch64SysVAbort(Abort, LoongArch64SysVModel):
106
+ pass
107
+
108
+
109
+ class LoongArch64SysVAtexit(Atexit, LoongArch64SysVModel):
110
+ pass
111
+
112
+
113
+ class LoongArch64SysVGetenv(Getenv, LoongArch64SysVModel):
114
+ pass
115
+
116
+
117
+ class LoongArch64SysVMblen(Mblen, LoongArch64SysVModel):
118
+ pass
119
+
120
+
121
+ class LoongArch64SysVMbstowcs(Mbstowcs, LoongArch64SysVModel):
122
+ pass
123
+
124
+
125
+ class LoongArch64SysVMbtowc(Mbtowc, LoongArch64SysVModel):
126
+ pass
127
+
128
+
129
+ class LoongArch64SysVSystem(System, LoongArch64SysVModel):
130
+ pass
131
+
132
+
133
+ class LoongArch64SysVWcstombs(Wcstombs, LoongArch64SysVModel):
134
+ pass
135
+
136
+
137
+ class LoongArch64SysVWctomb(Wctomb, LoongArch64SysVModel):
138
+ pass
139
+
140
+
141
+ __all__ = [
142
+ "LoongArch64SysVAbs",
143
+ "LoongArch64SysVLAbs",
144
+ "LoongArch64SysVLLAbs",
145
+ "LoongArch64SysVAtof",
146
+ "LoongArch64SysVAtoi",
147
+ "LoongArch64SysVAtol",
148
+ "LoongArch64SysVAtoll",
149
+ "LoongArch64SysVCalloc",
150
+ "LoongArch64SysVDiv",
151
+ "LoongArch64SysVLDiv",
152
+ "LoongArch64SysVLLDiv",
153
+ "LoongArch64SysVExit",
154
+ "LoongArch64SysVFree",
155
+ "LoongArch64SysVMalloc",
156
+ "LoongArch64SysVQSort",
157
+ "LoongArch64SysVRand",
158
+ "LoongArch64SysVRealloc",
159
+ "LoongArch64SysVSrand",
160
+ "LoongArch64SysVAbort",
161
+ "LoongArch64SysVAtexit",
162
+ "LoongArch64SysVGetenv",
163
+ "LoongArch64SysVMblen",
164
+ "LoongArch64SysVMbstowcs",
165
+ "LoongArch64SysVMbtowc",
166
+ "LoongArch64SysVSystem",
167
+ "LoongArch64SysVWcstombs",
168
+ "LoongArch64SysVWctomb",
169
+ ]