8000 Unexpected Dynarec-Interpreter Difference on `cmp` Instruction · Issue #1661 · ptitSeb/box64 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Unexpected Dynarec-Interpreter Difference on cmp Instruction #1661
Closed
@Coekjan

Description

@Coekjan

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:

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:

  (( 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    %
4C9C
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0