Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


more decoder fixes to handle incorrect long mode register decoding
Jack Lange [Fri, 9 Sep 2011 20:13:18 +0000 (16:13 -0400)]
palacios/include/palacios/vmm_decoder.h
palacios/include/palacios/vmm_instr_decoder.h

index 767fe25..03c5edb 100644 (file)
@@ -216,11 +216,18 @@ static inline addr_t get_addr_linear(struct guest_info * info, addr_t addr, stru
            return addr + seg->base;
            break;
 
-       case LONG:
+       case LONG: {
+           uint64_t seg_base = 0;
+
            // In long mode the segment bases are disregarded (forced to 0), unless using 
            // FS or GS, then the base addresses are added
-           return addr + seg->base;
 
+           if (seg) {
+               seg_base = seg->base;
+           }
+
+           return addr + seg_base;
+       }
        case LONG_16_COMPAT:
        default:
            PrintError("Unsupported CPU Mode: %d\n", info->cpu_mode);
index 3fe838b..6e33c46 100644 (file)
@@ -1017,23 +1017,24 @@ int decode_rm_operand64(struct guest_info * core, uint8_t * modrm_instr,
        }
     
 
-       /* 
-          Segments should be ignored 
-          // get appropriate segment
-          if (instr->prefixes.cs_override) {
-          seg = &(core->segments.cs);
-          } else if (instr->prefixes.es_override) {
-          seg = &(core->segments.es);
-          } else if (instr->prefixes.ss_override) {
-          seg = &(core->segments.ss);
-          } else if (instr->prefixes.fs_override) {
-          seg = &(core->segments.fs);
-          } else if (instr->prefixes.gs_override) {
-          seg = &(core->segments.gs);
-          } else {
-          seg = &(core->segments.ds);
-          }
-       */
+       
+       //Segments should be ignored 
+       // get appropriate segment
+
+       if (instr->prefixes.cs_override) {
+           seg = &(core->segments.cs);
+       } else if (instr->prefixes.es_override) {
+           seg = &(core->segments.es);
+       } else if (instr->prefixes.ss_override) {
+           seg = &(core->segments.ss);
+       } else if (instr->prefixes.fs_override) {
+           seg = &(core->segments.fs);
+       } else if (instr->prefixes.gs_override) {
+           seg = &(core->segments.gs);
+       } else {
+           seg = &(core->segments.ds);
+       }
+       
 
        operand->operand = ADDR_MASK(get_addr_linear(core, base_addr, seg), 
                                     get_addr_width(core, instr));
@@ -1061,7 +1062,7 @@ static int decode_rm_operand(struct guest_info * core,
        case REAL:
            return decode_rm_operand16(core, instr_ptr, instr, operand, reg_code);
        case LONG:
-           if (instr->prefixes.rex_op_size) {
+           if (instr->prefixes.rex) {
                return decode_rm_operand64(core, instr_ptr, instr, operand, reg_code);
            }
        case PROTECTED: