-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Architecture updater (auto-sync) - Updating PPC #2013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
15d7f83
Refactor PPC module for auto-sync
Rot127 5205916
Update auto-sync scripts with changes introdduces with PPC update
Rot127 ebdd62f
Update additional files associated with PPC auto-sync update.
Rot127 405ba19
Add check for detail
Rot127 d232140
Add getFeatureBits call.
Rot127 39dc350
Fix reachable assert/segfault (also in LLVM).
Rot127 51df179
Remove INVALID entry which is already part of the generated data
Rot127 7223607
Handle memory operands printed via printOperand without setting mem o…
Rot127 09387bb
Set correct operand type of cr bit field.
Rot127 0d1db37
Remove debug string
Rot127 a57ffa1
Fix braces around initializer bug
Rot127 7cb368d
Add naive fuzzing code.
Rot127 ac787be
Add MT/MFSPR alias enum values
Rot127 8336458
Rename duplicate variable
Rot127 c5d9aee
Revert "Rename duplicate variable"
Rot127 762b508
Revert "Add naive fuzzing code."
Rot127 5d48271
Add missing operand printers
Rot127 bd97d98
Fix undefined behavior of shift by using uint64_t and fix build warni…
Rot127 a89cbfc
Add more MTSPR and MFSPR alias
Rot127 e5df497
Increment major version
Rot127 29abd76
Fix rebase blunder. Set correct header file location.
Rot127 c567ec7
Allow to patch also inc files without specifing the include guard.
Rot127 12e1357
Fix: Cutting first line.
Rot127 8d5e42e
Add feature to select between alias and real operand set.
Rot127 3b05ae2
Clearify documentation and fix incorrect SO predicates.
Rot127 4ca8fde
Save BI field separately from csX_bit.
Rot127 d876f73
Replace magic numbers with their enums.
Rot127 3a2185c
Add helper functions to test for branch cond flags.
Rot127 0064e01
Remove LI instruction (they are alias).
Rot127 f2238cb
Set constant zero as mem base if base reg == r0.
Rot127 b5e1b90
Replace tabs after mnemonic with space.
Rot127 5d0c547
Set ZERO register, not the value 0 for (RA|0) cases
Rot127 a01fef3
Add missing implicit write to LR.
Rot127 93e6915
Print implicity read/written registers.
Rot127 9ee7bb1
Remove unused code (was replaced with proper alias handling.)
Rot127 f7646d2
Fix S[LR]WI alias instructions.
Rot127 f11afcc
Handle hardcoded sldi alias.
Rot127 216eb47
Remove unused variable
Rot127 74a1271
Remove leading tabs
Rot127 58fbfa4
Check if detail ops shall be filled before insert_op
Rot127 00641b1
Replace branch alias defined as instructions with actual alias.
Rot127 7891d77
Remove additional space before alias mnemonic
Rot127 07277ef
Rename function to make it less similar to test_cr_bit and add harder…
Rot127 59fef92
Fix build of cstest ppc_detail.c
Rot127 1590b86
Reorder alias after change to td files.
Rot127 affa5af
Set correct type instruction decoding (fixes prefixed instructions.)
Rot127 f6ffa21
Add memory operand flags to prefix instructions.
Rot127 8235f42
Check for option to print register names without prefix.
Rot127 c14282b
Add check if PS mode is enabled.
Rot127 467358f
Revert "Increment major version"
Rot127 43cad57
Add READ_WRITE access attribute to fix build error.
Rot127 8d7aaeb
Run clang-format
Rot127 fbb39c2
Remove manipulation of cs option during tests.
Rot127 1d73395
Add NOREGNAME option to endocing tests.
Rot127 09d6343
Revert "ppc: fix suite/MC/PowerPC/ppc64-encoding.s.cs"
Rot127 8420dd7
Fix PPC alias instruction tests.
Rot127 16a5f36
Disable MSYNC feature.
Rot127 777b88d
Fix book-II instruction tests - Sets instructions as in LLVM
Rot127 0d1d15e
Add more ppc64 encoding tests.
Rot127 44ad6e2
Add AIXOS feature to not enabled list.
Rot127 a08bbf1
Add conditional branch alias which branch always.
Rot127 b8718c2
Add ppc64 encoding ext tests with new branch alias.
Rot127 1e92e9a
Add Book-III tests from LLVM
Rot127 31b59cf
Remove wrong branch alias and add tests for them.
Rot127 fb6b2ee
Add three more tests
Rot127 1aa62ad
Add BOOKE as mode.
Rot127 75923a1
Compile cstest with debug info
Rot127 a18fcf6
Add option to print % sign in front of register names.
Rot127 f882dff
Add support for S12 immediates of PS instructions.
Rot127 bed53d7
Add option to choose instruction detail set (between alias and real).
Rot127 8313842
Fix syntax/alias issuesin issues.cs
Rot127 a385d79
fix false usage of arm details.
Rot127 243823d
Update python constants.
Rot127 23e9796
Update python bindings with changes to PPC and cs_insn structs.
Rot127 3acd756
Check for more edge cases when memory operands are emitted via printO…
Rot127 4556561
Set correct values for the MCRegisterInfo struct.
Rot127 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
/* Rot127 <unisono@quyllur.org>, 2022-2023 */ | ||
|
||
#include "Mapping.h" | ||
#include "capstone/capstone.h" | ||
|
||
// create a cache for fast id lookup | ||
static unsigned short *make_id2insn(const insn_map *insns, unsigned int size) | ||
|
@@ -311,3 +312,60 @@ const cs_ac_type mapping_get_op_access(MCInst *MI, unsigned OpNum, | |
DEFINE_get_detail_op(arm, ARM); | ||
DEFINE_get_detail_op(ppc, PPC); | ||
DEFINE_get_detail_op(tricore, TriCore); | ||
|
||
/// Returns true if for this architecture the | ||
/// alias operands should be filled. | ||
/// TODO: Replace this with a proper option. | ||
/// So it can be toggled between disas() calls. | ||
bool map_use_alias_details(const MCInst *MI) { | ||
assert(MI); | ||
return !(MI->csh->detail_opt & CS_OPT_DETAIL_REAL); | ||
} | ||
|
||
/// Sets the setDetailOps flag to @p Val. | ||
/// If detail == NULLit refuses to set the flag to true. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo? |
||
void map_set_fill_detail_ops(MCInst *MI, bool Val) { | ||
assert(MI); | ||
if (!detail_is_set(MI)) { | ||
MI->fillDetailOps = false; | ||
return; | ||
} | ||
|
||
MI->fillDetailOps = Val; | ||
} | ||
|
||
/// Sets the instruction alias flags and the given alias id. | ||
void map_set_is_alias_insn(MCInst *MI, bool Val, uint64_t Alias) { | ||
assert(MI); | ||
MI->isAliasInstr = Val; | ||
MI->flat_insn->is_alias = Val; | ||
MI->flat_insn->alias_id = Alias; | ||
} | ||
|
||
/// Sets an alternative id for some instruction. | ||
/// Or -1 if it fails. | ||
/// You must add (<ARCH>_INS_ALIAS_BEGIN + 1) to the id to get the real id. | ||
void map_set_alias_id(MCInst *MI, const SStream *O, const name_map *alias_mnem_id_map, int map_size) { | ||
if (!MCInst_isAlias(MI)) | ||
return; | ||
|
||
char alias_mnem[16] = { 0 }; | ||
int i = 0, j = 0; | ||
const char *asm_str_buf = O->buffer; | ||
// Skip spaces and tabs | ||
while (asm_str_buf[i] == ' ' || asm_str_buf[i] == '\t') { | ||
if (!asm_str_buf[i]) { | ||
MI->flat_insn->alias_id = -1; | ||
return; | ||
} | ||
++i; | ||
} | ||
for (; j < sizeof(alias_mnem) - 1; ++j, ++i) { | ||
if (!asm_str_buf[i] || asm_str_buf[i] == ' ' || asm_str_buf[i] == '\t') | ||
break; | ||
alias_mnem[j] = O->buffer[i]; | ||
} | ||
|
||
MI->flat_insn->alias_id = name2id(alias_mnem_id_map, map_size, alias_mnem); | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. I need to update
AArch64
andARM
for it as well. Do this after or just before everything is updated to LLVM 17.