From c3669b892548ed3e1e8f4016f1e18202c5e7f484 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 20 Jul 2007 17:02:39 -0700 Subject: [PATCH] Implement the rest of the conditional jump instructions and hook them into the decoder. --HG-- extra : convert_revision : 8d1d6abce29371def560e1c3f31dabb4de01366f --- src/arch/x86/isa/decoder/one_byte_opcodes.isa | 40 +++---- src/arch/x86/isa/decoder/two_byte_opcodes.isa | 40 +++---- .../x86/isa/insts/control_transfer/jump.py | 100 ++++++++++++++++++ 3 files changed, 142 insertions(+), 38 deletions(-) diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa index 42404ab91..d1ef8d48e 100644 --- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa @@ -214,25 +214,27 @@ 0x6: outs_Dx_Xb(); 0x7: outs_Dx_Xz(); } - 0x0E: decode OPCODE_OP_BOTTOM3 { - 0x0: jo_Jb(); - 0x1: jno_Jb(); - 0x2: jb_Jb(); - 0x3: Inst::JNB(Jb); - 0x4: Inst::JZ(Jb); - 0x5: Inst::JNZ(Jb); - 0x6: Inst::JBE(Jb); - 0x7: Inst::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: Inst::JNLE(Jb); + 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); + } } 0x10: decode OPCODE_OP_BOTTOM3 { //0x0: group1_Eb_Ib(); diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa index a62e911e2..383d64e5a 100644 --- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa +++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa @@ -227,25 +227,27 @@ 0x6: holder(); 0x7: holder(); } - 0x10: decode OPCODE_OP_BOTTOM3 { - 0x0: jo_Jz(); - 0x1: jno_Jz(); - 0x2: jb_Jz(); - 0x3: Inst::JNB(Jz); - 0x4: Inst::JZ(Jz); - 0x5: Inst::JNZ(Jz); - 0x6: Inst::JBE(Jz); - 0x7: Inst::JNBE(Jz); - } - 0x11: decode OPCODE_OP_BOTTOM3 { - 0x0: js_Jz(); - 0x1: jns_Jz(); - 0x2: jp_Jz(); - 0x3: jnp_Jz(); - 0x4: jl_Jz(); - 0x5: jnl_Jz(); - 0x6: jle_Jz(); - 0x7: jnle_Jz(); + format Inst { + 0x10: decode OPCODE_OP_BOTTOM3 { + 0x0: JO(Jz); + 0x1: JNO(Jz); + 0x2: JB(Jz); + 0x3: JNB(Jz); + 0x4: JZ(Jz); + 0x5: JNZ(Jz); + 0x6: JBE(Jz); + 0x7: JNBE(Jz); + } + 0x11: decode OPCODE_OP_BOTTOM3 { + 0x0: JS(Jz); + 0x1: JNS(Jz); + 0x2: JP(Jz); + 0x3: JNP(Jz); + 0x4: JL(Jz); + 0x5: JNL(Jz); + 0x6: JLE(Jz); + 0x7: JNLE(Jz); + } } 0x12: decode OPCODE_OP_BOTTOM3 { 0x0: seto_Eb(); diff --git a/src/arch/x86/isa/insts/control_transfer/jump.py b/src/arch/x86/isa/insts/control_transfer/jump.py index 3d69643ae..489eb9e39 100644 --- a/src/arch/x86/isa/insts/control_transfer/jump.py +++ b/src/arch/x86/isa/insts/control_transfer/jump.py @@ -74,6 +74,16 @@ def macroop JNZ_I wrip t1, t2, flags=(nCZF,) }; +def macroop JB_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(CCF,) +}; + def macroop JNB_I { # Make the default data size of jumps 64 bits in 64 bit mode @@ -104,6 +114,76 @@ def macroop JNBE_I wrip t1, t2, flags=(nCCvZF,) }; +def macroop JS_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(CSF,) +}; + +def macroop JNS_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(nCSF,) +}; + +def macroop JP_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(CPF,) +}; + +def macroop JNP_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(nCPF,) +}; + +def macroop JL_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(CSxOF,) +}; + +def macroop JNL_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(nCSxOF,) +}; + +def macroop JLE_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(CSxOvZF,) +}; + def macroop JNLE_I { # Make the default data size of jumps 64 bits in 64 bit mode @@ -114,6 +194,26 @@ def macroop JNLE_I wrip t1, t2, flags=(nCSxOvZF,) }; +def macroop JO_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(COF,) +}; + +def macroop JNO_I +{ + # Make the default data size of jumps 64 bits in 64 bit mode + .adjust_env oszIn64Override + + rdip t1 + limm t2, imm + wrip t1, t2, flags=(nCOF,) +}; + def macroop JMP_I { # Make the default data size of jumps 64 bits in 64 bit mode -- 2.30.2