Changeset 2892 in vbox
- Timestamp:
- May 28, 2007 12:52:11 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r2818 r2892 594 594 { 595 595 rc = VMXWriteVMCS(VMX_VMCS_GUEST_FIELD_TR, pCtx->tr); 596 597 /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */ 598 /* @todo use fake TSS here */ 599 //if (!(pCtx->cr0 & X86_CR0_PROTECTION_ENABLE)) 600 596 601 rc |= VMXWriteVMCS(VMX_VMCS_GUEST_TR_LIMIT, pCtx->trHid.u32Limit); 597 602 rc |= VMXWriteVMCS(VMX_VMCS_GUEST_TR_BASE, pCtx->trHid.u32Base); … … 599 604 600 605 /* The TSS selector must be busy. */ 601 if ((val & 0xF) == X86_SEL_TYPE_SYS_386_TSS_AVAIL)602 val = (val & ~0xF) | X86_SEL_TYPE_SYS_386_TSS_BUSY;603 else604 606 if ((val & 0xF) == X86_SEL_TYPE_SYS_286_TSS_AVAIL) 605 607 val = (val & ~0xF) | X86_SEL_TYPE_SYS_286_TSS_BUSY; 608 else 609 /* Default even if no TR selector has been set (otherwise vmlaunch will fail!) */ 610 val = (val & ~0xF) | X86_SEL_TYPE_SYS_386_TSS_BUSY; 606 611 607 612 rc |= VMXWriteVMCS(VMX_VMCS_GUEST_TR_ACCESS_RIGHTS, val); … … 664 669 val |= X86_CR0_NE; /* always turn on the native mechanism to report FPU errors (old style uses interrupts) */ 665 670 } 671 /* Note: protected mode & paging are always enabled; we use them for emulating real and protected mode without paging too. */ 672 val |= X86_CR0_PE | X86_CR0_PG; 673 666 674 rc |= VMXWriteVMCS(VMX_VMCS_GUEST_CR0, val); 667 675 Log2(("Guest CR0 %08x\n", val)); … … 669 677 * the VM will exit. 670 678 */ 671 val = X86_CR0_PE 679 val = X86_CR0_PE /* Must monitor this bit (assumptions are made for real mode emulation) */ 672 680 | X86_CR0_WP /** @todo do we care? (we do if we start patching the guest) */ 673 | X86_CR0_PG 681 | X86_CR0_PG /* Must monitor this bit (assumptions are made for real mode & protected mode without paging emulation) */ 674 682 | X86_CR0_TS 675 683 | X86_CR0_ET … … 691 699 switch(pVM->hwaccm.s.enmShadowMode) 692 700 { 693 case PGMMODE_REAL: 694 case PGMMODE_PROTECTED: /* Protected mode, no paging. */ 695 AssertFailed(); 696 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 697 701 case PGMMODE_REAL: /* Real mode -> emulated using v86 mode */ 702 case PGMMODE_PROTECTED: /* Protected mode, no paging -> emulated using identity mapping. */ 698 703 case PGMMODE_32_BIT: /* 32-bit paging. */ 699 704 break; … … 714 719 return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE; 715 720 } 721 /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */ 722 if (!(pCtx->cr0 & X86_CR0_PROTECTION_ENABLE)) 723 val |= X86_CR4_VME; 724 716 725 rc |= VMXWriteVMCS(VMX_VMCS_GUEST_CR4, val); 717 726 Log2(("Guest CR4 %08x\n", val)); … … 770 779 val &= VMX_EFLAGS_RESERVED_0; 771 780 val |= VMX_EFLAGS_RESERVED_1; 781 782 /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */ 783 if (!(pCtx->cr0 & X86_CR0_PROTECTION_ENABLE)) 784 { 785 val |= X86_EFL_VM; 786 if (pCtx->eflags.Bits.u1IF) 787 val |= X86_EFL_VIF; 788 else 789 val &= ~X86_EFL_VIF; 790 } 791 772 792 rc = VMXWriteVMCS(VMX_VMCS_GUEST_RFLAGS, val); 773 793 AssertRC(rc); … … 1185 1205 pCtx->eflags.u32 = val; 1186 1206 1207 /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */ 1208 if (!(pCtx->cr0 & X86_CR0_PROTECTION_ENABLE)) 1209 { 1210 /* Hide our emulation flags */ 1211 pCtx->eflags.Bits.u1VM = 0; 1212 pCtx->eflags.Bits.u1IF = pCtx->eflags.Bits.u1VIF; 1213 pCtx->eflags.Bits.u1VIF = 0; 1214 } 1215 1187 1216 /* Control registers. */ 1188 1217 VMXReadVMCS(VMX_VMCS_CTRL_CR0_READ_SHADOW, &valShadow);
Note:
See TracChangeset
for help on using the changeset viewer.