@psnext/slingcli 2.4.20260525-4 → 2.4.20260527-2

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 (243) hide show
  1. package/bin/sling.js +4 -1
  2. package/node_modules/@aws-sdk/core/package.json +2 -2
  3. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  4. package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +12 -6
  5. package/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.js +12 -6
  6. package/node_modules/@aws-sdk/credential-provider-http/package.json +3 -2
  7. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  8. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  9. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  10. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  11. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
  12. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  13. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  14. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  15. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  16. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  17. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  18. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  19. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  20. package/node_modules/@aws-sdk/nested-clients/package.json +3 -3
  21. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -2
  22. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  23. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +18 -24
  24. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  25. package/node_modules/@earendil-works/pi-ai/dist/cli.js +14 -0
  26. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +78 -63
  27. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +2 -1
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +8 -22
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +1 -1
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +1 -1
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +60 -40
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +1 -1
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +1 -1
  34. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +55 -0
  35. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +45 -69
  36. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -0
  37. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +5 -2
  38. package/node_modules/@earendil-works/pi-ai/package.json +4 -3
  39. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/file-processor.js +2 -3
  40. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +18 -12
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +2 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +3 -2
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +8 -2
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +2 -1
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +18 -24
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/index.js +8 -6
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +6 -3
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +12 -29
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +5 -1
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/core/output-guard.js +52 -22
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +63 -36
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -20
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/core/resource-loader.js +38 -31
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +9 -4
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +32 -24
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +6 -13
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +8 -22
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +54 -53
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit-diff.js +8 -1
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +44 -81
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/file-mutation-queue.js +27 -12
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +2 -3
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +3 -3
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -5
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/output-accumulator.js +9 -3
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/path-utils.js +39 -21
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +9 -8
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/truncate.js +12 -2
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +20 -35
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -6
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +1 -1
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -5
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +29 -4
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +4 -4
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +37 -28
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +64 -7
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +15 -3
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard-native.js +14 -8
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-core.js +124 -0
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize-worker.js +31 -0
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/image-resize.js +75 -115
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +33 -7
  84. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +13 -26
  85. package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
  86. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +40 -55
  87. package/node_modules/@earendil-works/pi-tui/dist/components/input.js +2 -2
  88. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
  89. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +53 -0
  90. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +4 -1
  91. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +38 -16
  92. package/node_modules/@earendil-works/pi-tui/dist/utils.js +19 -12
  93. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  94. package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  95. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  96. package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  97. package/node_modules/@earendil-works/pi-tui/package.json +3 -5
  98. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  99. package/node_modules/undici/lib/api/api-request.js +1 -1
  100. package/node_modules/undici/lib/cache/sqlite-cache-store.js +3 -3
  101. package/node_modules/undici/lib/core/connect.js +16 -0
  102. package/node_modules/undici/lib/core/request.js +17 -2
  103. package/node_modules/undici/lib/core/socks5-client.js +10 -5
  104. package/node_modules/undici/lib/core/socks5-utils.js +17 -22
  105. package/node_modules/undici/lib/dispatcher/client-h1.js +64 -20
  106. package/node_modules/undici/lib/dispatcher/client.js +6 -2
  107. package/node_modules/undici/lib/dispatcher/h2c-client.js +1 -1
  108. package/node_modules/undici/lib/mock/mock-call-history.js +15 -15
  109. package/node_modules/undici/lib/util/cache.js +8 -7
  110. package/node_modules/undici/lib/web/fetch/formdata-parser.js +17 -6
  111. package/node_modules/undici/lib/web/fetch/index.js +5 -2
  112. package/node_modules/undici/lib/web/webidl/index.js +5 -5
  113. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +1 -7
  114. package/node_modules/undici/package.json +1 -1
  115. package/package.json +6 -6
  116. package/slingshot/index.js +269 -266
  117. package/node_modules/koffi/CHANGELOG.md +0 -1093
  118. package/node_modules/koffi/LICENSE.txt +0 -22
  119. package/node_modules/koffi/README.md +0 -43
  120. package/node_modules/koffi/build/koffi/darwin_arm64/koffi.node +0 -0
  121. package/node_modules/koffi/build/koffi/darwin_x64/koffi.node +0 -0
  122. package/node_modules/koffi/build/koffi/freebsd_arm64/koffi.node +0 -0
  123. package/node_modules/koffi/build/koffi/freebsd_ia32/koffi.node +0 -0
  124. package/node_modules/koffi/build/koffi/freebsd_x64/koffi.node +0 -0
  125. package/node_modules/koffi/build/koffi/linux_arm64/koffi.node +0 -0
  126. package/node_modules/koffi/build/koffi/linux_armhf/koffi.node +0 -0
  127. package/node_modules/koffi/build/koffi/linux_ia32/koffi.node +0 -0
  128. package/node_modules/koffi/build/koffi/linux_loong64/koffi.node +0 -0
  129. package/node_modules/koffi/build/koffi/linux_riscv64d/koffi.node +0 -0
  130. package/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  131. package/node_modules/koffi/build/koffi/musl_arm64/koffi.node +0 -0
  132. package/node_modules/koffi/build/koffi/musl_x64/koffi.node +0 -0
  133. package/node_modules/koffi/build/koffi/openbsd_ia32/koffi.node +0 -0
  134. package/node_modules/koffi/build/koffi/openbsd_x64/koffi.node +0 -0
  135. package/node_modules/koffi/build/koffi/win32_arm64/koffi.exp +0 -0
  136. package/node_modules/koffi/build/koffi/win32_arm64/koffi.lib +0 -0
  137. package/node_modules/koffi/build/koffi/win32_arm64/koffi.node +0 -0
  138. package/node_modules/koffi/build/koffi/win32_ia32/koffi.exp +0 -0
  139. package/node_modules/koffi/build/koffi/win32_ia32/koffi.lib +0 -0
  140. package/node_modules/koffi/build/koffi/win32_ia32/koffi.node +0 -0
  141. package/node_modules/koffi/build/koffi/win32_x64/koffi.exp +0 -0
  142. package/node_modules/koffi/build/koffi/win32_x64/koffi.lib +0 -0
  143. package/node_modules/koffi/build/koffi/win32_x64/koffi.node +0 -0
  144. package/node_modules/koffi/doc/benchmarks.md +0 -126
  145. package/node_modules/koffi/doc/callbacks.md +0 -210
  146. package/node_modules/koffi/doc/contribute.md +0 -148
  147. package/node_modules/koffi/doc/functions.md +0 -250
  148. package/node_modules/koffi/doc/index.md +0 -61
  149. package/node_modules/koffi/doc/input.md +0 -471
  150. package/node_modules/koffi/doc/migration.md +0 -159
  151. package/node_modules/koffi/doc/misc.md +0 -180
  152. package/node_modules/koffi/doc/output.md +0 -305
  153. package/node_modules/koffi/doc/packaging.md +0 -88
  154. package/node_modules/koffi/doc/platforms.md +0 -36
  155. package/node_modules/koffi/doc/pointers.md +0 -328
  156. package/node_modules/koffi/doc/start.md +0 -118
  157. package/node_modules/koffi/doc/unions.md +0 -186
  158. package/node_modules/koffi/doc/variables.md +0 -102
  159. package/node_modules/koffi/index.d.ts +0 -288
  160. package/node_modules/koffi/index.js +0 -634
  161. package/node_modules/koffi/indirect.js +0 -533
  162. package/node_modules/koffi/lib/native/base/base.cc +0 -11015
  163. package/node_modules/koffi/lib/native/base/base.hh +0 -6003
  164. package/node_modules/koffi/lib/native/base/crc.inc +0 -2214
  165. package/node_modules/koffi/lib/native/base/crc_gen.py +0 -72
  166. package/node_modules/koffi/lib/native/base/mimetypes.inc +0 -1248
  167. package/node_modules/koffi/lib/native/base/mimetypes_gen.py +0 -58
  168. package/node_modules/koffi/lib/native/base/tower.cc +0 -821
  169. package/node_modules/koffi/lib/native/base/tower.hh +0 -81
  170. package/node_modules/koffi/lib/native/base/unicode.inc +0 -408
  171. package/node_modules/koffi/lib/native/base/unicode_gen.py +0 -152
  172. package/node_modules/koffi/package.json +0 -38
  173. package/node_modules/koffi/src/cnoke/LICENSE.txt +0 -22
  174. package/node_modules/koffi/src/cnoke/README.md +0 -99
  175. package/node_modules/koffi/src/cnoke/assets/FindCNoke.cmake +0 -127
  176. package/node_modules/koffi/src/cnoke/assets/toolchains.json +0 -126
  177. package/node_modules/koffi/src/cnoke/assets/win_delay_hook.c +0 -36
  178. package/node_modules/koffi/src/cnoke/cnoke.js +0 -170
  179. package/node_modules/koffi/src/cnoke/package.json +0 -24
  180. package/node_modules/koffi/src/cnoke/src/builder.js +0 -511
  181. package/node_modules/koffi/src/cnoke/src/index.js +0 -10
  182. package/node_modules/koffi/src/cnoke/src/tools.js +0 -407
  183. package/node_modules/koffi/src/koffi/CMakeLists.txt +0 -182
  184. package/node_modules/koffi/src/koffi/src/abi_arm32.cc +0 -1018
  185. package/node_modules/koffi/src/koffi/src/abi_arm32_asm.S +0 -169
  186. package/node_modules/koffi/src/koffi/src/abi_arm64.cc +0 -1295
  187. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.S +0 -195
  188. package/node_modules/koffi/src/koffi/src/abi_arm64_asm.asm +0 -174
  189. package/node_modules/koffi/src/koffi/src/abi_loong64.cc +0 -5
  190. package/node_modules/koffi/src/koffi/src/abi_loong64_asm.S +0 -204
  191. package/node_modules/koffi/src/koffi/src/abi_riscv64.cc +0 -915
  192. package/node_modules/koffi/src/koffi/src/abi_riscv64_asm.S +0 -203
  193. package/node_modules/koffi/src/koffi/src/abi_x64_sysv.cc +0 -939
  194. package/node_modules/koffi/src/koffi/src/abi_x64_sysv_asm.S +0 -231
  195. package/node_modules/koffi/src/koffi/src/abi_x64_win.cc +0 -715
  196. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.S +0 -166
  197. package/node_modules/koffi/src/koffi/src/abi_x64_win_asm.asm +0 -192
  198. package/node_modules/koffi/src/koffi/src/abi_x86.cc +0 -860
  199. package/node_modules/koffi/src/koffi/src/abi_x86_asm.S +0 -193
  200. package/node_modules/koffi/src/koffi/src/abi_x86_asm.asm +0 -177
  201. package/node_modules/koffi/src/koffi/src/call.cc +0 -1326
  202. package/node_modules/koffi/src/koffi/src/call.hh +0 -179
  203. package/node_modules/koffi/src/koffi/src/errno.inc +0 -462
  204. package/node_modules/koffi/src/koffi/src/ffi.cc +0 -2702
  205. package/node_modules/koffi/src/koffi/src/ffi.hh +0 -354
  206. package/node_modules/koffi/src/koffi/src/init.js +0 -105
  207. package/node_modules/koffi/src/koffi/src/parser.cc +0 -220
  208. package/node_modules/koffi/src/koffi/src/parser.hh +0 -54
  209. package/node_modules/koffi/src/koffi/src/util.cc +0 -1807
  210. package/node_modules/koffi/src/koffi/src/util.hh +0 -221
  211. package/node_modules/koffi/src/koffi/src/uv.cc +0 -193
  212. package/node_modules/koffi/src/koffi/src/uv.def +0 -10
  213. package/node_modules/koffi/src/koffi/src/uv.hh +0 -40
  214. package/node_modules/koffi/src/koffi/src/win32.cc +0 -198
  215. package/node_modules/koffi/src/koffi/src/win32.hh +0 -119
  216. package/node_modules/koffi/src/koffi/tools/write_trampolines.js +0 -77
  217. package/node_modules/koffi/vendor/node-addon-api/LICENSE.md +0 -9
  218. package/node_modules/koffi/vendor/node-addon-api/README.md +0 -95
  219. package/node_modules/koffi/vendor/node-addon-api/napi-inl.deprecated.h +0 -186
  220. package/node_modules/koffi/vendor/node-addon-api/napi-inl.h +0 -7033
  221. package/node_modules/koffi/vendor/node-addon-api/napi.h +0 -3309
  222. package/node_modules/koffi/vendor/node-api-headers/LICENSE +0 -21
  223. package/node_modules/koffi/vendor/node-api-headers/README.md +0 -95
  224. package/node_modules/koffi/vendor/node-api-headers/def/js_native_api.def +0 -125
  225. package/node_modules/koffi/vendor/node-api-headers/def/node_api.def +0 -157
  226. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api.h +0 -591
  227. package/node_modules/koffi/vendor/node-api-headers/include/js_native_api_types.h +0 -210
  228. package/node_modules/koffi/vendor/node-api-headers/include/node_api.h +0 -265
  229. package/node_modules/koffi/vendor/node-api-headers/include/node_api_types.h +0 -58
  230. package/node_modules/koffi/vendor/node-api-headers/include/uv/aix.h +0 -32
  231. package/node_modules/koffi/vendor/node-api-headers/include/uv/bsd.h +0 -34
  232. package/node_modules/koffi/vendor/node-api-headers/include/uv/darwin.h +0 -61
  233. package/node_modules/koffi/vendor/node-api-headers/include/uv/errno.h +0 -483
  234. package/node_modules/koffi/vendor/node-api-headers/include/uv/linux.h +0 -34
  235. package/node_modules/koffi/vendor/node-api-headers/include/uv/os390.h +0 -33
  236. package/node_modules/koffi/vendor/node-api-headers/include/uv/posix.h +0 -31
  237. package/node_modules/koffi/vendor/node-api-headers/include/uv/sunos.h +0 -44
  238. package/node_modules/koffi/vendor/node-api-headers/include/uv/threadpool.h +0 -37
  239. package/node_modules/koffi/vendor/node-api-headers/include/uv/tree.h +0 -521
  240. package/node_modules/koffi/vendor/node-api-headers/include/uv/unix.h +0 -512
  241. package/node_modules/koffi/vendor/node-api-headers/include/uv/version.h +0 -43
  242. package/node_modules/koffi/vendor/node-api-headers/include/uv/win.h +0 -698
  243. package/node_modules/koffi/vendor/node-api-headers/include/uv.h +0 -1990
@@ -1,193 +0,0 @@
1
- # SPDX-License-Identifier: MIT
2
- # SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- #define SYMBOL(Symbol) Symbol
5
-
6
- # Forward
7
- # ----------------------------
8
-
9
- .global ForwardCallG
10
- .global ForwardCallF
11
- .global ForwardCallD
12
- .global ForwardCallRG
13
- .global ForwardCallRF
14
- .global ForwardCallRD
15
-
16
- #define ENDBR32 .byte 0xf3, 0x0f, 0x1e, 0xfb
17
-
18
- # Copy function pointer to EAX, in order to save it through argument forwarding.
19
- # Also make a copy of the SP to CallData::old_sp because the callback system might need it.
20
- # Save ESP in EBX (non-volatile), and use carefully assembled stack provided by caller.
21
- .macro prologue
22
- .cfi_startproc
23
- .cfi_def_cfa esp, 4
24
- ENDBR32
25
- push %ebp
26
- .cfi_def_cfa esp, 8
27
- movl %esp, %ebp
28
- .cfi_def_cfa ebp, 8
29
- movl 16(%esp), %eax
30
- movl %esp, 0(%eax)
31
- movl 8(%esp), %eax
32
- movl 12(%esp), %esp
33
- .endm
34
-
35
- .macro fastcall
36
- movl 0(%esp), %ecx
37
- movl 4(%esp), %edx
38
- addl $16, %esp
39
- .endm
40
-
41
- # Call native function.
42
- # Once done, restore normal stack pointer and return.
43
- # The return value is passed back untouched.
44
- .macro epilogue
45
- call *%eax
46
- movl %ebp, %esp
47
- pop %ebp
48
- .cfi_def_cfa esp, 4
49
- ret
50
- .cfi_endproc
51
- .endm
52
-
53
- ForwardCallG:
54
- prologue
55
- epilogue
56
-
57
- ForwardCallF:
58
- prologue
59
- epilogue
60
-
61
- ForwardCallD:
62
- prologue
63
- epilogue
64
-
65
- ForwardCallRG:
66
- prologue
67
- fastcall
68
- epilogue
69
-
70
- ForwardCallRF:
71
- prologue
72
- fastcall
73
- epilogue
74
-
75
- ForwardCallRD:
76
- prologue
77
- fastcall
78
- epilogue
79
-
80
- # Callbacks
81
- # ----------------------------
82
-
83
- .global RelayCallback
84
- .global SwitchAndRelay
85
- .global RelayDirect
86
- .global FindTrampolineStart
87
- .global FindTrampolineEnd
88
-
89
- # Call the C function RelayCallback with the following arguments:
90
- # static trampoline ID, the current stack pointer, a pointer to the stack arguments of this call,
91
- # and a pointer to a struct that will contain the result registers.
92
- # After the call, simply load these registers from the output struct.
93
- # Depending on ABI, call convention and return value size, we need to issue ret <something>. Since ret
94
- # only takes an immediate value, and I prefer not to branch, the return address is moved instead according
95
- # to BackRegisters::ret_pop before ret is issued.
96
- # We need to branch at the end to avoid x87 stack imbalance.
97
- .macro trampoline id
98
- .cfi_startproc
99
- ENDBR32
100
- movl $\id, %eax
101
- jmp RelayTrampoline
102
- .cfi_endproc
103
- .endm
104
-
105
- RelayTrampoline:
106
- .cfi_startproc
107
- .cfi_def_cfa esp, 4
108
- sub $44, %esp
109
- .cfi_def_cfa esp, 48
110
- movl %eax, 0(%esp)
111
- movl %esp, 4(%esp)
112
- movl $0, 32(%esp)
113
- movl $0, 36(%esp)
114
- call GetEIP
115
- addl $_GLOBAL_OFFSET_TABLE_, %eax
116
- call *RelayCallback@GOT(%eax)
117
- movl 44(%esp), %edx
118
- movl 36(%esp), %ecx
119
- movl %edx, 44(%esp, %ecx)
120
- cmpl $1, 32(%esp)
121
- je 1f
122
- cmpl $2, 32(%esp)
123
- je 2f
124
- 0:
125
- movl 16(%esp), %eax
126
- movl 20(%esp), %edx
127
- leal 44(%esp, %ecx), %esp
128
- .cfi_def_cfa esp, 4
129
- ret
130
- 1:
131
- flds 24(%esp)
132
- leal 44(%esp, %ecx), %esp
133
- .cfi_def_cfa esp, 4
134
- ret
135
- 2:
136
- fldl 24(%esp)
137
- leal 44(%esp, %ecx), %esp
138
- .cfi_def_cfa esp, 4
139
- ret
140
- .cfi_endproc
141
-
142
- # When a callback is relayed, Koffi will call into Node.js and V8 to execute Javascript.
143
- # The problem is that we're still running on the separate Koffi stack, and V8 will
144
- # probably misdetect this as a "stack overflow". We have to restore the old
145
- # stack pointer, call Node.js/V8 and go back to ours.
146
- SwitchAndRelay:
147
- .cfi_startproc
148
- .cfi_def_cfa esp, 4
149
- ENDBR32
150
- push %ebp
151
- .cfi_def_cfa esp, 8
152
- movl %esp, %ebp
153
- .cfi_def_cfa ebp, 8
154
- movl 24(%esp), %ecx
155
- movl %esp, %eax
156
- subl 0(%ecx), %eax
157
- andl $-16, %eax
158
- movl %eax, 4(%ecx)
159
- movl 20(%esp), %esp
160
- subl $24, %esp
161
- movl 8(%ebp), %eax
162
- movl %eax, 0(%esp)
163
- movl 12(%ebp), %eax
164
- movl %eax, 4(%esp)
165
- movl 16(%ebp), %eax
166
- movl %eax, 8(%esp)
167
- call GetEIP
168
- addl $_GLOBAL_OFFSET_TABLE_, %eax
169
- call *RelayDirect@GOT(%eax)
170
- mov %ebp, %esp
171
- .cfi_def_cfa esp, 8
172
- pop %ebp
173
- .cfi_def_cfa esp, 4
174
- ret
175
- .cfi_endproc
176
-
177
- .balign 16
178
- FindTrampolineStart:
179
- call GetEIP
180
- addl $16, %eax
181
- andl $0xFFFFFFF0, %eax
182
- ret
183
- .balign 16
184
-
185
- #include "gnu.inc"
186
-
187
- FindTrampolineEnd:
188
- call GetEIP
189
- ret
190
-
191
- GetEIP:
192
- movl (%esp), %eax
193
- ret
@@ -1,177 +0,0 @@
1
- ; SPDX-License-Identifier: MIT
2
- ; SPDX-FileCopyrightText: 2025 Niels Martignène <niels.martignene@protonmail.com>
3
-
4
- ; Forward
5
- ; ----------------------------
6
-
7
- public ForwardCallG
8
- public ForwardCallF
9
- public ForwardCallD
10
- public ForwardCallRG
11
- public ForwardCallRF
12
- public ForwardCallRD
13
-
14
- .model flat, C
15
- .code
16
-
17
- ; Copy function pointer to EAX, in order to save it through argument forwarding.
18
- ; Also make a copy of the SP to CallData::old_sp because the callback system might need it.
19
- ; Save ESP in EBX (non-volatile), and use carefully assembled stack provided by caller.
20
- prologue macro
21
- endbr32
22
- push ebp
23
- mov ebp, esp
24
- mov eax, dword ptr [esp+16]
25
- mov dword ptr [eax+0], esp
26
- mov eax, dword ptr [esp+8]
27
- mov esp, dword ptr [esp+12]
28
- endm
29
-
30
- fastcall macro
31
- mov ecx, dword ptr [esp+0]
32
- mov edx, dword ptr [esp+4]
33
- add esp, 16
34
- endm
35
-
36
- ; Call native function.
37
- ; Once done, restore normal stack pointer and return.
38
- ; The return value is passed back untouched.
39
- epilogue macro
40
- call eax
41
- mov esp, ebp
42
- pop ebp
43
- ret
44
- endm
45
-
46
- ForwardCallG proc
47
- prologue
48
- epilogue
49
- ForwardCallG endp
50
-
51
- ForwardCallF proc
52
- prologue
53
- epilogue
54
- ForwardCallF endp
55
-
56
- ForwardCallD proc
57
- prologue
58
- epilogue
59
- ForwardCallD endp
60
-
61
- ForwardCallRG proc
62
- prologue
63
- fastcall
64
- epilogue
65
- ForwardCallRG endp
66
-
67
- ForwardCallRF proc
68
- prologue
69
- fastcall
70
- epilogue
71
- ForwardCallRF endp
72
-
73
- ForwardCallRD proc
74
- prologue
75
- fastcall
76
- epilogue
77
- ForwardCallRD endp
78
-
79
- ; Callbacks
80
- ; ----------------------------
81
-
82
- extern RelayCallback : PROC
83
- public SwitchAndRelay
84
- extern RelayDirect : PROC
85
-
86
- ; Call the C function RelayCallback with the following arguments:
87
- ; static trampoline ID, the current stack pointer, a pointer to the stack arguments of this call,
88
- ; and a pointer to a struct that will contain the result registers.
89
- ; After the call, simply load these registers from the output struct.
90
- ; Depending on ABI, call convention and return value size, we need to issue ret <something>. Since ret
91
- ; only takes an immediate value, and I prefer not to branch, the return address is moved instead according
92
- ; to BackRegisters::ret_pop before ret is issued.
93
- ; We need to branch at the end to avoid x87 stack imbalance.
94
- trampoline macro ID
95
- endbr32
96
- mov eax, ID
97
- jmp RelayTrampoline
98
- endm
99
-
100
- RelayTrampoline proc
101
- sub esp, 44
102
- mov dword ptr [esp+0], eax
103
- mov dword ptr [esp+4], esp
104
- mov dword ptr [esp+32], 0
105
- mov dword ptr [esp+36], 0
106
- call RelayCallback
107
- mov edx, dword ptr [esp+44]
108
- mov ecx, dword ptr [esp+36]
109
- mov dword ptr [esp+ecx+44], edx
110
- cmp dword ptr [esp+32], 1
111
- je l1
112
- cmp dword ptr [esp+32], 2
113
- je l2
114
- l0:
115
- mov eax, dword ptr [esp+16]
116
- mov edx, dword ptr [esp+20]
117
- lea esp, dword ptr [esp+ecx+44]
118
- ret
119
- l1:
120
- fld dword ptr [esp+24]
121
- lea esp, dword ptr [esp+ecx+44]
122
- ret
123
- l2:
124
- fld qword ptr [esp+24]
125
- lea esp, dword ptr [esp+ecx+44]
126
- ret
127
- RelayTrampoline endp
128
-
129
- ; When a callback is relayed, Koffi will call into Node.js and V8 to execute Javascript.
130
- ; The problem is that we're still running on the separate Koffi stack, and V8 will
131
- ; probably misdetect this as a "stack overflow". We have to restore the old
132
- ; stack pointer, call Node.js/V8 and go back to ours.
133
- SwitchAndRelay proc
134
- endbr32
135
- push ebp
136
- mov ebp, esp
137
- mov ecx, dword ptr [esp+24]
138
- mov eax, esp
139
- sub eax, dword ptr [ecx+0]
140
- and eax, -16
141
- mov dword ptr [ecx+4], eax
142
- mov esp, dword ptr [esp+20]
143
- sub esp, 24
144
- mov eax, dword ptr [ebp+8]
145
- mov dword ptr [esp+0], eax
146
- mov eax, dword ptr [ebp+12]
147
- mov dword ptr [esp+4], eax
148
- mov eax, dword ptr [ebp+16]
149
- mov dword ptr [esp+8], eax
150
- call RelayDirect
151
- mov esp, ebp
152
- pop ebp
153
- ret
154
- SwitchAndRelay endp
155
-
156
- align 16
157
- FindTrampolineStart proc
158
- call GetEIP
159
- add eax, 16
160
- and eax, 0FFFFFFF0h
161
- ret
162
- FindTrampolineStart endp
163
- align 16
164
-
165
- include masm32.inc
166
-
167
- FindTrampolineEnd proc
168
- call GetEIP
169
- ret
170
- FindTrampolineEnd endp
171
-
172
- GetEIP proc
173
- mov eax, dword ptr [esp]
174
- ret
175
- GetEIP endp
176
-
177
- end