capstone/arch/PowerPC/PPCModule.c
Rot127 93a104c009
PPC LLVM 18 (#2540)
* Update PPC module to LLVM 18.

**New**

(According to LLVM changelog)

- Added DFP instruction.
- Added the SCV instruction.

**Changes**

- Memory decoder were simplified by decoding disponent and base reg separately.
- `DFORM` -> `DFORM_BASE`
- Use inverted `MCInstDesc` table.
- Replace the many declared printer in PPCInstPrinter with `static inlines`.
- Renamed groups to upper case.
- Switched to `ARCH_add_cs_detail_X()` function names.
- Remove `PPCInstPrinter.h` because it is no longer used.

* Fix: Use correct directory name.

* Fix segfaults and add asserts for these NULL cases.

* Allow to map a single LLVM option to multiple CS options

* Add default endian option to the MCUpdater

* Fix setter for Little endian

* Add SPE option to cstool

* Fix QPX instructions.

Due to 4b43ef3e5c
the names of the operands were matched.
Because FRT dosn't exist in the XForm_1 class,
the generated tables didn't decoded them.

* Fix: AbsAddr should be printed as unsigned.

* Fix S12 immediate printing for PC memory operands

* Fix MCUpdater tests

* Update PPCRegisterInfo_stripRegisterPrefix

* Add support for selection of Power versions

* Run clang-format

* Fix feature check

* Allow to overwrite in multi-mode

* Add some more flags

* Fix order and map name

* Add new test files.

* Fix checks for features.

Only enables PowerX feature checks of a Power architecture is enabled
and the feature is in the list of it.

* Print byte sequence with space between comma.

This helps with copy and search of the byte string in the test files.

* Fix tests broken due to feature toggles

* Shorten generated names.

* Update bindings
2024-12-05 19:26:33 +08:00

50 lines
1.1 KiB
C

/* Capstone Disassembly Engine */
/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */
#ifdef CAPSTONE_HAS_POWERPC
#include "../../utils.h"
#include "../../MCRegisterInfo.h"
#include "PPCMapping.h"
#include "PPCModule.h"
cs_err PPC_global_init(cs_struct *ud)
{
MCRegisterInfo *mri;
mri = (MCRegisterInfo *)cs_mem_malloc(sizeof(*mri));
PPC_init_mri(mri);
ud->printer = PPC_printer;
ud->printer_info = mri;
ud->getinsn_info = mri;
ud->disasm = PPC_getInstruction;
ud->post_printer = NULL;
ud->reg_name = PPC_reg_name;
ud->insn_id = PPC_get_insn_id;
ud->insn_name = PPC_insn_name;
ud->group_name = PPC_group_name;
return CS_ERR_OK;
}
cs_err PPC_option(cs_struct *handle, cs_opt_type type, size_t value)
{
if (type == CS_OPT_SYNTAX)
handle->syntax = (int)value;
if (type == CS_OPT_MODE) {
if (value == CS_MODE_LITTLE_ENDIAN) {
handle->mode = handle->mode & ~CS_MODE_BIG_ENDIAN;
return CS_ERR_OK;
}
handle->mode |= (cs_mode)value;
if (value & CS_MODE_MSYNC) {
handle->mode |= (cs_mode)CS_MODE_BOOKE;
}
}
return CS_ERR_OK;
}
#endif