unicorn
unicorn copied to clipboard
Branch instruction "B" fails with an UC_ERR_EXCEPTION on aarch64
Hi Sir, I have add some code into function "test_arm64" in the file "sample_arm64.c".
Some variables used in the test_arm64 can be instanced as bellow.
uint64_t mem_data = 0; uint64_t pc_addr = 0; uint32_t isa_word = 0; char isa_bytes[4];
The added code is here:
// 14000004 b 200028 <main>
isa_word = 0x14000004;
pc_addr = 0x200018;
memcpy(isa_bytes, &isa_word, 4);
uc_mem_write(uc, pc_addr, isa_bytes, 4);
err = uc_emu_start(uc, pc_addr, pc_addr + 4, 0, 0);
if (err) {
printf("B-inst Test Failed on uc_emu_start() with error returned: %u\n", err);
}
But when I have built the unicorn, I run the "sample_arm64", it turns out an error like this: B-inst Test Failed on uc_emu_start() with error returned: 21
So, I want to know if this is s bug. Why does this error turn out? And how can I test branch instructions of aarch64?
Thanks a lot!
Why pc_addr + 3
instead of pc_addr + 4
?
Why
pc_addr + 3
instead ofpc_addr + 4
?
sorry, it is a handwriting error in this issue. Actually, it is 'pc_addr+4' in the code.
Why
pc_addr + 3
instead ofpc_addr + 4
?sorry, it is a handwriting error in this issue. Actually, it is 'pc_addr+4' in the code.
Please post a full and minimal reproduction script, thanks.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.