Skip to content

Commit

Permalink
ARM fixes (#2477)
Browse files Browse the repository at this point in the history
* Fix #2381

* Fix #2382

* Fix post-index correction only for pop with single register

* Fix missing memory index register scale

* Remove faulty and duplicated lshift field.

* Add shift information to shift alias instructions and add several tests.

* Fix scale tests

---------

Co-authored-by: Wu ChenXu <[email protected]>
  • Loading branch information
Rot127 and kabeor authored Sep 23, 2024
1 parent 40dffb2 commit 5430745
Show file tree
Hide file tree
Showing 12 changed files with 720 additions and 96 deletions.
11 changes: 8 additions & 3 deletions Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,13 @@ void map_set_is_alias_insn(MCInst *MI, bool Val, uint64_t Alias) {
MI->flat_insn->alias_id = Alias;
}

static inline bool char_ends_mnem(const char c) {
return (!c || c == ' ' || c == '\t');
static inline bool char_ends_mnem(const char c, cs_arch arch) {
switch (arch) {
default:
return (!c || c == ' ' || c == '\t' || c == '.');
case CS_ARCH_PPC:
return (!c || c == ' ' || c == '\t');
}
}

/// Sets an alternative id for some instruction.
Expand All @@ -400,7 +405,7 @@ void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_i
++i;
}
for (; j < sizeof(alias_mnem) - 1; ++j, ++i) {
if (char_ends_mnem(asm_str_buf[i]))
if (char_ends_mnem(asm_str_buf[i], MI->csh->arch))
break;
alias_mnem[j] = asm_str_buf[i];
}
Expand Down
Loading

0 comments on commit 5430745

Please sign in to comment.