Instructions new in each chip
Each chip has everything the one before it has (except the DSP extensions, which are not decoded). Counts of instruction types: the SH-3 software manual (Rev. 4.00, section 7.1) says “The SH-3 instruction set includes 68 basic instruction types, and the SH-3E instruction set includes 84 basic instruction types”; no figure for the SH-1, SH-2 or SH-4 is given here because none was read in a manual (the 68 belongs to the SH-3, not the SH-1).
| Chip | New instructions |
|---|---|
| SH-1 | The base set: mov in all its addressing modes, mova, movt, swap, xtrct; add to subv, the compares, div0s, div0u, div1, exts, extu, mac.w, muls.w, mulu.w, neg, negc; the logic set with tas.b; the shifts and rotates; bt, bf, bra, bsr, jmp, jsr, rts, rte, trapa; clrt, sett, clrmac, nop, sleep; ldc, stc, lds, sts of SR, GBR, VBR, MACH, MACL, PR. |
| SH-2 | bt/s, bf/s, braf, bsrf, dt, mul.l, mac.l, dmuls.l, dmulu.l. |
| SH-3 | shad, shld, pref, ldtlb, clrs, sets; ldc and stc of SSR, SPC and the banked registers; privileged mode and the MMU. (The SH-3E adds a single-precision FPU, and the SH3-DSP a DSP: not decoded.) |
| SH-4 | The whole floating-point line (fpu page), lds, sts of FPUL and FPSCR; ocbi, ocbp, ocbwb, movca.l; ldc and stc of DBR, stc of SGR. |
| SH-4A | fsca, fsrra, fpchg; movli.l, movco.l, movua.l; icbi, prefi, synco; ldc and ldc.l to SGR (the SH-4 can only read SGR). |
What the explorer does with an instruction the chip lacks
Decoding for the SH-2, a word 0x4010 is dt r0; decoding for the SH-1 it is "not in this ISA" (an SH-2 instruction) and is shown as a .word with the real instruction in the note.
A word that no chip defines is illegal. On an SH-4 or SH-4A without FPU (SH4_NOFPU, SH4A_NOFPU in an ELF file) every word of line F is "not in this ISA", and so are lds, lds.l, sts and sts.l of FPUL and FPSCR: the SH-4A manual counts “the H'F*** instructions and the LDS (.L)/STS (.L) instructions using FPUL/FPSCR” as FPU instructions (the SR.FD text), and the SH-2A manual lists “FPU instruction or FPU-related CPU instruction in a product with no FPU” as an undefined code. The chip is chosen by the options bar; in an ELF file the default comes
from e_flags (see the ELF page).
Byte order by machine
| Machine | Chip | Byte order |
|---|---|---|
| Sega Saturn (main and slave CPU) | SH-2 (SH7095) | big |
| Sega 32X (two) | SH-2 (SH7095) | big |
| Sega Dreamcast | SH-4 (SH7091) | little (the CPU can run big; the console does not) |
| Windows CE handhelds, Linux SH ports | SH-3, SH-4 | usually little (the chips are bi-endian) |
The byte-order option defaults to the chip's usual order: big for SH-1 and SH-2, little for SH-3 and later. If the disassembly of an SH-2 binary looks like noise, try the other order.
Not described
Known, not yet covered
- Reference and viewer: SH-2A, SH-2E, SH-3E, SH-DSP, SH3-DSP and SH4AL-DSP (see the overview). What is still missing: for the SH-2A the 32-bit instructions (
MOVI20,MOVI20S, bit operations, the 12-bit displacement loads and stores),JSR/N,RTS/N,RESBANK,MOVML/MOVMU, the banked-register instructions and the double-precision FPU additions (GNU objdump decodes about 6,200 words of the 16-bit space that we call undefined on an SH-2); for the SH-2E and SH-3E the single-precision FPU subset (about 3,800 words objdump decodes and we do not); for the SH-DSP, SH3-DSP and SH4AL-DSP the parallel DSP instructions (about 3,400 words). The manuals for the SH-2A, SH-3, SH-3E and SH3-DSP were read this session, so the work is sourced; it is not done.
Unknown
- Reference: the assignment of an instruction to the chip that introduced it: the SH-3 additions were checked against the SH-3 software manual (Rev. 4.00) and the SH-4 and SH-4A assignments against the SH-4 core manual, the SH-4A manual and GNU objdump 2.47. The SH-1 and SH-2 assignments rest on objdump only (no SH-1/SH-2 programming manual was obtained).
- Reference:
brk(0x003B) is documented in one manual only, the ST and Hitachi SH-4 32-bit CPU Core Architecture (ADCS 7182230F): a vendor extension of the ST SH-4 core, absent from the Renesas SH-4A manual, the SH-3 and SH-2A manuals and binutils. It is not decoded on any variant here (see the overview).