Lines Matching defs:tb
819 TranslationBlock *tb;
823 for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) {
824 if (!(address + TARGET_PAGE_SIZE <= tb->pc ||
825 address >= tb->pc + tb->size)) {
828 address, (long)tb->pc, tb->size);
837 TranslationBlock *tb;
841 for(tb = tb_phys_hash[i]; tb != NULL; tb = tb->phys_hash_next) {
842 flags1 = page_get_flags(tb->pc);
843 flags2 = page_get_flags(tb->pc + tb->size - 1);
846 (long)tb->pc, tb->size, flags1, flags2);
855 static inline void tb_remove(TranslationBlock **ptb, TranslationBlock *tb,
861 if (tb1 == tb) {
869 static inline void tb_page_remove(TranslationBlock **ptb, TranslationBlock *tb)
878 if (tb1 == tb) {
886 static inline void tb_jmp_remove(TranslationBlock *tb, int n)
891 ptb = &tb->jmp_next[n];
894 /* find tb(n) in circular list */
899 if (n1 == n && tb1 == tb)
907 /* now we can suppress tb(n) from the list */
908 *ptb = tb->jmp_next[n];
910 tb->jmp_next[n] = NULL;
916 static inline void tb_reset_jump(TranslationBlock *tb, int n)
918 tb_set_jmp_target(tb, n, (uintptr_t)(tb->tc_ptr + tb->tb_next_offset[n]));
921 void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr)
930 phys_pc = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
932 tb_remove(&tb_phys_hash[h], tb,
936 if (tb->page_addr[0] != page_addr) {
937 p = page_find(tb->page_addr[0] >> TARGET_PAGE_BITS);
938 tb_page_remove(&p->first_tb, tb);
941 if (tb->page_addr[1] != -1 && tb->page_addr[1] != page_addr) {
942 p = page_find(tb->page_addr[1] >> TARGET_PAGE_BITS);
943 tb_page_remove(&p->first_tb, tb);
950 h = tb_jmp_cache_hash_func(tb->pc);
952 if (env->tb_jmp_cache[h] == tb)
957 tb_jmp_remove(tb, 0);
958 tb_jmp_remove(tb, 1);
961 tb1 = tb->jmp_first;
972 tb->jmp_first = (TranslationBlock *)((intptr_t)tb | 2); /* fail safe */
986 TranslationBlock *tb, **ptb;
993 tb = tb_find(&ptb, (uintptr_t)pc, (uintptr_t)cs_base,
996 if(tb)
999 printf("invalidating TB (%08X) at %08X\n", tb, eip);
1001 tb_invalidate(tb);
1004 tb->pc = 0;
1005 tb->cs_base = 0;
1006 tb->flags = 0;
1054 TranslationBlock *tb;
1058 tb = p->first_tb;
1059 while (tb != NULL) {
1060 n = (intptr_t)tb & 3;
1061 tb = (TranslationBlock *)((intptr_t)tb & ~3);
1066 tb_start = tb->pc & ~TARGET_PAGE_MASK;
1067 tb_end = tb_start + tb->size;
1072 tb_end = ((tb->pc + tb->size) & ~TARGET_PAGE_MASK);
1075 tb = tb->page_next[n];
1083 TranslationBlock *tb;
1090 tb = tb_alloc(pc);
1091 if (!tb) {
1095 tb = tb_alloc(pc);
1100 tb->tc_ptr = tc_ptr;
1101 tb->cs_base = cs_base;
1102 tb->flags = flags;
1103 tb->cflags = cflags;
1104 cpu_gen_code(env, tb, &code_gen_size);
1108 virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
1113 tb_link_page(tb, phys_pc, phys_page2);
1114 return tb;
1125 TranslationBlock *tb, *tb_next, *saved_tb;
1151 tb = p->first_tb;
1152 while (tb != NULL) {
1153 n = (intptr_t)tb & 3;
1154 tb = (TranslationBlock *)((intptr_t)tb & ~3);
1155 tb_next = tb->page_next[n];
1160 tb_start = tb->page_addr[0] + (tb->pc & ~TARGET_PAGE_MASK);
1161 tb_end = tb_start + tb->size;
1163 tb_start = tb->page_addr[1];
1164 tb_end = tb_start + ((tb->pc + tb->size) & ~TARGET_PAGE_MASK);
1176 if (current_tb == tb &&
1198 tb_phys_invalidate(tb, -1);
1205 tb = tb_next;
1259 TranslationBlock *tb;
1275 tb = p->first_tb;
1277 if (tb && pc != 0) {
1281 while (tb != NULL) {
1282 n = (intptr_t)tb & 3;
1283 tb = (TranslationBlock *)((intptr_t)tb & ~3);
1285 if (current_tb == tb &&
1299 tb_phys_invalidate(tb, addr);
1300 tb = tb->page_next[n];
1316 /* add the tb in the target page and protect it if necessary */
1317 static inline void tb_alloc_page(TranslationBlock *tb,
1323 tb->page_addr[n] = page_addr;
1325 tb->page_next[n] = p->first_tb;
1327 p->first_tb = (TranslationBlock *)((intptr_t)tb | n);
1374 TranslationBlock *tb;
1379 tb = &tbs[nb_tbs++];
1380 tb->pc = pc;
1381 tb->cflags = 0;
1382 return tb;
1385 void tb_free(TranslationBlock *tb)
1390 if (nb_tbs > 0 && tb == &tbs[nb_tbs - 1]) {
1391 code_gen_ptr = tb->tc_ptr;
1398 void tb_link_page(TranslationBlock *tb,
1410 tb->phys_hash_next = *ptb;
1411 *ptb = tb;
1414 tb_alloc_page(tb, 0, phys_pc & TARGET_PAGE_MASK);
1416 tb_alloc_page(tb, 1, phys_page2);
1418 tb->page_addr[1] = -1;
1420 tb->jmp_first = (TranslationBlock *)((intptr_t)tb | 2);
1421 tb->jmp_next[0] = NULL;
1422 tb->jmp_next[1] = NULL;
1425 if (tb->tb_next_offset[0] != 0xffff)
1426 tb_reset_jump(tb, 0);
1427 if (tb->tb_next_offset[1] != 0xffff)
1428 tb_reset_jump(tb, 1);
1436 /* find the TB 'tb' such that tb[0].tc_ptr <= tc_ptr <
1437 tb[1].tc_ptr. Return NULL if not found */
1442 TranslationBlock *tb;
1454 tb = &tbs[m];
1455 v = (uintptr_t)tb->tc_ptr;
1457 return tb;
1467 static void tb_reset_jump_recursive(TranslationBlock *tb);
1469 static inline void tb_reset_jump_recursive2(TranslationBlock *tb, int n)
1474 tb1 = tb->jmp_next[n];
1484 /* we are now sure now that tb jumps to tb1 */
1487 /* remove tb from the jmp_first list */
1493 if (n1 == n && tb1 == tb)
1497 *ptb = tb->jmp_next[n];
1498 tb->jmp_next[n] = NULL;
1500 /* suppress the jump to next tb in generated code */
1501 tb_reset_jump(tb, n);
1503 /* suppress jumps in the tb on which we could have jumped */
1508 static void tb_reset_jump_recursive(TranslationBlock *tb)
1510 tb_reset_jump_recursive2(tb, 0);
1511 tb_reset_jump_recursive2(tb, 1);
1773 TranslationBlock *tb;
1777 tb = env->current_tb;
1780 if (tb) {
1782 tb_reset_jump_recursive(tb);
2081 /* Discard jump cache entries for any tb which might potentially
3464 TranslationBlock *tb;
3483 tb = tb_find_pc(env->mem_io_pc);
3484 if (!tb) {
3488 cpu_restore_state(tb, env, env->mem_io_pc, NULL);
3489 tb_phys_invalidate(tb, -1);
4454 TranslationBlock *tb;
4459 tb = tb_find_pc((uintptr_t)retaddr);
4460 if (!tb) {
4464 n = env->icount_decr.u16.low + tb->icount;
4465 cpu_restore_state(tb, env, (uintptr_t)retaddr, NULL);
4494 pc = tb->pc;
4495 cs_base = tb->cs_base;
4496 flags = tb->flags;
4497 tb_phys_invalidate(tb, -1);
4501 /* TODO: If env->pc != tb->pc (i.e. the faulting instruction was not
4517 TranslationBlock *tb;
4525 tb = &tbs[i];
4526 target_code_size += tb->size;
4527 if (tb->size > max_target_code_size)
4528 max_target_code_size = tb->size;
4529 if (tb->page_addr[1] != -1)
4531 if (tb->tb_next_offset[0] != 0xffff) {
4533 if (tb->tb_next_offset[1] != 0xffff) {