VirtualBox

Ignore:
Timestamp:
Jun 29, 2011 7:02:40 PM (13 years ago)
Author:
vboxsync
Message:

rem: fixed 64-bit host bustage.

File:
1 edited

Legend:

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

    r37689 r37696  
    364364};
    365365
     366#if defined(VBOX)
     367/* Calc the size of the tcg_out_opc() result. */
     368static inline unsigned char tcg_calc_opc_len(TCGContext *s, int opc, int r, int rm, int x)
     369{
     370    unsigned char len = 1;
     371# if TCG_TARGET_REG_BITS == 64
     372    unsigned rex;
     373    rex = 0;
     374    rex |= (opc & P_REXW) >> 8;         /* REX.W */
     375    rex |= (r & 8) >> 1;                /* REX.R */
     376    rex |= (x & 8) >> 2;                /* REX.X */
     377    rex |= (rm & 8) >> 3;               /* REX.B */
     378    rex |= opc & (r >= 4 ? P_REXB_R : 0);
     379    rex |= opc & (rm >= 4 ? P_REXB_RM : 0);
     380    if (rex)            len++;
     381    if (opc & P_ADDR32) len++;
     382# endif
     383    if (opc & P_DATA16) len++;
     384    if (opc & P_EXT)    len++;
     385
     386    return len;
     387}
     388#endif
     389
    366390#if TCG_TARGET_REG_BITS == 64
    367391static void tcg_out_opc(TCGContext *s, int opc, int r, int rm, int x)
     
    439463            /* Try for a rip-relative addressing mode.  This has replaced
    440464               the 32-bit-mode absolute addressing encoding.  */
     465#ifdef VBOX
     466            tcg_target_long pc = (tcg_target_long)s->code_ptr + tcg_calc_opc_len(s, opc, r, 0, 0) + 5;
     467#else
    441468            tcg_target_long pc = (tcg_target_long)s->code_ptr + 5 + ~rm;
     469#endif
    442470            tcg_target_long disp = offset - pc;
    443471            if (disp == (int32_t)disp) {
     
    445473                tcg_out8(s, (LOWREGMASK(r) << 3) | 5);
    446474                tcg_out32(s, disp);
     475#ifdef VBOX
     476                Assert(pc == (tcg_target_long)s->code_ptr);
     477#endif
    447478                return;
    448479            }
     
    960991static void tcg_out_branch(TCGContext *s, int call, tcg_target_long dest)
    961992{
     993#ifdef VBOX
     994    tcg_target_long disp = dest - (tcg_target_long)s->code_ptr
     995                         - tcg_calc_opc_len(s, call ? OPC_CALL_Jz : OPC_JMP_long, 0, 0, 0);
     996#else
    962997    tcg_target_long disp = dest - (tcg_target_long)s->code_ptr - 5;
     998#endif
    963999
    9641000    if (disp == (int32_t)disp) {
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