2 * Format of an instruction in memory.
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 1996, 2000 by Ralf Baechle
9 * Copyright (C) 2006 by Thiemo Seufer
14 #include <uapi/asm/inst.h>
16 /* HACHACHAHCAHC ... */
18 /* In case some other massaging is needed, keep MIPSInst as wrapper */
22 #define I_OPCODE_SFT 26
23 #define MIPSInst_OPCODE(x) (MIPSInst(x) >> I_OPCODE_SFT)
25 #define I_JTARGET_SFT 0
26 #define MIPSInst_JTARGET(x) (MIPSInst(x) & 0x03ffffff)
29 #define MIPSInst_RS(x) ((MIPSInst(x) & 0x03e00000) >> I_RS_SFT)
32 #define MIPSInst_RT(x) ((MIPSInst(x) & 0x001f0000) >> I_RT_SFT)
35 #define MIPSInst_SIMM(x) ((int)((short)(MIPSInst(x) & 0xffff)))
36 #define MIPSInst_UIMM(x) (MIPSInst(x) & 0xffff)
38 #define I_CACHEOP_SFT 18
39 #define MIPSInst_CACHEOP(x) ((MIPSInst(x) & 0x001c0000) >> I_CACHEOP_SFT)
41 #define I_CACHESEL_SFT 16
42 #define MIPSInst_CACHESEL(x) ((MIPSInst(x) & 0x00030000) >> I_CACHESEL_SFT)
45 #define MIPSInst_RD(x) ((MIPSInst(x) & 0x0000f800) >> I_RD_SFT)
48 #define MIPSInst_RE(x) ((MIPSInst(x) & 0x000007c0) >> I_RE_SFT)
51 #define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
54 #define MIPSInst_FFMT(x) ((MIPSInst(x) & 0x01e00000) >> I_FFMT_SFT)
57 #define MIPSInst_FT(x) ((MIPSInst(x) & 0x001f0000) >> I_FT_SFT)
60 #define MIPSInst_FS(x) ((MIPSInst(x) & 0x0000f800) >> I_FS_SFT)
63 #define MIPSInst_FD(x) ((MIPSInst(x) & 0x000007c0) >> I_FD_SFT)
66 #define MIPSInst_FR(x) ((MIPSInst(x) & 0x03e00000) >> I_FR_SFT)
68 #define I_FMA_FUNC_SFT 2
69 #define MIPSInst_FMA_FUNC(x) ((MIPSInst(x) & 0x0000003c) >> I_FMA_FUNC_SFT)
71 #define I_FMA_FFMT_SFT 0
72 #define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000003)
74 typedef unsigned int mips_instruction;
76 /* microMIPS instruction decode structure. Do NOT export!!! */
77 struct mm_decoded_insn {
78 mips_instruction insn;
79 mips_instruction next_insn;
85 #endif /* _ASM_INST_H */