mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 13:39:46 +00:00
3a2cd3c331
* Fix CID 508418 - Uninitialized struct * Fix CID 509089 - Fix OOB read and write * Fix CID 509088 - OOB. Also adds tests and to ensure no OOB access. * Fix CID 509085 - Resource leak. * Fix CID 508414 and companions - Using undefined values. * Fix CID 508405 - Use of uninitialized value * Remove unnecessary and badly implemented dev fuzz code. * Fix CID 508396 - Uninitialzied variable. * Fix CID 508393, 508365 -- OOB read. * Fix CID 432207 - OVerlapping memory access. * Remove unused functions * Fix CID 432170 - Overlapping memory access. * Fix CID 166022 - Check for negative index * Let strncat not depend n src operand. * Fix 509083 and 509084 - NULL dereference * Remove duplicated code. * Initialize sysop * Fix resource leak * Remove unreachable code. * Remove duplicate code. * Add assert to check return value of cmoack * Fixed: d should be a signed value, since it is checked against < 0 * Add missing break. * Add NULL check * Fix signs of binary search comparisons. * Add explicit cast of or result * Fix correct scope of case. * Handle invalid integer type. * Return UINT_MAX instead of implicitly casted -1 * Remove dead code * Fix type of im * Fix type of d * Remove duplicated code. * Add returns after CS_ASSERTS * Check for len == 0 case. * Ensure shift operates on uint64 * Replace strcpy with strncpy. * Handle edge cases for 32bit rotate * Fix some out of enum warnings * Replace a strcpy with strncpy. * Fix increment of address * Skip some linting * Fix: set instruction id * Remove unused enum * Replace the last usages of strcpy with SStream functions. * Increase number of allowed AArch64 operands. * Check safety of incrementing t the next operand. * Fix naming of operand * Update python constants * Fix option setup of CS_OPT_DETAIL_REAL * Document DETAIL_REAL has to be used with CS_OPT_ON. * Run Coverity scan every Monday. * Remove dead code * Fix OOB read * Rename macro to reflect it is only used with sstreams * Fix rebase issues
86 lines
2.4 KiB
C
86 lines
2.4 KiB
C
/* Capstone Disassembler Engine */
|
|
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014 */
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <capstone/capstone.h>
|
|
#include "cstool.h"
|
|
|
|
void print_insn_detail_systemz(csh handle, cs_insn *ins)
|
|
{
|
|
cs_systemz *systemz;
|
|
int i;
|
|
|
|
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
|
|
if (ins->detail == NULL)
|
|
return;
|
|
|
|
systemz = &(ins->detail->systemz);
|
|
if (systemz->op_count)
|
|
printf("\top_count: %u\n", systemz->op_count);
|
|
|
|
for (i = 0; i < systemz->op_count; i++) {
|
|
cs_systemz_op *op = &(systemz->operands[i]);
|
|
switch((int)op->type) {
|
|
default:
|
|
break;
|
|
case SYSTEMZ_OP_REG:
|
|
printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
|
|
break;
|
|
case SYSTEMZ_OP_IMM:
|
|
printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
|
|
break;
|
|
case SYSTEMZ_OP_MEM:
|
|
printf("\t\toperands[%u].type: MEM\n", i);
|
|
if (op->mem.base != SYSTEMZ_REG_INVALID)
|
|
printf("\t\t\toperands[%u].mem.base: REG = %s\n",
|
|
i, cs_reg_name(handle, op->mem.base));
|
|
if (op->mem.index != SYSTEMZ_REG_INVALID)
|
|
printf("\t\t\toperands[%u].mem.index: REG = %s\n",
|
|
i, cs_reg_name(handle, op->mem.index));
|
|
if (op->mem.length != 0) {
|
|
printf("\t\t\toperands[%u].mem.length: 0x%" PRIx64 "\n", i, op->mem.length);
|
|
}
|
|
printf("\t\t\toperands[%u].mem.disp: 0x%" PRIx64 "\n", i, op->mem.disp);
|
|
switch(op->mem.am) {
|
|
default:
|
|
printf("\t\t\toperands[%u].mem.am: UNHANDLED\n", i);
|
|
break;
|
|
case SYSTEMZ_AM_BD:
|
|
printf("\t\t\toperands[%u].mem.am: SYSTEMZ_AM_BD\n", i);
|
|
break;
|
|
case SYSTEMZ_AM_BDX:
|
|
printf("\t\t\toperands[%u].mem.am: SYSTEMZ_AM_BDX\n", i);
|
|
break;
|
|
case SYSTEMZ_AM_BDL:
|
|
printf("\t\t\toperands[%u].mem.am: SYSTEMZ_AM_BDL\n", i);
|
|
break;
|
|
case SYSTEMZ_AM_BDR:
|
|
printf("\t\t\toperands[%u].mem.am: SYSTEMZ_AM_BDR\n", i);
|
|
break;
|
|
case SYSTEMZ_AM_BDV:
|
|
printf("\t\t\toperands[%u].mem.am: SYSTEMZ_AM_BDV\n", i);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
switch(op->access) {
|
|
default:
|
|
break;
|
|
case CS_AC_READ:
|
|
printf("\t\toperands[%u].access: READ\n", i);
|
|
break;
|
|
case CS_AC_WRITE:
|
|
printf("\t\toperands[%u].access: WRITE\n", i);
|
|
break;
|
|
case CS_AC_READ | CS_AC_WRITE:
|
|
printf("\t\toperands[%u].access: READ | WRITE\n", i);
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
if (systemz->cc != SYSTEMZ_CC_INVALID)
|
|
printf("\tCode condition: %u\n", systemz->cc);
|
|
}
|