Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JIT] Emulation Error Aarch64 ccmp #1491

Open
echarron-git opened this issue Jul 1, 2024 · 0 comments
Open

[JIT] Emulation Error Aarch64 ccmp #1491

echarron-git opened this issue Jul 1, 2024 · 0 comments

Comments

@echarron-git
Copy link

Hello,

I have not the same result with a native CPU and MIASM (miasm==0.1.5.dev47) for the following instructions (X2 = 0x00000000000000; X5 = 0x000000000003F4)

0014BB24 CMP        X2, 0x60
0014BB28 CCMP       X5, X2, 0x2, HI
0014BB2C B.CS       loc_14b9b0

The program should go in 0x14B9B0 and not in 0x14BB30 (according the native CPU),
From my understanding, Like x2 is not highter than 0x60, the NZCV should be set to 2 (ie cf = 1). I think the problem its because the ccmp intruction not set correctly flag ... (miasm/arch/aarch64/sem.py)

Attached the snipped code to reproduce the bug

loc_db = LocationDB()
machine = Machine("aarch64l")
jitter = machine.jitter(loc_db, jit_type="python")
jitter.vm.add_memory_page(0x14bb20, PAGE_READ | PAGE_WRITE | PAGE_EXEC, b'\x05\x00\x01\xcb\x5f\x80\x01\xf1\xa2\x80\x42\xfa\x22\xf4\xff\x54\xc5\x04\x00\xb4'+b'\x00'*1024 , "CODE")

jitter.set_trace_log()

jitter.cpu.X2 = 0x00000000000000
jitter.cpu.X5 = 0x000000000003F4
jitter.run(0x14bb24)

I would be very grateful if anyone could correct the problem inside this file

miasm/arch/aarch64/sem.py

https://developer.arm.com/documentation/dui0801/g/A64-General-Instructions/CCMP--register-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant