mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-03-01 11:08:06 +00:00
systemz: fix truncated 64bit imm operand in issue #1515
This commit is contained in:
parent
626bd6ab8e
commit
bb838aa7d8
@ -10645,6 +10645,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 0 encoded into 5 bits for 18 unique commands.
|
||||
// printf("Fragment 0 = %" PRIu64 "\n", (Bits >> 14) & 31);
|
||||
switch ((Bits >> 14) & 31) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -10752,6 +10753,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 1 encoded into 5 bits for 17 unique commands.
|
||||
// printf("Fragment 1 = %" PRIu64 "\n", (Bits >> 19) & 31);
|
||||
switch ((Bits >> 19) & 31) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -10845,6 +10847,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 2 encoded into 6 bits for 34 unique commands.
|
||||
// printf("Fragment 2 = %" PRIu64 "\n", (Bits >> 24) & 63);
|
||||
switch ((Bits >> 24) & 63) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11011,6 +11014,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 3 encoded into 5 bits for 20 unique commands.
|
||||
// printf("Fragment 3 = %" PRIu64 "\n", (Bits >> 30) & 31);
|
||||
switch ((Bits >> 30) & 31) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11116,6 +11120,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 4 encoded into 6 bits for 33 unique commands.
|
||||
// printf("Fragment 4 = %" PRIu64 "\n", (Bits >> 35) & 63);
|
||||
switch ((Bits >> 35) & 63) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11277,6 +11282,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 5 encoded into 4 bits for 9 unique commands.
|
||||
// printf("Fragment 5 = %" PRIu64 "\n", (Bits >> 41) & 15);
|
||||
switch ((Bits >> 41) & 15) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11329,6 +11335,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 6 encoded into 4 bits for 11 unique commands.
|
||||
// printf("Fragment 6 = %" PRIu64 "\n", (Bits >> 45) & 15);
|
||||
switch ((Bits >> 45) & 15) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11386,6 +11393,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 7 encoded into 1 bits for 2 unique commands.
|
||||
// printf("Fragment 7 = %" PRIu64 "\n", (Bits >> 49) & 1);
|
||||
if ((Bits >> 49) & 1) {
|
||||
// RISBG, RISBG32, RISBGN, RISBHG, RISBLG, RNSBG, ROSBG, RXSBG, VAC, VACC...
|
||||
SStream_concat0(O, ", ");
|
||||
@ -11396,6 +11404,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 8 encoded into 2 bits for 3 unique commands.
|
||||
// printf("Fragment 8 = %" PRIu64 "\n", (Bits >> 50) & 3);
|
||||
switch ((Bits >> 50) & 3) {
|
||||
default: // llvm_unreachable("Invalid command number.");
|
||||
case 0:
|
||||
@ -11416,6 +11425,7 @@ static void printInstruction(MCInst *MI, SStream *O, MCRegisterInfo *MRI)
|
||||
|
||||
|
||||
// Fragment 9 encoded into 1 bits for 2 unique commands.
|
||||
// printf("Fragment 9 = %" PRIu64 "\n", (Bits >> 52) & 1);
|
||||
if ((Bits >> 52) & 1) {
|
||||
// VFCE, VFCH, VFCHE, VFMA, VFMAX, VFMIN, VFMS, VFNMA, VFNMS, VMSL, VSTRC
|
||||
SStream_concat0(O, ", ");
|
||||
|
@ -297,16 +297,15 @@ static void printU48ImmOperand(MCInst *MI, int OpNum, SStream *O)
|
||||
static void printPCRelOperand(MCInst *MI, int OpNum, SStream *O)
|
||||
{
|
||||
MCOperand *MO = MCInst_getOperand(MI, OpNum);
|
||||
int32_t imm;
|
||||
|
||||
if (MCOperand_isImm(MO)) {
|
||||
imm = (int32_t)MCOperand_getImm(MO);
|
||||
int64_t imm = (int64_t)MCOperand_getImm(MO);
|
||||
|
||||
printInt32(O, imm);
|
||||
printInt64(O, imm);
|
||||
|
||||
if (MI->csh->detail) {
|
||||
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_IMM;
|
||||
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].imm = (int64_t)imm;
|
||||
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].imm = imm;
|
||||
MI->flat_insn->detail->sysz.op_count++;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user