mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 12:11:55 +00:00
3c11e8f59f
This patch modifies the SLEIGH specification of MSP430 (but not the MSP430X extension) to produce pcode that more accurately reflects the actual behaviour of the instruction set. These changes were derived by testing the Ghidra emulation of MSP430 instructions against the behaviour of an MSP430FR5994 dev board. The changes include: Unaligned (odd) word memory accesses and writes now properly round down rather than accessing unaligned memory. This affects instructions that depend on the stack pointer, which can be misaligned. The PC register can now never become misaligned (it's low bit is effectively zero). Accesses of the PC register now properly reflect the address of the next instruction. Instructions that use the status register (SR) as a general source register have been modified to prevent changes to the status codes (embedded in SR) to clobber the value of SR prior to its use in the operation. There is more work to be done to correct the behaviour of instructions where SR is used as the destination register. Instructions of the form MNEM @reg+ X(reg) where the source and dest use the same register now accurately reflect the source increment in the calculation of the dest value. [These instruction behaves as: fetch source, increment source, fetch dest] The implementation of the V flag for ADDC, SUBC, and related emulated instructions now reflects comparing the src and dest signs (without the carry) with the result sign (which includes the carry). [The original implementation adds the carry to either the source or dest prior to scarry] Added an implementation of the decimal add instructions that may be clunky, but accurately performs the operations. The RRC instruction now clears the V flag. A new table has been added for single operand instructions, as tbl_bzero was incorrectly applied (single operand instructions use the as (not ad) token for the dest). The carry flag was inverted for DEC and DECD. Corrections for corner case instructions: PUSH/POP SP, PUSH/CALL X(SP), BR @reg+. |
||
---|---|---|
.. | ||
6502 | ||
8048 | ||
8051 | ||
8085 | ||
68000 | ||
AARCH64 | ||
ARM | ||
Atmel | ||
BPF | ||
CP1600 | ||
CR16 | ||
Dalvik | ||
DATA | ||
eBPF | ||
HCS08 | ||
HCS12 | ||
JVM | ||
Loongarch | ||
M8C | ||
MC6800 | ||
MCS96 | ||
MIPS | ||
PA-RISC | ||
PIC | ||
PowerPC | ||
RISCV | ||
Sparc | ||
SuperH | ||
SuperH4 | ||
TI_MSP430 | ||
Toy | ||
tricore | ||
V850 | ||
x86 | ||
Xtensa | ||
Z80 |