diff --git a/macho-go/pkg/ios/macho/arm.c b/macho-go/pkg/ios/macho/arm.c index bb82b8b..8842c26 100644 --- a/macho-go/pkg/ios/macho/arm.c +++ b/macho-go/pkg/ios/macho/arm.c @@ -43,6 +43,7 @@ struct add { uint32_t op : 1; uint32_t s : 1; uint32_t sig : 5; + uint32_t shift : 2; uint32_t imm : 12; uint32_t rn : 5; uint32_t rd : 5; @@ -54,6 +55,7 @@ struct add to_add(uint32_t inst) { parsed.op = is_bit_set(inst, 30); parsed.s = is_bit_set(inst, 29); parsed.sig = get_bits(inst, 24, 28); + parsed.shift = get_bits(inst, 22, 23); parsed.imm = get_bits(inst, 10, 21); parsed.rn = get_bits(inst, 5, 9); parsed.rd = get_bits(inst, 0, 4); @@ -66,6 +68,7 @@ void from_add(struct add parsed, uint32_t *inst) { *inst |= parsed.op << 30; *inst |= parsed.s << 29; *inst |= parsed.sig << 24; + *inst |= parsed.shift << 22; *inst |= parsed.imm << 10; *inst |= parsed.rn << 5; *inst |= parsed.rd; @@ -83,6 +86,10 @@ int add_imm_set(uint32_t *inst, uint32_t offset) { uint32_t add_imm_get(uint32_t inst) { struct add parsed = to_add(inst); + if (parsed.shift != 0) { + printf("add instruction shift != 0 is not supported\n"); + *(char*)0 = 0; + } return parsed.imm; }