diff options
| author | James Hogan <james.hogan@imgtec.com> | 2016-06-15 14:29:47 -0400 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2016-06-15 17:58:17 -0400 |
| commit | 258f3a2ea93ff7e322006c716cedc4fa3d861453 (patch) | |
| tree | 06792df7de3f877db5af2850c454f36a18d11cec /arch/mips/include/uapi/asm | |
| parent | d5cd26bcfc881f5443d510e3acd40b30d7b7d0df (diff) | |
MIPS: KVM: Convert emulation to use asm/inst.h
Convert various MIPS KVM guest instruction emulation functions to decode
instructions (and encode translations) using the union mips_instruction
and related enumerations in asm/inst.h rather than #defines and
hardcoded values.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/mips/include/uapi/asm')
| -rw-r--r-- | arch/mips/include/uapi/asm/inst.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h index 8051f9aa1379..a1ebf973725c 100644 --- a/arch/mips/include/uapi/asm/inst.h +++ b/arch/mips/include/uapi/asm/inst.h | |||
| @@ -103,7 +103,7 @@ enum rt_op { | |||
| 103 | bltzal_op, bgezal_op, bltzall_op, bgezall_op, | 103 | bltzal_op, bgezal_op, bltzall_op, bgezall_op, |
| 104 | rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17, | 104 | rt_op_0x14, rt_op_0x15, rt_op_0x16, rt_op_0x17, |
| 105 | rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b, | 105 | rt_op_0x18, rt_op_0x19, rt_op_0x1a, rt_op_0x1b, |
| 106 | bposge32_op, rt_op_0x1d, rt_op_0x1e, rt_op_0x1f | 106 | bposge32_op, rt_op_0x1d, rt_op_0x1e, synci_op |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | /* | 109 | /* |
| @@ -586,6 +586,36 @@ struct r_format { /* Register format */ | |||
| 586 | ;)))))) | 586 | ;)))))) |
| 587 | }; | 587 | }; |
| 588 | 588 | ||
| 589 | struct c0r_format { /* C0 register format */ | ||
| 590 | __BITFIELD_FIELD(unsigned int opcode : 6, | ||
| 591 | __BITFIELD_FIELD(unsigned int rs : 5, | ||
| 592 | __BITFIELD_FIELD(unsigned int rt : 5, | ||
| 593 | __BITFIELD_FIELD(unsigned int rd : 5, | ||
| 594 | __BITFIELD_FIELD(unsigned int z: 8, | ||
| 595 | __BITFIELD_FIELD(unsigned int sel : 3, | ||
| 596 | ;)))))) | ||
| 597 | }; | ||
| 598 | |||
| 599 | struct mfmc0_format { /* MFMC0 register format */ | ||
| 600 | __BITFIELD_FIELD(unsigned int opcode : 6, | ||
| 601 | __BITFIELD_FIELD(unsigned int rs : 5, | ||
| 602 | __BITFIELD_FIELD(unsigned int rt : 5, | ||
| 603 | __BITFIELD_FIELD(unsigned int rd : 5, | ||
| 604 | __BITFIELD_FIELD(unsigned int re : 5, | ||
| 605 | __BITFIELD_FIELD(unsigned int sc : 1, | ||
| 606 | __BITFIELD_FIELD(unsigned int : 2, | ||
| 607 | __BITFIELD_FIELD(unsigned int sel : 3, | ||
| 608 | ;)))))))) | ||
| 609 | }; | ||
| 610 | |||
| 611 | struct co_format { /* C0 CO format */ | ||
| 612 | __BITFIELD_FIELD(unsigned int opcode : 6, | ||
| 613 | __BITFIELD_FIELD(unsigned int co : 1, | ||
| 614 | __BITFIELD_FIELD(unsigned int code : 19, | ||
| 615 | __BITFIELD_FIELD(unsigned int func : 6, | ||
| 616 | ;)))) | ||
| 617 | }; | ||
| 618 | |||
| 589 | struct p_format { /* Performance counter format (R10000) */ | 619 | struct p_format { /* Performance counter format (R10000) */ |
| 590 | __BITFIELD_FIELD(unsigned int opcode : 6, | 620 | __BITFIELD_FIELD(unsigned int opcode : 6, |
| 591 | __BITFIELD_FIELD(unsigned int rs : 5, | 621 | __BITFIELD_FIELD(unsigned int rs : 5, |
| @@ -937,6 +967,9 @@ union mips_instruction { | |||
| 937 | struct u_format u_format; | 967 | struct u_format u_format; |
| 938 | struct c_format c_format; | 968 | struct c_format c_format; |
| 939 | struct r_format r_format; | 969 | struct r_format r_format; |
| 970 | struct c0r_format c0r_format; | ||
| 971 | struct mfmc0_format mfmc0_format; | ||
| 972 | struct co_format co_format; | ||
| 940 | struct p_format p_format; | 973 | struct p_format p_format; |
| 941 | struct f_format f_format; | 974 | struct f_format f_format; |
| 942 | struct ma_format ma_format; | 975 | struct ma_format ma_format; |
