summary refs log tree commit diff stats
path: root/results/scraper/box64/1661
blob: e771d881a420416e848dd7aae7a9540243a49a90 (plain) (blame)
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
Unexpected Dynarec-Interpreter Difference on `cmp` Instruction
I tried to run python3.12 with box64 on rv64 platform (prior issue #1652 ) and used `BOX64_DYNAREC_TEST=1` to test the differences between dynarec and interpreter. I saw 4 differences about `cmp` instruction:

```txt
Warning, difference between x64 Interpreter and Dynarec in 0x3f001ea3f3 (7e 17 83 fe 63 7f 12 89)
=======================================
DIFF: Dynarec |  Interpreter
----------------------
RIP: 0000003f001ea40c | 0000003f001ea3f5
Warning, difference between x64 Interpreter and Dynarec in 0x3f001ea36f (0f 8f bb 00 00 00 39 c3)
=======================================
DIFF: Dynarec |  Interpreter
----------------------
RIP: 0000003f001ea430 | 0000003f001ea375
Warning, difference between x64 Interpreter and Dynarec in 0x3f001ea3f3 (7e 17 83 fe 63 7f 12 89)
=======================================
DIFF: Dynarec |  Interpreter
----------------------
RIP: 0000003f001ea40c | 0000003f001ea3f5
Warning, difference between x64 Interpreter and Dynarec in 0x3f001ea36f (0f 8f bb 00 00 00 39 c3)
=======================================
DIFF: Dynarec |  Interpreter
----------------------
RIP: 0000003f001ea430 | 0000003f001ea375
```

The relative RIP `0x3f001ea3f3` & `0x3f001ea36f` is actually in `libpython3.12.so` and `objdump` told me:

```txt
  (( omitted ))
  1ea369:	8b 41 3c             	mov    0x3c(%rcx),%eax
  1ea36c:	83 f8 63             	cmp    $0x63,%eax
  1ea36f:	0f 8f bb 00 00 00    	jg     1ea430 <PyDict_Clear@@Base+0x3d0>
  1ea375:	39 c3                	cmp    %eax,%ebx
  (( omitted ))
  1ea3ed:	44 0f 4c e0          	cmovl  %eax,%r12d
  1ea3f1:	39 f0                	cmp    %esi,%eax
  1ea3f3:	7e 17                	jle    1ea40c <PyDict_Clear@@Base+0x3ac>
  1ea3f5:	83 fe 63             	cmp    $0x63,%esi
  (( omitted ))
```

I guess this might be because `cmp` did not set x64 FLAGS correctly, thus the following `jle` & `jg` did not jump to correct address. But why? I have investigated the code for about 1 day and till now can not find out the reason.

I would appreciate it if anyone could help to solve this problem or give some hints about this. Thanks in advance.