koffi 1.0.1 → 1.0.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 (48) hide show
  1. package/CMakeLists.txt +12 -11
  2. package/build/qemu/1.0.2/koffi_darwin_x64.tar.gz +0 -0
  3. package/build/qemu/1.0.2/koffi_freebsd_arm64.tar.gz +0 -0
  4. package/build/qemu/1.0.2/koffi_freebsd_ia32.tar.gz +0 -0
  5. package/build/qemu/1.0.2/koffi_freebsd_x64.tar.gz +0 -0
  6. package/build/qemu/1.0.2/koffi_linux_arm.tar.gz +0 -0
  7. package/build/qemu/1.0.2/koffi_linux_arm64.tar.gz +0 -0
  8. package/build/qemu/1.0.2/koffi_linux_ia32.tar.gz +0 -0
  9. package/build/qemu/1.0.2/koffi_linux_x64.tar.gz +0 -0
  10. package/build/qemu/1.0.2/koffi_win32_ia32.tar.gz +0 -0
  11. package/build/qemu/1.0.2/koffi_win32_x64.tar.gz +0 -0
  12. package/package.json +8 -4
  13. package/qemu/qemu.js +794 -0
  14. package/qemu/registry/machines.json +415 -0
  15. package/qemu/registry/sha256sum.txt +45 -0
  16. package/src/{call_arm32.cc → abi_arm32.cc} +76 -50
  17. package/src/{call_arm32_fwd.S → abi_arm32_fwd.S} +0 -0
  18. package/src/{call_arm64.cc → abi_arm64.cc} +79 -51
  19. package/src/{call_arm64_fwd.S → abi_arm64_fwd.S} +0 -0
  20. package/src/{call_x64_sysv.cc → abi_x64_sysv.cc} +77 -49
  21. package/src/{call_x64_sysv_fwd.S → abi_x64_sysv_fwd.S} +0 -0
  22. package/src/{call_x64_win.cc → abi_x64_win.cc} +71 -47
  23. package/src/{call_x64_win_fwd.asm → abi_x64_win_fwd.asm} +0 -0
  24. package/src/{call_x86.cc → abi_x86.cc} +74 -56
  25. package/src/{call_x86_fwd.S → abi_x86_fwd.S} +0 -0
  26. package/src/{call_x86_fwd.asm → abi_x86_fwd.asm} +0 -0
  27. package/src/call.cc +228 -0
  28. package/src/call.hh +96 -4
  29. package/src/ffi.cc +7 -2
  30. package/src/ffi.hh +2 -0
  31. package/src/util.cc +11 -157
  32. package/src/util.hh +0 -91
  33. package/test/CMakeLists.txt +1 -0
  34. package/test/misc.c +289 -0
  35. package/test/misc.def +3 -0
  36. package/test/misc.js +180 -0
  37. package/test/raylib.js +165 -0
  38. package/test/sqlite.js +104 -0
  39. package/build/qemu/1.0.1/koffi_darwin_x64.tar.gz +0 -0
  40. package/build/qemu/1.0.1/koffi_freebsd_arm64.tar.gz +0 -0
  41. package/build/qemu/1.0.1/koffi_freebsd_ia32.tar.gz +0 -0
  42. package/build/qemu/1.0.1/koffi_freebsd_x64.tar.gz +0 -0
  43. package/build/qemu/1.0.1/koffi_linux_arm.tar.gz +0 -0
  44. package/build/qemu/1.0.1/koffi_linux_arm64.tar.gz +0 -0
  45. package/build/qemu/1.0.1/koffi_linux_ia32.tar.gz +0 -0
  46. package/build/qemu/1.0.1/koffi_linux_x64.tar.gz +0 -0
  47. package/build/qemu/1.0.1/koffi_win32_ia32.tar.gz +0 -0
  48. package/build/qemu/1.0.1/koffi_win32_x64.tar.gz +0 -0
@@ -0,0 +1,415 @@
1
+ {
2
+ "debian_arm32": {
3
+ "name": "Debian ARM32",
4
+
5
+ "qemu": {
6
+ "binary": "qemu-system-arm",
7
+ "arguments": ["-M", "virt", "-cpu", "cortex-a15", "-m", "1G", "-smp", 2, "-kernel", "vmlinuz-5.10.0-12-armmp-lpae", "-initrd", "initrd.img-5.10.0-12-armmp-lpae", "-append", "root=/dev/vda2 apparmor=0", "-drive", "if=none,file=disk.qcow2,format=qcow2,id=hd", "-device", "virtio-blk-device,drive=hd", "-netdev", "user,id=mynet,hostfwd=tcp::22201-:22", "-device", "virtio-net-device,netdev=mynet", "-vnc", "127.0.0.1:11"]
8
+ },
9
+
10
+ "info": {
11
+ "version": 3,
12
+ "platform": "linux",
13
+ "arch": "arm",
14
+
15
+ "ssh_port": 22201,
16
+ "vnc_port": 5911,
17
+
18
+ "username": "debian",
19
+ "password": "debian",
20
+
21
+ "shutdown": "sudo poweroff"
22
+ },
23
+
24
+ "builds": {
25
+ "Linux ARM32": {
26
+ "directory": "/home/debian/luigi",
27
+ "build": "node ../cnoke/cnoke.js"
28
+ }
29
+ },
30
+
31
+ "tests": {
32
+ "Linux ARM32": {
33
+ "directory": "/home/debian/luigi",
34
+ "build": {
35
+ "Build": "node ../cnoke/cnoke.js -C test"
36
+ },
37
+ "commands": {
38
+ "Test Raylib": "xvfb-run node test/raylib.js",
39
+ "Test Misc": "node test/misc.js",
40
+ "Test SQLite": "node test/sqlite.js"
41
+ }
42
+ }
43
+ }
44
+ },
45
+
46
+ "debian_arm64": {
47
+ "name": "Debian ARM64",
48
+
49
+ "qemu": {
50
+ "binary": "qemu-system-aarch64",
51
+ "arguments": ["-M", "virt", "-cpu", "cortex-a53", "-m", "1G", "-smp", 2, "-kernel", "vmlinuz-5.10.0-12-arm64", "-initrd", "initrd.img-5.10.0-12-arm64", "-append", "root=/dev/vda2 apparmor=0", "-drive", "if=none,file=disk.qcow2,format=qcow2,id=hd", "-device", "virtio-blk-device,drive=hd", "-netdev", "user,id=mynet,hostfwd=tcp::22202-:22", "-device", "virtio-net-device,netdev=mynet", "-vnc", "127.0.0.1:12"]
52
+ },
53
+
54
+ "info": {
55
+ "version": 3,
56
+ "platform": "linux",
57
+ "arch": "arm64",
58
+
59
+ "ssh_port": 22202,
60
+ "vnc_port": 5912,
61
+
62
+ "username": "debian",
63
+ "password": "debian",
64
+
65
+ "shutdown": "sudo poweroff"
66
+ },
67
+
68
+ "builds": {
69
+ "Linux ARM64": {
70
+ "directory": "/home/debian/luigi",
71
+ "build": "node ../cnoke/cnoke.js"
72
+ }
73
+ },
74
+
75
+ "tests": {
76
+ "Linux ARM64": {
77
+ "directory": "/home/debian/luigi",
78
+ "build": {
79
+ "Build": "node ../cnoke/cnoke.js -C test"
80
+ },
81
+ "commands": {
82
+ "Test Raylib": "xvfb-run node test/raylib.js",
83
+ "Test Misc": "node test/misc.js",
84
+ "Test SQLite": "node test/sqlite.js"
85
+ }
86
+ }
87
+ }
88
+ },
89
+
90
+ "debian_i386": {
91
+ "name": "Debian i386",
92
+
93
+ "qemu": {
94
+ "binary": "qemu-system-i386",
95
+ "arguments": ["-cpu", "max", "-m", "1G", "-smp", 2, "-kernel", "vmlinuz-5.10.0-12-686-pae", "-initrd", "initrd.img-5.10.0-12-686-pae", "-append", "root=/dev/sda1 apparmor=0", "-hda", "disk.qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22203-:22", "-device", "e1000,netdev=mynet", "-vnc", "127.0.0.1:13"]
96
+ },
97
+
98
+ "info": {
99
+ "version": 3,
100
+ "platform": "linux",
101
+ "arch": "ia32",
102
+
103
+ "ssh_port": 22203,
104
+ "vnc_port": 5913,
105
+
106
+ "username": "debian",
107
+ "password": "debian",
108
+
109
+ "shutdown": "sudo poweroff"
110
+ },
111
+
112
+ "builds": {
113
+ "Linux i386": {
114
+ "directory": "/home/debian/luigi",
115
+ "build": "node ../cnoke/cnoke.js"
116
+ }
117
+ },
118
+
119
+ "tests": {
120
+ "Linux i386": {
121
+ "directory": "/home/debian/luigi",
122
+ "build": {
123
+ "Build": "node ../cnoke/cnoke.js -C test"
124
+ },
125
+ "commands": {
126
+ "Test Raylib": "xvfb-run node test/raylib.js",
127
+ "Test Misc": "node test/misc.js",
128
+ "Test SQLite": "node test/sqlite.js"
129
+ }
130
+ }
131
+ }
132
+ },
133
+
134
+ "debian_x64": {
135
+ "name": "Debian x64",
136
+
137
+ "qemu": {
138
+ "binary": "qemu-system-x86_64",
139
+ "arguments": ["-m", "1G", "-smp", 2, "-kernel", "vmlinuz-5.10.0-12-amd64", "-initrd", "initrd.img-5.10.0-12-amd64", "-append", "root=/dev/sda1 apparmor=0", "-hda", "disk.qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22204-:22", "-device", "e1000,netdev=mynet", "-vnc", "127.0.0.1:14"]
140
+ },
141
+
142
+ "info": {
143
+ "version": 3,
144
+ "platform": "linux",
145
+ "arch": "x64",
146
+
147
+ "ssh_port": 22204,
148
+ "vnc_port": 5914,
149
+
150
+ "username": "debian",
151
+ "password": "debian",
152
+
153
+ "shutdown": "sudo poweroff"
154
+ },
155
+
156
+ "builds": {
157
+ "Linux x64": {
158
+ "directory": "/home/debian/luigi",
159
+ "build": "node ../cnoke/cnoke.js"
160
+ }
161
+ },
162
+
163
+ "tests": {
164
+ "Linux x64": {
165
+ "directory": "/home/debian/luigi",
166
+ "build": {
167
+ "Build": "node ../cnoke/cnoke.js -C test"
168
+ },
169
+ "commands": {
170
+ "Test Raylib": "xvfb-run node test/raylib.js",
171
+ "Test Misc": "node test/misc.js",
172
+ "Test SQLite": "node test/sqlite.js"
173
+ }
174
+ }
175
+ }
176
+ },
177
+
178
+ "windows": {
179
+ "name": "Windows",
180
+
181
+ "qemu": {
182
+ "binary": "qemu-system-x86_64",
183
+ "arguments": ["-m", "3G", "-smp", 4, "-rtc", "clock=host,base=localtime", "-bios", "bios.bin", "-hda", "disk.qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22205-:22", "-device", "e1000,netdev=mynet", "-vga", "std", "-device", "qemu-xhci", "-device", "usb-tablet", "-vnc", "127.0.0.1:15"]
184
+ },
185
+
186
+ "info": {
187
+ "version": 7,
188
+ "platform": "win32",
189
+ "arch": "x64",
190
+
191
+ "ssh_port": 22205,
192
+ "vnc_port": 5915,
193
+
194
+ "username": "windows",
195
+ "password": "windows",
196
+
197
+ "shutdown": "shutdown -s -t 0"
198
+ },
199
+
200
+ "builds": {
201
+ "Windows i386": {
202
+ "arch": "ia32",
203
+ "directory": "C:/Users/windows/Desktop/luigi32",
204
+ "build": "C:\\Node32\\node32.cmd node ../cnoke/cnoke.js"
205
+ },
206
+
207
+ "Windows x64": {
208
+ "arch": "x64",
209
+ "directory": "C:/Users/windows/Desktop/luigi64",
210
+ "build": "C:\\Node64\\node64.cmd node ../cnoke/cnoke.js"
211
+ }
212
+ },
213
+
214
+ "tests": {
215
+ "Windows i386": {
216
+ "directory": "C:/Users/windows/Desktop/luigi32",
217
+ "build": {
218
+ "Build": "C:\\Node32\\node32.cmd node ../cnoke/cnoke.js -C test"
219
+ },
220
+ "commands": {
221
+ "Test Raylib": "seatsh C:\\Node32\\node32.cmd node test/raylib.js",
222
+ "Test Misc": "C:\\Node32\\node32.cmd node test/misc.js",
223
+ "Test SQLite": "C:\\Node32\\node32.cmd node test/sqlite.js"
224
+ }
225
+ },
226
+
227
+ "Windows x64": {
228
+ "directory": "C:/Users/windows/Desktop/luigi64",
229
+ "build": {
230
+ "Build": "C:\\Node64\\node64.cmd node ../cnoke/cnoke.js -C test"
231
+ },
232
+ "commands": {
233
+ "Test Raylib": "seatsh C:\\Node64\\node64.cmd node test/raylib.js",
234
+ "Test Misc": "C:\\Node64\\node64.cmd node test/misc.js",
235
+ "Test SQLite": "C:\\Node64\\node64.cmd node test/sqlite.js"
236
+ }
237
+ }
238
+ }
239
+ },
240
+
241
+ "freebsd_x64": {
242
+ "name": "FreeBSD x64",
243
+
244
+ "qemu": {
245
+ "binary": "qemu-system-x86_64",
246
+ "arguments": ["-m", "1G", "-smp", 2, "-hda", "disk.qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22206-:22", "-device", "e1000,netdev=mynet", "-vnc", "127.0.0.1:16"]
247
+ },
248
+
249
+ "info": {
250
+ "version": 1,
251
+ "platform": "freebsd",
252
+ "arch": "x64",
253
+
254
+ "ssh_port": 22206,
255
+ "vnc_port": 5916,
256
+
257
+ "username": "freebsd",
258
+ "password": "freebsd",
259
+
260
+ "shutdown": "sudo poweroff"
261
+ },
262
+
263
+ "builds": {
264
+ "FreeBSD x64": {
265
+ "directory": "/home/freebsd/luigi",
266
+ "build": "node ../cnoke/cnoke.js"
267
+ }
268
+ },
269
+
270
+ "tests": {
271
+ "FreeBSD x64": {
272
+ "directory": "/home/freebsd/luigi",
273
+ "build": {
274
+ "Build": "node ../cnoke/cnoke.js -C test"
275
+ },
276
+ "commands": {
277
+ "Test Raylib": "xvfb-run node test/raylib.js",
278
+ "Test Misc": "node test/misc.js",
279
+ "Test SQLite": "node test/sqlite.js"
280
+ }
281
+ }
282
+ }
283
+ },
284
+
285
+ "freebsd_i386": {
286
+ "name": "FreeBSD i386",
287
+
288
+ "qemu": {
289
+ "binary": "qemu-system-i386",
290
+ "arguments": ["-m", "1G", "-smp", 2, "-hda", "disk.qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22207-:22", "-device", "e1000,netdev=mynet", "-vnc", "127.0.0.1:17"]
291
+ },
292
+
293
+ "info": {
294
+ "version": 1,
295
+ "platform": "freebsd",
296
+ "arch": "ia32",
297
+
298
+ "ssh_port": 22207,
299
+ "vnc_port": 5917,
300
+
301
+ "username": "freebsd",
302
+ "password": "freebsd",
303
+
304
+ "shutdown": "sudo poweroff"
305
+ },
306
+
307
+ "builds": {
308
+ "FreeBSD i386": {
309
+ "directory": "/home/freebsd/luigi",
310
+ "build": "node ../cnoke/cnoke.js"
311
+ }
312
+ },
313
+
314
+ "tests": {
315
+ "FreeBSD i386": {
316
+ "directory": "/home/freebsd/luigi",
317
+ "build": {
318
+ "Build": "node ../cnoke/cnoke.js -C test"
319
+ },
320
+ "commands": {
321
+ "Test Raylib": "xvfb-run node test/raylib.js",
322
+ "Test Misc": "node test/misc.js",
323
+ "Test SQLite": "node test/sqlite.js"
324
+ }
325
+ }
326
+ }
327
+ },
328
+
329
+ "freebsd_arm64": {
330
+ "name": "FreeBSD ARM64",
331
+
332
+ "qemu": {
333
+ "binary": "qemu-system-aarch64",
334
+ "arguments": ["-M", "virt", "-cpu", "cortex-a53", "-m", "1G", "-smp", 2, "-drive", "if=pflash,format=raw,file=QEMU_EFI.img", "-drive", "if=pflash,file=varstore.img", "-drive", "if=virtio,file=disk.qcow2,format=qcow2", "-netdev", "user,id=mynet,hostfwd=tcp::22208-:22", "-device", "virtio-net-device,netdev=mynet", "-vnc", "127.0.0.1:18"]
335
+ },
336
+
337
+ "info": {
338
+ "version": 1,
339
+ "platform": "freebsd",
340
+ "arch": "arm64",
341
+
342
+ "ssh_port": 22208,
343
+ "vnc_port": 5918,
344
+
345
+ "username": "freebsd",
346
+ "password": "freebsd",
347
+
348
+ "shutdown": "sudo poweroff"
349
+ },
350
+
351
+ "builds": {
352
+ "FreeBSD ARM64": {
353
+ "directory": "/home/freebsd/luigi",
354
+ "build": "node ../cnoke/cnoke.js"
355
+ }
356
+ },
357
+
358
+ "tests": {
359
+ "FreeBSD ARM64": {
360
+ "directory": "/home/freebsd/luigi",
361
+ "build": {
362
+ "Build": "node ../cnoke/cnoke.js -C test"
363
+ },
364
+ "commands": {
365
+ "Test Raylib": "xvfb-run node test/raylib.js",
366
+ "Test Misc": "node test/misc.js",
367
+ "Test SQLite": "node test/sqlite.js"
368
+ }
369
+ }
370
+ }
371
+ },
372
+
373
+ "macos_x64": {
374
+ "name": "macOS x64",
375
+
376
+ "qemu": {
377
+ "binary": "qemu-system-x86_64",
378
+ "arguments": ["-m", "3G", "-machine", "q35", "-smp", 2, "-cpu", "Penryn,vendor=GenuineIntel,kvm=on,+sse3,+sse4.2,+aes,+xsave,+avx,+xsaveopt,+xsavec,+xgetbv1,+avx2,+bmi2,+smep,+bmi1,+fma,+movbe,+invtsc", "-device", "isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc", "-smbios", "type=2", "-drive", "if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd", "-drive", "if=pflash,format=raw,file=OVMF_VARS-1024x768.fd", "-vga", "qxl", "-device", "ich9-intel-hda", "-device", "hda-output", "-usb", "-device", "usb-kbd", "-device", "usb-tablet", "-netdev", "user,id=net0,hostfwd=tcp::22209-:22", "-device", "e1000-82545em,netdev=net0,id=net0,mac=52:54:00:c9:18:27", "-device", "ich9-ahci,id=sata", "-drive", "id=ESP,if=none,format=qcow2,file=ESP.qcow2", "-device", "ide-hd,bus=sata.2,drive=ESP", "-drive", "id=SystemDisk,if=none,file=macOS.qcow2", "-device", "ide-hd,bus=sata.4,drive=SystemDisk", "-vnc", "127.0.0.1:19"]
379
+ },
380
+
381
+ "info": {
382
+ "version": 2,
383
+ "platform": "darwin",
384
+ "arch": "x64",
385
+
386
+ "ssh_port": 22209,
387
+ "vnc_port": 5919,
388
+
389
+ "username": "macos",
390
+ "password": "macos",
391
+
392
+ "shutdown": "sudo shutdown -h now"
393
+ },
394
+
395
+ "builds": {
396
+ "macOS x64": {
397
+ "directory": "/Users/macos/luigi",
398
+ "build": "PATH=/usr/local/bin:/usr/bin:/bin SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk node ../cnoke/cnoke.js"
399
+ }
400
+ },
401
+
402
+ "tests": {
403
+ "macOS x64": {
404
+ "directory": "/Users/macos/luigi",
405
+ "build": {
406
+ "Build": "PATH=/usr/local/bin:/usr/bin:/bin SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk node ../cnoke/cnoke.js -C test"
407
+ },
408
+ "commands": {
409
+ "Test Misc": "PATH=/usr/local/bin:/usr/bin:/bin node test/misc.js",
410
+ "Test SQLite": "PATH=/usr/local/bin:/usr/bin:/bin node test/sqlite.js"
411
+ }
412
+ }
413
+ }
414
+ }
415
+ }
@@ -0,0 +1,45 @@
1
+ 10159baf262b43a92d95db59dae1f72c645127301661e0a3ce4e38b295a97c58 *qemu/windows/VERSION
2
+ eb30b5652a0b7962710c72cb2ba79626347eee84ebe3fc5482a93ec8b8fe8b02 *qemu/windows/install.sh
3
+ f8c9a1638a3fc2cdd214f2cbcad6fee0e3b2c9383942bbd49b3915bb4c3da102 *qemu/windows/bios.bin
4
+ 23792b98aef4d169a9a0382a474b279d24dc0757698870f16b950f44dd7c2c2c *qemu/windows/disk.qcow2
5
+ 1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 *qemu/debian_x64/VERSION
6
+ ba418d2d602981fe324ae7a1a608b0f2d8d7c6113d03a429cc402e24ddc81311 *qemu/debian_x64/vmlinuz-5.10.0-12-amd64
7
+ 4d44622e8ce058017c08051d694b8e5afe9ff406b6ad91c17ebc4ec43d205c42 *qemu/debian_x64/install.sh
8
+ e349fd503c943541f24a91198ef29c1df26f120fd294a4a01426bbf46d7423f1 *qemu/debian_x64/initrd.img-5.10.0-12-amd64
9
+ c84dc75dcfcd9ceeb969d6d1d2d4c37ef9c5edfa3c5dd93c6073588a2b02be63 *qemu/debian_x64/disk.qcow2
10
+ 1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 *qemu/debian_arm64/VERSION
11
+ 79c324a3901d8864628e804ac6490ca372782f836c6ea7d9e9843bd066247274 *qemu/debian_arm64/install.sh
12
+ d05326434988381b4048a2e4aeac08497487d17f0cddb3b5ab69123a5d7be9ea *qemu/debian_arm64/vmlinuz-5.10.0-12-arm64
13
+ b582530fdfbcd347f9a371e059a93b42e68258b2526d7ac1f9facefb89f3194d *qemu/debian_arm64/initrd.img-5.10.0-12-arm64
14
+ 272d3d5d8b9a8d9505f0c236c92fbcdab4a118127b18727ca91fdc955927124f *qemu/debian_arm64/disk.qcow2
15
+ 1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 *qemu/debian_arm32/VERSION
16
+ 1b3784d44757394f8b318b85c2afda659ead4487e31600e635d0512eb41ce718 *qemu/debian_arm32/vmlinuz-5.10.0-12-armmp-lpae
17
+ bb37ce287d9d262f467a4b88d0c45220f0d1abfa8e579511322c0c4572dd7774 *qemu/debian_arm32/install.sh
18
+ fbbc2ed94c4a7bb22341f621e0226b71b8c3498f9a2cf4f7028af1c5c2b95006 *qemu/debian_arm32/initrd.img-5.10.0-12-armmp-lpae
19
+ f52cd3988a0b8a5cd74f0cc3b3a36231f53618309d8ea9e98e056205bd1f8afb *qemu/debian_arm32/disk.qcow2
20
+ ed05b84b7759ec945bb5422305a3a3c5b61d89e231844656ea31e07d89451a20 *qemu/debian_i386/vmlinuz-5.10.0-12-686-pae
21
+ 1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 *qemu/debian_i386/VERSION
22
+ 292a61c415a99a9c63a9337f1e074bea6c5df594e16bc40ded76141963c67ea4 *qemu/debian_i386/install.sh
23
+ 8dc1360e1c23ea21931f5eb94461d15fac6bcec00cf42bf1e590b7fb937e80c1 *qemu/debian_i386/initrd.img-5.10.0-12-686-pae
24
+ 338602d969f953cd88c2df736b9f8f7ee53029d233c83c7398258ae5bcb4e286 *qemu/debian_i386/disk.qcow2
25
+ 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b *qemu/freebsd_arm64/VERSION
26
+ 5daea533330eb8d2f8df946561680e09f8dacc467fbf03d28caa2115d94386b5 *qemu/freebsd_arm64/QEMU_EFI.img
27
+ a083e4e1f58f477e4a9e8ae30f75660e82275b88f77b5e2c7f5d6ee1deb43b41 *qemu/freebsd_arm64/varstore.img
28
+ 53a4dc48317e1c9de4a088cd45ba39a1810f0bafad75c7f810e18d4e3eb340e3 *qemu/freebsd_arm64/install.sh
29
+ a19ad06aec7972f3b95a56fb9bb8ac8a6afcd61b586f398691d58c704e8c466e *qemu/freebsd_arm64/disk.qcow2
30
+ 10f2bc603b171368cacda43485f8f72567af0a9a490b7e0fa0c14c983ae66f16 *qemu/freebsd_arm64/xvfb-run.sh
31
+ 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b *qemu/freebsd_x64/VERSION
32
+ 06eef544fe9c61d3905b0e588c306d1dedac7ee7d4c01df154ff6ed64e25ef77 *qemu/freebsd_x64/install.sh
33
+ 060b66901313ddfcd434c20a7b13052b3e5126e43c4e44884b85191560bd99eb *qemu/freebsd_x64/disk.qcow2
34
+ 10f2bc603b171368cacda43485f8f72567af0a9a490b7e0fa0c14c983ae66f16 *qemu/freebsd_x64/xvfb-run.sh
35
+ 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b *qemu/freebsd_i386/VERSION
36
+ bdeac2cca1d22d70c2d388a50709d5cba3069bbd4bd1bcb102955b0ee12ca3e9 *qemu/freebsd_i386/install.sh
37
+ 8191cea63d738cdca6df0b2d2d6953675e1dd33cac4d98fff88ba4367b182b64 *qemu/freebsd_i386/disk.qcow2
38
+ 10f2bc603b171368cacda43485f8f72567af0a9a490b7e0fa0c14c983ae66f16 *qemu/freebsd_i386/xvfb-run.sh
39
+ 16a4f09b3e70b97f5cfb1cf9b913d67d0ec45c4342d202cc9a2b2cfee852a8de *qemu/macos_x64/ESP.qcow2
40
+ 5d2ac383371b408398accee7ec27c8c09ea5b74a0de0ceea6513388b15be5d1e *qemu/macos_x64/OVMF_VARS.fd
41
+ d79538ac489f1948b04b65f12c5618c28e4a5de0be062f5cf1d73e422a091a37 *qemu/macos_x64/install.txt
42
+ 5bb918652a31eb2059450c8b0b9b2fdf51fb600a9bd892f4e6f66b4080e3e764 *qemu/macos_x64/macOS.qcow2
43
+ 5cc2d42949c7e4e763db0abeb88299972bafef991d87dbf744a5108ef9190f6f *qemu/macos_x64/OVMF_VARS-1024x768.fd
44
+ 53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3 *qemu/macos_x64/VERSION
45
+ 2a247500e8ad9aa479994097ba5976bd881fde4de1516abd14491f3dba9fe060 *qemu/macos_x64/OVMF_CODE.fd
@@ -84,6 +84,7 @@ bool AnalyseFunction(InstanceData *, FunctionInfo *func)
84
84
  case PrimitiveKind::Int32:
85
85
  case PrimitiveKind::UInt32:
86
86
  case PrimitiveKind::String:
87
+ case PrimitiveKind::String16:
87
88
  case PrimitiveKind::Pointer: {
88
89
  if (gpr_avail) {
89
90
  param.gpr_count = 1;
@@ -220,11 +221,8 @@ static Napi::Object PopHFA(napi_env env, const uint8_t *ptr, const TypeInfo *typ
220
221
  return obj;
221
222
  }
222
223
 
223
- Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, const Napi::CallbackInfo &info)
224
+ Napi::Value CallData::Execute(const Napi::CallbackInfo &info)
224
225
  {
225
- Napi::Env env = info.Env();
226
- CallData call(env, instance, func);
227
-
228
226
  // Sanity checks
229
227
  if (info.Length() < (uint32_t)func->parameters.len) {
230
228
  ThrowError<Napi::TypeError>(env, "Expected %1 arguments, got %2", func->parameters.len, info.Length());
@@ -240,14 +238,14 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
240
238
  // registers just before the stack (so behind the vector ones).
241
239
  // In the armv7hf calling convention, some arguments can end up
242
240
  // partially in GPR, partially in the stack.
243
- if (RG_UNLIKELY(!call.AllocStack(func->args_size, 16, &args_ptr)))
241
+ if (RG_UNLIKELY(!AllocStack(func->args_size, 16, &args_ptr)))
244
242
  return env.Null();
245
- if (RG_UNLIKELY(!call.AllocStack(4 * 4, 8, &gpr_ptr)))
243
+ if (RG_UNLIKELY(!AllocStack(4 * 4, 8, &gpr_ptr)))
246
244
  return env.Null();
247
- if (RG_UNLIKELY(!call.AllocStack(8 * 8, 8, &vec_ptr)))
245
+ if (RG_UNLIKELY(!AllocStack(8 * 8, 8, &vec_ptr)))
248
246
  return env.Null();
249
247
  if (func->ret.use_memory) {
250
- if (RG_UNLIKELY(!call.AllocHeap(func->ret.type->size, 16, &return_ptr)))
248
+ if (RG_UNLIKELY(!AllocHeap(func->ret.type->size, 16, &return_ptr)))
251
249
  return env.Null();
252
250
  *(uint8_t **)(gpr_ptr++) = return_ptr;
253
251
  }
@@ -357,7 +355,7 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
357
355
  case PrimitiveKind::String: {
358
356
  const char *str;
359
357
  if (RG_LIKELY(value.IsString())) {
360
- str = call.PushString(value);
358
+ str = PushString(value);
361
359
  if (RG_UNLIKELY(!str))
362
360
  return env.Null();
363
361
  } else if (IsNullOrUndefined(value)) {
@@ -374,6 +372,26 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
374
372
  args_ptr += 4;
375
373
  }
376
374
  } break;
375
+ case PrimitiveKind::String16: {
376
+ const char16_t *str16;
377
+ if (RG_LIKELY(value.IsString())) {
378
+ str16 = PushString16(value);
379
+ if (RG_UNLIKELY(!str16))
380
+ return env.Null();
381
+ } else if (IsNullOrUndefined(value)) {
382
+ str16 = nullptr;
383
+ } else {
384
+ ThrowError<Napi::TypeError>(env, "Unexpected %1 value for argument %2, expected string", GetValueType(instance, value), i + 1);
385
+ return env.Null();
386
+ }
387
+
388
+ if (RG_LIKELY(param.gpr_count)) {
389
+ *(gpr_ptr++) = (uint64_t)str16;
390
+ } else {
391
+ *(const char16_t **)args_ptr = str16;
392
+ args_ptr += 4;
393
+ }
394
+ } break;
377
395
  case PrimitiveKind::Pointer: {
378
396
  uint8_t *ptr;
379
397
 
@@ -382,11 +400,11 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
382
400
  } else if (IsObject(value) && param.type->ref->primitive == PrimitiveKind::Record) {
383
401
  Napi::Object obj = value.As<Napi::Object>();
384
402
 
385
- if (RG_UNLIKELY(!call.AllocHeap(param.type->ref->size, 16, &ptr)))
403
+ if (RG_UNLIKELY(!AllocHeap(param.type->ref->size, 16, &ptr)))
386
404
  return env.Null();
387
405
 
388
406
  if (param.directions & 1) {
389
- if (!call.PushObject(obj, param.type->ref, ptr))
407
+ if (!PushObject(obj, param.type->ref, ptr))
390
408
  return env.Null();
391
409
  } else {
392
410
  memset(ptr, 0, param.type->size);
@@ -426,7 +444,7 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
426
444
  if (param.gpr_count) {
427
445
  RG_ASSERT(param.type->align <= 8);
428
446
 
429
- if (!call.PushObject(obj, param.type, (uint8_t *)gpr_ptr))
447
+ if (!PushObject(obj, param.type, (uint8_t *)gpr_ptr))
430
448
  return env.Null();
431
449
 
432
450
  gpr_ptr += param.gpr_count;
@@ -435,7 +453,7 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
435
453
  int16_t align = (param.type->align <= 4) ? 4 : 8;
436
454
 
437
455
  args_ptr = AlignUp(args_ptr, align);
438
- if (!call.PushObject(obj, param.type, args_ptr))
456
+ if (!PushObject(obj, param.type, args_ptr))
439
457
  return env.Null();
440
458
  args_ptr += AlignLen(param.type->size, 4);
441
459
  }
@@ -445,30 +463,69 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
445
463
  }
446
464
 
447
465
  if (instance->debug) {
448
- call.DumpDebug();
466
+ DumpDebug();
449
467
  }
450
468
 
451
469
  #define PERFORM_CALL(Suffix) \
452
470
  ([&]() { \
453
- auto ret = (func->forward_fp ? ForwardCallX ## Suffix(func->func, call.GetSP()) \
454
- : ForwardCall ## Suffix(func->func, call.GetSP())); \
471
+ auto ret = (func->forward_fp ? ForwardCallX ## Suffix(func->func, GetSP()) \
472
+ : ForwardCall ## Suffix(func->func, GetSP())); \
455
473
  PopOutArguments(out_objects); \
456
474
  return ret; \
457
475
  })()
458
476
 
459
477
  // Execute and convert return value
460
478
  switch (func->ret.type->primitive) {
479
+ case PrimitiveKind::Void: {
480
+ PERFORM_CALL(GG);
481
+ return env.Null();
482
+ } break;
483
+ case PrimitiveKind::Bool: {
484
+ uint32_t r0 = (uint32_t)PERFORM_CALL(GG);
485
+ return Napi::Boolean::New(env, r0);
486
+ } break;
487
+ case PrimitiveKind::Int8:
488
+ case PrimitiveKind::UInt8:
489
+ case PrimitiveKind::Int16:
490
+ case PrimitiveKind::UInt16:
491
+ case PrimitiveKind::Int32:
492
+ case PrimitiveKind::UInt32: {
493
+ uint32_t r0 = (uint32_t)PERFORM_CALL(GG);
494
+ return Napi::Number::New(env, (double)r0);
495
+ } break;
496
+ case PrimitiveKind::Int64: {
497
+ uint64_t ret = PERFORM_CALL(GG);
498
+ return Napi::BigInt::New(env, (int64_t)ret);
499
+ } break;
500
+ case PrimitiveKind::UInt64: {
501
+ uint64_t ret = PERFORM_CALL(GG);
502
+ return Napi::BigInt::New(env, ret);
503
+ } break;
461
504
  case PrimitiveKind::Float32: {
462
505
  float f = PERFORM_CALL(F);
463
-
464
506
  return Napi::Number::New(env, (double)f);
465
507
  } break;
466
-
467
508
  case PrimitiveKind::Float64: {
468
509
  HfaRet ret = PERFORM_CALL(DDDD);
469
-
470
510
  return Napi::Number::New(env, (double)ret.d0);
471
511
  } break;
512
+ case PrimitiveKind::String: {
513
+ uint32_t r0 = (uint32_t)PERFORM_CALL(GG);
514
+ return Napi::String::New(env, (const char *)r0);
515
+ } break;
516
+ case PrimitiveKind::String16: {
517
+ uint32_t r0 = (uint32_t)PERFORM_CALL(GG);
518
+ return Napi::String::New(env, (const char16_t *)r0);
519
+ } break;
520
+ case PrimitiveKind::Pointer: {
521
+ uint32_t r0 = (uint32_t)PERFORM_CALL(GG);
522
+ void *ptr = (void *)r0;
523
+
524
+ Napi::External<void> external = Napi::External<void>::New(env, ptr);
525
+ SetValueTag(instance, external, func->ret.type);
526
+
527
+ return external;
528
+ } break;
472
529
 
473
530
  case PrimitiveKind::Record: {
474
531
  if (func->ret.gpr_count) {
@@ -500,37 +557,6 @@ Napi::Value TranslateCall(InstanceData *instance, const FunctionInfo *func, cons
500
557
  return obj;
501
558
  }
502
559
  } break;
503
-
504
- default: {
505
- uint64_t ret = PERFORM_CALL(GG);
506
- uint32_t r0 = (uint32_t)ret;
507
-
508
- switch (func->ret.type->primitive) {
509
- case PrimitiveKind::Void: return env.Null();
510
- case PrimitiveKind::Bool: return Napi::Boolean::New(env, r0);
511
- case PrimitiveKind::Int8: return Napi::Number::New(env, (double)r0);
512
- case PrimitiveKind::UInt8: return Napi::Number::New(env, (double)r0);
513
- case PrimitiveKind::Int16: return Napi::Number::New(env, (double)r0);
514
- case PrimitiveKind::UInt16: return Napi::Number::New(env, (double)r0);
515
- case PrimitiveKind::Int32: return Napi::Number::New(env, (double)r0);
516
- case PrimitiveKind::UInt32: return Napi::Number::New(env, (double)r0);
517
- case PrimitiveKind::Int64: return Napi::BigInt::New(env, (int64_t)ret);
518
- case PrimitiveKind::UInt64: return Napi::BigInt::New(env, ret);
519
- case PrimitiveKind::Float32: { RG_UNREACHABLE(); } break;
520
- case PrimitiveKind::Float64: { RG_UNREACHABLE(); } break;
521
- case PrimitiveKind::String: return Napi::String::New(env, (const char *)r0);
522
- case PrimitiveKind::Pointer: {
523
- void *ptr = (void *)r0;
524
-
525
- Napi::External<void> external = Napi::External<void>::New(env, ptr);
526
- SetValueTag(instance, external, func->ret.type);
527
-
528
- return external;
529
- } break;
530
-
531
- case PrimitiveKind::Record: { RG_UNREACHABLE(); } break;
532
- }
533
- } break;
534
560
  }
535
561
 
536
562
  #undef PERFORM_CALL