- Timestamp:
- Dec 4, 2008 3:39:41 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/CPUMInternal.mac
r14987 r14993 28 28 %define CPUM_USE_DEBUG_REGS_HOST RT_BIT(4) 29 29 %define CPUM_USE_DEBUG_REGS RT_BIT(5) 30 %define CPUM_SYNC_FPU_STATE RT_BIT(7) 31 %define CPUM_SYNC_DEBUG_STATE RT_BIT(8) 30 32 31 33 %define CPUM_HANDLER_DS 1 -
trunk/src/VBox/VMM/VMMGC/HWACCMGCA.asm
r14900 r14993 170 170 ; * 171 171 ; * @returns VBox status code 172 ; * @param pCtx Guest context 172 ; * @param pCtx Guest context (rsi) 173 173 ; */ 174 174 BEGINPROC VMXGCStartVM64 … … 371 371 ; * 372 372 ; * @returns VBox status code 373 ; * @param HCPhysVMCB Physical address of host VMCB 374 ; * @param HCPhysVMCB Physical address of guest VMCB 375 ; * @param pCtx Guest context 373 ; * @param HCPhysVMCB Physical address of host VMCB (rsp+8) 374 ; * @param HCPhysVMCB Physical address of guest VMCB (rsp+16) 375 ; * @param pCtx Guest context (rsi) 376 376 ; */ 377 377 BEGINPROC SVMGCVMRun64 378 ; fake a cdecl stack frame379 %ifdef ASM_CALL64_GCC380 push rdx381 push rsi382 push rdi383 %else384 push r8385 push rdx386 push rcx387 %endif388 push 0389 378 push rbp 390 379 mov rbp, rsp … … 405 394 406 395 ;/* Save the Guest CPU context pointer. */ 407 mov rsi, [rbp + 8*2 + RTHCPHYS_CB*2] ; pCtx408 396 push rsi ; push for saving the state at the end 409 397 … … 413 401 414 402 ; save host fs, gs, sysenter msr etc 415 mov rax, [rbp + 8 *2] ; pVMCBHostPhys (64 bits physical address; x86: take low dword only)416 push rax ; save for the vmload after vmrun403 mov rax, [rbp + 8] ; pVMCBHostPhys (64 bits physical address) 404 push rax ; save for the vmload after vmrun 417 405 vmsave 418 406 419 407 ; setup eax for VMLOAD 420 mov rax, [rbp + 8 *2 + RTHCPHYS_CB] ; pVMCBPhys (64 bits physical address; take low dword only)408 mov rax, [rbp + 8 + RTHCPHYS_CB] ; pVMCBPhys (64 bits physical address) 421 409 422 410 ;/* Restore Guest's general purpose registers. */ … … 483 471 popf 484 472 pop rbp 485 add rsp, 4*8486 473 ret 487 474 ENDPROC SVMGCVMRun64 -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r14945 r14993 2284 2284 DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu) 2285 2285 { 2286 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64); 2286 int rc; 2287 RTCCUINTREG uFlags; 2288 2289 /* @todo This code is not guest SMP safe (hyper context) */ 2290 AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED); 2291 2292 uFlags = ASMIntDisableFlags(); 2293 2294 CPUMSetHyperESP(pVM, VMMGetStackRC(pVM)); 2295 CPUMPushHyper(pVM, (uint32_t)(pVMCBHostPhys >> 32)); /* Param 2: pVMCBHostPhys - Hi. */ 2296 CPUMPushHyper(pVM, (uint32_t)pVMCBHostPhys); /* Param 2: pVMCBHostPhys - Lo. */ 2297 CPUMPushHyper(pVM, (uint32_t)(pVMCBPhys >> 32)); /* Param 1: pVMCBPhys - Hi. */ 2298 CPUMPushHyper(pVM, (uint32_t)pVMCBPhys); /* Param 1: pVMCBPhys - Lo. */ 2299 CPUMSetHyperEIP(pVM, pVM->hwaccm.s.pfnVMXGCStartVM64); 2300 2301 /* Call switcher. */ 2302 rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM); 2303 2304 ASMSetFlags(uFlags); 2305 return rc; 2287 2306 } 2288 2307 -
trunk/src/VBox/VMM/VMMSwitcher/LegacyandAMD64.mac
r14988 r14993 136 136 pop dword [edx + CPUMCPU.Host.eflags] 137 137 138 ;; handle use flags.139 mov esi, [edx + CPUMCPU.fUseFlags] ; esi == use flags.140 and esi, ~CPUM_USED_FPU ; Clear CPUM_USED_* flags. ;;@todo FPU check can be optimized to use cr0 flags!141 mov [edx + CPUMCPU.fUseFlags], esi142 143 138 ; control registers. 144 139 mov eax, cr0 … … 240 235 mov ds, rax 241 236 mov es, rax 242 237 243 238 ; Setup stack; use the lss_esp, ss pair for lss 244 239 DEBUG_CHAR('7') … … 248 243 lss esp, [rdx + CPUM.Hyper.lss_esp] 249 244 250 ; call the hypervisor function with rdx=pCpumCpu 251 mov eax, [rdx + CPUM.Hyper.eip] 245 ; load the hypervisor function address 246 mov r9, [rdx + CPUM.Hyper.eip] 247 252 248 CPUMCPU_FROM_CPUM(edx) 249 250 ; Check if we need to restore the guest FPU state 251 mov esi, [rdx + CPUMCPU.fUseFlags] ; esi == use flags. 252 test esi, CPUM_SYNC_FPU_STATE 253 jz near gth_fpu_no 254 255 mov rax, cr0 256 mov rcx, rax ; save old CR0 257 and rax, ~(X86_CR0_TS | X86_CR0_EM) 258 mov cr0, rax 259 fxrstor [rdx + CPUMCPU.Guest.fpu] 260 mov cr0, rcx ; and restore old CR0 again 261 262 gth_fpu_no: 263 ; Check if we need to restore the guest debug state 264 test esi, CPUM_SYNC_DEBUG_STATE 265 jz near gth_debug_no 266 267 mov rax, qword [rdx + CPUMCPU.Guest.dr + 0*8] 268 mov dr0, rax 269 mov rax, qword [rdx + CPUMCPU.Guest.dr + 1*8] 270 mov dr1, rax 271 mov rax, qword [rdx + CPUMCPU.Guest.dr + 2*8] 272 mov dr2, rax 273 mov rax, qword [rdx + CPUMCPU.Guest.dr + 3*8] 274 mov dr3, rax 275 mov rax, qword [rdx + CPUMCPU.Guest.dr + 6*8] 276 mov dr6, rax ; not required for AMD-V 277 278 gth_debug_no: 253 279 254 280 ; parameter for all helper functions (pCtx) 255 281 lea rsi, [rdx + CPUMCPU.Guest.fpu] 256 call r ax282 call r9 257 283 258 284 ; Load CPUM pointer into rdx
Note:
See TracChangeset
for help on using the changeset viewer.