Skip to content

CKB-VM asm64 and interpreter64 modes report inconsistent errors #489

@Subway2023

Description

@Subway2023

Describe the bug
When running the same RISC-V program on CKB-VM, the error results differ between asm64 mode and interpreter64 mode.

To Reproduce

.text
.globl _start
_start:
    li x15, -300
    li x16, 600
    xori x17, x15, -750
    andi x18, x16, 31
    sra x19, x17, 4
    bgeu x19, x18, path1
    beq x15, x16, path2
    or x20, x17, x18
    j exit
path1:
    li x21, 7
    j exit
path2:
    li x22, 8
exit:
    li x23, 0
    jalr x0, x23, 0

  1. compiler
riscv64-unknown-elf-gcc -nostdlib -march=rv64imc -mabi=lp64 -o test.elf  test.s
  1. run with asm mode
ckb-vm/target/debug/examples/ckb_vm_runner --mode asm64 test.elf
exit=Err(MemWriteOnExecutablePage(0))
cycles=16
r[a1]=0
registers=[0, 0, 4194288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18446744073709551316, 600, 966, 24, 60, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  1. run with interpreter mode
ckb-vm/target/debug/examples/ckb_vm_runner --mode interpreter64 test.elf
exit=Err(InvalidInstruction { pc: 0, instruction: 0 })
cycles=16
r[a1]=0
registers=[0, 0, 4194288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18446744073709551316, 600, 966, 24, 60, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions