Changeset 97203 in vbox
- Timestamp:
- Oct 18, 2022 12:28:22 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 154179
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dis.h
r96407 r97203 790 790 DISDECL(int) DISFetchReg64(PCCPUMCTXCORE pCtx, unsigned reg64, uint64_t *pVal); 791 791 DISDECL(int) DISFetchRegSeg(PCCPUMCTXCORE pCtx, DISSELREG sel, RTSEL *pVal); 792 DISDECL(int) DISFetchRegSegEx(PCPUMCTXCORE pCtx, DISSELREG sel, PCPUMSELREG *ppSelReg);793 792 DISDECL(int) DISWriteReg8(PCPUMCTXCORE pRegFrame, unsigned reg8, uint8_t val8); 794 793 DISDECL(int) DISWriteReg16(PCPUMCTXCORE pRegFrame, unsigned reg32, uint16_t val16); -
trunk/include/VBox/vmm/selm.h
r96407 r97203 54 54 55 55 VMMDECL(int) SELMGetTSSInfo(PVM pVM, PVMCPU pVCpu, PRTGCUINTPTR pGCPtrTss, PRTGCUINTPTR pcbTss, bool *pfCanHaveIOBitmap); 56 VMMDECL(RTGCPTR) SELMToFlat(PVMC C pVM, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr);56 VMMDECL(RTGCPTR) SELMToFlat(PVMCPUCC pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr); 57 57 VMMDECL(RTGCPTR) SELMToFlatBySel(PVM pVM, RTSEL Sel, RTGCPTR Addr); 58 58 … … 76 76 /** @} */ 77 77 78 VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr, uint32_t fFlags, 79 PRTGCPTR ppvGC); 78 VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr, uint32_t fFlags, PRTGCPTR ppvGC); 80 79 VMMDECL(int) SELMValidateAndConvertCSAddr(PVMCPU pVCpu, X86EFLAGS eflags, RTSEL SelCPL, RTSEL SelCS, 81 80 PCPUMSELREG pSRegCS, RTGCPTR Addr, PRTGCPTR ppvFlat); -
trunk/src/VBox/Disassembler/DisasmReg.cpp
r96407 r97203 452 452 453 453 /** 454 * Returns the value of the specified segment register including a pointer to the hidden register in the supplied cpu context455 *456 */457 DISDECL(int) DISFetchRegSegEx(PCPUMCTXCORE pCtx, DISSELREG sel, PCPUMSELREG *ppSelReg)458 {459 AssertReturnStmt((unsigned)sel < RT_ELEMENTS(g_aRegSegIndex), *ppSelReg = NULL, VERR_INVALID_PARAMETER);460 *ppSelReg = (CPUMSELREG *)((uintptr_t)pCtx + g_aRegHidSegIndex[sel]);461 return VINF_SUCCESS;462 }463 464 /**465 454 * Updates the value of the specified 64 bits general purpose register 466 455 * -
trunk/src/VBox/VMM/VMMAll/SELMAll.cpp
r96407 r97203 56 56 * 57 57 * @returns Flat address. 58 * @param pV M The cross context VMstructure.59 * @param SelReg Selector register60 * @param pCtx Core CPU context58 * @param pVCpu The cross context virtual CPU structure. 59 * @param idxSeg The selector register to use (X86_SREG_XXX). 60 * @param pCtx Pointer to the register context for the CPU. 61 61 * @param Addr Address part. 62 62 */ 63 VMMDECL(RTGCPTR) SELMToFlat(PVMCC pVM, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr) 64 { 65 PCPUMSELREG pSReg; 66 PVMCPUCC pVCpu = VMMGetCpu(pVM); 67 68 int rc = DISFetchRegSegEx(pCtxCore, SelReg, &pSReg); AssertRC(rc); 63 VMMDECL(RTGCPTR) SELMToFlat(PVMCPUCC pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr) 64 { 65 Assert(idxSeg < RT_ELEMENTS(pCtx->aSRegs)); 66 PCPUMSELREG pSReg = &pCtx->aSRegs[idxSeg]; 69 67 70 68 /* 71 69 * Deal with real & v86 mode first. 72 70 */ 73 if ( pCtx Core->eflags.Bits.u1VM71 if ( pCtx->eflags.Bits.u1VM 74 72 || CPUMIsGuestInRealMode(pVCpu)) 75 73 { … … 83 81 84 82 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg)); 85 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx Core->cs));83 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->cs)); 86 84 87 85 /* 64 bits mode: CS, DS, ES and SS are treated as if each segment base is 0 88 86 (Intel(r) 64 and IA-32 Architectures Software Developer's Manual: 3.4.2.1). */ 89 if ( pCtx Core->cs.Attr.n.u1Long87 if ( pCtx->cs.Attr.n.u1Long 90 88 && CPUMIsGuestInLongMode(pVCpu)) 91 89 { 92 switch ( SelReg)93 { 94 case DISSELREG_FS:95 case DISSELREG_GS:90 switch (idxSeg) 91 { 92 case X86_SREG_FS: 93 case X86_SREG_GS: 96 94 return (RTGCPTR)(pSReg->u64Base + Addr); 97 95 … … 114 112 * @returns VBox status 115 113 * @param pVCpu The cross context virtual CPU structure. 116 * @param SelReg Selector register.117 * @param pCtx Core CPU context.114 * @param idxSeg The selector register to use (X86_SREG_XXX). 115 * @param pCtx Pointer to the register context for the CPU. 118 116 * @param Addr Address part. 119 117 * @param fFlags SELMTOFLAT_FLAGS_* … … 121 119 * @param ppvGC Where to store the GC flat address. 122 120 */ 123 VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, DISSELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr, uint32_t fFlags, PRTGCPTR ppvGC) 124 { 125 /* 126 * Fetch the selector first. 127 */ 128 PCPUMSELREG pSReg; 129 int rc = DISFetchRegSegEx(pCtxCore, SelReg, &pSReg); 130 AssertRCReturn(rc, rc); AssertPtr(pSReg); 121 VMMDECL(int) SELMToFlatEx(PVMCPU pVCpu, unsigned idxSeg, PCPUMCTX pCtx, RTGCPTR Addr, uint32_t fFlags, PRTGCPTR ppvGC) 122 { 123 AssertReturn(idxSeg < RT_ELEMENTS(pCtx->aSRegs), VERR_INVALID_PARAMETER); 124 PCPUMSELREG pSReg = &pCtx->aSRegs[idxSeg]; 131 125 132 126 /* 133 127 * Deal with real & v86 mode first. 134 128 */ 135 if ( pCtx Core->eflags.Bits.u1VM129 if ( pCtx->eflags.Bits.u1VM 136 130 || CPUMIsGuestInRealMode(pVCpu)) 137 131 { … … 148 142 149 143 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, pSReg)); 150 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx Core->cs));144 Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(pVCpu, &pCtx->cs)); 151 145 152 146 /* 64 bits mode: CS, DS, ES and SS are treated as if each segment base is 0 … … 154 148 RTGCPTR pvFlat; 155 149 bool fCheckLimit = true; 156 if ( pCtx Core->cs.Attr.n.u1Long150 if ( pCtx->cs.Attr.n.u1Long 157 151 && CPUMIsGuestInLongMode(pVCpu)) 158 152 { 159 153 fCheckLimit = false; 160 switch ( SelReg)161 { 162 case DISSELREG_FS:163 case DISSELREG_GS:154 switch (idxSeg) 155 { 156 case X86_SREG_FS: 157 case X86_SREG_GS: 164 158 pvFlat = pSReg->u64Base + Addr; 165 159 break; -
trunk/src/VBox/VMM/VMMR3/EMHM.cpp
r96894 r97203 301 301 /** @todo this should be skipped! */ 302 302 CPUM_IMPORT_EXTRN_RET(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_SS); 303 rc = PGMPrefetchPage(pVCpu, SELMToFlat(pV M, DISSELREG_CS, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), pVCpu->cpum.GstCtx.rip));303 rc = PGMPrefetchPage(pVCpu, SELMToFlat(pVCpu, X86_SREG_CS, &pVCpu->cpum.GstCtx, pVCpu->cpum.GstCtx.rip)); 304 304 if (rc == VINF_SUCCESS) 305 rc = PGMPrefetchPage(pVCpu, SELMToFlat(pV M, DISSELREG_SS, CPUMCTX2CORE(&pVCpu->cpum.GstCtx), pVCpu->cpum.GstCtx.rsp));305 rc = PGMPrefetchPage(pVCpu, SELMToFlat(pVCpu, X86_SREG_SS, &pVCpu->cpum.GstCtx, pVCpu->cpum.GstCtx.rsp)); 306 306 if (rc != VINF_SUCCESS) 307 307 {
Note:
See TracChangeset
for help on using the changeset viewer.