1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
[wine] SIGSEGV in JIT stub (`CALL Ed`) when running box64 wine64 control
I encountered a segmentation fault while running `box64 wine64 control` on RISC-V [Voyager](https://www.andestech.com/en/2024/05/30/andes-technology-announced-the-qilai-soc-and/) (quad-core RISC-V AX45MP cluster and one NX27V vector processor) with dynarec and GDB JIT enabled.
Box64 crashed at `CALL Ed` in the emitted JIT code(`rv64_prolog.S:82`).
### Crash Log
which should be `[BOX64] Using emulated /home/jkchiu/Downloads/wine/bin/../lib/wine/x86_64-unix/ntdll.so`
```
[BOX64] 36321|SIGSEGV @0x3ff7236060 (???(0x3ff7236060)) (x64pc=0x1000010f4/"/root/Downloads/wine/bin/wine64/_start + 0x24", rsp=0x3ff7db84b8, stack=0x3ff75b9000:0x3ff7db9000 own=(nil) fp=(nil)), for accessing 0x35c3cebe (code=2/prot=0), db=0x3ff7dbe980(0x3ff7236010:0x3ff72360d8/0x1000010d0:0x1000010fa//root/Downloads/wine/bin/wine64/_start:clean, hash:4fd74e48/4fd74e48) handler=(nil)
RAX:0x0000000035c51571 RCX:0x0000000100001250 RDX:0x0000003ff7db84c8 RBX:0x0000000000000000
RSP:0x0000003ff7db84b8 RBP:0x0000000000000000 RSI:0x000000000000006e RDI:0x0000000100000d60
R8:0x00000001000012c0 R9:0x0000000060000080 R10:0x0000000000000000 R11:0x0000000000000000
R12:0x0000000000000000 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053
RSP-0x20:0x0000000000000000 RSP-0x18:0x0000000000000000 RSP-0x10:0x0000000000000000 RSP-0x08:0x0000000000000000
RSP+0x00:0x0000003ff7db84c0 RSP+0x08:0x0000000060000080 RSP+0x10:0x0000000000000002 RSP+0x18:0x0000003ff7db868d x64opcode=FF 15 E6 0E 20 00 F4 0F (opcode=feeb338b)
```
In GDB:
```
Program received signal SIGSEGV, Segmentation fault.
0x0000003ff7236060 in 10d0 () at /tmp/box64gdbjit-4ilAQo.S:22
22 CALL Ed
```
### JIT Assembly Snippet
The code generated at `/tmp/box64gdbjit-F8JP6k.S` is:
```
XOR Ed, Gd
MOV Ed, Gd
POP reg
MOV Ed, Gd
AND Ed, Ib
PUSH reg
PUSH reg
LEA Gd, Ed
LEA Gd, Ed
LEA Gd, Ed
CALL Ed. # ← crashes here
```
### Environment
1. Box64 version: Box64 riscv64 v0.3.5 16bdcc0c with Dynarec built on May 19 2025
2. Build flags:
```
cmake -G Ninja \
-DBOX32=ON \
-DRV64=1 \
-DRV64_DYNAREC=ON \
-DGDBJIT=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_C_COMPILER=gcc \
..
```
3. Platform: RISC-V 64, Debian (chroot)
4. CPU: 4× cores(Andes AX45MP), Little Endian
5. Wine version : Wine 10.0 from [Wine-Builds](https://github.com/Kron4ek/Wine-Builds)
6. page size 4096
7. Kernel: 6.1.47+
8. gcc (Debian 14.2.0-19) 14.2.0
9. dd (Debian GLIBC 2.41-7) 2.41
|