diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2007-10-18 22:39:39 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2007-10-18 22:39:39 -0700 |
commit | 70542c8e617b3b721b3cc5e7e52ca62b65e3073b (patch) | |
tree | ed7ccffddb0f7c54d5db35a2c06a3f11fc48c03e /src/arch/x86/isa/decoder | |
parent | dc2e887f238d48f15364d9937bc71940d3849c0a (diff) | |
download | gem5-70542c8e617b3b721b3cc5e7e52ca62b65e3073b.tar.xz |
X86: Make "Inst" the default format instead of WarnUnimpl for one byte opcodes.
--HG--
extra : convert_revision : 591e67fc21f5b72977c5876e39f488494fda77c2
Diffstat (limited to 'src/arch/x86/isa/decoder')
-rw-r--r-- | src/arch/x86/isa/decoder/one_byte_opcodes.isa | 667 | ||||
-rw-r--r-- | src/arch/x86/isa/decoder/x87.isa | 546 |
2 files changed, 603 insertions, 610 deletions
diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa index 29b952cab..10118eae8 100644 --- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa @@ -59,15 +59,15 @@ // 0x1: decode OPCODE_OP_TOP5 { - format WarnUnimpl { + format Inst { 0x00: decode OPCODE_OP_BOTTOM3 { 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: push_ES(); + 0x0: UD2(); + default: WarnUnimpl::push_ES(); } 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: pop_ES(); + 0x0: UD2(); + default: WarnUnimpl::pop_ES(); } default: MultiInst::ADD(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], @@ -76,8 +76,8 @@ } 0x01: decode OPCODE_OP_BOTTOM3 { 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: push_CS(); + 0x0: UD2(); + default: WarnUnimpl::push_CS(); } //Any time this is seen, it should generate a two byte opcode 0x7: M5InternalError::error( @@ -89,12 +89,12 @@ } 0x02: decode OPCODE_OP_BOTTOM3 { 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: push_SS(); + 0x0: UD2(); + default: WarnUnimpl::push_SS(); } 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: pop_SS(); + 0x0: UD2(); + default: WarnUnimpl::pop_SS(); } default: MultiInst::ADC(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], @@ -103,12 +103,12 @@ } 0x03: decode OPCODE_OP_BOTTOM3 { 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: push_DS(); + 0x0: UD2(); + default: WarnUnimpl::push_DS(); } 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: pop_DS(); + 0x0: UD2(); + default: WarnUnimpl::pop_DS(); } default: MultiInst::SBB(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], @@ -119,8 +119,8 @@ 0x6: M5InternalError::error( {{"Tried to execute the ES segment override prefix!"}}); 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: daa(); + 0x0: UD2(); + default: WarnUnimpl::daa(); } default: MultiInst::AND(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], @@ -130,7 +130,10 @@ 0x05: decode OPCODE_OP_BOTTOM3 { 0x6: M5InternalError::error( {{"Tried to execute the CS segment override prefix!"}}); - 0x7: das(); + 0x7: decode MODE_SUBMODE { + 0x0: UD2(); + default: WarnUnimpl::das(); + } default: MultiInst::SUB(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], [Gb,Eb], [Gv,Ev], @@ -140,8 +143,8 @@ 0x6: M5InternalError::error( {{"Tried to execute the SS segment override prefix!"}}); 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: aaa(); + 0x0: UD2(); + default: WarnUnimpl::aaa(); } default: MultiInst::XOR(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], @@ -152,47 +155,45 @@ 0x6: M5InternalError::error( {{"Tried to execute the DS segment override prefix!"}}); 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: aas(); + 0x0: UD2(); + default: WarnUnimpl::aas(); } default: MultiInst::CMP(OPCODE_OP_BOTTOM3, [Eb,Gb], [Ev,Gv], [Gb,Eb], [Gv,Ev], [rAb,Ib], [rAv,Iz]); } - format Inst { - 0x08: decode MODE_SUBMODE { - 0x0: M5InternalError::error ( - {{"Tried to execute an REX prefix!"}}); - default: INC(Bv); - } - 0x09: decode MODE_SUBMODE { - 0x0: M5InternalError::error ( - {{"Tried to execute an REX prefix!"}}); - default: DEC(Bv); - } - 0x0A: PUSH(Bv); - 0x0B: POP(Bv); + 0x08: decode MODE_SUBMODE { + 0x0: M5InternalError::error ( + {{"Tried to execute an REX prefix!"}}); + default: INC(Bv); + } + 0x09: decode MODE_SUBMODE { + 0x0: M5InternalError::error ( + {{"Tried to execute an REX prefix!"}}); + default: DEC(Bv); } + 0x0A: PUSH(Bv); + 0x0B: POP(Bv); 0x0C: decode OPCODE_OP_BOTTOM3 { 0x0: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: Inst::PUSHA(); + 0x0: UD2(); + default: PUSHA(); } 0x1: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: Inst::POPA(); + 0x0: UD2(); + default: POPA(); } 0x2: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: bound_Gv_Ma(); + 0x0: UD2(); + default: WarnUnimpl::bound_Gv_Ma(); } 0x3: decode MODE_SUBMODE { //The second operand should really be of size "d", but it's //set to "v" in order to have a consistent register size. //This shouldn't affect behavior. - 0x0: Inst::MOVSXD(Gv,Ev); - default: arpl_Ew_Gw(); + 0x0: MOVSXD(Gv,Ev); + default: WarnUnimpl::arpl_Ew_Gw(); } 0x4: M5InternalError::error( {{"Tried to execute the FS segment override prefix!"}}); @@ -204,41 +205,62 @@ {{"Tried to execute the DS address size override prefix!"}}); } 0x0D: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::PUSH(Iz); - 0x1: Inst::IMUL(Gv,Ev,Iz); - 0x2: Inst::PUSH(Ib); - 0x3: Inst::IMUL(Gv,Ev,Ib); - 0x4: ins_Yb_Dx(); - 0x5: ins_Yz_Dx(); - 0x6: outs_Dx_Xb(); - 0x7: outs_Dx_Xz(); + 0x0: PUSH(Iz); + 0x1: IMUL(Gv,Ev,Iz); + 0x2: PUSH(Ib); + 0x3: IMUL(Gv,Ev,Ib); + 0x4: WarnUnimpl::ins_Yb_Dx(); + 0x5: WarnUnimpl::ins_Yz_Dx(); + 0x6: WarnUnimpl::outs_Dx_Xb(); + 0x7: WarnUnimpl::outs_Dx_Xz(); } - format Inst { - 0x0E: decode OPCODE_OP_BOTTOM3 { - 0x0: JO(Jb); - 0x1: JNO(Jb); - 0x2: JB(Jb); - 0x3: JNB(Jb); - 0x4: JZ(Jb); - 0x5: JNZ(Jb); - 0x6: JBE(Jb); - 0x7: JNBE(Jb); - } - 0x0F: decode OPCODE_OP_BOTTOM3 { - 0x0: JS(Jb); - 0x1: JNS(Jb); - 0x2: JP(Jb); - 0x3: JNP(Jb); - 0x4: JL(Jb); - 0x5: JNL(Jb); - 0x6: JLE(Jb); - 0x7: JNLE(Jb); - } + 0x0E: decode OPCODE_OP_BOTTOM3 { + 0x0: JO(Jb); + 0x1: JNO(Jb); + 0x2: JB(Jb); + 0x3: JNB(Jb); + 0x4: JZ(Jb); + 0x5: JNZ(Jb); + 0x6: JBE(Jb); + 0x7: JNBE(Jb); + } + 0x0F: decode OPCODE_OP_BOTTOM3 { + 0x0: JS(Jb); + 0x1: JNS(Jb); + 0x2: JP(Jb); + 0x3: JNP(Jb); + 0x4: JL(Jb); + 0x5: JNL(Jb); + 0x6: JLE(Jb); + 0x7: JNLE(Jb); } - format Inst { - 0x10: decode OPCODE_OP_BOTTOM3 { - //0x0: group1_Eb_Ib(); - 0x0: decode MODRM_REG { + 0x10: decode OPCODE_OP_BOTTOM3 { + //0x0: group1_Eb_Ib(); + 0x0: decode MODRM_REG { + 0x0: ADD(Eb,Ib); + 0x1: OR(Eb,Ib); + 0x2: ADC(Eb,Ib); + 0x3: SBB(Eb,Ib); + 0x4: AND(Eb,Ib); + 0x5: SUB(Eb,Ib); + 0x6: XOR(Eb,Ib); + 0x7: CMP(Eb,Ib); + } + //0x1: group1_Ev_Iz(); + 0x1: decode MODRM_REG { + 0x0: ADD(Ev,Iz); + 0x1: OR(Ev,Iz); + 0x2: ADC(Ev,Iz); + 0x3: SBB(Ev,Iz); + 0x4: AND(Ev,Iz); + 0x5: SUB(Ev,Iz); + 0x6: XOR(Ev,Iz); + 0x7: CMP(Ev,Iz); + } + 0x2: decode MODE_SUBMODE { + 0x0: UD2(); + //default: group1_Eb_Ib(); + default: decode MODRM_REG { 0x0: ADD(Eb,Ib); 0x1: OR(Eb,Ib); 0x2: ADC(Eb,Ib); @@ -248,313 +270,282 @@ 0x6: XOR(Eb,Ib); 0x7: CMP(Eb,Ib); } - //0x1: group1_Ev_Iz(); - 0x1: decode MODRM_REG { - 0x0: ADD(Ev,Iz); - 0x1: OR(Ev,Iz); - 0x2: ADC(Ev,Iz); - 0x3: SBB(Ev,Iz); - 0x4: AND(Ev,Iz); - 0x5: SUB(Ev,Iz); - 0x6: XOR(Ev,Iz); - 0x7: CMP(Ev,Iz); - } - 0x2: decode MODE_SUBMODE { - 0x0: UD2(); - //default: group1_Eb_Ib(); - default: decode MODRM_REG { - 0x0: ADD(Eb,Ib); - 0x1: OR(Eb,Ib); - 0x2: ADC(Eb,Ib); - 0x3: SBB(Eb,Ib); - 0x4: AND(Eb,Ib); - 0x5: SUB(Eb,Ib); - 0x6: XOR(Eb,Ib); - 0x7: CMP(Eb,Ib); - } - } - //0x3: group1_Ev_Ib(); - 0x3: decode MODRM_REG { - 0x0: ADD(Ev,Ib); - 0x1: OR(Ev,Ib); - 0x2: ADC(Ev,Ib); - 0x3: SBB(Ev,Ib); - 0x4: AND(Ev,Ib); - 0x5: SUB(Ev,Ib); - 0x6: XOR(Ev,Ib); - 0x7: CMP(Ev,Ib); - } - 0x4: TEST(Eb,Gb); - 0x5: TEST(Ev,Gv); - 0x6: XCHG(Eb,Gb); - 0x7: XCHG(Ev,Gv); } + //0x3: group1_Ev_Ib(); + 0x3: decode MODRM_REG { + 0x0: ADD(Ev,Ib); + 0x1: OR(Ev,Ib); + 0x2: ADC(Ev,Ib); + 0x3: SBB(Ev,Ib); + 0x4: AND(Ev,Ib); + 0x5: SUB(Ev,Ib); + 0x6: XOR(Ev,Ib); + 0x7: CMP(Ev,Ib); + } + 0x4: TEST(Eb,Gb); + 0x5: TEST(Ev,Gv); + 0x6: XCHG(Eb,Gb); + 0x7: XCHG(Ev,Gv); } 0x11: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::MOV(Eb,Gb); - 0x1: Inst::MOV(Ev,Gv); - 0x2: Inst::MOV(Gb,Eb); - 0x3: Inst::MOV(Gv,Ev); - 0x4: mov_MwRv_Sw(); //What to do with this one? - 0x5: Inst::LEA(Gv,M); - 0x6: mov_Sw_MwRv(); - 0x7: group10_Ev(); //Make sure this is Ev + 0x0: MOV(Eb,Gb); + 0x1: MOV(Ev,Gv); + 0x2: MOV(Gb,Eb); + 0x3: MOV(Gv,Ev); + 0x4: WarnUnimpl::mov_MwRv_Sw(); //What to do with this one? + 0x5: LEA(Gv,M); + 0x6: WarnUnimpl::mov_Sw_MwRv(); + 0x7: WarnUnimpl::group10_Ev(); //Make sure this is Ev } 0x12: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::NOP(); //XXX repe makes this a "pause" - default: Inst::XCHG(Bv,rAv); + 0x0: NOP(); //XXX repe makes this a "pause" + default: XCHG(Bv,rAv); } 0x13: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::CDQE(rAv); - 0x1: Inst::CQO(rAv,rDv); + 0x0: CDQE(rAv); + 0x1: CQO(rAv,rDv); 0x2: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: call_far_Ap(); + 0x0: UD2(); + default: WarnUnimpl::call_far_Ap(); } - 0x3: fwait(); //aka wait - 0x4: pushf_Fv(); - 0x5: popf_Fv(); + 0x3: WarnUnimpl::fwait(); //aka wait + 0x4: WarnUnimpl::pushf_Fv(); + 0x5: WarnUnimpl::popf_Fv(); //Both of these should be illegal only if CPUID.AHF64=0, //according to sandpile.org 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: sahf(); + 0x0: UD2(); + default: WarnUnimpl::sahf(); } 0x7: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: lahf(); + 0x0: UD2(); + default: WarnUnimpl::lahf(); } } - format Inst { - 0x14: decode OPCODE_OP_BOTTOM3 { - 0x0: MOV(rAb, Ob); - 0x1: MOV(rAv, Ov); - 0x2: MOV(Ob, rAb); - 0x3: MOV(Ov, rAv); - 0x4: StringInst::MOVS(Yb,Xb); - 0x5: StringInst::MOVS(Yv,Xv); - 0x6: StringTestInst::CMPS(Yb,Xb); - 0x7: StringTestInst::CMPS(Yv,Xv); - } - 0x15: decode OPCODE_OP_BOTTOM3 { - 0x0: TEST(rAb,Ib); - 0x1: TEST(rAv,Iz); - 0x2: StringInst::STOS(Yb); - 0x3: StringInst::STOS(Yv); - 0x4: StringInst::LODS(Xb); - 0x5: StringInst::LODS(Xv); - 0x6: StringTestInst::SCAS(Yb); - 0x7: StringTestInst::SCAS(Yv); - } - 0x16: MOV(Bb,Ib); - 0x17: MOV(Bv,Iv); - 0x18: decode OPCODE_OP_BOTTOM3 { - //0x0: group2_Eb_Ib(); - 0x0: decode MODRM_REG { - 0x0: ROL(Eb,Ib); - 0x1: ROR(Eb,Ib); - 0x2: RCL(Eb,Ib); - 0x3: RCR(Eb,Ib); - 0x4: SAL(Eb,Ib); - 0x5: SHR(Eb,Ib); - 0x6: SAL(Eb,Ib); - 0x7: SAR(Eb,Ib); - } - //0x1: group2_Ev_Ib(); - 0x1: decode MODRM_REG { - 0x0: ROL(Ev,Ib); - 0x1: ROR(Ev,Ib); - 0x2: RCL(Ev,Ib); - 0x3: RCR(Ev,Ib); - 0x4: SAL(Ev,Ib); - 0x5: SHR(Ev,Ib); - 0x6: SAL(Ev,Ib); - 0x7: SAR(Ev,Ib); - } - 0x2: RET_NEAR(Iw); - 0x3: RET_NEAR(); - 0x4: decode MODE_SUBMODE { - 0x0: UD2(); - default: WarnUnimpl::les_Gz_Mp(); - } - 0x5: decode MODE_SUBMODE { - 0x0: UD2(); - default: WarnUnimpl::lds_Gz_Mp(); - } - //0x6: group12_Eb_Ib(); - 0x6: decode MODRM_REG { - 0x0: MOV(Eb,Ib); - default: UD2(); - } - //0x7: group12_Ev_Iz(); - 0x7: decode MODRM_REG { - 0x0: MOV(Ev,Iz); - default: UD2(); - } + 0x14: decode OPCODE_OP_BOTTOM3 { + 0x0: MOV(rAb, Ob); + 0x1: MOV(rAv, Ov); + 0x2: MOV(Ob, rAb); + 0x3: MOV(Ov, rAv); + 0x4: StringInst::MOVS(Yb,Xb); + 0x5: StringInst::MOVS(Yv,Xv); + 0x6: StringTestInst::CMPS(Yb,Xb); + 0x7: StringTestInst::CMPS(Yv,Xv); + } + 0x15: decode OPCODE_OP_BOTTOM3 { + 0x0: TEST(rAb,Ib); + 0x1: TEST(rAv,Iz); + 0x2: StringInst::STOS(Yb); + 0x3: StringInst::STOS(Yv); + 0x4: StringInst::LODS(Xb); + 0x5: StringInst::LODS(Xv); + 0x6: StringTestInst::SCAS(Yb); + 0x7: StringTestInst::SCAS(Yv); + } + 0x16: MOV(Bb,Ib); + 0x17: MOV(Bv,Iv); + 0x18: decode OPCODE_OP_BOTTOM3 { + //0x0: group2_Eb_Ib(); + 0x0: decode MODRM_REG { + 0x0: ROL(Eb,Ib); + 0x1: ROR(Eb,Ib); + 0x2: RCL(Eb,Ib); + 0x3: RCR(Eb,Ib); + 0x4: SAL(Eb,Ib); + 0x5: SHR(Eb,Ib); + 0x6: SAL(Eb,Ib); + 0x7: SAR(Eb,Ib); + } + //0x1: group2_Ev_Ib(); + 0x1: decode MODRM_REG { + 0x0: ROL(Ev,Ib); + 0x1: ROR(Ev,Ib); + 0x2: RCL(Ev,Ib); + 0x3: RCR(Ev,Ib); + 0x4: SAL(Ev,Ib); + 0x5: SHR(Ev,Ib); + 0x6: SAL(Ev,Ib); + 0x7: SAR(Ev,Ib); + } + 0x2: RET_NEAR(Iw); + 0x3: RET_NEAR(); + 0x4: decode MODE_SUBMODE { + 0x0: UD2(); + default: WarnUnimpl::les_Gz_Mp(); + } + 0x5: decode MODE_SUBMODE { + 0x0: UD2(); + default: WarnUnimpl::lds_Gz_Mp(); + } + //0x6: group12_Eb_Ib(); + 0x6: decode MODRM_REG { + 0x0: MOV(Eb,Ib); + default: UD2(); + } + //0x7: group12_Ev_Iz(); + 0x7: decode MODRM_REG { + 0x0: MOV(Ev,Iz); + default: UD2(); } } - 0x19: decode OPCODE_OP_BOTTOM3 { - 0x0: enter_Iw_Ib(); - 0x1: Inst::LEAVE(); - 0x2: ret_far_Iw(); - 0x3: ret_far(); - 0x4: int3(); - 0x5: int_Ib(); - 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: into(); + format WarnUnimpl { + 0x19: decode OPCODE_OP_BOTTOM3 { + 0x0: enter_Iw_Ib(); + 0x1: Inst::LEAVE(); + 0x2: ret_far_Iw(); + 0x3: ret_far(); + 0x4: int3(); + 0x5: int_Ib(); + 0x6: decode MODE_SUBMODE { + 0x0: Inst::UD2(); + default: into(); + } + 0x7: iret(); } - 0x7: iret(); } 0x1A: decode OPCODE_OP_BOTTOM3 { - format Inst { - //0x0: group2_Eb_1(); - 0x0: decode MODRM_REG { - 0x0: ROL_1(Eb); - 0x1: ROR_1(Eb); - 0x2: RCL_1(Eb); - 0x3: RCR_1(Eb); - 0x4: SAL_1(Eb); - 0x5: SHR_1(Eb); - 0x6: SAL_1(Eb); - 0x7: SAR_1(Eb); - } - //0x1: group2_Ev_1(); - 0x1: decode MODRM_REG { - 0x0: ROL_1(Ev); - 0x1: ROR_1(Ev); - 0x2: RCL_1(Ev); - 0x3: RCR_1(Ev); - 0x4: SAL_1(Ev); - 0x5: SHR_1(Ev); - 0x6: SAL_1(Ev); - 0x7: SAR_1(Ev); - } - //0x2: group2_Eb_Cl(); - 0x2: decode MODRM_REG { - 0x0: ROL(Eb,rCb); - 0x1: ROR(Eb,rCb); - 0x2: RCL(Eb,rCb); - 0x3: RCR(Eb,rCb); - 0x4: SAL(Eb,rCb); - 0x5: SHR(Eb,rCb); - 0x6: SAL(Eb,rCb); - 0x7: SAR(Eb,rCb); - } - //The second operand should have size "b", but to have - //consistent register sizes it's "v". This shouldn't have - //any affect on functionality. - //0x3: group2_Ev_Cl(); - 0x3: decode MODRM_REG { - 0x0: ROL(Ev,rCv); - 0x1: ROR(Ev,rCv); - 0x2: RCL(Ev,rCv); - 0x3: RCR(Ev,rCv); - 0x4: SAL(Ev,rCv); - 0x5: SHR(Ev,rCv); - 0x6: SAL(Ev,rCv); - 0x7: SAR(Ev,rCv); - } + //0x0: group2_Eb_1(); + 0x0: decode MODRM_REG { + 0x0: ROL_1(Eb); + 0x1: ROR_1(Eb); + 0x2: RCL_1(Eb); + 0x3: RCR_1(Eb); + 0x4: SAL_1(Eb); + 0x5: SHR_1(Eb); + 0x6: SAL_1(Eb); + 0x7: SAR_1(Eb); + } + //0x1: group2_Ev_1(); + 0x1: decode MODRM_REG { + 0x0: ROL_1(Ev); + 0x1: ROR_1(Ev); + 0x2: RCL_1(Ev); + 0x3: RCR_1(Ev); + 0x4: SAL_1(Ev); + 0x5: SHR_1(Ev); + 0x6: SAL_1(Ev); + 0x7: SAR_1(Ev); + } + //0x2: group2_Eb_Cl(); + 0x2: decode MODRM_REG { + 0x0: ROL(Eb,rCb); + 0x1: ROR(Eb,rCb); + 0x2: RCL(Eb,rCb); + 0x3: RCR(Eb,rCb); + 0x4: SAL(Eb,rCb); + 0x5: SHR(Eb,rCb); + 0x6: SAL(Eb,rCb); + 0x7: SAR(Eb,rCb); + } + //The second operand should have size "b", but to have + //consistent register sizes it's "v". This shouldn't have + //any affect on functionality. + //0x3: group2_Ev_Cl(); + 0x3: decode MODRM_REG { + 0x0: ROL(Ev,rCv); + 0x1: ROR(Ev,rCv); + 0x2: RCL(Ev,rCv); + 0x3: RCR(Ev,rCv); + 0x4: SAL(Ev,rCv); + 0x5: SHR(Ev,rCv); + 0x6: SAL(Ev,rCv); + 0x7: SAR(Ev,rCv); } 0x4: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: aam_Ib(); + 0x0: UD2(); + default: WarnUnimpl::aam_Ib(); } 0x5: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: aad_Ib(); + 0x0: UD2(); + default: WarnUnimpl::aad_Ib(); } 0x6: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: salc(); + 0x0: UD2(); + default: WarnUnimpl::salc(); } - 0x7: xlat(); + 0x7: WarnUnimpl::xlat(); } ##include "x87.isa" 0x1C: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::LOOPNE(Jb); - 0x1: Inst::LOOPE(Jb); - 0x2: Inst::LOOP(Jb); - 0x3: Inst::JRCX(Jb); - 0x4: Inst::IN(rAb,Ib); - 0x5: Inst::IN(rAv,Iv); - 0x6: Inst::OUT(Ib,rAb); - 0x7: Inst::OUT(Iv,rAv); + 0x0: LOOPNE(Jb); + 0x1: LOOPE(Jb); + 0x2: LOOP(Jb); + 0x3: JRCX(Jb); + 0x4: IN(rAb,Ib); + 0x5: IN(rAv,Iv); + 0x6: OUT(Ib,rAb); + 0x7: OUT(Iv,rAv); } 0x1D: decode OPCODE_OP_BOTTOM3 { - 0x0: Inst::CALL_NEAR(Jz); - 0x1: Inst::JMP(Jz); + 0x0: CALL_NEAR(Jz); + 0x1: JMP(Jz); 0x2: decode MODE_SUBMODE { - 0x0: Inst::UD2(); - default: jmp_far_Ap(); - } - 0x3: Inst::JMP(Jb); - 0x4: Inst::IN(rAb,rD); - 0x5: Inst::IN(rAv,rD); - 0x6: Inst::OUT(rD,rAb); - 0x7: Inst::OUT(rD,rAv); + 0x0: UD2(); + default: WarnUnimpl::jmp_far_Ap(); + } + 0x3: JMP(Jb); + 0x4: IN(rAb,rD); + 0x5: IN(rAv,rD); + 0x6: OUT(rD,rAb); + 0x7: OUT(rD,rAv); } 0x1E: decode OPCODE_OP_BOTTOM3 { 0x0: M5InternalError::error( {{"Tried to execute the lock prefix!"}}); - 0x1: int1(); + 0x1: WarnUnimpl::int1(); 0x2: M5InternalError::error( {{"Tried to execute the repne prefix!"}}); 0x3: M5InternalError::error( {{"Tried to execute the rep/repe prefix!"}}); - 0x4: hlt(); - format Inst { - 0x5: CMC(); - //0x6: group3_Eb(); - 0x6: decode MODRM_REG { - 0x0: TEST(Eb,Iz); - 0x1: TEST(Eb,Iz); - 0x2: NOT(Eb); - 0x3: NEG(Eb); - 0x4: MUL_B(Eb); - 0x5: IMUL_B(Eb); - //This should be Eb, but it access the entire word value ax. - 0x6: DIV_B(Ew); - 0x7: IDIV(Eb); - } - //0x7: group3_Ev(); - 0x7: decode MODRM_REG { - 0x0: TEST(Ev,Iz); - 0x1: TEST(Ev,Iz); - 0x2: NOT(Ev); - 0x3: NEG(Ev); - 0x4: MUL(Ev); - 0x5: IMUL(Ev); - 0x6: DIV(Ev); - 0x7: IDIV(Ev); - } + 0x4: WarnUnimpl::hlt(); + 0x5: CMC(); + //0x6: group3_Eb(); + 0x6: decode MODRM_REG { + 0x0: TEST(Eb,Iz); + 0x1: TEST(Eb,Iz); + 0x2: NOT(Eb); + 0x3: NEG(Eb); + 0x4: MUL_B(Eb); + 0x5: IMUL_B(Eb); + //This should be Eb, but it access the entire word value ax. + 0x6: DIV_B(Ew); + 0x7: IDIV(Eb); + } + //0x7: group3_Ev(); + 0x7: decode MODRM_REG { + 0x0: TEST(Ev,Iz); + 0x1: TEST(Ev,Iz); + 0x2: NOT(Ev); + 0x3: NEG(Ev); + 0x4: MUL(Ev); + 0x5: IMUL(Ev); + 0x6: DIV(Ev); + 0x7: IDIV(Ev); } } 0x1F: decode OPCODE_OP_BOTTOM3 { - format Inst { - 0x0: CLC(); - 0x1: STC(); - 0x2: WarnUnimpl::cli(); - 0x3: WarnUnimpl::sti(); - 0x4: CLD(); - 0x5: STD(); - //0x6: group4(); - 0x6: decode MODRM_REG { - 0x0: INC(Eb); - 0x1: DEC(Eb); - default: UD2(); - } - //0x7: group5(); - 0x7: decode MODRM_REG { - 0x0: INC(Ev); - 0x1: DEC(Ev); - 0x2: CALL_NEAR(Ev); - 0x3: WarnUnimpl::call_far_Mp(); - 0x4: JMP(Ev); - 0x5: WarnUnimpl::jmp_far_Mp(); - 0x6: PUSH(Ev); - 0x7: UD2(); - } + 0x0: CLC(); + 0x1: STC(); + 0x2: WarnUnimpl::cli(); + 0x3: WarnUnimpl::sti(); + 0x4: CLD(); + 0x5: STD(); + //0x6: group4(); + 0x6: decode MODRM_REG { + 0x0: INC(Eb); + 0x1: DEC(Eb); + default: UD2(); + } + //0x7: group5(); + 0x7: decode MODRM_REG { + 0x0: INC(Ev); + 0x1: DEC(Ev); + 0x2: CALL_NEAR(Ev); + 0x3: WarnUnimpl::call_far_Mp(); + 0x4: JMP(Ev); + 0x5: WarnUnimpl::jmp_far_Mp(); + 0x6: PUSH(Ev); + 0x7: UD2(); } } } diff --git a/src/arch/x86/isa/decoder/x87.isa b/src/arch/x86/isa/decoder/x87.isa index 667a8a66e..9a6473141 100644 --- a/src/arch/x86/isa/decoder/x87.isa +++ b/src/arch/x86/isa/decoder/x87.isa @@ -53,294 +53,296 @@ // // Authors: Gabe Black -0x1B: decode OPCODE_OP_BOTTOM3 { - //0x0: esc0(); - 0x0: decode MODRM_REG { - 0x0: fadd(); - 0x1: fmul(); - 0x2: fcom(); - 0x3: fcomp(); - 0x4: fsub(); - 0x5: fsubr(); - 0x6: fdiv(); - 0x7: fdivr(); - } - //0x1: esc1(); - 0x1: decode MODRM_REG { - 0x0: fld(); - 0x1: decode MODRM_MOD { - 0x3: fxch(); - default: Inst::UD2(); - } - 0x2: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: fnop(); +format WarnUnimpl { + 0x1B: decode OPCODE_OP_BOTTOM3 { + //0x0: esc0(); + 0x0: decode MODRM_REG { + 0x0: fadd(); + 0x1: fmul(); + 0x2: fcom(); + 0x3: fcomp(); + 0x4: fsub(); + 0x5: fsubr(); + 0x6: fdiv(); + 0x7: fdivr(); + } + //0x1: esc1(); + 0x1: decode MODRM_REG { + 0x0: fld(); + 0x1: decode MODRM_MOD { + 0x3: fxch(); default: Inst::UD2(); } - default: fst(); - } - 0x3: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fstp(); - } - 0x4: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: fchs(); - 0x1: fabs(); - 0x4: ftst(); - 0x5: fxam(); - default: Inst::UD2(); + 0x2: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: fnop(); + default: Inst::UD2(); + } + default: fst(); } - default: fldenv(); - } - 0x5: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: fld1(); - 0x1: fldl2t(); - 0x2: fldl2e(); - 0x3: fldpi(); - 0x4: fldlg2(); - 0x5: fldln2(); - 0x6: fldz(); - } - default: fldcw_Mw(); - } - 0x6: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: f2xm1(); - 0x1: fyl2x(); - 0x2: fptan(); - 0x3: fpatan(); - 0x4: fxtract(); - 0x5: fprem1(); - 0x6: fdecstp(); - 0x7: fincstp(); - } - default: fnstenv(); - } - 0x7: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: fprem(); - 0x1: fyl2xp1(); - 0x2: fsqrt(); - 0x3: fsincos(); - 0x4: frndint(); - 0x5: fscale(); - 0x6: fsin(); - 0x7: fcos(); - } - default: fnstcw_Mw(); - } - } - //0x2: esc2(); - 0x2: decode MODRM_REG { - 0x0: decode MODRM_MOD { - 0x3: fcmovb(); - default: fiadd(); - } - 0x1: decode MODRM_MOD { - 0x3: fcmove(); - default: fimul(); - } - 0x2: decode MODRM_MOD { - 0x3: fcmovbe(); - default: ficom(); - } - 0x3: decode MODRM_MOD { - 0x3: fcmovu(); - default: ficomp(); - } - 0x4: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fisub(); - } - 0x5: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x1: fucompp(); - default: Inst::UD2(); + 0x3: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fstp(); + } + 0x4: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: fchs(); + 0x1: fabs(); + 0x4: ftst(); + 0x5: fxam(); + default: Inst::UD2(); + } + default: fldenv(); + } + 0x5: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: fld1(); + 0x1: fldl2t(); + 0x2: fldl2e(); + 0x3: fldpi(); + 0x4: fldlg2(); + 0x5: fldln2(); + 0x6: fldz(); + } + default: fldcw_Mw(); + } + 0x6: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: f2xm1(); + 0x1: fyl2x(); + 0x2: fptan(); + 0x3: fpatan(); + 0x4: fxtract(); + 0x5: fprem1(); + 0x6: fdecstp(); + 0x7: fincstp(); + } + default: fnstenv(); + } + 0x7: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: fprem(); + 0x1: fyl2xp1(); + 0x2: fsqrt(); + 0x3: fsincos(); + 0x4: frndint(); + 0x5: fscale(); + 0x6: fsin(); + 0x7: fcos(); + } + default: fnstcw_Mw(); } - default: fisubr(); - } - 0x6: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fidiv(); - } - 0x7: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fidivr(); - } - } - //0x3: esc3(); - 0x3: decode MODRM_REG { - 0x0: decode MODRM_MOD { - 0x3: fcmovnb(); - default: fild(); - } - 0x1: decode MODRM_MOD { - 0x3: fcmovne(); - default: fisttp(); - } - 0x2: decode MODRM_MOD { - 0x3: fcmovnbe(); - default: fist(); } - 0x3: decode MODRM_MOD { - 0x3: fcmovnu(); - default: fistp(); + //0x2: esc2(); + 0x2: decode MODRM_REG { + 0x0: decode MODRM_MOD { + 0x3: fcmovb(); + default: fiadd(); + } + 0x1: decode MODRM_MOD { + 0x3: fcmove(); + default: fimul(); + } + 0x2: decode MODRM_MOD { + 0x3: fcmovbe(); + default: ficom(); + } + 0x3: decode MODRM_MOD { + 0x3: fcmovu(); + default: ficomp(); + } + 0x4: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fisub(); + } + 0x5: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x1: fucompp(); + default: Inst::UD2(); + } + default: fisubr(); + } + 0x6: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fidiv(); + } + 0x7: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fidivr(); + } } - 0x4: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x2: fnclex(); - 0x3: fninit(); + //0x3: esc3(); + 0x3: decode MODRM_REG { + 0x0: decode MODRM_MOD { + 0x3: fcmovnb(); + default: fild(); + } + 0x1: decode MODRM_MOD { + 0x3: fcmovne(); + default: fisttp(); + } + 0x2: decode MODRM_MOD { + 0x3: fcmovnbe(); + default: fist(); + } + 0x3: decode MODRM_MOD { + 0x3: fcmovnu(); + default: fistp(); + } + 0x4: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x2: fnclex(); + 0x3: fninit(); + default: Inst::UD2(); + } default: Inst::UD2(); } - default: Inst::UD2(); - } - 0x5: decode MODRM_MOD { - 0x3: fucomi(); - default: fld(); - } - 0x6: decode MODRM_MOD { - 0x3: fcomi(); - default: Inst::UD2(); - } - 0x7: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fstp(); - } - } - //0x4: esc4(); - 0x4: decode MODRM_REG { - 0x0: fadd(); - 0x1: fmul(); - 0x2: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fcom(); - } - 0x3: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fcomp(); - } - 0x4: decode MODRM_MOD { - 0x3: fsubr(); - default: fsub(); - } - 0x5: decode MODRM_MOD { - 0x3: fsub(); - default: fsubr(); - } - 0x6: decode MODRM_MOD { - 0x3: fdivr(); - default: fdiv(); - } - 0x7: decode MODRM_MOD { - 0x3: fdiv(); - default: fdivr(); - } - } - //0x5: esc5(); - 0x5: decode MODRM_REG { - 0x0: decode MODRM_MOD { - 0x3: ffree(); - default: Inst::FLD(Mq); - } - 0x1: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fisttp(); - } - 0x2: Inst::FST(Mq); - 0x3: Inst::FSTP(Mq); - 0x4: decode MODRM_MOD { - 0x3: fucom(); - default: frstor(); - } - 0x5: decode MODRM_MOD { - 0x3: fucomp(); - default: Inst::UD2(); - } - 0x6: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fnsave(); - } - 0x7: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fnstsw(); - } - } - //0x6: esc6(); - 0x6: decode MODRM_REG { - 0x0: decode MODRM_MOD { - 0x3: faddp(); - default: fiadd(); - } - 0x1: decode MODRM_MOD { - 0x3: fmulp(); - default: fimul(); - } - 0x2: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: ficom(); - } - 0x3: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x1: fcompp(); + 0x5: decode MODRM_MOD { + 0x3: fucomi(); + default: fld(); + } + 0x6: decode MODRM_MOD { + 0x3: fcomi(); default: Inst::UD2(); } - default: ficomp(); - } - 0x4: decode MODRM_MOD { - 0x3: fsubrp(); - default: fisub(); - } - 0x5: decode MODRM_MOD { - 0x3: fsubp(); - default: fisubr(); - } - 0x6: decode MODRM_MOD { - 0x3: fdivrp(); - default: fidiv(); - } - 0x7: decode MODRM_MOD { - 0x3: fdivp(); - default: fidivr(); - } - } - //0x7: esc7(); - 0x7: decode MODRM_REG { - 0x0: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fild(); - } - 0x1: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fisttp(); - } - 0x2: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fist(); + 0x7: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fstp(); + } } - 0x3: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fistp(); + //0x4: esc4(); + 0x4: decode MODRM_REG { + 0x0: fadd(); + 0x1: fmul(); + 0x2: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fcom(); + } + 0x3: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fcomp(); + } + 0x4: decode MODRM_MOD { + 0x3: fsubr(); + default: fsub(); + } + 0x5: decode MODRM_MOD { + 0x3: fsub(); + default: fsubr(); + } + 0x6: decode MODRM_MOD { + 0x3: fdivr(); + default: fdiv(); + } + 0x7: decode MODRM_MOD { + 0x3: fdiv(); + default: fdivr(); + } } - 0x4: decode MODRM_MOD { - 0x3: decode MODRM_RM { - 0x0: fnstsw(); + //0x5: esc5(); + 0x5: decode MODRM_REG { + 0x0: decode MODRM_MOD { + 0x3: ffree(); + default: Inst::FLD(Mq); + } + 0x1: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fisttp(); + } + 0x2: Inst::FST(Mq); + 0x3: Inst::FSTP(Mq); + 0x4: decode MODRM_MOD { + 0x3: fucom(); + default: frstor(); + } + 0x5: decode MODRM_MOD { + 0x3: fucomp(); default: Inst::UD2(); } - default: fbld(); - } - 0x5: decode MODRM_MOD { - 0x3: fucomip(); - default: fild(); + 0x6: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fnsave(); + } + 0x7: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fnstsw(); + } } - 0x6: decode MODRM_MOD { - 0x3: fcomip(); - default: fbstp(); + //0x6: esc6(); + 0x6: decode MODRM_REG { + 0x0: decode MODRM_MOD { + 0x3: faddp(); + default: fiadd(); + } + 0x1: decode MODRM_MOD { + 0x3: fmulp(); + default: fimul(); + } + 0x2: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: ficom(); + } + 0x3: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x1: fcompp(); + default: Inst::UD2(); + } + default: ficomp(); + } + 0x4: decode MODRM_MOD { + 0x3: fsubrp(); + default: fisub(); + } + 0x5: decode MODRM_MOD { + 0x3: fsubp(); + default: fisubr(); + } + 0x6: decode MODRM_MOD { + 0x3: fdivrp(); + default: fidiv(); + } + 0x7: decode MODRM_MOD { + 0x3: fdivp(); + default: fidivr(); + } } - 0x7: decode MODRM_MOD { - 0x3: Inst::UD2(); - default: fistp(); + //0x7: esc7(); + 0x7: decode MODRM_REG { + 0x0: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fild(); + } + 0x1: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fisttp(); + } + 0x2: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fist(); + } + 0x3: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fistp(); + } + 0x4: decode MODRM_MOD { + 0x3: decode MODRM_RM { + 0x0: fnstsw(); + default: Inst::UD2(); + } + default: fbld(); + } + 0x5: decode MODRM_MOD { + 0x3: fucomip(); + default: fild(); + } + 0x6: decode MODRM_MOD { + 0x3: fcomip(); + default: fbstp(); + } + 0x7: decode MODRM_MOD { + 0x3: Inst::UD2(); + default: fistp(); + } } } } |