VirtualBox

Changeset 1514 in vbox for trunk


Ignore:
Timestamp:
Mar 15, 2007 2:57:05 PM (18 years ago)
Author:
vboxsync
Message:

Update eip for each instruction. (makes it easier to generate exceptions)
Re-enabled null selector check during memory accesses.

Location:
trunk/src/recompiler/target-i386
Files:
2 edited

Legend:

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

    r1511 r1514  
    496496        sync_seg(env, idx, env->segs[idx].newselector);
    497497    }
    498 #if 0
    499498    /* Loading a null selector into a segment register is valid, but using it is most definitely not! */
    500499    if (    (env->cr[0] & (CR0_PE_MASK|CR0_PG_MASK)) == (CR0_PE_MASK|CR0_PG_MASK)
     
    505504        raise_exception(EXCP0D_GPF);
    506505    }
    507 #endif
    508 
    509506    A0 = (uint32_t)env->segs[idx].base;
     507    FORCE_RET();
    510508#else
    511509    A0 = (uint32_t)*(target_ulong *)((char *)env + PARAM1);
     
    522520        sync_seg(env, idx, env->segs[idx].newselector);
    523521    }
    524 #if 0
    525522    /* Loading a null selector into a segment register is valid, but using it is most definitely not! */
    526523    if (    (env->cr[0] & (CR0_PE_MASK|CR0_PG_MASK)) == (CR0_PE_MASK|CR0_PG_MASK)
     
    531528        raise_exception(EXCP0D_GPF);
    532529    }
    533 #endif
    534530    A0 = (uint32_t)(A0 + env->segs[idx].base);
     531    FORCE_RET();
    535532#else
    536533    A0 = (uint32_t)(A0 + *(target_ulong *)((char *)env + PARAM1));
  • trunk/src/recompiler/target-i386/translate.c

    r1478 r1514  
    833833    gen_op_check_external_event();
    834834}
     835
     836static inline void gen_update_eip(target_ulong pc)
     837{
     838#ifdef TARGET_X86_64
     839    if (pc == (uint32_t)pc) {
     840        gen_op_movl_eip_im(pc);
     841    } else if (pc == (int32_t)pc) {
     842        gen_op_movq_eip_im(pc);
     843    } else {
     844        gen_op_movq_eip_im64(pc >> 32, pc);
     845    }
     846#else
     847    gen_op_movl_eip_im(pc);
     848#endif
     849}
     850
    835851#endif /* VBOX */
    836852
     
    839855#ifdef VBOX
    840856    gen_check_external_event();
    841 #endif /* VBOX */
     857#endif
    842858#ifdef TARGET_X86_64
    843859    if (pc == (uint32_t)pc) {
     
    31343150#endif
    31353151    s->rip_offset = 0; /* for relative ip address */
     3152
     3153#ifdef VBOX
     3154    /* Always update EIP. Otherwise one must be very careful with generated code that can raise exceptions. */
     3155    gen_update_eip(pc_start - s->cs_base);
     3156#endif
     3157
    31363158 next_byte:
    31373159    b = ldub_code(s->pc);
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