[unicorn-engine] ARM emulation issue

  • From: Greg Luterman <greg.luterman@xxxxxxxxxxxxxxxxxxx>
  • To: "unicorn-engine@xxxxxxxxxxxxx" <unicorn-engine@xxxxxxxxxxxxx>
  • Date: Fri, 23 Nov 2018 16:31:00 +0000

Hey there!

I just discovered Unicorn two days ago, so I'm still pretty new to it. I'm 
using it to emulate some ARM Thumb instructions, but the status registers 
aren't changing in a way that I would expect. I suspect that this is probably 
an issue in the QEMU underneath Unicorn, but I thought that I should probably 
ask here before diving into QEMU.

Here's some debug logging from my code:

DEBUG:test_simple:cpsr=400001f3 spsr=00000000
INFO:arm_tester.arm_program:    b656: 2b06                     cmp       r3, #6
DEBUG:test_simple:cpsr=200001f3 spsr=00000000
INFO:arm_tester.arm_program:    b658: bf8c      ite               hi
DEBUG:test_simple:cpsr=200001f3 spsr=00000000

As you can see, the cmp instruction is changing the CPSR register (clears the Z 
flag and sets the C), but the ite command is not. The IF-THEN-ELSE should be 
setting IT[7:0] to the HI condition and then-else execution flags, but all 
eight bits are zero before and after executing ite.

Can you verify that this is a QEMU issue? Or perhaps it's an error in Unicorn, 
or perhaps it indicates that I have something configured wrong? I'm running 
under Windows, if that's significant.

Many thanks,
Gre7g

Other related posts:

  • » [unicorn-engine] ARM emulation issue - Greg Luterman