From: Kyle Hale Date: Mon, 20 Jun 2011 22:49:12 +0000 (-0400) Subject: Software interrupt decoder support X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=7d80144eeb8dc7f5bb48975a7d7ab0d3b126d795;p=palacios.git Software interrupt decoder support --- diff --git a/palacios/include/palacios/vmm_decoder.h b/palacios/include/palacios/vmm_decoder.h index 7b703a8..7f33fde 100644 --- a/palacios/include/palacios/vmm_decoder.h +++ b/palacios/include/palacios/vmm_decoder.h @@ -34,7 +34,7 @@ typedef enum { V3_INVALID_OP, V3_OP_SETB, V3_OP_SETBE, V3_OP_SETL, V3_OP_SETLE, V3_OP_SETNB, V3_OP_SETNBE, V3_OP_SETNL, V3_OP_SETNLE, V3_OP_SETNO, V3_OP_SETNP, V3_OP_SETNS, V3_OP_SETNZ, V3_OP_SETO, V3_OP_SETP, V3_OP_SETS, - V3_OP_SETZ, V3_OP_MOVS, V3_OP_STOS, V3_OP_MOVZX, V3_OP_MOVSX } v3_op_type_t; + V3_OP_SETZ, V3_OP_MOVS, V3_OP_STOS, V3_OP_MOVZX, V3_OP_MOVSX, V3_OP_INT } v3_op_type_t; typedef enum {INVALID_OPERAND, REG_OPERAND, MEM_OPERAND, IMM_OPERAND} v3_operand_type_t; diff --git a/palacios/include/palacios/vmm_instr_decoder.h b/palacios/include/palacios/vmm_instr_decoder.h index 2e26457..6ed6ba0 100644 --- a/palacios/include/palacios/vmm_instr_decoder.h +++ b/palacios/include/palacios/vmm_instr_decoder.h @@ -28,6 +28,7 @@ typedef enum { SMSW, CLTS, INVLPG, + INT, MOV_CR2, MOV_2CR, @@ -310,6 +311,7 @@ static int get_operand_width(struct guest_info * info, struct x86_instr * instr, return -1; } + case INT: case MOV_DR2: case MOV_2DR: case MOV_CR2: @@ -1331,6 +1333,8 @@ static op_form_t op_code_to_form(uint8_t * instr, int * length) { case 0xf4: return HLT; + case 0xcd: + return INT; case 0xf6: { struct modrm_byte * modrm = (struct modrm_byte *)&(instr[1]); @@ -1493,6 +1497,7 @@ static char * op_form_to_str(op_form_t form) { case SETO: return "SETO"; case STOS_8: return "STOS_8"; case STOS: return "STOS"; + case INT: return "INT"; case INVALID_INSTR: default: diff --git a/palacios/src/palacios/vmm_decoder.c b/palacios/src/palacios/vmm_decoder.c index a2f260c..874e8cf 100644 --- a/palacios/src/palacios/vmm_decoder.c +++ b/palacios/src/palacios/vmm_decoder.c @@ -146,6 +146,7 @@ static char * op_type_to_str(v3_op_type_t type) { case V3_OP_STOS: return "V3_OP_STOS"; case V3_OP_MOVZX: return "V3_OP_MOVZX"; case V3_OP_MOVSX: return "V3_OP_MOVSX"; + case V3_OP_INT: return "V3_OP_INT"; case V3_INVALID_OP: default: return "V3_INVALID_OP"; diff --git a/palacios/src/palacios/vmm_v3dec.c b/palacios/src/palacios/vmm_v3dec.c index 2de8b00..b862f96 100644 --- a/palacios/src/palacios/vmm_v3dec.c +++ b/palacios/src/palacios/vmm_v3dec.c @@ -501,12 +501,14 @@ static v3_op_type_t op_form_to_type(op_form_t form) { case INVLPG: return V3_OP_INVLPG; + case INT: + return V3_OP_INT; + case MOV_CR2: return V3_OP_MOVCR2; case MOV_2CR: return V3_OP_MOV2CR; - case MOV_MEM2_8: case MOV_MEM2: case MOV_2MEM_8: diff --git a/palacios/src/palacios/vmm_xed.c b/palacios/src/palacios/vmm_xed.c index 1a80d18..e35b4b0 100644 --- a/palacios/src/palacios/vmm_xed.c +++ b/palacios/src/palacios/vmm_xed.c @@ -443,6 +443,19 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins case XED_OPERAND_IMM0: + { + v3_op->size = xed_decoded_inst_get_immediate_width(&xed_instr); + + if (v3_op->size > 4) { + PrintError("Unhandled 64 bit immediates\n"); + return -1; + } + v3_op->operand = xed_decoded_inst_get_unsigned_immediate(&xed_instr); + + v3_op->type = IMM_OPERAND; + + } + break; case XED_OPERAND_AGEN: case XED_OPERAND_PTR: case XED_OPERAND_RELBR: @@ -581,7 +594,7 @@ int v3_decode(struct guest_info * info, addr_t instr_ptr, struct x86_instr * ins instr->third_operand.type = REG_OPERAND; - PrintDebug("Operand 3 mode: %s\n", xed_operand_action_enum_t2str(xed_operand_rw(op))); + PrintDebug("Operand 2 mode: %s\n", xed_operand_action_enum_t2str(xed_operand_rw(op))); if (xed_operand_read(op)) { @@ -1270,6 +1283,9 @@ static v3_op_type_t get_opcode(xed_iform_enum_t iform) { case XED_IFORM_INVLPG_MEMb: return V3_OP_INVLPG; + case XED_IFORM_INT_IMM: + return V3_OP_INT; + /* Data Instructions */