Changeset 47309 in vbox for trunk/src/recompiler/target-i386
- Timestamp:
- Jul 22, 2013 2:42:08 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87449
- Location:
- trunk/src/recompiler/target-i386
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/target-i386/cpu.h
r43394 r47309 116 116 117 117 #define DESC_TSS_BUSY_MASK (1 << 9) 118 #ifdef VBOX 119 # define DESC_INTEL_UNUSABLE RT_BIT_32(16+8) /**< Internal VT-x bit for NULL sectors. */ 120 #endif 118 121 119 122 /* eflags masks */ … … 949 952 if (flags & DESC_P_MASK) 950 953 flags |= DESC_A_MASK; /* Make sure the A bit is set to avoid trouble. */ 954 if (selector < 4U && (env->hflags & HF_CS64_MASK)) 955 flags |= DESC_INTEL_UNUSABLE; 956 else 957 flags &= ~DESC_INTEL_UNUSABLE; 951 958 sc->flags = flags; 952 959 sc->newselector = 0; -
trunk/src/recompiler/target-i386/op_helper.c
r45494 r47309 274 274 sc->flags = e2; 275 275 #ifdef VBOX 276 sc->flags &= ~DESC_INTEL_UNUSABLE; 276 277 sc->newselector = 0; 277 278 sc->fVBoxFlags = CPUMSELREG_FLAGS_VALID; … … 624 625 env->ldt.flags = 0; 625 626 #ifdef VBOX 627 env->ldt.flags = DESC_INTEL_UNUSABLE; 626 628 env->ldt.fVBoxFlags = CPUMSELREG_FLAGS_VALID; 627 629 env->ldt.newselector = 0; … … 1326 1328 if (new_stack) { 1327 1329 ss = 0 | dpl; 1330 #ifndef VBOX 1328 1331 cpu_x86_load_seg_cache(env, R_SS, ss, 0, 0, 0); 1332 #else 1333 cpu_x86_load_seg_cache(env, R_SS, ss, 0, 0, dpl << DESC_DPL_SHIFT); 1334 #endif 1329 1335 } 1330 1336 ESP = esp; … … 2503 2509 env->ldt.limit = 0; 2504 2510 #ifdef VBOX 2511 env->ldt.flags = DESC_INTEL_UNUSABLE; 2505 2512 env->ldt.fVBoxFlags = CPUMSELREG_FLAGS_VALID; 2506 2513 env->ldt.newselector = 0; … … 2569 2576 env->tr.flags = 0; 2570 2577 #ifdef VBOX 2578 env->tr.flags = DESC_INTEL_UNUSABLE; 2571 2579 env->tr.fVBoxFlags = CPUMSELREG_FLAGS_VALID; 2572 2580 env->tr.newselector = 0; … … 2645 2653 if ((selector & 0xfffc) == 0) { 2646 2654 /* null selector case */ 2655 #ifndef VBOX 2647 2656 if (seg_reg == R_SS 2648 2657 #ifdef TARGET_X86_64 … … 2652 2661 raise_exception_err(EXCP0D_GPF, 0); 2653 2662 cpu_x86_load_seg_cache(env, seg_reg, selector, 0, 0, 0); 2663 #else 2664 if (seg_reg == R_SS) { 2665 if (!(env->hflags & HF_CS64_MASK) || cpl == 3) 2666 raise_exception_err(EXCP0D_GPF, 0); 2667 e2 = (cpl << DESC_DPL_SHIFT) | DESC_INTEL_UNUSABLE; 2668 } else { 2669 e2 = DESC_INTEL_UNUSABLE; 2670 } 2671 cpu_x86_load_seg_cache(env, seg_reg, selector, 0, 0, e2); 2672 #endif 2654 2673 } else { 2655 2674 … … 3321 3340 #endif 3322 3341 { 3342 #if defined(VBOX) && defined(DEBUG) 3343 Log(("NULL ss, rpl=%d\n", rpl)); 3344 #endif 3323 3345 raise_exception_err(EXCP0D_GPF, 0); 3324 3346 } 3325 3347 } else { 3326 3348 if ((new_ss & 3) != rpl) 3349 { 3350 #if defined(VBOX) && defined(DEBUG) 3351 Log(("new_ss=%x != rpl=%d\n", new_ss, rpl)); 3352 #endif 3327 3353 raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); 3354 } 3328 3355 if (load_segment(&ss_e1, &ss_e2, new_ss) != 0) 3356 { 3357 #if defined(VBOX) && defined(DEBUG) 3358 Log(("new_ss=%x load error\n", new_ss)); 3359 #endif 3329 3360 raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); 3361 } 3330 3362 if (!(ss_e2 & DESC_S_MASK) || 3331 3363 (ss_e2 & DESC_CS_MASK) || 3332 3364 !(ss_e2 & DESC_W_MASK)) 3365 { 3366 #if defined(VBOX) && defined(DEBUG) 3367 Log(("new_ss=%x ss_e2=%#x bad type\n", new_ss, ss_e2)); 3368 #endif 3333 3369 raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); 3370 } 3334 3371 dpl = (ss_e2 >> DESC_DPL_SHIFT) & 3; 3335 3372 if (dpl != rpl) 3373 { 3374 #if defined(VBOX) && defined(DEBUG) 3375 Log(("SS.dpl=%u != rpl=%u\n", dpl, rpl)); 3376 #endif 3336 3377 raise_exception_err(EXCP0D_GPF, new_ss & 0xfffc); 3378 } 3337 3379 if (!(ss_e2 & DESC_P_MASK)) 3380 { 3381 #if defined(VBOX) && defined(DEBUG) 3382 Log(("new_ss=%#x #NP\n", new_ss)); 3383 #endif 3338 3384 raise_exception_err(EXCP0B_NOSEG, new_ss & 0xfffc); 3385 } 3339 3386 #ifdef VBOX 3340 3387 if (!(e2 & DESC_A_MASK)) … … 3419 3466 3420 3467 #ifdef VBOX 3468 Log(("iret (shift=%d new_eip=%#x)\n", shift, next_eip)); 3421 3469 e1 = e2 = 0; /** @todo Why do we do this? */ 3422 3470 remR3TrapClear(env->pVM); … … 3427 3475 #ifdef TARGET_X86_64 3428 3476 if (env->hflags & HF_LMA_MASK) 3477 { 3478 #if defined(VBOX) && defined(DEBUG) 3479 Log(("eflags.NT=1 on iret in long mode\n")); 3480 #endif 3429 3481 raise_exception_err(EXCP0D_GPF, 0); 3482 } 3430 3483 #endif 3431 3484 tss_selector = lduw_kernel(env->tr.base + 0); … … 3597 3650 env->dr[reg] = t0; 3598 3651 hw_breakpoint_insert(env, reg); 3652 # ifndef VBOX 3599 3653 } else if (reg == 7) { 3654 # else 3655 } else if (reg == 7 || reg == 5) { 3656 # endif 3600 3657 for (i = 0; i < 4; i++) 3601 3658 hw_breakpoint_remove(env, i); … … 3604 3661 hw_breakpoint_insert(env, i); 3605 3662 } else 3663 # ifndef VBOX 3606 3664 env->dr[reg] = t0; 3665 # else 3666 env->dr[6] = (t0 & ~RT_BIT_32(12)) | UINT32_C(0xffff0ff0); /* 4 is an alias for 6. */ 3667 # endif 3607 3668 } 3608 3669 #endif
Note:
See TracChangeset
for help on using the changeset viewer.