69 Commits

Author SHA1 Message Date
ghidorahrex
37f858aafd Fixed issue with MIPS64 DINS and related instructions. 2021-09-27 09:37:43 -04:00
kotcrab
3ad11a8a36 Fix decompilation of MIPS ins instruction
Simplify ext instruction
2021-09-24 19:06:11 +02:00
ghidorahrex
7321e2a09a Fixed MIPS bitpattern endian mixup 2021-09-17 12:03:14 -04:00
Nicolas Iooss
8194ee34ec fix(mips32el): fix positions of float registers in Little-Endian MIPS32 CPU
When loading double constants using two lwc1 instructions ("Load Word in
Coprocessor 1"), the words are swapped on Little-Endian MIPS machines.

More precisely, when compiling the following function with
mipsel-linux-gnu-gcc -O3 -mfp32 -march=mips1

    double add_0x100000000(double num) {
        return num + 4294967296.0;
    }

The produced assembly (seen with objdump) is:

    00000000 <add_0x100000000>:
       0:    3c1c0000     lui   gp,0x0
       4:    279c0000     addiu gp,gp,0
       8:    0399e021     addu  gp,gp,t9
       c:    8f820000     lw    v0,0(gp)
      10:    00000000     nop
      14:    c4400000     lwc1  $f0,0(v0)     ; load the first 32-bit word
      18:    00000000     nop
      1c:    c4410004     lwc1  $f1,4(v0)     ; load the second 32-bit word
      20:    03e00008     jr    ra
      24:    46206000     add.d $f0,$f12,$f0  ; perform the addition

(the rodata section contains "00000000 0000f041" to encode the constant).

When opening the produced file with Ghidra 10.0, the assembly code is
fine but the decompiler outputs:

    double add_0x100000000(double param_1)
    {
      return param_1 + 5.465589744795806e-315;
    }

5.465589744795806e-315 comes from the decoding of "0000f041 00000000"
instead of "00000000 0000f041": the words were swapped.

Fix this by swapping f0 and f1, f2 and f3... when using a Little-Endian
MIPS machine with 32-bit floating-point registers.
2021-07-12 21:06:44 +02:00
veritas501
89ecfcc236 fix(mips32r6): Optimize inst jic 2021-05-12 15:02:15 +08:00
veritas501
e606a9a18f fix(mips32r6): jic is not call but jump
See https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf,
page 205 (page 215 in file).
jic is not like jialc, which set ra by `GPR[31] <- PC + 4`, it's just a jump.
So, if meet jic reg,xxx , identify it as a jump.
If meet jic ra,xxx , identify it as a return.
2021-05-11 13:13:07 +08:00
caheckman
872cd724cb Split out BE and LE cspec for MIPS 2021-03-24 13:23:04 -04:00
ghidra1
32ae57e312 Merge remote-tracking branch
'origin/GP-33_emteere_PR-1766_mumbel_mips-rfe' into patch
2021-01-25 15:45:45 -05:00
emteere
d7a1085619 GP-33_emteere Updated comment, read Status reg only once 2021-01-25 15:21:47 -05:00
mumbel
734c945f6d MIPS missing rfe instruction 2020-04-13 15:30:21 -05:00
ghidorahrex
02319781b6 GT-3466 Fixed export of local variables as constants 2020-02-07 12:07:26 -05:00
mumbel
dce6e9f6a8 Cleaning up warnings and errors, mostly looking for:
temporary is written but not read in constructor
2020-01-22 19:51:45 -06:00
Ryan Kurtz
f33e2c1296 Merge remote-tracking branch
'origin/GT-3028_ghidorahrex_PR_marpie_Update_MIPS_processor_manuals'

Conflicts:
	Ghidra/Processors/MIPS/data/manuals/mipsMic.idx
2019-07-23 09:03:50 -04:00
ghidra1
a7345527c9 BitFields - added preliminary support for composite bitfields 2019-07-17 11:55:29 -04:00
mumbel
f36d7a29da prime 1E, OCTEON/DSP, and cleanup
- The EVA instructions have prime=0x1E, this should be 0x1F. These
  instructions are used to access user mode virtual address from
  kernel mode, so probably not used often.

- General cleanup in the bit pattern.  There was mixed used of
  decimal and hex values for the same token, converted >9 to hex

- Added OCTEON instructions: lbx, blux, ldx, lhx, lhux, lwx, and lwux

- Implemented the multiple accumulator found in DSP for:
  madd, maddu, mfhi, mflo, msub, msubu, mthi, mtlo, mult, and multu

  These changes convert '00' to ac in the bit pattern and attach to
  the original lo/hi pair and now lo1/hi1, lo2/hi2, and lo3/hi3 pairs.
  The value of ac can range from 0 to 3.  When ac=0, this refers to
  the original HI/LO register pair of the architecture.

- some minor whitespace cleanup
2019-07-17 10:59:37 -04:00
Markus Piéton
508c9a7ea0 Updating MIPS Processor Manuals to latest version.
* MIPS Architecture For Programmers Volume II-A:
      MD00087-2B-MIPS64BIS-AFP-6.06.pdf
  * MIPS Architecture for Programmers Volume II-B: microMIPS64
      MD00594-2B-microMIPS64-AFP-6.05.pdf
  * MIPS Architecture for Programmers Volume II-B: microMIPS32
      MIPS_Architecture_microMIPS32_InstructionSet_AFP_P_MD00582_06.04.pdf

Document Source:

  * https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00087-2B-MIPS64BIS-AFP-6.06.pdf
  * https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00594-2B-microMIPS64-AFP-6.05.pdf
  * https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MIPS_Architecture_microMIPS32_InstructionSet_AFP_P_MD00582_06.04.pdf
2019-05-11 11:45:05 +02:00
ghidorahrex
bc6f6ad927 GT-2768: Corrected spelling and index for mips reference manual. 2019-04-16 14:03:16 -04:00
ghidra1
7179c6de81 GT-2667 added support for generating sleigh build.xml files 2019-03-29 17:24:31 -04:00
Dan
79d8f164f8 Candidate release of source code. 2019-03-26 13:46:51 -04:00