#include "architecture.h" void architecture_info(struct archinfo *ai, const struct iovec *regs) { user_regs_t *data = regs->iov_base; /* Not every platform supports 64-bits, but those that do are generally * backward compatible with 32-bits, so this is the one we explicitly * compare with. */ if (regs->iov_len == sizeof(struct user_regs_32)) { ai->progmctr = data->PROGMCTR_32; ai->stackptr = data->STACKPTR_32; ai->bp_insn = BREAKPOINT_INSN_32; ai->bp_mask = BREAKPOINT_MASK_32; ai->bp_adjust = BREAKPOINT_ADJS_32; ai->cs_arch = CAPSTONE_ARCH_32; ai->cs_mode = CAPSTONE_MODE_32; ai->cs_call = CAPSTONE_CALL_32; ai->wordsize = WORDSIZE_32; } else { ai->progmctr = data->PROGMCTR_64; ai->stackptr = data->STACKPTR_64; ai->bp_insn = BREAKPOINT_INSN_64; ai->bp_mask = BREAKPOINT_MASK_64; ai->bp_adjust = BREAKPOINT_ADJS_64; ai->cs_arch = CAPSTONE_ARCH_64; ai->cs_mode = CAPSTONE_MODE_64; ai->cs_call = CAPSTONE_CALL_64; ai->wordsize = WORDSIZE_64; } }