mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-27 23:40:25 +00:00
Merge pull request #764 from akihikodaki/next
arm: treat ARM address as unsigned
This commit is contained in:
commit
399dd9da81
@ -850,18 +850,20 @@ static void printOperand(MCInst *MI, unsigned OpNo, SStream *O)
|
||||
// add 8 in ARM mode, or 4 in Thumb mode
|
||||
// printf(">> opcode: %u\n", MCInst_getOpcode(MI));
|
||||
if (ARM_rel_branch(MI->csh, opc)) {
|
||||
uint32_t address;
|
||||
|
||||
// only do this for relative branch
|
||||
if (MI->csh->mode & CS_MODE_THUMB) {
|
||||
imm += (int32_t)MI->address + 4;
|
||||
address = (uint32_t)MI->address + 4;
|
||||
if (ARM_blx_to_arm_mode(MI->csh, opc)) {
|
||||
// here need to align down to the nearest 4-byte address
|
||||
imm &= ~3;
|
||||
address &= ~3;
|
||||
}
|
||||
} else {
|
||||
imm += (int32_t)MI->address + 8;
|
||||
address = (uint32_t)MI->address + 8;
|
||||
}
|
||||
|
||||
printUInt32Bang(O, imm);
|
||||
printUInt32Bang(O, address + imm);
|
||||
} else {
|
||||
switch(MI->flat_insn->id) {
|
||||
default:
|
||||
|
@ -10,7 +10,7 @@ from xprint import to_hex, to_x_32
|
||||
|
||||
ARM_CODE = b"\x86\x48\x60\xf4\xED\xFF\xFF\xEB\x04\xe0\x2d\xe5\x00\x00\x00\x00\xe0\x83\x22\xe5\xf1\x02\x03\x0e\x00\x00\xa0\xe3\x02\x30\xc1\xe7\x00\x00\x53\xe3\x00\x02\x01\xf1\x05\x40\xd0\xe8\xf4\x80\x00\x00"
|
||||
ARM_CODE2 = b"\xd1\xe8\x00\xf0\xf0\x24\x04\x07\x1f\x3c\xf2\xc0\x00\x00\x4f\xf0\x00\x01\x46\x6c"
|
||||
THUMB_CODE = b"\x70\x47\xeb\x46\x83\xb0\xc9\x68\x1f\xb1\x30\xbf\xaf\xf3\x20\x84\x52\xf8\x23\xf0"
|
||||
THUMB_CODE = b"\x70\x47\x00\xf0\x10\xe8\xeb\x46\x83\xb0\xc9\x68\x1f\xb1\x30\xbf\xaf\xf3\x20\x84\x52\xf8\x23\xf0"
|
||||
THUMB_CODE2 = b"\x4f\xf0\x00\x01\xbd\xe8\x00\x88\xd1\xe8\x00\xf0\x18\xbf\xad\xbf\xf3\xff\x0b\x0c\x86\xf3\x00\x89\x80\xf3\x00\x8c\x4f\xfa\x99\xf6\xd0\xff\xa2\x01"
|
||||
THUMB_MCLASS = b"\xef\xf3\x02\x80"
|
||||
ARMV8 = b"\xe0\x3b\xb2\xee\x42\x00\x01\xe1\x51\xf0\x7f\xf5"
|
||||
@ -140,7 +140,7 @@ def test_class():
|
||||
if syntax is not None:
|
||||
md.syntax = syntax
|
||||
md.detail = True
|
||||
for insn in md.disasm(code, 0x1000):
|
||||
for insn in md.disasm(code, 0x80001000):
|
||||
print_insn_detail(insn)
|
||||
print ()
|
||||
except CsError as e:
|
||||
|
@ -245,7 +245,7 @@ static void test()
|
||||
//#define THUMB_CODE "\x02\x47" // bx r0
|
||||
//#define THUMB_CODE "\x0a\xbf" // itet eq
|
||||
|
||||
#define THUMB_CODE "\x60\xf9\x1f\x04\xe0\xf9\x4f\x07\x70\x47\xeb\x46\x83\xb0\xc9\x68\x1f\xb1\x30\xbf\xaf\xf3\x20\x84\x52\xf8\x23\xf0"
|
||||
#define THUMB_CODE "\x60\xf9\x1f\x04\xe0\xf9\x4f\x07\x70\x47\x00\xf0\x10\xe8\xeb\x46\x83\xb0\xc9\x68\x1f\xb1\x30\xbf\xaf\xf3\x20\x84\x52\xf8\x23\xf0"
|
||||
//#define THUMB_CODE "\xe0\xf9\x4f\x07"
|
||||
|
||||
#define THUMB_CODE2 "\x4f\xf0\x00\x01\xbd\xe8\x00\x88\xd1\xe8\x00\xf0\x18\xbf\xad\xbf\xf3\xff\x0b\x0c\x86\xf3\x00\x89\x80\xf3\x00\x8c\x4f\xfa\x99\xf6\xd0\xff\xa2\x01"
|
||||
@ -298,7 +298,7 @@ static void test()
|
||||
},
|
||||
};
|
||||
|
||||
uint64_t address = 0x1000;
|
||||
uint64_t address = 0x80001000;
|
||||
cs_insn *insn;
|
||||
int i;
|
||||
size_t count;
|
||||
|
Loading…
Reference in New Issue
Block a user