VirtualBox

Changeset 13999 in vbox for trunk/src/recompiler_new


Ignore:
Timestamp:
Nov 10, 2008 12:09:18 PM (16 years ago)
Author:
vboxsync
Message:

fixed triple fault, implemented segment sync code, maybe not really needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler_new/target-i386/translate.c

    r13968 r13999  
    631631#endif
    632632}
     633#ifdef VBOX
     634DECLINLINE(void) gen_op_seg_check(int reg, bool keepA0)
     635{
     636    /* It seems segments doesn't get out of sync - if they do in fact - enable below code. */
     637#if 0
     638    /* Our segments could be outdated, thus check for newselector field to see if update really needed */
     639    int skip_label;
     640    TCGv t0, a0;
     641
     642    /* For other segments this check is waste of time, and also TCG is unable to cope with this code,
     643       for data segments, as expects alive temps */
     644    if (reg != R_GS)
     645        return;
     646
     647    if (keepA0)
     648    {
     649        /* we need to store old cpu_A0 */
     650        a0 = tcg_temp_local_new(TCG_TYPE_TL);
     651        tcg_gen_mov_tl(a0, cpu_A0);
     652    }
     653
     654    skip_label = gen_new_label();
     655    t0 = tcg_temp_local_new(TCG_TYPE_TL);
     656
     657    tcg_gen_ld32u_tl(t0, cpu_env, offsetof(CPUState, segs[reg].newselector) + REG_L_OFFSET);
     658    tcg_gen_brcondi_i32(TCG_COND_EQ, t0, 0, skip_label);
     659    tcg_gen_ld32u_tl(t0, cpu_env, offsetof(CPUState, eflags) + REG_L_OFFSET);
     660    tcg_gen_andi_tl(t0, t0, VM_MASK);
     661    tcg_gen_brcondi_i32(TCG_COND_NE, t0, 0, skip_label);   
     662    tcg_gen_movi_tl(t0, reg);
     663   
     664    tcg_gen_helper_0_1(helper_sync_seg, t0);
     665
     666    tcg_temp_free(t0);
     667
     668   gen_set_label(skip_label);
     669    if (keepA0)
     670    {
     671        tcg_gen_mov_tl(cpu_A0, a0);
     672        tcg_temp_free(a0);
     673    }
     674#endif /* 0 */
     675}
     676#endif
    633677
    634678#ifndef VBOX
     
    638682#endif /* VBOX */
    639683{
     684#ifdef VBOX
     685    gen_op_seg_check(reg, false);
     686#endif
    640687    tcg_gen_ld32u_tl(cpu_A0, cpu_env, offsetof(CPUState, segs[reg].base) + REG_L_OFFSET);
    641688}
     
    647694#endif /* VBOX */
    648695{
     696#ifdef VBOX
     697    gen_op_seg_check(reg, true);
     698#endif
    649699    tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, segs[reg].base));
    650700    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
     
    661711#endif /* VBOX */
    662712{
     713#ifdef VBOX
     714    gen_op_seg_check(reg, false);
     715#endif
    663716    tcg_gen_ld_tl(cpu_A0, cpu_env, offsetof(CPUState, segs[reg].base));
    664717}
     
    670723#endif /* VBOX */
    671724{
     725#ifdef VBOX
     726    gen_op_seg_check(reg, true);
     727#endif
    672728    tcg_gen_ld_tl(cpu_tmp0, cpu_env, offsetof(CPUState, segs[reg].base));
    673729    tcg_gen_add_tl(cpu_A0, cpu_A0, cpu_tmp0);
     
    78537909            if (!s->pe || s->vm86)
    78547910                goto illegal_op;
     7911
    78557912            t0 = tcg_temp_local_new(TCG_TYPE_TL);
    78567913            t1 = tcg_temp_local_new(TCG_TYPE_TL);
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