Changeset 41931 in vbox for trunk/src/VBox
- Timestamp:
- Jun 27, 2012 4:12:16 PM (13 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
r41565 r41931 366 366 } 367 367 368 VMMDECL(PCCPUMCTXCORE) CPUMGetHyperCtxCore(PVMCPU pVCpu)369 {370 return NULL;371 }372 373 368 VMMDECL(uint32_t) CPUMGetHyperEIP(PVMCPU pVCpu) 374 369 { … … 381 376 } 382 377 383 VMMDECL(int) CPUMQueryHyperCtxPtr(PVMCPU pVCpu, PCPUMCTX *ppCtx)384 {385 return VERR_INTERNAL_ERROR;386 }387 388 378 389 379 -
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r41906 r41931 48 48 49 49 /** 50 * Sets or resets an alternative hypervisor context core. 51 * 52 * This is called when we get a hypervisor trap set switch the context 53 * core with the trap frame on the stack. It is called again to reset 54 * back to the default context core when resuming hypervisor execution. 55 * 56 * @param pVCpu Pointer to the VMCPU. 57 * @param pCtxCore Pointer to the alternative context core or NULL 58 * to go back to the default context core. 59 */ 60 VMMDECL(void) CPUMHyperSetCtxCore(PVMCPU pVCpu, PCPUMCTXCORE pCtxCore) 61 { 62 PVM pVM = pVCpu->CTX_SUFF(pVM); 63 64 LogFlow(("CPUMHyperSetCtxCore: %p/%p/%p -> %p\n", pVCpu->cpum.s.CTX_SUFF(pHyperCore), pCtxCore)); 65 if (!pCtxCore) 66 { 67 pCtxCore = CPUMCTX2CORE(&pVCpu->cpum.s.Hyper); 68 pVCpu->cpum.s.pHyperCoreR3 = (R3PTRTYPE(PCPUMCTXCORE))VM_R3_ADDR(pVM, pCtxCore); 69 pVCpu->cpum.s.pHyperCoreR0 = (R0PTRTYPE(PCPUMCTXCORE))VM_R0_ADDR(pVM, pCtxCore); 70 pVCpu->cpum.s.pHyperCoreRC = (RCPTRTYPE(PCPUMCTXCORE))VM_RC_ADDR(pVM, pCtxCore); 71 } 72 else 73 { 74 pVCpu->cpum.s.pHyperCoreR3 = (R3PTRTYPE(PCPUMCTXCORE))MMHyperCCToR3(pVM, pCtxCore); 75 pVCpu->cpum.s.pHyperCoreR0 = (R0PTRTYPE(PCPUMCTXCORE))MMHyperCCToR0(pVM, pCtxCore); 76 pVCpu->cpum.s.pHyperCoreRC = (RCPTRTYPE(PCPUMCTXCORE))MMHyperCCToRC(pVM, pCtxCore); 77 } 78 } 79 80 81 /** 82 * Gets the pointer to the internal CPUMCTXCORE structure for the hypervisor. 83 * This is only for reading in order to save a few calls. 50 * Obsolete. 51 * 52 * We don't support nested hypervisor context interrupts or traps. Life is much 53 * simpler when we don't. It's also slightly faster at times. 84 54 * 85 55 * @param pVM Handle to the virtual machine. … … 87 57 VMMDECL(PCCPUMCTXCORE) CPUMGetHyperCtxCore(PVMCPU pVCpu) 88 58 { 89 return pVCpu->cpum.s.CTX_SUFF(pHyperCore); 90 } 91 92 93 /** 94 * Queries the pointer to the internal CPUMCTX structure for the hypervisor. 95 * 96 * @returns VBox status code. 97 * @param pVM Handle to the virtual machine. 98 * @param ppCtx Receives the hyper CPUMCTX pointer when successful. 99 * 100 * @deprecated This will *not* (and has never) given the right picture of the 101 * hypervisor register state. With CPUMHyperSetCtxCore() this is 102 * getting much worse. So, use the individual functions for getting 103 * and esp. setting the hypervisor registers. 104 */ 105 VMMDECL(int) CPUMQueryHyperCtxPtr(PVMCPU pVCpu, PCPUMCTX *ppCtx) 106 { 107 *ppCtx = &pVCpu->cpum.s.Hyper; 108 return VINF_SUCCESS; 59 return CPUMCTX2CORE(&pVCpu->cpum.s.Hyper); 60 } 61 62 63 /** 64 * Gets the pointer to the hypervisor CPU context structure of a virtual CPU. 65 * 66 * @param pVCpu Pointer to the virtual CPU. 67 */ 68 VMMDECL(PCPUMCTX) CPUMGetHyperCtxPtr(PVMCPU pVCpu) 69 { 70 return &pVCpu->cpum.s.Hyper; 109 71 } 110 72 … … 120 82 { 121 83 pVCpu->cpum.s.Hyper.idtr.cbIdt = limit; 122 pVCpu->cpum.s.Hyper.idtr.pIdt = addr;84 pVCpu->cpum.s.Hyper.idtr.pIdt = addr; 123 85 } 124 86 … … 142 104 VMMDECL(void) CPUMSetHyperCS(PVMCPU pVCpu, RTSEL SelCS) 143 105 { 144 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->cs.Sel = SelCS;106 pVCpu->cpum.s.Hyper.cs.Sel = SelCS; 145 107 } 146 108 … … 148 110 VMMDECL(void) CPUMSetHyperDS(PVMCPU pVCpu, RTSEL SelDS) 149 111 { 150 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ds.Sel = SelDS;112 pVCpu->cpum.s.Hyper.ds.Sel = SelDS; 151 113 } 152 114 … … 154 116 VMMDECL(void) CPUMSetHyperES(PVMCPU pVCpu, RTSEL SelES) 155 117 { 156 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->es.Sel = SelES;118 pVCpu->cpum.s.Hyper.es.Sel = SelES; 157 119 } 158 120 … … 160 122 VMMDECL(void) CPUMSetHyperFS(PVMCPU pVCpu, RTSEL SelFS) 161 123 { 162 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->fs.Sel = SelFS;124 pVCpu->cpum.s.Hyper.fs.Sel = SelFS; 163 125 } 164 126 … … 166 128 VMMDECL(void) CPUMSetHyperGS(PVMCPU pVCpu, RTSEL SelGS) 167 129 { 168 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->gs.Sel = SelGS;130 pVCpu->cpum.s.Hyper.gs.Sel = SelGS; 169 131 } 170 132 … … 172 134 VMMDECL(void) CPUMSetHyperSS(PVMCPU pVCpu, RTSEL SelSS) 173 135 { 174 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ss.Sel = SelSS;136 pVCpu->cpum.s.Hyper.ss.Sel = SelSS; 175 137 } 176 138 … … 178 140 VMMDECL(void) CPUMSetHyperESP(PVMCPU pVCpu, uint32_t u32ESP) 179 141 { 180 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->esp = u32ESP;142 pVCpu->cpum.s.Hyper.esp = u32ESP; 181 143 } 182 144 … … 184 146 VMMDECL(int) CPUMSetHyperEFlags(PVMCPU pVCpu, uint32_t Efl) 185 147 { 186 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->eflags.u32 = Efl;148 pVCpu->cpum.s.Hyper.eflags.u32 = Efl; 187 149 return VINF_SUCCESS; 188 150 } … … 191 153 VMMDECL(void) CPUMSetHyperEIP(PVMCPU pVCpu, uint32_t u32EIP) 192 154 { 193 pVCpu->cpum.s. CTX_SUFF(pHyperCore)->eip = u32EIP;155 pVCpu->cpum.s.Hyper.eip = u32EIP; 194 156 } 195 157 … … 251 213 VMMDECL(RTSEL) CPUMGetHyperCS(PVMCPU pVCpu) 252 214 { 253 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->cs.Sel;215 return pVCpu->cpum.s.Hyper.cs.Sel; 254 216 } 255 217 … … 257 219 VMMDECL(RTSEL) CPUMGetHyperDS(PVMCPU pVCpu) 258 220 { 259 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ds.Sel;221 return pVCpu->cpum.s.Hyper.ds.Sel; 260 222 } 261 223 … … 263 225 VMMDECL(RTSEL) CPUMGetHyperES(PVMCPU pVCpu) 264 226 { 265 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->es.Sel;227 return pVCpu->cpum.s.Hyper.es.Sel; 266 228 } 267 229 … … 269 231 VMMDECL(RTSEL) CPUMGetHyperFS(PVMCPU pVCpu) 270 232 { 271 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->fs.Sel;233 return pVCpu->cpum.s.Hyper.fs.Sel; 272 234 } 273 235 … … 275 237 VMMDECL(RTSEL) CPUMGetHyperGS(PVMCPU pVCpu) 276 238 { 277 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->gs.Sel;239 return pVCpu->cpum.s.Hyper.gs.Sel; 278 240 } 279 241 … … 281 243 VMMDECL(RTSEL) CPUMGetHyperSS(PVMCPU pVCpu) 282 244 { 283 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ss.Sel;245 return pVCpu->cpum.s.Hyper.ss.Sel; 284 246 } 285 247 … … 287 249 VMMDECL(uint32_t) CPUMGetHyperEAX(PVMCPU pVCpu) 288 250 { 289 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->eax;251 return pVCpu->cpum.s.Hyper.eax; 290 252 } 291 253 … … 293 255 VMMDECL(uint32_t) CPUMGetHyperEBX(PVMCPU pVCpu) 294 256 { 295 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ebx;257 return pVCpu->cpum.s.Hyper.ebx; 296 258 } 297 259 … … 299 261 VMMDECL(uint32_t) CPUMGetHyperECX(PVMCPU pVCpu) 300 262 { 301 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ecx;263 return pVCpu->cpum.s.Hyper.ecx; 302 264 } 303 265 … … 305 267 VMMDECL(uint32_t) CPUMGetHyperEDX(PVMCPU pVCpu) 306 268 { 307 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->edx;269 return pVCpu->cpum.s.Hyper.edx; 308 270 } 309 271 … … 311 273 VMMDECL(uint32_t) CPUMGetHyperESI(PVMCPU pVCpu) 312 274 { 313 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->esi;275 return pVCpu->cpum.s.Hyper.esi; 314 276 } 315 277 … … 317 279 VMMDECL(uint32_t) CPUMGetHyperEDI(PVMCPU pVCpu) 318 280 { 319 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->edi;281 return pVCpu->cpum.s.Hyper.edi; 320 282 } 321 283 … … 323 285 VMMDECL(uint32_t) CPUMGetHyperEBP(PVMCPU pVCpu) 324 286 { 325 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->ebp;287 return pVCpu->cpum.s.Hyper.ebp; 326 288 } 327 289 … … 329 291 VMMDECL(uint32_t) CPUMGetHyperESP(PVMCPU pVCpu) 330 292 { 331 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->esp;293 return pVCpu->cpum.s.Hyper.esp; 332 294 } 333 295 … … 335 297 VMMDECL(uint32_t) CPUMGetHyperEFlags(PVMCPU pVCpu) 336 298 { 337 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->eflags.u32;299 return pVCpu->cpum.s.Hyper.eflags.u32; 338 300 } 339 301 … … 341 303 VMMDECL(uint32_t) CPUMGetHyperEIP(PVMCPU pVCpu) 342 304 { 343 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->eip;305 return pVCpu->cpum.s.Hyper.eip; 344 306 } 345 307 … … 347 309 VMMDECL(uint64_t) CPUMGetHyperRIP(PVMCPU pVCpu) 348 310 { 349 return pVCpu->cpum.s. CTX_SUFF(pHyperCore)->rip;311 return pVCpu->cpum.s.Hyper.rip; 350 312 } 351 313 -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r41906 r41931 426 426 PVMCPU pVCpu = &pVM->aCpus[i]; 427 427 428 /* 429 * Setup any fixed pointers and offsets. 430 */ 431 pVCpu->cpum.s.pHyperCoreR3 = CPUMCTX2CORE(&pVCpu->cpum.s.Hyper); 432 pVCpu->cpum.s.pHyperCoreR0 = VM_R0_ADDR(pVM, CPUMCTX2CORE(&pVCpu->cpum.s.Hyper)); 433 434 pVCpu->cpum.s.offCPUM = RT_OFFSETOF(VM, aCpus[i].cpum) - RT_OFFSETOF(VM, cpum); 428 pVCpu->cpum.s.offCPUM = RT_OFFSETOF(VM, aCpus[i].cpum) - RT_OFFSETOF(VM, cpum); 435 429 Assert((uintptr_t)&pVCpu->cpum - pVCpu->cpum.s.offCPUM == (uintptr_t)&pVM->cpum); 436 430 } … … 1269 1263 { 1270 1264 LogFlow(("CPUMR3Relocate\n")); 1271 for (VMCPUID i = 0; i < pVM->cCpus; i++) 1272 { 1273 /* 1274 * Switcher pointers. 1275 */ 1276 PVMCPU pVCpu = &pVM->aCpus[i]; 1277 pVCpu->cpum.s.pHyperCoreRC = MMHyperCCToRC(pVM, pVCpu->cpum.s.pHyperCoreR3); 1278 Assert(pVCpu->cpum.s.pHyperCoreRC != NIL_RTRCPTR); 1279 1280 } 1265 /* nothing to do any more. */ 1281 1266 } 1282 1267 … … 2923 2908 cpumR3InfoParseArg(pszArgs, &enmType, &pszComment); 2924 2909 pHlp->pfnPrintf(pHlp, "Hypervisor CPUM state: %s\n", pszComment); 2925 cpumR3InfoOne(pVM, &pVCpu->cpum.s.Hyper, pVCpu->cpum.s.pHyperCoreR3, pHlp, enmType, ".");2910 cpumR3InfoOne(pVM, &pVCpu->cpum.s.Hyper, CPUMCTX2CORE(&pVCpu->cpum.s.Hyper), pHlp, enmType, "."); 2926 2911 pHlp->pfnPrintf(pHlp, "CR4OrMask=%#x CR4AndMask=%#x\n", pVM->cpum.s.CR4.OrMask, pVM->cpum.s.CR4.AndMask); 2927 2912 } -
trunk/src/VBox/VMM/VMMR3/PDMLdr.cpp
r41800 r41931 25 25 #include <VBox/vmm/pdm.h> 26 26 #include <VBox/vmm/mm.h> 27 #include <VBox/vmm/trpm.h> 27 28 #include <VBox/vmm/vmm.h> 28 29 #include <VBox/vmm/vm.h> … … 355 356 else if (!strcmp(pszSymbol, "g_CPUM")) 356 357 *pValue = VM_RC_ADDR(pVM, &pVM->cpum); 357 else if (!strcmp(pszSymbol, "g_TRPM")) 358 *pValue = VM_RC_ADDR(pVM, &pVM->trpm); 359 else if (!strcmp(pszSymbol, "g_TRPMCPU")) 360 *pValue = VM_RC_ADDR(pVM, &pVM->aCpus[0].trpm); 358 else if ( !strncmp(pszSymbol, "g_TRPM", 6) 359 || !strncmp(pszSymbol, "g_trpm", 6) 360 || !strncmp(pszSymbol, "TRPM", 4)) 361 { 362 RTRCPTR RCPtr = 0; 363 rc = TRPMR3GetImportRC(pVM, pszSymbol, &RCPtr); 364 if (RT_SUCCESS(rc)) 365 *pValue = RCPtr; 366 } 361 367 else if ( !strncmp(pszSymbol, "VMM", 3) 362 368 || !strcmp(pszSymbol, "g_Logger") -
trunk/src/VBox/VMM/VMMR3/TRPM.cpp
r41803 r41931 782 782 783 783 /** 784 * Resolve a builtin RC symbol. 785 * 786 * Called by PDM when loading or relocating RC modules. 787 * 788 * @returns VBox status 789 * @param pVM Pointer to the VM. 790 * @param pszSymbol Symbol to resolv 791 * @param pRCPtrValue Where to store the symbol value. 792 * 793 * @remark This has to work before VMMR3Relocate() is called. 794 */ 795 VMMR3_INT_DECL(int) TRPMR3GetImportRC(PVM pVM, const char *pszSymbol, PRTRCPTR pRCPtrValue) 796 { 797 if (!strcmp(pszSymbol, "g_TRPM")) 798 *pRCPtrValue = VM_RC_ADDR(pVM, &pVM->trpm); 799 else if (!strcmp(pszSymbol, "g_TRPMCPU")) 800 *pRCPtrValue = VM_RC_ADDR(pVM, &pVM->aCpus[0].trpm); 801 else if (!strcmp(pszSymbol, "g_trpmGuestCtxCore")) 802 { 803 PCPUMCTX pCtx = CPUMQueryGuestCtxPtr(VMMGetCpu0(pVM)); 804 *pRCPtrValue = VM_RC_ADDR(pVM, CPUMCTX2CORE(pCtx)); 805 } 806 else if (!strcmp(pszSymbol, "g_trpmHyperCtxCore")) 807 { 808 PCPUMCTX pCtx = CPUMGetHyperCtxPtr(VMMGetCpu0(pVM)); 809 *pRCPtrValue = VM_RC_ADDR(pVM, CPUMCTX2CORE(pCtx)); 810 } 811 else 812 return VERR_SYMBOL_NOT_FOUND; 813 return VINF_SUCCESS; 814 } 815 816 817 /** 784 818 * Execute state save operation. 785 819 * -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r41906 r41931 561 561 if (RT_SUCCESS(rc)) 562 562 { 563 CPUMHyperSetCtxCore(pVCpu, NULL);564 563 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ 565 564 uint64_t u64TS = RTTimeProgramStartNanoTS(); … … 1874 1873 * Setup the call frame using the trampoline. 1875 1874 */ 1876 CPUMHyperSetCtxCore(pVCpu, NULL);1877 1875 memset(pVCpu->vmm.s.pbEMTStackR3, 0xaa, VMM_STACK_SIZE); /* Clear the stack. */ 1878 1876 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC - cArgs * sizeof(RTGCUINTPTR32)); -
trunk/src/VBox/VMM/VMMR3/VMMTests.cpp
r41906 r41931 61 61 return rc; 62 62 63 CPUMHyperSetCtxCore(pVCpu, NULL);64 63 memset(pVCpu->vmm.s.pbEMTStackR3, 0xaa, VMM_STACK_SIZE); 65 64 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ … … 101 100 return rc; 102 101 103 CPUMHyperSetCtxCore(pVCpu, NULL);104 102 memset(pVCpu->vmm.s.pbEMTStackR3, 0xaa, VMM_STACK_SIZE); 105 103 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ … … 339 337 * Interrupt forwarding. 340 338 */ 341 CPUMHyperSetCtxCore(pVCpu, NULL);342 339 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ 343 340 CPUMPushHyper(pVCpu, 0); … … 403 400 for (i = 0; i < 1000000; i++) 404 401 { 405 CPUMHyperSetCtxCore(pVCpu, NULL);406 402 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ 407 403 CPUMPushHyper(pVCpu, 0); … … 495 491 AssertRCReturn(rc, rc); 496 492 497 CPUMQueryHyperCtxPtr(pVCpu, &pHyperCtx);493 pHyperCtx = CPUMGetHyperCtxPtr(pVCpu); 498 494 499 495 pHyperCtx->cr0 = X86_CR0_PE | X86_CR0_WP | X86_CR0_PG | X86_CR0_TS | X86_CR0_ET | X86_CR0_NE | X86_CR0_MP; … … 516 512 RTPrintf("VMM: VMMGCEntry=%RRv\n", RCPtrEP); 517 513 518 CPUMQueryHyperCtxPtr(pVCpu, &pHyperCtx);514 pHyperCtx = CPUMGetHyperCtxPtr(pVCpu); 519 515 520 516 /* Fill in hidden selector registers for the hypervisor state. */ … … 537 533 for (i = 0; i < 1000000; i++) 538 534 { 539 CPUMHyperSetCtxCore(pVCpu, NULL);540 541 535 CPUMSetHyperESP(pVCpu, pVCpu->vmm.s.pbEMTStackBottomRC); /* Clear the stack. */ 542 536 CPUMPushHyper(pVCpu, 0); … … 547 541 CPUMSetHyperEIP(pVCpu, pVM->vmm.s.pfnCallTrampolineRC); 548 542 549 CPUMQueryHyperCtxPtr(pVCpu, &pHyperCtx);543 pHyperCtx = CPUMGetHyperCtxPtr(pVCpu); 550 544 pGuestCtx = CPUMQueryGuestCtxPtr(pVCpu); 551 545 -
trunk/src/VBox/VMM/VMMRC/CPUMRCA.asm
r41906 r41931 44 44 45 45 ;; 46 ; Restores GC context before doing iret.47 ;48 ; @param [esp + 4] Pointer to interrupt stack frame, i.e. pointer49 ; to the a struct with this layout:50 ; 00h eip51 ; 04h cs52 ; 08h eflags53 ; 0ch esp54 ; 10h ss55 ; 14h es (V86 only)56 ; 18h ds (V86 only)57 ; 1Ch fs (V86 only)58 ; 20h gs (V86 only)59 ;60 ; @uses everything but cs, ss, esp, and eflags.61 ;62 ; @remark Assumes we're restoring in Ring-0 a context which is not Ring-0.63 ; Further assumes flat stack and valid ds.64 65 BEGINPROC CPUMGCRestoreInt66 ;67 ; Update iret frame.68 ;69 mov eax, [esp + 4] ; get argument70 mov edx, IMP(g_CPUM)71 ; Convert to CPUMCPU pointer72 add edx, [edx + CPUM.offCPUMCPU0]73 74 mov ecx, [edx + CPUMCPU.Guest.eip]75 mov [eax + 0h], ecx76 mov ecx, [edx + CPUMCPU.Guest.cs.Sel]77 mov [eax + 4h], ecx78 mov ecx, [edx + CPUMCPU.Guest.eflags]79 mov [eax + 8h], ecx80 mov ecx, [edx + CPUMCPU.Guest.esp]81 mov [eax + 0ch], ecx82 mov ecx, [edx + CPUMCPU.Guest.ss.Sel]83 mov [eax + 10h], ecx84 85 test dword [edx + CPUMCPU.Guest.eflags], X86_EFL_VM86 jnz short CPUMGCRestoreInt_V8687 88 ;89 ; Load registers.90 ;91 ; todo: potential trouble loading invalid es,fs,gs,ds because92 ; of a VMM imposed exception?93 mov es, [edx + CPUMCPU.Guest.es.Sel]94 mov fs, [edx + CPUMCPU.Guest.fs.Sel]95 mov gs, [edx + CPUMCPU.Guest.gs.Sel]96 mov esi, [edx + CPUMCPU.Guest.esi]97 mov edi, [edx + CPUMCPU.Guest.edi]98 mov ebp, [edx + CPUMCPU.Guest.ebp]99 mov ebx, [edx + CPUMCPU.Guest.ebx]100 mov ecx, [edx + CPUMCPU.Guest.ecx]101 mov eax, [edx + CPUMCPU.Guest.eax]102 push dword [edx + CPUMCPU.Guest.ds.Sel]103 mov edx, [edx + CPUMCPU.Guest.edx]104 pop ds105 106 ret107 108 CPUMGCRestoreInt_V86:109 ; iret restores ds, es, fs & gs110 mov ecx, [edx + CPUMCPU.Guest.es.Sel]111 mov [eax + 14h], ecx112 mov ecx, [edx + CPUMCPU.Guest.ds.Sel]113 mov [eax + 18h], ecx114 mov ecx, [edx + CPUMCPU.Guest.fs.Sel]115 mov [eax + 1Ch], ecx116 mov ecx, [edx + CPUMCPU.Guest.gs.Sel]117 mov [eax + 20h], ecx118 mov esi, [edx + CPUMCPU.Guest.esi]119 mov edi, [edx + CPUMCPU.Guest.edi]120 mov ebp, [edx + CPUMCPU.Guest.ebp]121 mov ebx, [edx + CPUMCPU.Guest.ebx]122 mov ecx, [edx + CPUMCPU.Guest.ecx]123 mov eax, [edx + CPUMCPU.Guest.eax]124 mov edx, [edx + CPUMCPU.Guest.edx]125 ret126 127 ENDPROC CPUMGCRestoreInt128 129 130 ;;131 46 ; Calls a guest trap/interrupt handler directly 132 47 ; Assumes a trap stack frame has already been setup on the guest's stack! -
trunk/src/VBox/VMM/VMMRC/TRPMRC.cpp
r41823 r41931 85 85 LogFlow(("TRPMGCHyperReturnToHost: rc=%Rrc\n", rc)); 86 86 TRPMResetTrap(pVCpu); 87 CPUMHyperSetCtxCore(pVCpu, NULL);88 87 VMMGCGuestToHost(pVM, rc); 89 88 AssertReleaseFailed(); -
trunk/src/VBox/VMM/VMMRC/TRPMRCHandlersA.asm
r41906 r41931 31 31 ;* External Symbols * 32 32 ;******************************************************************************* 33 extern IMPNAME(g_CPUM) ; These IMPNAME(g_*) symbols resolve to the import table 34 extern IMPNAME(g_TRPM) ; where there is a pointer to the real symbol. PE imports 35 extern IMPNAME(g_TRPMCPU) ; are a bit confusing at first... :-) 36 extern IMPNAME(g_VM) 37 extern NAME(CPUMGCRestoreInt) 38 extern NAME(cpumHandleLazyFPUAsm) 39 extern NAME(CPUMHyperSetCtxCore) 33 extern IMPNAME(g_TRPM) ; These IMPNAME(g_*) symbols resolve to the import table 34 extern IMPNAME(g_TRPMCPU) ; where there is a pointer to the real symbol. PE imports 35 extern IMPNAME(g_VM) ; are a bit confusing at first... :-) 36 extern IMPNAME(g_trpmGuestCtxCore) 37 extern IMPNAME(g_trpmHyperCtxCore) 40 38 extern NAME(trpmGCTrapInGeneric) 41 39 extern NAME(TRPMGCTrap01Handler) … … 56 54 extern NAME(TRPMGCHyperTrap0eHandler) 57 55 58 ;; IMPORTANT all COM_ functions trashes esi, some edi and the LOOP_SHORT_WHILE kills ecx. 56 57 ;******************************************************************************* 58 ;* Defined Constants And Macros * 59 ;******************************************************************************* 60 ;; Some conditional COM port debugging. 59 61 ;%define DEBUG_STUFF 1 60 62 ;%define DEBUG_STUFF_TRPG 1 61 63 ;%define DEBUG_STUFF_INT 1 64 62 65 63 66 BEGINCODE … … 244 247 245 248 ; 246 ; Setup CPUMCTXCORE frame 249 ; Save ds, es, eax and ebx so we have a context pointer (ebx) and 250 ; scratch (eax) register to work with. A sideeffect of using ebx is that 251 ; it's preserved accross cdecl calls. 252 ; 253 ; In order to safely access data, we need to load our flat DS & ES selector, 254 ; and clear make sure CR0.WP is cleared. 255 ; 256 push ds ; +0ch 257 push es ; +08h 258 push eax ; +04h 259 push ebx ; +00h 260 %push foobar 261 %define %$STK_SAVED_EBX esp 262 %define %$STK_SAVED_EAX esp + 04h 263 %define %$STK_SAVED_ES esp + 08h 264 %define %$STK_SAVED_DS esp + 0ch 265 %define %$ESPOFF 10h 266 %define %$STK_VECTOR esp + 00h + %$ESPOFF 267 %define %$STK_ERRCD esp + 04h + %$ESPOFF 268 %define %$STK_EIP esp + 08h + %$ESPOFF 269 %define %$STK_CS esp + 0ch + %$ESPOFF 270 %define %$STK_EFLAGS esp + 10h + %$ESPOFF 271 %define %$STK_ESP esp + 14h + %$ESPOFF 272 %define %$STK_SS esp + 18h + %$ESPOFF 273 %define %$STK_V86_ES esp + 1ch + %$ESPOFF 274 %define %$STK_V86_DS esp + 20h + %$ESPOFF 275 %define %$STK_V86_FS esp + 24h + %$ESPOFF 276 %define %$STK_V86_GS esp + 28h + %$ESPOFF 277 278 push ss 279 pop ds 280 push ss 281 pop es 282 283 mov eax, cr0 ;; @todo elimitate this read? 284 and eax, ~X86_CR0_WRITE_PROTECT 285 mov cr0, eax 286 287 mov ebx, IMP(g_trpmGuestCtxCore) ; Assume GC as the most common. 288 test byte [%$STK_CS], 3h ; check RPL of the cs selector 289 ;; @todo check this for conforming segments. 290 jnz .save_state 291 test dword [%$STK_EFLAGS], X86_EFL_VM ; If in V86, then guest. 292 jnz .save_state 293 mov ebx, IMP(g_trpmHyperCtxCore) ; It's raw-mode context, actually. 294 295 ; 296 ; Save the state. 247 297 ; 248 298 ; ASSUMPTION: If trap in hypervisor, we assume that we can read two dword 249 299 ; under the bottom of the stack. This is atm safe. 250 ; ASSUMPTION: There is sufficient stack space. 251 ; ASSUMPTION: The stack is not write protected. 252 ; 253 %define ESPOFF CPUMCTXCORE_size 254 255 sub esp, CPUMCTXCORE_size 256 mov [esp + CPUMCTXCORE.eax], eax 257 mov [esp + CPUMCTXCORE.ecx], ecx 258 mov [esp + CPUMCTXCORE.edx], edx 259 mov [esp + CPUMCTXCORE.ebx], ebx 260 mov [esp + CPUMCTXCORE.esi], esi 261 mov [esp + CPUMCTXCORE.edi], edi 262 mov [esp + CPUMCTXCORE.ebp], ebp 263 264 mov eax, [esp + 14h + ESPOFF] ; esp 265 mov [esp + CPUMCTXCORE.esp], eax 266 mov eax, [esp + 18h + ESPOFF] ; ss 267 mov dword [esp + CPUMCTXCORE.ss.Sel], eax 268 269 mov eax, [esp + 0ch + ESPOFF] ; cs 270 mov dword [esp + CPUMCTXCORE.cs.Sel], eax 271 mov eax, [esp + 08h + ESPOFF] ; eip 272 mov [esp + CPUMCTXCORE.eip], eax 273 mov eax, [esp + 10h + ESPOFF] ; eflags 274 mov [esp + CPUMCTXCORE.eflags], eax 275 276 %if GC_ARCH_BITS == 64 277 ; zero out the high dwords 278 mov dword [esp + CPUMCTXCORE.eax + 4], 0 279 mov dword [esp + CPUMCTXCORE.ecx + 4], 0 280 mov dword [esp + CPUMCTXCORE.edx + 4], 0 281 mov dword [esp + CPUMCTXCORE.ebx + 4], 0 282 mov dword [esp + CPUMCTXCORE.esi + 4], 0 283 mov dword [esp + CPUMCTXCORE.edi + 4], 0 284 mov dword [esp + CPUMCTXCORE.ebp + 4], 0 285 mov dword [esp + CPUMCTXCORE.esp + 4], 0 286 mov dword [esp + CPUMCTXCORE.eip + 4], 0 287 %endif 288 289 mov eax, es 290 mov dword [esp + CPUMCTXCORE.es.Sel], eax 291 mov eax, ds 292 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 293 mov eax, fs 294 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 295 mov eax, gs 296 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 297 298 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM 299 jz short gt_SkipV86Entry 300 301 ; 302 ; The DS, ES, FS and GS registers are zeroed in V86 mode and their real values are on the stack 303 ; 304 mov eax, dword [esp + ESPOFF + 1Ch] 305 mov dword [esp + CPUMCTXCORE.es.Sel], eax 306 307 mov eax, dword [esp + ESPOFF + 20h] 308 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 309 310 mov eax, dword [esp + ESPOFF + 24h] 311 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 312 313 mov eax, dword [esp + ESPOFF + 28h] 314 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 315 316 gt_SkipV86Entry: 317 ; 318 ; Disable Ring-0 WP 319 ; 320 mov eax, cr0 ;; @todo elimitate this read? 321 and eax, ~X86_CR0_WRITE_PROTECT 322 mov cr0, eax 323 324 ; 325 ; Load Hypervisor DS and ES (get it from the SS) 326 ; 327 mov eax, ss 328 mov ds, eax 329 mov es, eax 300 ; 301 .save_state: 302 mov eax, [%$STK_SAVED_EAX] 303 mov [ebx + CPUMCTXCORE.eax], eax 304 mov [ebx + CPUMCTXCORE.ecx], ecx 305 mov [ebx + CPUMCTXCORE.edx], edx 306 mov eax, [%$STK_SAVED_EBX] 307 mov [ebx + CPUMCTXCORE.ebx], eax 308 mov [ebx + CPUMCTXCORE.esi], esi 309 mov [ebx + CPUMCTXCORE.edi], edi 310 mov [ebx + CPUMCTXCORE.ebp], ebp 311 312 mov eax, [%$STK_ESP] 313 mov [ebx + CPUMCTXCORE.esp], eax 314 mov cx, [%$STK_SS] 315 mov [ebx + CPUMCTXCORE.ss.Sel], cx 316 317 mov cx, [%$STK_CS] 318 mov [ebx + CPUMCTXCORE.cs.Sel], cx 319 mov eax, [%$STK_EIP] 320 mov [ebx + CPUMCTXCORE.eip], eax 321 mov eax, [%$STK_EFLAGS] 322 mov [ebx + CPUMCTXCORE.eflags], eax 323 324 %if GC_ARCH_BITS == 64 ; zero out the high dwords - probably not necessary any more. 325 mov dword [ebx + CPUMCTXCORE.eax + 4], 0 326 mov dword [ebx + CPUMCTXCORE.ecx + 4], 0 327 mov dword [ebx + CPUMCTXCORE.edx + 4], 0 328 mov dword [ebx + CPUMCTXCORE.ebx + 4], 0 329 mov dword [ebx + CPUMCTXCORE.esi + 4], 0 330 mov dword [ebx + CPUMCTXCORE.edi + 4], 0 331 mov dword [ebx + CPUMCTXCORE.ebp + 4], 0 332 mov dword [ebx + CPUMCTXCORE.esp + 4], 0 333 mov dword [ebx + CPUMCTXCORE.eip + 4], 0 334 %endif 335 336 test dword [%$STK_EFLAGS], X86_EFL_VM 337 jnz .save_V86_segregs 338 339 mov cx, [%$STK_SAVED_ES] 340 mov [ebx + CPUMCTXCORE.es.Sel], cx 341 mov cx, [%$STK_SAVED_DS] 342 mov [ebx + CPUMCTXCORE.ds.Sel], cx 343 mov cx, fs 344 mov [ebx + CPUMCTXCORE.fs.Sel], cx 345 mov cx, gs 346 mov [ebx + CPUMCTXCORE.gs.Sel], cx 347 jmp .done_saving 348 349 ; 350 ; The DS, ES, FS and GS registers are zeroed in V86 mode and their real 351 ; values are on the stack. 352 ; 353 .save_V86_segregs: 354 mov cx, [%$STK_V86_ES] 355 mov [ebx + CPUMCTXCORE.es.Sel], cx 356 mov cx, [%$STK_V86_DS] 357 mov [ebx + CPUMCTXCORE.ds.Sel], cx 358 mov cx, [%$STK_V86_FS] 359 mov [ebx + CPUMCTXCORE.fs.Sel], cx 360 mov cx, [%$STK_V86_GS] 361 mov [ebx + CPUMCTXCORE.gs.Sel], cx 362 363 .done_saving: 330 364 331 365 %ifdef VBOX_WITH_STATISTICS … … 333 367 ; Start profiling. 334 368 ; 335 mov edx, [ esp + 0h + ESPOFF] ; vector number369 mov edx, [%$STK_VECTOR] 336 370 imul edx, edx, byte STAMPROFILEADV_size ; assumes < 128. 337 371 add edx, TRPM.aStatGCTraps … … 343 377 ; Store the information about the active trap/interrupt. 344 378 ; 345 mov e ax, IMP(g_TRPMCPU)346 movzx edx, byte [ esp + 0h + ESPOFF] ; vector number347 mov [e ax+ TRPMCPU.uActiveVector], edx348 mov edx, [ esp + 4h + ESPOFF] ; error code349 mov [e ax+ TRPMCPU.uActiveErrorCode], edx350 mov dword [e ax+ TRPMCPU.enmActiveType], TRPM_TRAP379 mov esi, IMP(g_TRPMCPU) ; esi = TRPMCPU until resume! 380 movzx edx, byte [%$STK_VECTOR] 381 mov [esi + TRPMCPU.uActiveVector], edx 382 mov edx, [%$STK_ERRCD] 383 mov [esi + TRPMCPU.uActiveErrorCode], edx 384 mov dword [esi + TRPMCPU.enmActiveType], TRPM_TRAP 351 385 mov edx, cr2 ;; @todo Check how expensive cr2 reads are! 352 mov dword [eax + TRPMCPU.uActiveCR2], edx 353 354 %if GC_ARCH_BITS == 64 355 ; zero out the high dword 356 mov dword [eax + TRPMCPU.uActiveErrorCode + 4], 0 357 mov dword [eax + TRPMCPU.uActiveCR2 + 4], 0 358 %endif 359 360 ; 361 ; Check if we're in Hypervisor when this happened. 362 ; 363 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM 364 jnz short gt_NotHyperVisor 365 366 test byte [esp + 0ch + ESPOFF], 3h ; check CPL of the cs selector 367 jz near gt_InHypervisor 386 mov dword [esi + TRPMCPU.uActiveCR2], edx 387 %if GC_ARCH_BITS == 64 ; zero out the high dwords. 388 mov dword [esi + TRPMCPU.uActiveErrorCode + 4], 0 389 mov dword [esi + TRPMCPU.uActiveCR2 + 4], 0 390 %endif 391 392 ; 393 ; Check if we're in the raw-mode context (RC / hypervisor) when this happened. 394 ; 395 test dword [%$STK_EFLAGS], X86_EFL_VM 396 jnz short .gc_not_raw_mode_context 397 398 test byte [%$STK_CS], 3h ; check RPL of the cs selector 399 jz .rc_in_raw_mode_context 368 400 369 401 ; 370 402 ; Trap in guest code. 371 403 ; 372 gt_NotHyperVisor:404 .gc_not_raw_mode_context: 373 405 %ifdef DEBUG_STUFF_TRPG 374 mov e bx, [esp + 4h + ESPOFF] ; error code406 mov eax, [%$STK_ERRCD] 375 407 mov ecx, 'trpG' ; indicate trap. 376 mov edx, [esp + 0h + ESPOFF] ; vector number 377 lea eax, [esp] 408 mov edx, [%$STK_VECTOR] 378 409 call trpmDbgDumpRegisterFrame 379 410 %endif … … 382 413 ; Do we have a GC handler for these traps? 383 414 ; 384 mov edx, [ esp + 0h + ESPOFF] ; vector number415 mov edx, [%$STK_VECTOR] 385 416 mov eax, [g_apfnStaticTrapHandlersGuest + edx * 4] 386 417 or eax, eax 387 jnz short gt_HaveHandler418 jnz short .gc_have_static_handler 388 419 mov eax, VINF_EM_RAW_GUEST_TRAP 389 jmp short gt_GuestTrap420 jmp short .gc_guest_trap 390 421 391 422 ; 392 423 ; Call static handler. 393 424 ; 394 gt_HaveHandler:395 push e sp; Param 2 - CPUMCTXCORE pointer.396 push dword IMP(g_TRPMCPU) ; Param 1 - Pointer to TRPMCPU425 .gc_have_static_handler: 426 push ebx ; Param 2 - CPUMCTXCORE pointer. 427 push esi ; Param 1 - Pointer to TRPMCPU. 397 428 call eax 398 429 add esp, byte 8 ; cleanup stack (cdecl) 399 430 or eax, eax 400 je near gt_continue_guest431 je near .gc_continue_guest 401 432 402 433 ; 403 434 ; Switch back to the host and process it there. 404 435 ; 405 gt_GuestTrap:436 .gc_guest_trap: 406 437 %ifdef VBOX_WITH_STATISTICS 407 mov edx, [ esp + 0h + ESPOFF] ; vector number438 mov edx, [%$STK_VECTOR] 408 439 imul edx, edx, byte STAMPROFILEADV_size ; assume < 128 409 440 add edx, IMP(g_TRPM) … … 412 443 %endif 413 444 mov edx, IMP(g_VM) 414 call [edx + VM.pfnVMMGCGuestToHostAsmGuestCtx] 415 416 ;; @todo r=bird: is this path actually every taken? if not we should replace this code with a panic. 417 ; 418 ; We've returned! 419 ; N.B. The stack has been changed now! No CPUMCTXCORE any longer. esp = vector number. 420 ; N.B. Current scheduling design causes this code path to be unused. 421 ; N.B. Better not use it when in V86 mode! 422 ; 423 424 ; Enable WP 425 mov eax, cr0 ;; @todo try elimiate this read. 426 or eax, X86_CR0_WRITE_PROTECT 427 mov cr0, eax 428 ; Restore guest context and continue execution. 429 mov edx, IMP(g_CPUM) 430 lea eax, [esp + 8] 431 push eax 432 call NAME(CPUMGCRestoreInt) 433 lea esp, [esp + 0ch] ; cleanup call and skip vector & error code. 434 435 iret 436 445 call [edx + VM.pfnVMMGCGuestToHostAsm] 446 447 ; We shouldn't ever return this way. So, raise a special IPE if we do. 448 .gc_panic_again: 449 mov eax, VERR_TRPM_IPE_3 450 mov edx, IMP(g_VM) 451 call [edx + VM.pfnVMMGCGuestToHostAsm] 452 jmp .gc_panic_again 437 453 438 454 ; … … 440 456 ; 441 457 ALIGNCODE(16) 442 gt_continue_guest:458 .gc_continue_guest: 443 459 %ifdef VBOX_WITH_STATISTICS 444 mov edx, [ esp + 0h + ESPOFF] ; vector number460 mov edx, [%$STK_VECTOR] 445 461 imul edx, edx, byte STAMPROFILEADV_size ; assumes < 128 446 462 add edx, TRPM.aStatGCTraps … … 455 471 456 472 ; restore guest state and start executing again. 457 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM 458 jnz gt_V86Return 459 460 mov ecx, [esp + CPUMCTXCORE.ecx] 461 mov edx, [esp + CPUMCTXCORE.edx] 462 mov ebx, [esp + CPUMCTXCORE.ebx] 463 mov ebp, [esp + CPUMCTXCORE.ebp] 464 mov esi, [esp + CPUMCTXCORE.esi] 465 mov edi, [esp + CPUMCTXCORE.edi] 466 467 mov eax, [esp + CPUMCTXCORE.esp] 468 mov [esp + 14h + ESPOFF], eax ; esp 469 mov eax, dword [esp + CPUMCTXCORE.ss.Sel] 470 mov [esp + 18h + ESPOFF], eax ; ss 471 472 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 473 mov eax, [ebx + CPUMCTXCORE.eax] 474 mov [%$STK_SAVED_EAX], eax 475 mov ecx, [ebx + CPUMCTXCORE.ecx] 476 mov edx, [ebx + CPUMCTXCORE.edx] 477 mov eax, [ebx + CPUMCTXCORE.ebx] 478 mov [%$STK_SAVED_EBX], eax 479 mov ebp, [ebx + CPUMCTXCORE.ebp] 480 mov esi, [ebx + CPUMCTXCORE.esi] 481 mov edi, [ebx + CPUMCTXCORE.edi] 482 483 mov eax, [ebx + CPUMCTXCORE.esp] 484 mov [%$STK_ESP], eax 485 mov eax, dword [ebx + CPUMCTXCORE.ss.Sel] 486 mov [%$STK_SS], eax 487 mov eax, [ebx + CPUMCTXCORE.eflags] 488 mov [%$STK_EFLAGS], eax 489 mov eax, dword [ebx + CPUMCTXCORE.cs.Sel] 490 mov [%$STK_CS], eax 491 mov eax, [ebx + CPUMCTXCORE.eip] 492 mov [%$STK_EIP], eax 493 494 test dword [ebx + CPUMCTXCORE.eflags], X86_EFL_VM 495 jnz .gc_V86_return 496 497 mov ax, [ebx + CPUMCTXCORE.gs.Sel] 473 498 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS 474 mov gs, eax475 476 mov eax, dword [esp+ CPUMCTXCORE.fs.Sel]499 mov gs, ax 500 501 mov ax, [ebx + CPUMCTXCORE.fs.Sel] 477 502 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS 478 mov fs, eax479 480 mov eax, dword [esp+ CPUMCTXCORE.es.Sel]503 mov fs, ax 504 505 mov ax, [ebx + CPUMCTXCORE.es.Sel] 481 506 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_ES 482 mov es, eax483 484 mov eax, dword [esp+ CPUMCTXCORE.ds.Sel]507 mov es, ax 508 509 mov ax, [ebx + CPUMCTXCORE.ds.Sel] 485 510 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_DS 486 mov ds, eax 487 488 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 489 mov [esp + 0ch + ESPOFF], eax ; cs 490 mov eax, [esp + CPUMCTXCORE.eflags] 491 mov [esp + 10h + ESPOFF], eax ; eflags 492 mov eax, [esp + CPUMCTXCORE.eip] 493 mov [esp + 08h + ESPOFF], eax ; eip 494 495 ; finally restore our scratch register eax 496 mov eax, [esp + CPUMCTXCORE.eax] 497 498 add esp, ESPOFF + 8 ; skip CPUMCTXCORE structure, error code and vector number 511 mov ds, ax 512 513 ; finally restore our scratch register eax and ebx. 514 pop ebx 515 pop eax 516 517 add esp, 8 + 8 ; skip ds, es, the error code, and vector number. 499 518 500 519 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_IRET … … 502 521 503 522 ALIGNCODE(16) 504 gt_V86Return: 505 mov ecx, [esp + CPUMCTXCORE.ecx] 506 mov edx, [esp + CPUMCTXCORE.edx] 507 mov ebx, [esp + CPUMCTXCORE.ebx] 508 mov ebp, [esp + CPUMCTXCORE.ebp] 509 mov esi, [esp + CPUMCTXCORE.esi] 510 mov edi, [esp + CPUMCTXCORE.edi] 511 512 mov eax, [esp + CPUMCTXCORE.esp] 513 mov [esp + 14h + ESPOFF], eax ; esp 514 mov eax, dword [esp + CPUMCTXCORE.ss.Sel] 515 mov [esp + 18h + ESPOFF], eax ; ss 516 517 mov eax, dword [esp + CPUMCTXCORE.es.Sel] 518 mov [esp + 1ch + ESPOFF], eax ; es 519 mov eax, dword [esp + CPUMCTXCORE.ds.Sel] 520 mov [esp + 20h + ESPOFF], eax ; ds 521 mov eax, dword [esp + CPUMCTXCORE.fs.Sel] 522 mov [esp + 24h + ESPOFF], eax ; fs 523 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 524 mov [esp + 28h + ESPOFF], eax ; gs 525 526 mov eax, [esp + CPUMCTXCORE.eip] 527 mov [esp + 08h + ESPOFF], eax ; eip 528 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 529 mov [esp + 0ch + ESPOFF], eax ; cs 530 mov eax, [esp + CPUMCTXCORE.eflags] 531 mov [esp + 10h + ESPOFF], eax ; eflags 532 533 ; finally restore our scratch register eax 534 mov eax, [esp + CPUMCTXCORE.eax] 535 536 add esp, ESPOFF + 8 ; skip CPUMCTXCORE structure, error code and vector number 523 .gc_V86_return: 524 mov eax, dword [ebx + CPUMCTXCORE.es.Sel] 525 mov [%$STK_V86_ES], eax 526 mov eax, dword [ebx + CPUMCTXCORE.ds.Sel] 527 mov [%$STK_V86_DS], eax 528 mov eax, dword [ebx + CPUMCTXCORE.fs.Sel] 529 mov [%$STK_V86_FS], eax 530 mov eax, dword [ebx + CPUMCTXCORE.gs.Sel] 531 mov [%$STK_V86_GS], eax 532 533 ; finally restore our scratch register eax and ebx. 534 pop ebx 535 pop eax 536 537 add esp, 8 + 8 ; skip ds, es, the error code, and vector number. 537 538 538 539 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_IRET | TRPM_TRAP_IN_V86 … … 545 546 ; 546 547 ALIGNCODE(16) 547 gt_InHypervisor:548 .rc_in_raw_mode_context: 548 549 ; fix ss:esp. 549 lea ebx, [esp + 14h + ESPOFF] ; calc esp at trap 550 mov [esp + CPUMCTXCORE.esp], ebx; update esp in register frame 551 mov [esp + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 552 553 ; tell cpum about the context core. 554 xchg esi, eax ; save pTRPMCPU - @todo reallocate this variable to esi, edi, or ebx 555 push esp ; Param 2 - The new CPUMCTXCORE pointer. 556 mov eax, IMP(g_VM) ; Param 1 - Pointer to the VMCPU. 557 add eax, [eax + VM.offVMCPU] 558 push eax 559 call NAME(CPUMHyperSetCtxCore) 560 add esp, byte 8 ; stack cleanup (cdecl) 561 xchg eax, esi ; restore pTRPMCPU 550 lea ecx, [%$STK_ESP] ; calc esp at trap 551 mov [ebx + CPUMCTXCORE.esp], ecx; update esp in register frame 552 mov [ebx + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 562 553 563 554 ; check for temporary handler. 564 movzx e bx, byte [eax+ TRPMCPU.uActiveVector]565 mov e si, IMP(g_TRPM) ; keep eax == pTRPMCPU555 movzx edx, byte [esi + TRPMCPU.uActiveVector] 556 mov edi, IMP(g_TRPM) 566 557 xor ecx, ecx 567 xchg ecx, [e si + TRPM.aTmpTrapHandlers + ebx * 4] ; ecx = Temp handler pointer or 0558 xchg ecx, [edi + TRPM.aTmpTrapHandlers + edx * 4] ; ecx = Temp handler pointer or 0 568 559 or ecx, ecx 569 jnz short gt_Hyper_HaveTemporaryHandler560 jnz short .rc_have_temporary_handler 570 561 571 562 ; check for static trap handler. 572 mov ecx, [g_apfnStaticTrapHandlersHyper + e bx * 4] ; ecx = Static handler pointer or 0563 mov ecx, [g_apfnStaticTrapHandlersHyper + edx * 4] ; ecx = Static handler pointer or 0 573 564 or ecx, ecx 574 jnz short gt_Hyper_HaveStaticHandler575 jmp gt_Hyper_AbandonShip565 jnz short .rc_have_static_handler 566 jmp .rc_abandon_ship 576 567 577 568 … … 579 570 ; Temporary trap handler present, call it (CDECL). 580 571 ; 581 gt_Hyper_HaveTemporaryHandler:582 push e sp; Param 2 - Pointer to CPUMCTXCORE.572 .rc_have_temporary_handler: 573 push ebx ; Param 2 - Pointer to CPUMCTXCORE. 583 574 push IMP(g_VM) ; Param 1 - Pointer to VM. 584 575 call ecx … … 586 577 587 578 cmp eax, byte VINF_SUCCESS ; If completely handled Then resume execution. 588 je near gt_Hyper_Continue 589 ;; @todo Handle ALL returns types from temporary handlers! 590 jmp gt_Hyper_AbandonShip 579 je near .rc_continue 580 jmp .rc_abandon_ship 591 581 592 582 … … 594 584 ; Static trap handler present, call it (CDECL). 595 585 ; 596 gt_Hyper_HaveStaticHandler:597 push e sp; Param 2 - Pointer to CPUMCTXCORE.598 push e ax; Param 1 - Pointer to TRPMCPU586 .rc_have_static_handler: 587 push ebx ; Param 2 - Pointer to CPUMCTXCORE. 588 push esi ; Param 1 - Pointer to TRPMCPU 599 589 call ecx 600 590 add esp, byte 8 ; cleanup stack (cdecl) 601 591 602 592 cmp eax, byte VINF_SUCCESS ; If completely handled Then resume execution. 603 je short gt_Hyper_Continue593 je short .rc_continue 604 594 cmp eax, VINF_EM_DBG_HYPER_STEPPED 605 je short gt_Hyper_ToHost595 je short .rc_to_host 606 596 cmp eax, VINF_EM_DBG_HYPER_BREAKPOINT 607 je short gt_Hyper_ToHost597 je short .rc_to_host 608 598 cmp eax, VINF_EM_DBG_HYPER_ASSERTION 609 je short gt_Hyper_ToHost610 jmp gt_Hyper_AbandonShip599 je short .rc_to_host 600 jmp .rc_abandon_ship 611 601 612 602 ; 613 603 ; Pop back to the host to service the error. 614 604 ; 615 gt_Hyper_ToHost:616 mov ecx, e sp605 .rc_to_host: 606 mov ecx, ebx 617 607 mov edx, IMP(g_VM) 618 608 call [edx + VM.pfnVMMGCGuestToHostAsm] 619 jmp short gt_Hyper_Continue609 jmp short .rc_continue 620 610 621 611 ; … … 624 614 ; 625 615 ALIGNCODE(16) 626 gt_Hyper_Continue:616 .rc_continue: 627 617 %ifdef DEBUG_STUFF 628 mov e bx, [esp + 4h + ESPOFF] ; error code618 mov eax, [%$STK_ERRCD] 629 619 mov ecx, 'resH' ; indicate trap. 630 mov edx, [esp + 0h + ESPOFF] ; vector number 631 lea eax, [esp] 620 mov edx, [%$STK_VECTOR] 632 621 call trpmDbgDumpRegisterFrame 633 622 %endif 634 ; tell CPUM to use the default CPUMCTXCORE.635 push byte 0 ; Param 2 - NULL indicating use default context core.636 mov eax, IMP(g_VM) ; Param 1 - Pointer to the VMCPU.637 add eax, [eax + VM.offVMCPU]638 push eax639 call NAME(CPUMHyperSetCtxCore)640 add esp, byte 8 ; stack cleanup (cdecl)641 623 642 624 %ifdef VBOX_WITH_STATISTICS 643 mov edx, [ esp + 0h + ESPOFF] ; vector number625 mov edx, [%$STK_VECTOR] 644 626 imul edx, edx, byte STAMPROFILEADV_size ; assumes < 128 645 627 add edx, TRPM.aStatGCTraps … … 649 631 650 632 ; restore 651 mov ecx, [esp + CPUMCTXCORE.ecx] 652 mov edx, [esp + CPUMCTXCORE.edx] 653 mov ebx, [esp + CPUMCTXCORE.ebx] 654 mov ebp, [esp + CPUMCTXCORE.ebp] 655 mov esi, [esp + CPUMCTXCORE.esi] 656 mov edi, [esp + CPUMCTXCORE.edi] 657 658 mov eax, dword [esp + CPUMCTXCORE.gs.Sel] 633 mov eax, [ebx + CPUMCTXCORE.eax] 634 mov [%$STK_SAVED_EAX], eax 635 mov ecx, [ebx + CPUMCTXCORE.ecx] 636 mov edx, [ebx + CPUMCTXCORE.edx] 637 mov eax, [ebx + CPUMCTXCORE.ebx] 638 mov [%$STK_SAVED_EBX], eax 639 mov ebp, [ebx + CPUMCTXCORE.ebp] 640 mov esi, [ebx + CPUMCTXCORE.esi] 641 mov edi, [ebx + CPUMCTXCORE.edi] 642 643 ; skipping esp & ss. 644 645 mov eax, [ebx + CPUMCTXCORE.eflags] 646 mov [%$STK_EFLAGS], eax 647 mov eax, dword [ebx + CPUMCTXCORE.cs.Sel] 648 mov [%$STK_CS], eax 649 mov eax, [ebx + CPUMCTXCORE.eip] 650 mov [%$STK_EIP], eax 651 652 mov ax, [ebx + CPUMCTXCORE.gs.Sel] 659 653 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS | TRPM_TRAP_IN_HYPER 660 mov gs, eax661 662 mov eax, dword [esp+ CPUMCTXCORE.fs.Sel]654 mov gs, ax 655 656 mov ax, [ebx + CPUMCTXCORE.fs.Sel] 663 657 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS | TRPM_TRAP_IN_HYPER 664 mov fs, eax 665 666 mov eax, dword [esp + CPUMCTXCORE.es.Sel] 667 mov es, eax 668 mov eax, dword [esp + CPUMCTXCORE.ds.Sel] 669 mov ds, eax 670 671 ; skip esp & ss 672 673 mov eax, [esp + CPUMCTXCORE.eip] 674 mov [esp + 08h + ESPOFF], eax ; eip 675 mov eax, dword [esp + CPUMCTXCORE.cs.Sel] 676 mov [esp + 0ch + ESPOFF], eax ; cs 677 mov eax, [esp + CPUMCTXCORE.eflags] 678 mov [esp + 10h + ESPOFF], eax ; eflags 679 680 ; finally restore our scratch register eax 681 mov eax, [esp + CPUMCTXCORE.eax] 682 683 add esp, ESPOFF + 8 ; skip CPUMCTXCORE structure, error code and vector number 658 mov fs, ax 659 660 mov ax, [ebx + CPUMCTXCORE.es.Sel] 661 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_ES | TRPM_TRAP_IN_HYPER 662 mov es, ax 663 664 mov ax, [ebx + CPUMCTXCORE.ds.Sel] 665 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_DS | TRPM_TRAP_IN_HYPER 666 mov ds, ax 667 668 ; finally restore our scratch register eax and ebx. 669 pop ebx 670 pop eax 671 672 add esp, 8 + 8 ; skip ds, es, the error code, and vector number. 684 673 685 674 iret … … 687 676 688 677 ; 689 ; ABANDON SHIP! DON'T PANIC!690 ; 691 gt_Hyper_AbandonShip:678 ; Internal processing error - don't panic, start meditating! 679 ; 680 .rc_abandon_ship: 692 681 %ifdef DEBUG_STUFF 693 mov e bx, [esp + 4h + ESPOFF] ; error code682 mov eax, [%$STK_ERRCD] 694 683 mov ecx, 'trpH' ; indicate trap. 695 mov edx, [esp + 0h + ESPOFF] ; vector number 696 lea eax, [esp] 684 mov edx, [%$STK_VECTOR] 697 685 call trpmDbgDumpRegisterFrame 698 686 %endif 699 687 700 gt_Hyper_DontPanic: 701 mov ecx, esp 688 .rc_do_not_panic: 702 689 mov edx, IMP(g_VM) 703 690 mov eax, VERR_TRPM_DONT_PANIC 704 call [edx + VM.pfnVMMGCGuestToHostAsm HyperCtx]691 call [edx + VM.pfnVMMGCGuestToHostAsm] 705 692 %ifdef DEBUG_STUFF 706 693 COM_S_PRINT 'bad!!!' 707 694 %endif 708 jmp gt_Hyper_DontPanic; this shall never ever happen!709 % undef ESPOFF695 jmp .rc_do_not_panic ; this shall never ever happen! 696 %pop 710 697 ENDPROC TRPMGCHandlerGeneric 711 698 … … 748 735 749 736 ; 750 ; Setup CPUMCTXCORE frame 737 ; Save ds, es, eax and ebx so we have a context pointer (ebx) and 738 ; scratch (eax) register to work with. A sideeffect of using ebx is that 739 ; it's preserved accross cdecl calls. 740 ; 741 ; In order to safely access data, we need to load our flat DS & ES selector, 742 ; and clear make sure CR0.WP is cleared. 743 ; 744 push ds ; +0ch 745 push es ; +08h 746 push eax ; +04h 747 push ebx ; +00h 748 %push foobar 749 %define %$STK_SAVED_EBX esp 750 %define %$STK_SAVED_EAX esp + 04h 751 %define %$STK_SAVED_ES esp + 08h 752 %define %$STK_SAVED_DS esp + 0ch 753 %define %$ESPOFF 10h 754 %define %$STK_VECTOR esp + 00h + %$ESPOFF 755 %define %$STK_EIP esp + 04h + %$ESPOFF 756 %define %$STK_CS esp + 08h + %$ESPOFF 757 %define %$STK_EFLAGS esp + 0ch + %$ESPOFF 758 %define %$STK_ESP esp + 10h + %$ESPOFF 759 %define %$STK_SS esp + 14h + %$ESPOFF 760 %define %$STK_V86_ES esp + 18h + %$ESPOFF 761 %define %$STK_V86_DS esp + 1ch + %$ESPOFF 762 %define %$STK_V86_FS esp + 20h + %$ESPOFF 763 %define %$STK_V86_GS esp + 24h + %$ESPOFF 764 765 push ss 766 pop ds 767 push ss 768 pop es 769 770 mov eax, cr0 ;; @todo elimitate this read? 771 and eax, ~X86_CR0_WRITE_PROTECT 772 mov cr0, eax 773 774 mov ebx, IMP(g_trpmGuestCtxCore) ; Assume GC as the most common. 775 test byte [%$STK_CS], 3h ; check RPL of the cs selector 776 ;; @todo check this for conforming segments. 777 jnz .save_state 778 test dword [%$STK_EFLAGS], X86_EFL_VM ; If in V86, then guest. 779 jnz .save_state 780 mov ebx, IMP(g_trpmHyperCtxCore) ; It's raw-mode context, actually. 781 782 ; 783 ; Save the state. 751 784 ; 752 785 ; ASSUMPTION: If trap in hypervisor, we assume that we can read two dword 753 786 ; under the bottom of the stack. This is atm safe. 754 ; ASSUMPTION: There is sufficient stack space. 755 ; ASSUMPTION: The stack is not write protected. 756 ; 757 %define ESPOFF CPUMCTXCORE_size 758 759 sub esp, CPUMCTXCORE_size 760 mov [esp + CPUMCTXCORE.eax], eax 761 mov [esp + CPUMCTXCORE.ecx], ecx 762 mov [esp + CPUMCTXCORE.edx], edx 763 mov [esp + CPUMCTXCORE.ebx], ebx 764 mov [esp + CPUMCTXCORE.esi], esi 765 mov [esp + CPUMCTXCORE.edi], edi 766 mov [esp + CPUMCTXCORE.ebp], ebp 767 768 mov eax, [esp + 04h + ESPOFF] ; eip 769 mov [esp + CPUMCTXCORE.eip], eax 770 mov eax, dword [esp + 08h + ESPOFF] ; cs 771 mov [esp + CPUMCTXCORE.cs.Sel], eax 772 mov eax, [esp + 0ch + ESPOFF] ; eflags 773 mov [esp + CPUMCTXCORE.eflags], eax 774 775 mov eax, [esp + 10h + ESPOFF] ; esp 776 mov [esp + CPUMCTXCORE.esp], eax 777 mov eax, dword [esp + 14h + ESPOFF] ; ss 778 mov [esp + CPUMCTXCORE.ss.Sel], eax 779 780 %if GC_ARCH_BITS == 64 781 ; zero out the high dwords 782 mov dword [esp + CPUMCTXCORE.eax + 4], 0 783 mov dword [esp + CPUMCTXCORE.ecx + 4], 0 784 mov dword [esp + CPUMCTXCORE.edx + 4], 0 785 mov dword [esp + CPUMCTXCORE.ebx + 4], 0 786 mov dword [esp + CPUMCTXCORE.esi + 4], 0 787 mov dword [esp + CPUMCTXCORE.edi + 4], 0 788 mov dword [esp + CPUMCTXCORE.ebp + 4], 0 789 mov dword [esp + CPUMCTXCORE.esp + 4], 0 790 mov dword [esp + CPUMCTXCORE.eip + 4], 0 791 %endif 792 793 mov eax, es 794 mov dword [esp + CPUMCTXCORE.es.Sel], eax 795 mov eax, ds 796 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 797 mov eax, fs 798 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 799 mov eax, gs 800 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 801 802 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM 803 jz short ti_SkipV86Entry 804 805 ; 806 ; The DS, ES, FS and GS registers are zeroed in V86 mode and their real values are on the stack 807 ; 808 mov eax, dword [esp + ESPOFF + 18h] 809 mov dword [esp + CPUMCTXCORE.es.Sel], eax 810 811 mov eax, dword [esp + ESPOFF + 1Ch] 812 mov dword [esp + CPUMCTXCORE.ds.Sel], eax 813 814 mov eax, dword [esp + ESPOFF + 20h] 815 mov dword [esp + CPUMCTXCORE.fs.Sel], eax 816 817 mov eax, dword [esp + ESPOFF + 24h] 818 mov dword [esp + CPUMCTXCORE.gs.Sel], eax 819 820 ti_SkipV86Entry: 821 822 ; 823 ; Disable Ring-0 WP 824 ; 825 mov eax, cr0 ;; @todo try elimiate this read. 826 and eax, ~X86_CR0_WRITE_PROTECT 827 mov cr0, eax 828 829 ; 830 ; Load Hypervisor DS and ES (get it from the SS) 831 ; 832 mov eax, ss 833 mov ds, eax 834 mov es, eax 787 ; 788 .save_state: 789 mov eax, [%$STK_SAVED_EAX] 790 mov [ebx + CPUMCTXCORE.eax], eax 791 mov [ebx + CPUMCTXCORE.ecx], ecx 792 mov [ebx + CPUMCTXCORE.edx], edx 793 mov eax, [%$STK_SAVED_EBX] 794 mov [ebx + CPUMCTXCORE.ebx], eax 795 mov [ebx + CPUMCTXCORE.esi], esi 796 mov [ebx + CPUMCTXCORE.edi], edi 797 mov [ebx + CPUMCTXCORE.ebp], ebp 798 799 mov eax, [%$STK_ESP] 800 mov [ebx + CPUMCTXCORE.esp], eax 801 mov cx, [%$STK_SS] 802 mov [ebx + CPUMCTXCORE.ss.Sel], cx 803 804 mov cx, [%$STK_CS] 805 mov [ebx + CPUMCTXCORE.cs.Sel], cx 806 mov eax, [%$STK_EIP] 807 mov [ebx + CPUMCTXCORE.eip], eax 808 mov eax, [%$STK_EFLAGS] 809 mov [ebx + CPUMCTXCORE.eflags], eax 810 811 %if GC_ARCH_BITS == 64 ; zero out the high dwords - probably not necessary any more. 812 mov dword [ebx + CPUMCTXCORE.eax + 4], 0 813 mov dword [ebx + CPUMCTXCORE.ecx + 4], 0 814 mov dword [ebx + CPUMCTXCORE.edx + 4], 0 815 mov dword [ebx + CPUMCTXCORE.ebx + 4], 0 816 mov dword [ebx + CPUMCTXCORE.esi + 4], 0 817 mov dword [ebx + CPUMCTXCORE.edi + 4], 0 818 mov dword [ebx + CPUMCTXCORE.ebp + 4], 0 819 mov dword [ebx + CPUMCTXCORE.esp + 4], 0 820 mov dword [ebx + CPUMCTXCORE.eip + 4], 0 821 %endif 822 823 test dword [%$STK_EFLAGS], X86_EFL_VM 824 jnz .save_V86_segregs 825 826 mov cx, [%$STK_SAVED_ES] 827 mov [ebx + CPUMCTXCORE.es.Sel], cx 828 mov cx, [%$STK_SAVED_DS] 829 mov [ebx + CPUMCTXCORE.ds.Sel], cx 830 mov cx, fs 831 mov [ebx + CPUMCTXCORE.fs.Sel], cx 832 mov cx, gs 833 mov [ebx + CPUMCTXCORE.gs.Sel], cx 834 jmp .done_saving 835 836 ; 837 ; The DS, ES, FS and GS registers are zeroed in V86 mode and their real 838 ; values are on the stack. 839 ; 840 .save_V86_segregs: 841 mov cx, [%$STK_V86_ES] 842 mov [ebx + CPUMCTXCORE.es.Sel], cx 843 mov cx, [%$STK_V86_DS] 844 mov [ebx + CPUMCTXCORE.ds.Sel], cx 845 mov cx, [%$STK_V86_FS] 846 mov [ebx + CPUMCTXCORE.fs.Sel], cx 847 mov cx, [%$STK_V86_GS] 848 mov [ebx + CPUMCTXCORE.gs.Sel], cx 849 850 .done_saving: 835 851 836 852 ; 837 853 ; Store the information about the active trap/interrupt. 838 854 ; 839 mov eax, IMP(g_TRPMCPU) 840 movzx edx, byte [esp + 0h + ESPOFF] ; vector number 841 mov [eax + TRPMCPU.uActiveVector], edx 842 xor edx, edx 843 mov dword [eax + TRPMCPU.enmActiveType], TRPM_HARDWARE_INT 844 dec edx 845 mov [eax + TRPMCPU.uActiveErrorCode], edx 846 mov [eax + TRPMCPU.uActiveCR2], edx 847 %if GC_ARCH_BITS == 64 848 ; zero out the high dword 849 mov dword [eax + TRPMCPU.uActiveErrorCode + 4], 0 850 mov dword [eax + TRPMCPU.uActiveCR2 + 4], 0 855 mov esi, IMP(g_TRPMCPU) ; esi = TRPMCPU until resume! 856 movzx edx, byte [%$STK_VECTOR] 857 mov [esi + TRPMCPU.uActiveVector], edx 858 mov dword [esi + TRPMCPU.uActiveErrorCode], 0 859 mov dword [esi + TRPMCPU.enmActiveType], TRPM_TRAP 860 mov dword [esi + TRPMCPU.uActiveCR2], edx 861 %if GC_ARCH_BITS == 64 ; zero out the high dwords. 862 mov dword [esi + TRPMCPU.uActiveErrorCode + 4], 0 863 mov dword [esi + TRPMCPU.uActiveCR2 + 4], 0 851 864 %endif 852 865 … … 855 868 ; Update statistics. 856 869 ; 857 mov e ax, IMP(g_TRPM)858 movzx edx, byte [ esp + 0h + ESPOFF] ; vector number870 mov edi, IMP(g_TRPM) 871 movzx edx, byte [%$STK_VECTOR] ; vector number 859 872 imul edx, edx, byte STAMCOUNTER_size 860 add edx, [e ax+ TRPM.paStatHostIrqRC]873 add edx, [edi + TRPM.paStatHostIrqRC] 861 874 STAM_COUNTER_INC edx 862 875 %endif 863 876 864 877 ; 865 ; Check if we're in Hypervisor when this happened. 866 ; 867 test byte [esp + 08h + ESPOFF], 3h ; check CPL of the cs selector 868 jnz short gi_NotHyperVisor 869 jmp gi_HyperVisor 878 ; Check if we're in the raw-mode context (RC / hypervisor) when this happened. 879 ; 880 test dword [%$STK_EFLAGS], X86_EFL_VM 881 jnz short .gc_not_raw_mode_context 882 883 test byte [%$STK_CS], 3h ; check RPL of the cs selector 884 jz .rc_in_raw_mode_context 870 885 871 886 ; 872 887 ; Trap in guest code. 873 888 ; 874 gi_NotHyperVisor:875 and dword [e sp + CPUMCTXCORE.eflags], ~010000h ; Clear RF (Resume Flag). @todo make %defines for eflags.889 .gc_not_raw_mode_context: 890 and dword [ebx + CPUMCTXCORE.eflags], ~X86_EFL_RF ; Clear RF. 876 891 ; The guest shall not see this in it's state. 877 892 %ifdef DEBUG_STUFF_INT 878 mov ecx, 'intG' ; indicate trap.879 mov zx edx, byte [esp + 0h + ESPOFF] ; vector number880 lea eax, [esp]893 xor eax, eax 894 mov ecx, 'intG' ; indicate trap in GC. 895 movzx edx, byte [%$STK_VECTOR] 881 896 call trpmDbgDumpRegisterFrame 882 897 %endif … … 887 902 mov edx, IMP(g_VM) 888 903 mov eax, VINF_EM_RAW_INTERRUPT 889 call [edx + VM.pfnVMMGCGuestToHostAsm GuestCtx]904 call [edx + VM.pfnVMMGCGuestToHostAsm] 890 905 891 906 ; 892 907 ; We've returned! 893 ; NOTE that the stack has been changed now! 894 ; there is no longer any CPUMCTXCORE around and esp points to vector number! 895 ; 908 ; 909 896 910 ; Reset TRPM state 897 mov eax, IMP(g_TRPMCPU)898 911 xor edx, edx 899 912 dec edx ; edx = 0ffffffffh 900 xchg [e ax+ TRPMCPU.uActiveVector], edx901 mov [e ax+ TRPMCPU.uPrevVector], edx902 903 ; Enable WP913 xchg [esi + TRPMCPU.uActiveVector], edx 914 mov [esi + TRPMCPU.uPrevVector], edx 915 916 ; enable WP 904 917 mov eax, cr0 ;; @todo try elimiate this read. 905 918 or eax, X86_CR0_WRITE_PROTECT 906 919 mov cr0, eax 907 ; restore guest context and continue execution. 908 lea eax, [esp + 8] 909 push eax 910 call NAME(CPUMGCRestoreInt) 911 lea esp, [esp + 0ch] ; cleanup call and skip vector & error code. 912 920 921 ; restore guest state and start executing again. 922 mov eax, [ebx + CPUMCTXCORE.eax] 923 mov [%$STK_SAVED_EAX], eax 924 mov ecx, [ebx + CPUMCTXCORE.ecx] 925 mov edx, [ebx + CPUMCTXCORE.edx] 926 mov eax, [ebx + CPUMCTXCORE.ebx] 927 mov [%$STK_SAVED_EBX], eax 928 mov ebp, [ebx + CPUMCTXCORE.ebp] 929 mov esi, [ebx + CPUMCTXCORE.esi] 930 mov edi, [ebx + CPUMCTXCORE.edi] 931 932 mov eax, [ebx + CPUMCTXCORE.esp] 933 mov [%$STK_ESP], eax 934 mov eax, dword [ebx + CPUMCTXCORE.ss.Sel] 935 mov [%$STK_SS], eax 936 mov eax, [ebx + CPUMCTXCORE.eflags] 937 mov [%$STK_EFLAGS], eax 938 mov eax, dword [ebx + CPUMCTXCORE.cs.Sel] 939 mov [%$STK_CS], eax 940 mov eax, [ebx + CPUMCTXCORE.eip] 941 mov [%$STK_EIP], eax 942 943 test dword [ebx + CPUMCTXCORE.eflags], X86_EFL_VM 944 jnz .gc_V86_return 945 946 mov ax, [ebx + CPUMCTXCORE.gs.Sel] 947 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS 948 mov gs, ax 949 950 mov ax, [ebx + CPUMCTXCORE.fs.Sel] 951 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS 952 mov fs, ax 953 954 mov ax, [ebx + CPUMCTXCORE.es.Sel] 955 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_ES 956 mov es, ax 957 958 mov ax, [ebx + CPUMCTXCORE.ds.Sel] 959 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_DS 960 mov ds, ax 961 962 ; finally restore our scratch register eax and ebx. 963 pop ebx 964 pop eax 965 966 add esp, 8 + 4 ; skip ds, es, and vector number. 967 968 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_IRET 969 iret 970 971 ALIGNCODE(16) 972 .gc_V86_return: 973 mov eax, dword [ebx + CPUMCTXCORE.es.Sel] 974 mov [%$STK_V86_ES], eax 975 mov eax, dword [ebx + CPUMCTXCORE.ds.Sel] 976 mov [%$STK_V86_DS], eax 977 mov eax, dword [ebx + CPUMCTXCORE.fs.Sel] 978 mov [%$STK_V86_FS], eax 979 mov eax, dword [ebx + CPUMCTXCORE.gs.Sel] 980 mov [%$STK_V86_GS], eax 981 982 ; finally restore our scratch register eax and ebx. 983 pop ebx 984 pop eax 985 986 add esp, 8 + 4 ; skip ds, es, and vector number. 987 988 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_IRET | TRPM_TRAP_IN_V86 913 989 iret 914 990 … … 922 998 ; We make ASSUMPTIONS about this in respects to the WP CR0 bit 923 999 ; 924 gi_HyperVisor: 925 lea eax, [esp + 14h + ESPOFF] ; calc esp at trap 926 mov [esp + CPUMCTXCORE.esp], eax ; update esp in register frame 927 mov [esp + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 1000 ALIGNCODE(16) 1001 .rc_in_raw_mode_context: 1002 ; fix ss:esp. 1003 lea ecx, [%$STK_ESP] ; calc esp at trap 1004 mov [ebx + CPUMCTXCORE.esp], ecx ; update esp in register frame 1005 mov [ebx + CPUMCTXCORE.ss.Sel], ss ; update ss in register frame 928 1006 929 1007 %ifdef DEBUG_STUFF_INT 930 mov ebx, [esp + 4h + ESPOFF] ; error code 931 mov ecx, 'intH' ; indicate hypervisor interrupt. 932 movzx edx, byte [esp + 0h + ESPOFF] ; vector number 933 lea eax, [esp] 1008 xor eax, eax 1009 mov ecx, 'intH' ; indicate trap in RC. 1010 movzx edx, byte [%$STK_VECTOR] 934 1011 call trpmDbgDumpRegisterFrame 935 1012 %endif 936 1013 937 mov ecx, esp938 1014 mov edx, IMP(g_VM) 939 1015 mov eax, VINF_EM_RAW_INTERRUPT_HYPER 940 1016 call [edx + VM.pfnVMMGCGuestToHostAsm] 941 1017 %ifdef DEBUG_STUFF_INT 942 COM_ CHAR '!'1018 COM_S_CHAR '!' 943 1019 %endif 944 1020 945 1021 ; 946 1022 ; We've returned! 947 ; 1023 ; Continue(/Resume/Restart/Whatever) hypervisor execution. 1024 ; 1025 948 1026 ; Reset TRPM state - don't record this. 949 mov eax, IMP(g_TRPMCPU)950 mov dword [e ax+ TRPMCPU.uActiveVector], 0ffffffffh1027 ;mov esi, IMP(g_TRPMCPU) 1028 mov dword [esi + TRPMCPU.uActiveVector], 0ffffffffh 951 1029 952 1030 ; 953 1031 ; Restore the hypervisor context and return. 954 1032 ; 955 mov ecx, [esp + CPUMCTXCORE.ecx] 956 mov edx, [esp + CPUMCTXCORE.edx] 957 mov ebx, [esp + CPUMCTXCORE.ebx] 958 mov ebp, [esp + CPUMCTXCORE.ebp] 959 mov esi, [esp + CPUMCTXCORE.esi] 960 mov edi, [esp + CPUMCTXCORE.edi] 961 962 ; In V86 mode DS, ES, FS & GS are restored by the iret 963 test dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM 964 jnz short ti_SkipSelRegs 965 966 mov eax, [esp + CPUMCTXCORE.gs.Sel] 1033 mov eax, [ebx + CPUMCTXCORE.eax] 1034 mov [%$STK_SAVED_EAX], eax 1035 mov ecx, [ebx + CPUMCTXCORE.ecx] 1036 mov edx, [ebx + CPUMCTXCORE.edx] 1037 mov eax, [ebx + CPUMCTXCORE.ebx] 1038 mov [%$STK_SAVED_EBX], eax 1039 mov ebp, [ebx + CPUMCTXCORE.ebp] 1040 mov esi, [ebx + CPUMCTXCORE.esi] 1041 mov edi, [ebx + CPUMCTXCORE.edi] 1042 1043 ; skipping esp & ss. 1044 1045 mov eax, [ebx + CPUMCTXCORE.eflags] 1046 mov [%$STK_EFLAGS], eax 1047 mov eax, dword [ebx + CPUMCTXCORE.cs.Sel] 1048 mov [%$STK_CS], eax 1049 mov eax, [ebx + CPUMCTXCORE.eip] 1050 mov [%$STK_EIP], eax 1051 1052 mov ax, [ebx + CPUMCTXCORE.gs.Sel] 967 1053 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS | TRPM_TRAP_IN_HYPER 968 mov gs, eax969 970 mov eax, [esp+ CPUMCTXCORE.fs.Sel]1054 mov gs, ax 1055 1056 mov ax, [ebx + CPUMCTXCORE.fs.Sel] 971 1057 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_FS | TRPM_TRAP_IN_HYPER 972 mov fs, eax973 974 mov eax, [esp+ CPUMCTXCORE.es.Sel]975 mov es, eax976 mov e ax, [esp + CPUMCTXCORE.ds.Sel]977 mov ds, eax 978 979 ti_SkipSelRegs: 980 ; finally restore our scratch register eax981 mov eax, [esp + CPUMCTXCORE.eax] 982 983 ; skip esp, ss, cs, eip & eflags. Done by iret984 985 add esp, ESPOFF + 4h ; skip CPUMCTXCORE structure & vector number. 986 1058 mov fs, ax 1059 1060 mov ax, [ebx + CPUMCTXCORE.es.Sel] 1061 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_ES | TRPM_TRAP_IN_HYPER 1062 mov es, ax 1063 1064 mov ax, [ebx + CPUMCTXCORE.ds.Sel] 1065 TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_DS | TRPM_TRAP_IN_HYPER 1066 mov ds, ax 1067 1068 ; finally restore our scratch register eax and ebx. 1069 pop ebx 1070 pop eax 1071 1072 add esp, 8 + 4 ; skip ds, es, and vector number. 987 1073 iret 988 % undef ESPOFF1074 %pop 989 1075 ENDPROC TRPMGCHandlerInterupt 990 1076 … … 1056 1142 1057 1143 ; 1144 ; Disable write protection. 1145 ; 1146 mov eax, cr0 1147 and eax, ~X86_CR0_WRITE_PROTECT 1148 mov cr0, eax 1149 1150 ; 1058 1151 ; Load Hypervisor DS and ES (get it from the SS) - paranoia, but the TSS could be overwritten.. :) 1059 1152 ; … … 1063 1156 1064 1157 COM_S_PRINT 10,13,'*** Guru Meditation 00000008 - Double Fault! ***',10,13 1065 1066 ;1067 ; Disable write protection.1068 ;1069 mov eax, cr01070 and eax, ~X86_CR0_WRITE_PROTECT1071 mov cr0, eax1072 1073 1158 1074 1159 COM_S_PRINT 'VM=' … … 1087 1172 ; Create CPUMCTXCORE structure. 1088 1173 ; 1089 sub esp, CPUMCTXCORE_size1174 mov ebx, IMP(g_trpmHyperCtxCore) ; It's raw-mode context, actually. 1090 1175 1091 1176 mov eax, [ecx + VBOXTSS.eip] 1092 mov [e sp+ CPUMCTXCORE.eip], eax1177 mov [ebx + CPUMCTXCORE.eip], eax 1093 1178 %if GC_ARCH_BITS == 64 1094 1179 ; zero out the high dword 1095 mov dword [e sp+ CPUMCTXCORE.eip + 4], 01180 mov dword [ebx + CPUMCTXCORE.eip + 4], 0 1096 1181 %endif 1097 1182 mov eax, [ecx + VBOXTSS.eflags] 1098 mov [e sp+ CPUMCTXCORE.eflags], eax1183 mov [ebx + CPUMCTXCORE.eflags], eax 1099 1184 1100 1185 movzx eax, word [ecx + VBOXTSS.cs] 1101 mov dword [e sp+ CPUMCTXCORE.cs.Sel], eax1186 mov dword [ebx + CPUMCTXCORE.cs.Sel], eax 1102 1187 movzx eax, word [ecx + VBOXTSS.ds] 1103 mov dword [e sp+ CPUMCTXCORE.ds.Sel], eax1188 mov dword [ebx + CPUMCTXCORE.ds.Sel], eax 1104 1189 movzx eax, word [ecx + VBOXTSS.es] 1105 mov dword [e sp+ CPUMCTXCORE.es.Sel], eax1190 mov dword [ebx + CPUMCTXCORE.es.Sel], eax 1106 1191 movzx eax, word [ecx + VBOXTSS.fs] 1107 mov dword [e sp+ CPUMCTXCORE.fs.Sel], eax1192 mov dword [ebx + CPUMCTXCORE.fs.Sel], eax 1108 1193 movzx eax, word [ecx + VBOXTSS.gs] 1109 mov dword [e sp+ CPUMCTXCORE.gs.Sel], eax1194 mov dword [ebx + CPUMCTXCORE.gs.Sel], eax 1110 1195 movzx eax, word [ecx + VBOXTSS.ss] 1111 mov [e sp+ CPUMCTXCORE.ss.Sel], eax1196 mov [ebx + CPUMCTXCORE.ss.Sel], eax 1112 1197 mov eax, [ecx + VBOXTSS.esp] 1113 mov [e sp+ CPUMCTXCORE.esp], eax1198 mov [ebx + CPUMCTXCORE.esp], eax 1114 1199 %if GC_ARCH_BITS == 64 1115 1200 ; zero out the high dword 1116 mov dword [e sp+ CPUMCTXCORE.esp + 4], 01201 mov dword [ebx + CPUMCTXCORE.esp + 4], 0 1117 1202 %endif 1118 1203 mov eax, [ecx + VBOXTSS.ecx] 1119 mov [e sp+ CPUMCTXCORE.ecx], eax1204 mov [ebx + CPUMCTXCORE.ecx], eax 1120 1205 mov eax, [ecx + VBOXTSS.edx] 1121 mov [e sp+ CPUMCTXCORE.edx], eax1206 mov [ebx + CPUMCTXCORE.edx], eax 1122 1207 mov eax, [ecx + VBOXTSS.ebx] 1123 mov [e sp+ CPUMCTXCORE.ebx], eax1208 mov [ebx + CPUMCTXCORE.ebx], eax 1124 1209 mov eax, [ecx + VBOXTSS.eax] 1125 mov [e sp+ CPUMCTXCORE.eax], eax1210 mov [ebx + CPUMCTXCORE.eax], eax 1126 1211 mov eax, [ecx + VBOXTSS.ebp] 1127 mov [e sp+ CPUMCTXCORE.ebp], eax1212 mov [ebx + CPUMCTXCORE.ebp], eax 1128 1213 mov eax, [ecx + VBOXTSS.esi] 1129 mov [e sp+ CPUMCTXCORE.esi], eax1214 mov [ebx + CPUMCTXCORE.esi], eax 1130 1215 mov eax, [ecx + VBOXTSS.edi] 1131 mov [e sp+ CPUMCTXCORE.edi], eax1216 mov [ebx + CPUMCTXCORE.edi], eax 1132 1217 1133 1218 ; 1134 1219 ; Show regs 1135 1220 ; 1136 mov e bx, 0ffffffffh1221 mov eax, 0ffffffffh 1137 1222 mov ecx, 'trpH' ; indicate trap. 1138 1223 mov edx, 08h ; vector number 1139 lea eax, [esp]1140 1224 call trpmDbgDumpRegisterFrame 1141 1225 … … 1154 1238 df_to_host: 1155 1239 COM_S_PRINT 'Trying to return to host...',10,13 1156 mov ecx, esp1157 1240 mov edx, IMP(g_VM) 1158 1241 mov eax, VERR_TRPM_PANIC 1159 call [edx + VM.pfnVMMGCGuestToHostAsm HyperCtx]1242 call [edx + VM.pfnVMMGCGuestToHostAsm] 1160 1243 jmp short df_to_host 1161 1244 … … 1182 1265 ; Internal procedure used to dump registers. 1183 1266 ; 1184 ; @param e ax Pointer to CPUMCTXCORE.1267 ; @param ebx Pointer to CPUMCTXCORE. 1185 1268 ; @param edx Vector number 1186 1269 ; @param ecx 'trap' if trap, 'int' if interrupt. 1187 ; @param e bx Error code if trap.1270 ; @param eax Error code if trap. 1188 1271 ; 1189 1272 trpmDbgDumpRegisterFrame: … … 1253 1336 COM_S_DWORD_REG edx 1254 1337 COM_S_PRINT ' ErrorCode=' 1255 COM_S_DWORD_REG e bx1338 COM_S_DWORD_REG eax 1256 1339 COM_S_PRINT ' cr2=' 1257 1340 mov ecx, cr2 … … 1260 1343 tddrf_regs: 1261 1344 COM_S_PRINT ' ***',10,13,'cs:eip=' 1262 movzx ecx, word [e ax + CPUMCTXCORE.cs.Sel]1345 movzx ecx, word [ebx + CPUMCTXCORE.cs.Sel] 1263 1346 COM_S_DWORD_REG ecx 1264 1347 COM_S_CHAR ':' 1265 mov ecx, [e ax + CPUMCTXCORE.eip]1348 mov ecx, [ebx + CPUMCTXCORE.eip] 1266 1349 COM_S_DWORD_REG ecx 1267 1350 1268 1351 COM_S_PRINT ' ss:esp=' 1269 movzx ecx, word [e ax + CPUMCTXCORE.ss.Sel]1352 movzx ecx, word [ebx + CPUMCTXCORE.ss.Sel] 1270 1353 COM_S_DWORD_REG ecx 1271 1354 COM_S_CHAR ':' 1272 mov ecx, [e ax + CPUMCTXCORE.esp]1355 mov ecx, [ebx + CPUMCTXCORE.esp] 1273 1356 COM_S_DWORD_REG ecx 1274 1357 … … 1302 1385 1303 1386 COM_S_PRINT ' eflags=' 1304 mov ecx, [e ax + CPUMCTXCORE.eflags]1387 mov ecx, [ebx + CPUMCTXCORE.eflags] 1305 1388 COM_S_DWORD_REG ecx 1306 1389 … … 1323 1406 1324 1407 COM_S_PRINT 10,13,' ds=' 1325 movzx ecx, word [e ax + CPUMCTXCORE.ds.Sel]1408 movzx ecx, word [ebx + CPUMCTXCORE.ds.Sel] 1326 1409 COM_S_DWORD_REG ecx 1327 1410 1328 1411 COM_S_PRINT ' es=' 1329 movzx ecx, word [e ax + CPUMCTXCORE.es.Sel]1412 movzx ecx, word [ebx + CPUMCTXCORE.es.Sel] 1330 1413 COM_S_DWORD_REG ecx 1331 1414 1332 1415 COM_S_PRINT ' fs=' 1333 movzx ecx, word [e ax + CPUMCTXCORE.fs.Sel]1416 movzx ecx, word [ebx + CPUMCTXCORE.fs.Sel] 1334 1417 COM_S_DWORD_REG ecx 1335 1418 1336 1419 COM_S_PRINT ' gs=' 1337 movzx ecx, word [e ax + CPUMCTXCORE.gs.Sel]1420 movzx ecx, word [ebx + CPUMCTXCORE.gs.Sel] 1338 1421 COM_S_DWORD_REG ecx 1339 1422 1340 1423 1341 1424 COM_S_PRINT 10,13,'eax=' 1342 mov ecx, [e ax + CPUMCTXCORE.eax]1425 mov ecx, [ebx + CPUMCTXCORE.eax] 1343 1426 COM_S_DWORD_REG ecx 1344 1427 1345 1428 COM_S_PRINT ' ebx=' 1346 mov ecx, [e ax + CPUMCTXCORE.ebx]1429 mov ecx, [ebx + CPUMCTXCORE.ebx] 1347 1430 COM_S_DWORD_REG ecx 1348 1431 1349 1432 COM_S_PRINT ' ecx=' 1350 mov ecx, [e ax + CPUMCTXCORE.ecx]1433 mov ecx, [ebx + CPUMCTXCORE.ecx] 1351 1434 COM_S_DWORD_REG ecx 1352 1435 1353 1436 COM_S_PRINT ' edx=' 1354 mov ecx, [e ax + CPUMCTXCORE.edx]1437 mov ecx, [ebx + CPUMCTXCORE.edx] 1355 1438 COM_S_DWORD_REG ecx 1356 1439 1357 1440 1358 1441 COM_S_PRINT 10,13,'esi=' 1359 mov ecx, [e ax + CPUMCTXCORE.esi]1442 mov ecx, [ebx + CPUMCTXCORE.esi] 1360 1443 COM_S_DWORD_REG ecx 1361 1444 1362 1445 COM_S_PRINT ' edi=' 1363 mov ecx, [e ax + CPUMCTXCORE.edi]1446 mov ecx, [ebx + CPUMCTXCORE.edi] 1364 1447 COM_S_DWORD_REG ecx 1365 1448 1366 1449 COM_S_PRINT ' ebp=' 1367 mov ecx, [e ax + CPUMCTXCORE.ebp]1450 mov ecx, [ebx + CPUMCTXCORE.ebp] 1368 1451 COM_S_DWORD_REG ecx 1369 1452 -
trunk/src/VBox/VMM/VMMRC/VMMRCBuiltin.def
r35345 r41931 25 25 g_RelLogger DATA 26 26 g_pSUPGlobalInfoPage DATA 27 g_trpmGuestCtxCore DATA ; for TRPMRCHandlersA.asm only 28 g_trpmHyperCtxCore DATA ; for TRPMRCHandlersA.asm only 27 29 28 30 ; code -
trunk/src/VBox/VMM/include/CPUMInternal.h
r41905 r41931 369 369 CPUMCTXMSRS GuestMsrs; 370 370 371 /** Pointer to the current hypervisor core context - R3Ptr. */372 R3PTRTYPE(PCPUMCTXCORE) pHyperCoreR3;373 /** Pointer to the current hypervisor core context - R0Ptr. */374 R0PTRTYPE(PCPUMCTXCORE) pHyperCoreR0;375 /** Pointer to the current hypervisor core context - RCPtr. */376 RCPTRTYPE(PCPUMCTXCORE) pHyperCoreRC;377 378 371 /** Use flags. 379 372 * These flags indicates both what is to be used and what has been used. … … 401 394 402 395 /** Align the structure on a 64-byte boundary. */ 403 uint8_t abPadding2[HC_ARCH_BITS == 32 ? 34 : 26];396 uint8_t abPadding2[HC_ARCH_BITS == 32 ? 48 : 46]; 404 397 } CPUMCPU; 405 398 /** Pointer to the CPUMCPU instance data residing in the shared VMCPU structure. */ -
trunk/src/VBox/VMM/include/CPUMInternal.mac
r41906 r41931 424 424 ; Other stuff. 425 425 ; 426 ; hypervisor core context.427 .pHyperCoreR3 RTR3PTR_RES 1428 .pHyperCoreR0 RTR0PTR_RES 1429 .pHyperCoreRC RTRCPTR_RES 1430 431 426 .fUseFlags resd 1 432 427 .fChanged resd 1 … … 437 432 438 433 %if RTHCPTR_CB == 8 439 .abPadding2 resb 26434 .abPadding2 resb 46 440 435 %else 441 .abPadding2 resb 34436 .abPadding2 resb 48 442 437 %endif 443 438 -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r41906 r41931 59 59 GEN_CHECK_OFF(CPUMCPU, Guest); 60 60 GEN_CHECK_OFF(CPUMCPU, GuestMsrs); 61 GEN_CHECK_OFF(CPUMCPU, pHyperCoreR3);62 GEN_CHECK_OFF(CPUMCPU, pHyperCoreR0);63 GEN_CHECK_OFF(CPUMCPU, pHyperCoreRC);64 61 GEN_CHECK_OFF(CPUMCPU, fUseFlags); 65 62 GEN_CHECK_OFF(CPUMCPU, fChanged);
Note:
See TracChangeset
for help on using the changeset viewer.