X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Finclude%2Fgeekos%2Fvmm_emulate.h;h=4b843cc3d132ca2c437f4ab5b1365ecf7bb9f52c;hp=5157214db539c6fa7cedfb245288d06f6d6059b1;hb=8c38488bc7d510a85ad23222ddd228924d14be8a;hpb=4c17fb67c38120c141fa36bca9d7faa418b3c8e5 diff --git a/palacios/include/geekos/vmm_emulate.h b/palacios/include/geekos/vmm_emulate.h index 5157214..4b843cc 100644 --- a/palacios/include/geekos/vmm_emulate.h +++ b/palacios/include/geekos/vmm_emulate.h @@ -150,6 +150,21 @@ static inline int is_prefix_byte(char byte) { +static inline addr_t get_rip_linear(struct guest_info * info, addr_t rip, addr_t cs_base) { + switch (info->cpu_mode) { + case REAL: + return rip + (cs_base << 4); + break; + case PROTECTED: + case PROTECTED_PG: + return rip + cs_base; + break; + default: + return 0; + } +} + + typedef enum {INVALID_ADDR_TYPE, REG, DISP0, DISP8, DISP16, DISP32} modrm_mode_t; typedef enum {INVALID_REG_SIZE, REG64, REG32, REG16, REG8} reg_size_t; typedef enum {INVALID_OPERAND, REG_OPERAND, MEM_OPERAND} operand_type_t;