VirtualBox

Changeset 26499 in vbox for trunk/src/recompiler/tcg/x86_64


Ignore:
Timestamp:
Feb 14, 2010 8:22:40 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57669
Message:

recompier: whitespace cleanup. (Clean up whitespace on the foreign code before trying to merge in new changes again.)

Location:
trunk/src/recompiler/tcg/x86_64
Files:
2 edited

Legend:

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

    r21292 r26499  
    8080
    8181static const int tcg_target_call_oarg_regs[2] = {
    82     TCG_REG_RAX, 
    83     TCG_REG_RDX 
     82    TCG_REG_RAX,
     83    TCG_REG_RDX
    8484};
    8585
    8686static uint8_t *tb_ret_addr;
    8787
    88 static void patch_reloc(uint8_t *code_ptr, int type, 
     88static void patch_reloc(uint8_t *code_ptr, int type,
    8989                        tcg_target_long value, tcg_target_long addend)
    9090{
     
    227227#define P_REXW  0x200 /* set rex.w = 1 */
    228228#define P_REXB  0x400 /* force rex use for byte registers */
    229                                  
     229
    230230static const uint8_t tcg_cond_to_jcc[10] = {
    231231    [TCG_COND_EQ] = JCC_JE,
     
    244244{
    245245    int rex;
    246     rex = ((opc >> 6) & 0x8) | ((r >> 1) & 0x4) | 
     246    rex = ((opc >> 6) & 0x8) | ((r >> 1) & 0x4) |
    247247        ((x >> 2) & 2) | ((rm >> 3) & 1);
    248248    if (rex || (opc & P_REXB)) {
     
    272272
    273273/* rm < 0 means no register index plus (-rm - 1 immediate bytes) */
    274 static inline void tcg_out_modrm_offset(TCGContext *s, int opc, int r, int rm, 
     274static inline void tcg_out_modrm_offset(TCGContext *s, int opc, int r, int rm,
    275275                                        tcg_target_long offset)
    276276{
     
    321321#if defined(CONFIG_SOFTMMU)
    322322/* XXX: incomplete. index must be different from ESP */
    323 static void tcg_out_modrm_offset2(TCGContext *s, int opc, int r, int rm, 
     323static void tcg_out_modrm_offset2(TCGContext *s, int opc, int r, int rm,
    324324                                  int index, int shift,
    325325                                  tcg_target_long offset)
     
    363363}
    364364
    365 static inline void tcg_out_movi(TCGContext *s, TCGType type, 
     365static inline void tcg_out_movi(TCGContext *s, TCGType type,
    366366                                int ret, tcg_target_long arg)
    367367{
     
    451451    int32_t val, val1;
    452452    TCGLabel *l = &s->labels[label_index];
    453    
     453
    454454    if (l->has_value) {
    455455        val = l->u.value - (tcg_target_long)s->code_ptr;
     
    483483}
    484484
    485 static void tcg_out_brcond(TCGContext *s, int cond, 
     485static void tcg_out_brcond(TCGContext *s, int cond,
    486486                           TCGArg arg1, TCGArg arg2, int const_arg2,
    487487                           int label_index, int rexw)
     
    510510     if ((val >> 32) != 0)
    511511     {
    512          tcg_out8(s, 0xc7); /* mov imm32, 4(%rsp) */ 
    513          tcg_out8(s, 0x44); 
     512         tcg_out8(s, 0xc7); /* mov imm32, 4(%rsp) */
     513         tcg_out8(s, 0x44);
    514514         tcg_out8(s, 0x24);
    515515         tcg_out8(s, 0x04);
     
    518518}
    519519
    520 DECLINLINE(void) tcg_out_long_call(TCGContext *s, tcg_target_long dst) 
     520DECLINLINE(void) tcg_out_long_call(TCGContext *s, tcg_target_long dst)
    521521{
    522522    intptr_t disp = dst - (tcg_target_long)s->code_ptr - 5;
     
    561561        return;
    562562    }
    563    
     563
    564564    disp = dst - (tcg_target_long)s->code_ptr - 5;
    565565    if (disp < 2LL * _1G && disp > -2LL * _1G)
     
    577577    tcg_out8(s, 0xe0);
    578578#endif
    579 } 
     579}
    580580#endif
    581581
     
    619619
    620620static void tcg_out_vbox_phys_read(TCGContext *s, int index, int addr_reg, int data_reg) {
    621     if (addr_reg != TCG_REG_RDI) 
     621    if (addr_reg != TCG_REG_RDI)
    622622        /* mov addr_reg, %rdi */
    623623        tcg_out_modrm(s, 0x8b |  P_REXW, TCG_REG_RDI, addr_reg);
    624    
     624
    625625    tcg_out_long_call(s, (tcg_target_long)vbox_ld_helpers[index]);
    626626    /* mov %rax, data_reg*/
     
    629629
    630630static void tcg_out_vbox_phys_write(TCGContext *s, int index, int addr_reg, int val_reg) {
    631     if (addr_reg != TCG_REG_RDI) 
     631    if (addr_reg != TCG_REG_RDI)
    632632        /* mov addr_reg, %rdi */
    633633        tcg_out_modrm(s, 0x8b |  P_REXW, TCG_REG_RDI, addr_reg);
    634     if (val_reg != TCG_REG_RSI) 
     634    if (val_reg != TCG_REG_RSI)
    635635        /* mov addr_reg, %rsi */
    636636        tcg_out_modrm(s, 0x8b | P_REXW, TCG_REG_RSI, val_reg);
     
    667667    /* mov */
    668668    tcg_out_modrm(s, 0x8b | rexw, r0, addr_reg);
    669  
     669
    670670    tcg_out_modrm(s, 0xc1 | rexw, 5, r1); /* shr $x, r1 */
    671     tcg_out8(s, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); 
    672    
     671    tcg_out8(s, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS);
     672
    673673    tcg_out_modrm(s, 0x81 | rexw, 4, r0); /* andl $x, r0 */
    674674    tcg_out32(s, TARGET_PAGE_MASK | ((1 << s_bits) - 1));
    675    
     675
    676676    tcg_out_modrm(s, 0x81, 4, r1); /* andl $x, r1 */
    677677    tcg_out32(s, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS);
     
    683683    /* cmp 0(r1), r0 */
    684684    tcg_out_modrm_offset(s, 0x3b | rexw, r0, r1, 0);
    685    
     685
    686686    /* mov */
    687687    tcg_out_modrm(s, 0x8b | rexw, r0, addr_reg);
    688    
     688
    689689    /* je label1 */
    690690    tcg_out8(s, 0x70 + JCC_JE);
     
    696696#ifndef VBOX
    697697    tcg_out8(s, 0xe8);
    698     tcg_out32(s, (tcg_target_long)qemu_ld_helpers[s_bits] - 
     698    tcg_out32(s, (tcg_target_long)qemu_ld_helpers[s_bits] -
    699699              (tcg_target_long)s->code_ptr - 4);
    700700#else
     
    731731    label2_ptr = s->code_ptr;
    732732    s->code_ptr++;
    733    
     733
    734734    /* label1: */
    735735    *label1_ptr = s->code_ptr - label1_ptr - 1;
    736736
    737737    /* add x(r1), r0 */
    738     tcg_out_modrm_offset(s, 0x03 | P_REXW, r0, r1, offsetof(CPUTLBEntry, addend) - 
     738    tcg_out_modrm_offset(s, 0x03 | P_REXW, r0, r1, offsetof(CPUTLBEntry, addend) -
    739739                         offsetof(CPUTLBEntry, addr_read));
    740740#else
    741741    r0 = addr_reg;
    742 #endif   
     742#endif
    743743
    744744#if !defined(VBOX) || !defined(REM_PHYS_ADDR_IN_TLB)
     
    764764        if (bswap) {
    765765            /* rolw $8, data_reg */
    766             tcg_out8(s, 0x66); 
     766            tcg_out8(s, 0x66);
    767767            tcg_out_modrm(s, 0xc1, 0, data_reg);
    768768            tcg_out8(s, 8);
     
    774774            tcg_out_modrm_offset(s, 0xb7 | P_EXT, data_reg, r0, 0);
    775775            /* rolw $8, data_reg */
    776             tcg_out8(s, 0x66); 
     776            tcg_out8(s, 0x66);
    777777            tcg_out_modrm(s, 0xc1, 0, data_reg);
    778778            tcg_out8(s, 8);
     
    855855    /* mov */
    856856    tcg_out_modrm(s, 0x8b | rexw, r0, addr_reg);
    857  
     857
    858858    tcg_out_modrm(s, 0xc1 | rexw, 5, r1); /* shr $x, r1 */
    859     tcg_out8(s, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); 
    860    
     859    tcg_out8(s, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS);
     860
    861861    tcg_out_modrm(s, 0x81 | rexw, 4, r0); /* andl $x, r0 */
    862862    tcg_out32(s, TARGET_PAGE_MASK | ((1 << s_bits) - 1));
    863    
     863
    864864    tcg_out_modrm(s, 0x81, 4, r1); /* andl $x, r1 */
    865865    tcg_out32(s, (CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS);
     
    871871    /* cmp 0(r1), r0 */
    872872    tcg_out_modrm_offset(s, 0x3b | rexw, r0, r1, 0);
    873    
     873
    874874    /* mov */
    875875    tcg_out_modrm(s, 0x8b | rexw, r0, addr_reg);
    876    
     876
    877877    /* je label1 */
    878878    tcg_out8(s, 0x70 + JCC_JE);
     
    902902#ifndef VBOX
    903903    tcg_out8(s, 0xe8);
    904     tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] - 
     904    tcg_out32(s, (tcg_target_long)qemu_st_helpers[s_bits] -
    905905              (tcg_target_long)s->code_ptr - 4);
    906906#else
     
    912912    label2_ptr = s->code_ptr;
    913913    s->code_ptr++;
    914    
     914
    915915    /* label1: */
    916916    *label1_ptr = s->code_ptr - label1_ptr - 1;
    917917
    918918    /* add x(r1), r0 */
    919     tcg_out_modrm_offset(s, 0x03 | P_REXW, r0, r1, offsetof(CPUTLBEntry, addend) - 
     919    tcg_out_modrm_offset(s, 0x03 | P_REXW, r0, r1, offsetof(CPUTLBEntry, addend) -
    920920                         offsetof(CPUTLBEntry, addr_write));
    921921#else
     
    983983{
    984984    int c;
    985    
     985
    986986    switch(opc) {
    987987    case INDEX_op_exit_tb:
     
    10041004            /* jmp Ev */
    10051005#ifndef VBOX
    1006             tcg_out_modrm_offset(s, 0xff, 4, -1, 
    1007                                  (tcg_target_long)(s->tb_next + 
     1006            tcg_out_modrm_offset(s, 0xff, 4, -1,
     1007                                 (tcg_target_long)(s->tb_next +
    10081008                                                   args[0]));
    10091009#else
    10101010            /* @todo: can we clobber RAX here? */
    1011             tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_RAX, 
     1011            tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_RAX,
    10121012                         (tcg_target_long)&(s->tb_next[args[0]]));
    10131013            tcg_out8(s, 0xff); tcg_out8(s, 0x20 | TCG_REG_RAX); /* jmp *(%rax) */
     
    10841084        tcg_out_modrm_offset(s, 0x8b | P_REXW, args[0], args[1], args[2]);
    10851085        break;
    1086        
     1086
    10871087    case INDEX_op_st8_i32:
    10881088    case INDEX_op_st8_i64:
     
    12131213        c = SHIFT_SAR;
    12141214        goto gen_shift32;
    1215        
     1215
    12161216    case INDEX_op_shl_i64:
    12171217        c = SHIFT_SHL;
     
    12341234        c = SHIFT_SAR;
    12351235        goto gen_shift64;
    1236        
     1236
    12371237    case INDEX_op_brcond_i32:
    1238         tcg_out_brcond(s, args[2], args[0], args[1], const_args[1], 
     1238        tcg_out_brcond(s, args[2], args[0], args[1], const_args[1],
    12391239                       args[3], 0);
    12401240        break;
    12411241    case INDEX_op_brcond_i64:
    1242         tcg_out_brcond(s, args[2], args[0], args[1], const_args[1], 
     1242        tcg_out_brcond(s, args[2], args[0], args[1], const_args[1],
    12431243                       args[3], P_REXW);
    12441244        break;
     
    12951295        tcg_out_qemu_ld(s, args, 3);
    12961296        break;
    1297        
     1297
    12981298    case INDEX_op_qemu_st8:
    12991299        tcg_out_qemu_st(s, args, 0);
     
    13381338    push_size = 8 + ARRAY_SIZE(tcg_target_callee_save_regs) * 8;
    13391339    frame_size = push_size + TCG_STATIC_CALL_ARGS_SIZE;
    1340     frame_size = (frame_size + TCG_TARGET_STACK_ALIGN - 1) & 
     1340    frame_size = (frame_size + TCG_TARGET_STACK_ALIGN - 1) &
    13411341        ~(TCG_TARGET_STACK_ALIGN - 1);
    13421342    stack_addend = frame_size - push_size;
     
    13441344
    13451345    tcg_out_modrm(s, 0xff, 4, TCG_REG_RDI); /* jmp *%rdi */
    1346    
     1346
    13471347    /* TB epilogue */
    13481348    tb_ret_addr = s->code_ptr;
     
    14531453    tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffff);
    14541454    tcg_regset_set32(tcg_target_call_clobber_regs, 0,
    1455                      (1 << TCG_REG_RDI) | 
    1456                      (1 << TCG_REG_RSI) | 
     1455                     (1 << TCG_REG_RDI) |
     1456                     (1 << TCG_REG_RSI) |
    14571457                     (1 << TCG_REG_RDX) |
    14581458                     (1 << TCG_REG_RCX) |
     
    14621462                     (1 << TCG_REG_R10) |
    14631463                     (1 << TCG_REG_R11));
    1464    
     1464
    14651465    tcg_regset_clear(s->reserved_regs);
    14661466    tcg_regset_set_reg(s->reserved_regs, TCG_REG_RSP);
  • trunk/src/recompiler/tcg/x86_64/tcg-target.h

    r21292 r26499  
    6060
    6161/* used for function call generation */
    62 #define TCG_REG_CALL_STACK TCG_REG_RSP 
     62#define TCG_REG_CALL_STACK TCG_REG_RSP
    6363#define TCG_TARGET_STACK_ALIGN 16
    6464#define TCG_TARGET_CALL_STACK_OFFSET 0
Note: See TracChangeset for help on using the changeset viewer.

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