VirtualBox

Ignore:
Timestamp:
Jul 19, 2011 10:08:30 AM (13 years ago)
Author:
vboxsync
Message:

tcg-target.c: Make sure the stack is aligned on darwin (VBoxREM64 only).

File:
1 edited

Legend:

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

    r37697 r38064  
    464464               the 32-bit-mode absolute addressing encoding.  */
    465465#ifdef VBOX
    466             tcg_target_long pc = (tcg_target_long)s->code_ptr 
     466            tcg_target_long pc = (tcg_target_long)s->code_ptr
    467467                               + tcg_calc_opc_len(s, opc, r, 0, 0) + 1 + 4;
    468468#else
     
    993993{
    994994#ifdef VBOX
    995     tcg_target_long disp = dest - (tcg_target_long)s->code_ptr 
     995    tcg_target_long disp = dest - (tcg_target_long)s->code_ptr
    996996                         - tcg_calc_opc_len(s, call ? OPC_CALL_Jz : OPC_JMP_long, 0, 0, 0)
    997997                         - 4;
     
    15191519    }
    15201520
    1521 #if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB)
     1521# if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB)
     1522#  if defined(VBOX) && defined(RT_OS_DARWIN) && ARCH_BITS == 32
     1523#   define VBOX_16_BYTE_STACK_ALIGN
     1524#  endif
    15221525
    15231526    /* XXX: move that code at the end of the TB */
     
    15311534        if (opc == 3) {
    15321535            tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_ECX, data_reg2);
     1536#  ifdef VBOX_16_BYTE_STACK_ALIGN
     1537            tcg_out_subi(s, TCG_REG_ESP, 12);
     1538#  endif
    15331539            tcg_out_pushi(s, mem_index);
    15341540            stack_adjust = 4;
     
    15401546        if (opc == 3) {
    15411547            tcg_out_mov(s, TCG_TYPE_I32, TCG_REG_EDX, args[addrlo_idx + 1]);
     1548#  ifdef VBOX_16_BYTE_STACK_ALIGN
     1549            tcg_out_pushi(s, 0);
     1550#  endif
    15421551            tcg_out_pushi(s, mem_index);
    15431552            tcg_out_push(s, data_reg2);
     
    15571566                break;
    15581567            }
     1568#  ifdef VBOX_16_BYTE_STACK_ALIGN
     1569            tcg_out_subi(s, TCG_REG_ESP, 12);
     1570#  endif
    15591571            tcg_out_pushi(s, mem_index);
    15601572            stack_adjust = 4;
     
    15641576    tcg_out_calli(s, (tcg_target_long)qemu_st_helpers[s_bits]);
    15651577
     1578#  ifdef VBOX_16_BYTE_STACK_ALIGN
     1579    if (stack_adjust != 0) {
     1580        tcg_out_addi(s, TCG_REG_ESP, RT_ALIGN(stack_adjust, 16));
     1581    }
     1582#  else
    15661583    if (stack_adjust == (TCG_TARGET_REG_BITS / 8)) {
    15671584        /* Pop and discard.  This is 2 bytes smaller than the add.  */
     
    15701587        tcg_out_addi(s, TCG_REG_ESP, stack_adjust);
    15711588    }
    1572 
    1573 #else  /* VBOX && REM_PHYS_ADDR_IN_TLB */
    1574 # error Borked
     1589#  endif
     1590
     1591# else  /* VBOX && REM_PHYS_ADDR_IN_TLB */
     1592#  error Borked
    15751593    tcg_out_vbox_phys_write(s, opc, r0, data_reg, data_reg2);
    1576 #endif /* VBOX && REM_PHYS_ADDR_IN_TLB */
     1594# endif /* VBOX && REM_PHYS_ADDR_IN_TLB */
    15771595
    15781596    /* label2: */
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