blob: 67838a0a55f87685053e79b96fb83d21ed52245a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#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;
}
}
|