snprintf(instruction->text, 128,
"0x%8.8" PRIx32 " 0x%4.4x \t"
- "LDR\tr%i, [pc, #%#" PRIx32 "]\t; %#8.8x",
+ "LDR\tr%i, [pc, #%#" PRIx32 "]\t; %#8.8" PRIx32,
address, opcode, Rd, immediate,
thumb_alignpc4(address) + immediate);
}
if (opcode & 0x00f0) {
- sprintf(cp, "DBG\t#%d", opcode & 0xf);
+ sprintf(cp, "DBG\t#%d", (int) opcode & 0xf);
return ERROR_OK;
}
case 0x38:
case 0x39:
sprintf(cp, "MSR\t%s, r%d", special_name(opcode & 0xff),
- (opcode >> 16) & 0x0f);
+ (int) (opcode >> 16) & 0x0f);
return ERROR_OK;
case 0x3a:
return t2ev_hint(opcode, address, instruction, cp);
return t2ev_misc(opcode, address, instruction, cp);
case 0x3e:
case 0x3f:
- sprintf(cp, "MRS\tr%d, %s", (opcode >> 8) & 0x0f,
+ sprintf(cp, "MRS\tr%d, %s", (int) (opcode >> 8) & 0x0f,
special_name(opcode & 0xff));
return ERROR_OK;
}
immed |= (opcode >> 10) & 0x1c;
sprintf(cp, "%sSAT\tr%d, #%d, r%d, %s #%d\t",
is_signed ? "S" : "U",
- rd, (opcode & 0x1f) + 1, rn,
+ rd, (int) (opcode & 0x1f) + 1, rn,
(opcode & (1 << 21)) ? "ASR" : "LSL",
immed ? immed : 32);
return ERROR_OK;
sprintf(cp, "%sBFX\tr%d, r%d, #%d, #%d\t",
is_signed ? "S" : "U",
rd, rn, immed,
- (opcode & 0x1f) + 1);
+ (int) (opcode & 0x1f) + 1);
return ERROR_OK;
case 0x16:
immed = (opcode >> 6) & 0x03;
if (rn == 0xf) /* bitfield clear */
sprintf(cp, "BFC\tr%d, #%d, #%d\t",
rd, immed,
- (opcode & 0x1f) + 1 - immed);
+ (int) (opcode & 0x1f) + 1 - immed);
else /* bitfield insert */
sprintf(cp, "BFI\tr%d, r%d, #%d, #%d\t",
rd, rn, immed,
- (opcode & 0x1f) + 1 - immed);
+ (int) (opcode & 0x1f) + 1 - immed);
return ERROR_OK;
default:
return ERROR_INVALID_ARGUMENTS;
}
sprintf(cp, "STR%s.W\tr%d, [r%d, r%d, LSL #%d]",
- size, rt, rn, opcode & 0x0f,
- (opcode >> 4) & 0x03);
+ size, rt, rn, (int) opcode & 0x0f,
+ (int) (opcode >> 4) & 0x03);
imm12:
immed = opcode & 0x0fff;
{
int ra = (opcode >> 12) & 0xf;
-
switch (opcode & 0x007000f0) {
case 0:
if (ra == 0xf)
sprintf(cp, "MUL\tr%d, r%d, r%d",
- (opcode >> 8) & 0xf, (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf);
else
sprintf(cp, "MLA\tr%d, r%d, r%d, r%d",
- (opcode >> 8) & 0xf, (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf, ra);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf, ra);
break;
case 0x10:
sprintf(cp, "MLS\tr%d, r%d, r%d, r%d",
- (opcode >> 8) & 0xf, (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf, ra);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf, ra);
break;
default:
return ERROR_INVALID_ARGUMENTS;
sprintf(cp, "%c%sL\tr%d, r%d, r%d, r%d",
(op & 0x20) ? 'U' : 'S',
infix,
- (opcode >> 12) & 0xf,
- (opcode >> 8) & 0xf,
- (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf);
+ (int) (opcode >> 12) & 0xf,
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf);
break;
case 0x1f:
case 0x3f:
sprintf(cp, "%cDIV\tr%d, r%d, r%d",
(op & 0x20) ? 'U' : 'S',
- (opcode >> 8) & 0xf,
- (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf);
break;
default:
return ERROR_INVALID_ARGUMENTS;
case 0:
if (immed == 0) {
sprintf(cp, "MOV%s.W\tr%d, r%d",
- suffix, rd, (opcode & 0xf));
+ suffix, rd,
+ (int) (opcode & 0xf));
return ERROR_OK;
}
mnemonic = "LSL";
default:
if (immed == 0) {
sprintf(cp, "RRX%s.W\tr%d, r%d",
- suffix, rd, (opcode & 0xf));
+ suffix, rd,
+ (int) (opcode & 0xf));
return ERROR_OK;
}
mnemonic = "ROR";
}
sprintf(cp, "%s%s.W\tr%d, r%d, r%d",
- mnemonic, suffix, rd, rn, (opcode & 0xf));
+ mnemonic, suffix, rd, rn, (int) (opcode & 0xf));
shift:
cp = strchr(cp, 0);
two:
sprintf(cp, "%s%s.W\tr%d, r%d",
- mnemonic, suffix, rn, (opcode & 0xf));
+ mnemonic, suffix, rn, (int) (opcode & 0xf));
goto shift;
immediate:
sprintf(cp, "%s%s.W\tr%d, r%d, #%d",
- mnemonic, suffix, rd, (opcode & 0xf), immed ? immed : 32);
+ mnemonic, suffix, rd,
+ (int) (opcode & 0xf), immed ? immed : 32);
return ERROR_OK;
}
suffix = "S";
sprintf(cp, "%s%s.W\tr%d, r%d, r%d",
mnemonic, suffix,
- (opcode >> 8) & 0xf,
- (opcode >> 16) & 0xf,
- (opcode >> 0) & 0xf);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
+ (int) (opcode >> 0) & 0xf);
} else if (opcode & (1 << 7)) {
switch ((opcode >> 24) & 0xf) {
sprintf(cp, "%cXT%c.W\tr%d, r%d%s",
(opcode & (1 << 24)) ? 'U' : 'S',
(opcode & (1 << 26)) ? 'B' : 'H',
- (opcode >> 8) & 0xf,
- (opcode >> 16) & 0xf,
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 16) & 0xf,
suffix);
break;
case 8:
}
sprintf(cp, "%s\tr%d, r%d",
mnemonic,
- (opcode >> 8) & 0xf,
- (opcode >> 0) & 0xf);
+ (int) (opcode >> 8) & 0xf,
+ (int) (opcode >> 0) & 0xf);
break;
default:
return ERROR_INVALID_ARGUMENTS;
if (opcode & (1 << 23))
immed = -immed;
sprintf(cp, "LDR\tr%d, %#8.8" PRIx32,
- (opcode >> 12) & 0xf,
+ (int) (opcode >> 12) & 0xf,
thumb_alignpc4(address) + immed);
return ERROR_OK;
}
if (opcode & (1 << 23)) {
immed = opcode & 0x0fff;
sprintf(cp, "LDR.W\tr%d, [r%d, #%d]\t; %#3.3x",
- (opcode >> 12) & 0xf,
+ (int) (opcode >> 12) & 0xf,
rn, immed, immed);
return ERROR_OK;
}
if (!(opcode & (0x3f << 6))) {
sprintf(cp, "LDR.W\tr%d, [r%d, r%d, LSL #%d]",
- (opcode >> 12) & 0xf,
+ (int) (opcode >> 12) & 0xf,
rn,
- (opcode >> 0) & 0xf,
- (opcode >> 4) & 0x3);
+ (int) (opcode >> 0) & 0xf,
+ (int) (opcode >> 4) & 0x3);
return ERROR_OK;
}
immed = opcode & 0x00ff;
sprintf(cp, "LDRT\tr%d, [r%d, #%d]\t; %#2.2x",
- (opcode >> 12) & 0xf,
+ (int) (opcode >> 12) & 0xf,
rn, immed, immed);
return ERROR_OK;
}
}
sprintf(cp, "LDR\tr%d, [r%d%s, #%s%u%s\t; %#2.2x",
- (opcode >> 12) & 0xf,
+ (int) (opcode >> 12) & 0xf,
rn, p1,
(opcode & 0x200) ? "" : "-",
immed, p2, immed);
return ERROR_OK;
}
- LOG_DEBUG("Can't decode 32-bit Thumb2 yet (opcode=%08x)", opcode);
+ LOG_DEBUG("Can't decode 32-bit Thumb2 yet (opcode=%08" PRIx32 ")",
+ opcode);
strcpy(cp, "(32-bit Thumb2 ...)");
return ERROR_OK;