--- trunk/src/cpus/cpu_dyntrans.c 2007/10/08 16:21:43 37 +++ trunk/src/cpus/cpu_dyntrans.c 2007/10/08 16:21:53 38 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: cpu_dyntrans.c,v 1.142 2007/02/11 10:47:31 debug Exp $ + * $Id: cpu_dyntrans.c,v 1.145 2007/04/10 17:26:20 debug Exp $ * * Common dyntrans routines. Included from cpu_*.c. */ @@ -488,12 +488,7 @@ * than were passed in register. */ for (x=0; xcd.DYNTRANS_ARCH. + int64_t d = cpu->cd.DYNTRANS_ARCH. #ifdef DYNTRANS_ALPHA r[ALPHA_A0 #endif @@ -514,9 +509,6 @@ #ifdef DYNTRANS_PPC gpr[3 #endif -#ifdef DYNTRANS_RCA180X - r[0 /* TODO */ -#endif #ifdef DYNTRANS_SH r[4 /* NetBSD seems to use 4? But 2 seems to be used by other code? TODO */ @@ -525,7 +517,7 @@ r[8 /* o0..o5 */ #endif + x]; -#endif + symbol = get_symbol_name(&cpu->machine->symbol_context, d, &ot); if (d > -256 && d < 256) @@ -565,8 +557,6 @@ { struct DYNTRANS_TC_PHYSPAGE *ppp; - native_commit(cpu); - ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache + cpu->translation_cache_cur_ofs); @@ -752,14 +742,21 @@ physpage_ofs = ppp->next_ofs; } - /* If the offset is 0 (or ppp is NULL), then we need to create a - new "default" empty translation page. */ + /* + * If the offset is 0, then no translation exists yet for this + * physical address. Let's create a new page, and add it first in + * the chain. + */ + if (physpage_ofs == 0) { + uint32_t previous_first_page_in_chain; - if (ppp == NULL) { /* fatal("CREATING page %lli (physaddr 0x%"PRIx64"), table " "index %i\n", (long long)pagenr, (uint64_t)physaddr, (int)table_index); */ - native_commit(cpu); + + previous_first_page_in_chain = *physpage_entryp; + + /* Insert the new page first in the chain: */ *physpage_entryp = physpage_ofs = cpu->translation_cache_cur_ofs; @@ -768,8 +765,13 @@ ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache + physpage_ofs); + + /* Point to the other pages in the same chain: */ + ppp->next_ofs = previous_first_page_in_chain; } + /* Here, ppp points to a valid physical page struct. */ + #ifdef MODE32 if (cpu->cd.DYNTRANS_ARCH.host_load[index] != NULL) cpu->cd.DYNTRANS_ARCH.phys_page[index] = ppp; @@ -1274,7 +1276,7 @@ /* If there is no translation, there is no need to go on and try to remove it from the vph_tlb_entry array: */ - if (ppp == NULL) + if (physpage_ofs == 0) return; #if 0