/[qemu]/qemu/exec.h
ViewVC logotype

Diff of /qemu/exec.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by bellard, Wed Aug 20 23:02:09 2003 UTC revision 1.20 by bellard, Wed Sep 17 22:53:20 2003 UTC
# Line 108  typedef struct TranslationBlock { Line 108  typedef struct TranslationBlock {
108         the code of this one. */         the code of this one. */
109      uint16_t tb_next_offset[2]; /* offset of original jump target */      uint16_t tb_next_offset[2]; /* offset of original jump target */
110  #ifdef USE_DIRECT_JUMP  #ifdef USE_DIRECT_JUMP
111      uint16_t tb_jmp_offset[2]; /* offset of jump instruction */      uint16_t tb_jmp_offset[4]; /* offset of jump instruction */
112  #else  #else
113      uint32_t tb_next[2]; /* address of jump generated code */      uint32_t tb_next[2]; /* address of jump generated code */
114  #endif  #endif
# Line 160  static inline TranslationBlock *tb_find( Line 160  static inline TranslationBlock *tb_find(
160    
161  #if defined(__powerpc__)  #if defined(__powerpc__)
162    
163  static inline void tb_set_jmp_target(TranslationBlock *tb,  static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr)
                                      int n, unsigned long addr)  
164  {  {
165      uint32_t val, *ptr;      uint32_t val, *ptr;
     unsigned long offset;  
   
     offset = (unsigned long)(tb->tc_ptr + tb->tb_jmp_offset[n]);  
166    
167      /* patch the branch destination */      /* patch the branch destination */
168      ptr = (uint32_t *)offset;      ptr = (uint32_t *)jmp_addr;
169      val = *ptr;      val = *ptr;
170      val = (val & ~0x03fffffc) | ((addr - offset) & 0x03fffffc);      val = (val & ~0x03fffffc) | ((addr - jmp_addr) & 0x03fffffc);
171      *ptr = val;      *ptr = val;
172      /* flush icache */      /* flush icache */
173      asm volatile ("dcbst 0,%0" : : "r"(ptr) : "memory");      asm volatile ("dcbst 0,%0" : : "r"(ptr) : "memory");
# Line 181  static inline void tb_set_jmp_target(Tra Line 177  static inline void tb_set_jmp_target(Tra
177      asm volatile ("isync" : : : "memory");      asm volatile ("isync" : : : "memory");
178  }  }
179    
180    static inline void tb_set_jmp_target(TranslationBlock *tb,
181                                         int n, unsigned long addr)
182    {
183        unsigned long offset;
184    
185        offset = tb->tb_jmp_offset[n];
186        tb_set_jmp_target1((unsigned long)(tb->tc_ptr + offset), addr);
187        offset = tb->tb_jmp_offset[n + 2];
188        if (offset != 0xffff)
189            tb_set_jmp_target1((unsigned long)(tb->tc_ptr + offset), addr);
190    }
191    
192  #else  #else
193    
194  /* set the jump target */  /* set the jump target */
# Line 228  do {\ Line 236  do {\
236      EXIT_TB();\      EXIT_TB();\
237  } while (0)  } while (0)
238    
239    #define JUMP_TB2(opname, tbparam, n)\
240    do {\
241        asm volatile ("b __op_jmp%0\n" : : "i" (n + 2));\
242    } while (0)
243    
244  #else  #else
245    
246  /* jump to next block operations (more portable code, does not need  /* jump to next block operations (more portable code, does not need
# Line 244  dummy_label ## n:\ Line 257  dummy_label ## n:\
257      EXIT_TB();\      EXIT_TB();\
258  } while (0)  } while (0)
259    
260    /* second jump to same destination 'n' */
261    #define JUMP_TB2(opname, tbparam, n)\
262    do {\
263        goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\
264    } while (0)
265    
266  #endif  #endif
267    
268  /* physical memory access */  /* physical memory access */

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26