VirtualBox

Ignore:
Timestamp:
Feb 23, 2009 10:46:45 PM (16 years ago)
Author:
vboxsync
Message:

Old REM: New TR sync.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/target-i386/helper.c

    r14411 r17039  
    44514451}
    44524452
    4453 /**
    4454  * Correctly loads a new tr selector.
    4455  *
    4456  * @param   env1        CPU environment.
    4457  * @param   selector    Selector to load.
    4458  */
    4459 int sync_tr(CPUX86State *env1, int selector)
    4460 {
    4461     /* ARG! this was going to call helper_ltr_T0 but that won't work because of busy flag. */
    4462     SegmentCache *dt;
    4463     uint32_t e1, e2;
    4464     int index, type, entry_limit;
    4465     target_ulong ptr;
    4466     CPUX86State *saved_env = env;
    4467     env = env1;
    4468 
    4469     selector &= 0xffff;
    4470     if ((selector & 0xfffc) == 0) {
    4471         /* NULL selector case: invalid TR */
    4472         env->tr.base = 0;
    4473         env->tr.limit = 0;
    4474         env->tr.flags = 0;
    4475     } else {
    4476         if (selector & 0x4)
    4477             goto l_failure;
    4478         dt = &env->gdt;
    4479         index = selector & ~7;
    4480 #ifdef TARGET_X86_64
    4481         if (env->hflags & HF_LMA_MASK)
    4482             entry_limit = 15;
    4483         else
    4484 #endif
    4485             entry_limit = 7;
    4486         if ((index + entry_limit) > dt->limit)
    4487             goto l_failure;
    4488         ptr = dt->base + index;
    4489         e1 = ldl_kernel(ptr);
    4490         e2 = ldl_kernel(ptr + 4);
    4491         type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
    4492         if ((e2 & DESC_S_MASK) /*||
    4493             (type != 1 && type != 9)*/)
    4494             goto l_failure;
    4495         if (!(e2 & DESC_P_MASK))
    4496             goto l_failure;
    4497 #ifdef TARGET_X86_64
    4498         if (env->hflags & HF_LMA_MASK) {
    4499             uint32_t e3;
    4500             e3 = ldl_kernel(ptr + 8);
    4501             load_seg_cache_raw_dt(&env->tr, e1, e2);
    4502             env->tr.base |= (target_ulong)e3 << 32;
    4503         } else
    4504 #endif
    4505         {
    4506             load_seg_cache_raw_dt(&env->tr, e1, e2);
    4507         }
    4508         e2 |= DESC_TSS_BUSY_MASK;
    4509         stl_kernel(ptr + 4, e2);
    4510     }
    4511     env->tr.selector = selector;
    4512 
    4513     env = saved_env;
    4514     return 0;
    4515 l_failure:
    4516     AssertMsgFailed(("selector=%d\n", selector));
    4517     return -1;
    4518 }
    4519 
    45204453int emulate_single_instr(CPUX86State *env1)
    45214454{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette