Skip to content

Commit

Permalink
add smaddl
Browse files Browse the repository at this point in the history
  • Loading branch information
tihmstar committed Aug 23, 2024
1 parent 71843c8 commit f45cac1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/libinsn/arm64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace tihmstar{
/* R */
ret,
/* S */
stp, str, strb, strh, sub, subs,
smaddl, stp, str, strb, strh, sub, subs,
/* T */
tbnz, tbz,

Expand Down
10 changes: 10 additions & 0 deletions libinsn/arm64_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ constexpr enum insn::type is_madd(uint32_t i){
return ((BIT_RANGE(i, 21, 30) == 0b0011011000) && (BIT_AT(i, 15) == 0)) ? insn::madd : insn::unknown;
}

constexpr enum insn::type is_smaddl(uint32_t i){
return ((BIT_RANGE(i, 21, 30) == 0b0011011001) && (BIT_AT(i, 15) == 0)) ? insn::smaddl : insn::unknown;
}

constexpr enum insn::type is_autda(uint32_t i){
return (BIT_RANGE(i, 10, 31) == 0b1101101011000001000110 /*autda*/) ? insn::autda : insn::unknown;
}
Expand Down Expand Up @@ -432,11 +436,13 @@ constexpr const insn_type_test_func special_decoders_0b11111010[] = {

constexpr const insn_type_test_func special_decoders_0b00011011[] = {
is_madd,
is_smaddl,
NULL
};

constexpr const insn_type_test_func special_decoders_0b10011011[] = {
is_madd,
is_smaddl,
NULL
};

Expand Down Expand Up @@ -807,6 +813,7 @@ uint8_t insn::ra(){
reterror("can't get ra of unknown instruction");
break;
case madd:
case smaddl:
return BIT_RANGE(_opcode, 10, 14);

default:
Expand Down Expand Up @@ -841,6 +848,7 @@ uint8_t insn::rd(){
case autda:
case autdza:
case madd:
case smaddl:
return (_opcode % (1<<5));

default:
Expand Down Expand Up @@ -882,6 +890,7 @@ uint8_t insn::rn(){
case blraaz:
case blrabz:
case madd:
case smaddl:
return BIT_RANGE(_opcode, 5, 9);

default:
Expand Down Expand Up @@ -937,6 +946,7 @@ uint8_t insn::rm(){
case mov:
case subs:
case madd:
case smaddl:
return BIT_RANGE(_opcode, 16, 20);

case br:
Expand Down
2 changes: 1 addition & 1 deletion libinsn/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using namespace tihmstar::libinsn;

int main(int argc, const char * argv[]) {
uint64_t opcode = 0x9B0A2D33;
uint64_t opcode = 0x9B2A2D33;
arm64::insn test(opcode,0xfffffff0084aa6dc);

// arm32::arm test(0xE92D40F0,0x803b65c0);
Expand Down

0 comments on commit f45cac1

Please sign in to comment.