diff options
| author | David Daney <ddaney@caviumnetworks.com> | 2010-02-18 19:13:03 -0500 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2010-04-12 12:26:14 -0400 |
| commit | 58b9e2239fa63c7c470acb4a77e9da17e6a6fa4f (patch) | |
| tree | 2f94c2146e2fe9adba511c4b66c3e3dd89d669b9 | |
| parent | 847253b9483f713b3797877034e0940fd45ce375 (diff) | |
MIPS: Add SYSCALL to uasm.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
To: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/976/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
| -rw-r--r-- | arch/mips/include/asm/uasm.h | 1 | ||||
| -rw-r--r-- | arch/mips/mm/uasm.c | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h index b99bd07e199b..32fe2ec9f960 100644 --- a/arch/mips/include/asm/uasm.h +++ b/arch/mips/include/asm/uasm.h | |||
| @@ -102,6 +102,7 @@ Ip_0(_tlbwr); | |||
| 102 | Ip_u3u1u2(_xor); | 102 | Ip_u3u1u2(_xor); |
| 103 | Ip_u2u1u3(_xori); | 103 | Ip_u2u1u3(_xori); |
| 104 | Ip_u2u1msbu3(_dins); | 104 | Ip_u2u1msbu3(_dins); |
| 105 | Ip_u1(_syscall); | ||
| 105 | 106 | ||
| 106 | /* Handle labels. */ | 107 | /* Handle labels. */ |
| 107 | struct uasm_label { | 108 | struct uasm_label { |
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c index 1581e9852461..d22d7bce02fb 100644 --- a/arch/mips/mm/uasm.c +++ b/arch/mips/mm/uasm.c | |||
| @@ -31,7 +31,8 @@ enum fields { | |||
| 31 | BIMM = 0x040, | 31 | BIMM = 0x040, |
| 32 | JIMM = 0x080, | 32 | JIMM = 0x080, |
| 33 | FUNC = 0x100, | 33 | FUNC = 0x100, |
| 34 | SET = 0x200 | 34 | SET = 0x200, |
| 35 | SCIMM = 0x400 | ||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | #define OP_MASK 0x3f | 38 | #define OP_MASK 0x3f |
| @@ -52,6 +53,8 @@ enum fields { | |||
| 52 | #define FUNC_SH 0 | 53 | #define FUNC_SH 0 |
| 53 | #define SET_MASK 0x7 | 54 | #define SET_MASK 0x7 |
| 54 | #define SET_SH 0 | 55 | #define SET_SH 0 |
| 56 | #define SCIMM_MASK 0xfffff | ||
| 57 | #define SCIMM_SH 6 | ||
| 55 | 58 | ||
| 56 | enum opcode { | 59 | enum opcode { |
| 57 | insn_invalid, | 60 | insn_invalid, |
| @@ -64,7 +67,7 @@ enum opcode { | |||
| 64 | insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, | 67 | insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, |
| 65 | insn_sd, insn_sll, insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, | 68 | insn_sd, insn_sll, insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, |
| 66 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, | 69 | insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, |
| 67 | insn_dins | 70 | insn_dins, insn_syscall |
| 68 | }; | 71 | }; |
| 69 | 72 | ||
| 70 | struct insn { | 73 | struct insn { |
| @@ -136,6 +139,7 @@ static struct insn insn_table[] __cpuinitdata = { | |||
| 136 | { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, | 139 | { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD }, |
| 137 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, | 140 | { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, |
| 138 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, | 141 | { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, |
| 142 | { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, | ||
| 139 | { insn_invalid, 0, 0 } | 143 | { insn_invalid, 0, 0 } |
| 140 | }; | 144 | }; |
| 141 | 145 | ||
| @@ -208,6 +212,14 @@ static inline __cpuinit u32 build_jimm(u32 arg) | |||
| 208 | return (arg >> 2) & JIMM_MASK; | 212 | return (arg >> 2) & JIMM_MASK; |
| 209 | } | 213 | } |
| 210 | 214 | ||
| 215 | static inline __cpuinit u32 build_scimm(u32 arg) | ||
| 216 | { | ||
| 217 | if (arg & ~SCIMM_MASK) | ||
| 218 | printk(KERN_WARNING "Micro-assembler field overflow\n"); | ||
| 219 | |||
| 220 | return (arg & SCIMM_MASK) << SCIMM_SH; | ||
| 221 | } | ||
| 222 | |||
| 211 | static inline __cpuinit u32 build_func(u32 arg) | 223 | static inline __cpuinit u32 build_func(u32 arg) |
| 212 | { | 224 | { |
| 213 | if (arg & ~FUNC_MASK) | 225 | if (arg & ~FUNC_MASK) |
| @@ -266,6 +278,8 @@ static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) | |||
| 266 | op |= build_func(va_arg(ap, u32)); | 278 | op |= build_func(va_arg(ap, u32)); |
| 267 | if (ip->fields & SET) | 279 | if (ip->fields & SET) |
| 268 | op |= build_set(va_arg(ap, u32)); | 280 | op |= build_set(va_arg(ap, u32)); |
| 281 | if (ip->fields & SCIMM) | ||
| 282 | op |= build_scimm(va_arg(ap, u32)); | ||
| 269 | va_end(ap); | 283 | va_end(ap); |
| 270 | 284 | ||
| 271 | **buf = op; | 285 | **buf = op; |
| @@ -391,6 +405,7 @@ I_0(_tlbwr) | |||
| 391 | I_u3u1u2(_xor) | 405 | I_u3u1u2(_xor) |
| 392 | I_u2u1u3(_xori) | 406 | I_u2u1u3(_xori) |
| 393 | I_u2u1msbu3(_dins); | 407 | I_u2u1msbu3(_dins); |
| 408 | I_u1(_syscall); | ||
| 394 | 409 | ||
| 395 | /* Handle labels. */ | 410 | /* Handle labels. */ |
| 396 | void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) | 411 | void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) |
