25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $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 $ |
29 |
* |
* |
30 |
* Common dyntrans routines. Included from cpu_*.c. |
* Common dyntrans routines. Included from cpu_*.c. |
31 |
*/ |
*/ |
488 |
* than were passed in register. |
* than were passed in register. |
489 |
*/ |
*/ |
490 |
for (x=0; x<n_args_to_print; x++) { |
for (x=0; x<n_args_to_print; x++) { |
491 |
int64_t d; |
int64_t d = cpu->cd.DYNTRANS_ARCH. |
|
#if defined(DYNTRANS_TRANSPUTER) |
|
|
d = 0; /* TODO */ |
|
|
#else |
|
|
/* Args in registers: */ |
|
|
d = cpu->cd.DYNTRANS_ARCH. |
|
492 |
#ifdef DYNTRANS_ALPHA |
#ifdef DYNTRANS_ALPHA |
493 |
r[ALPHA_A0 |
r[ALPHA_A0 |
494 |
#endif |
#endif |
509 |
#ifdef DYNTRANS_PPC |
#ifdef DYNTRANS_PPC |
510 |
gpr[3 |
gpr[3 |
511 |
#endif |
#endif |
|
#ifdef DYNTRANS_RCA180X |
|
|
r[0 /* TODO */ |
|
|
#endif |
|
512 |
#ifdef DYNTRANS_SH |
#ifdef DYNTRANS_SH |
513 |
r[4 /* NetBSD seems to use 4? But 2 seems |
r[4 /* NetBSD seems to use 4? But 2 seems |
514 |
to be used by other code? TODO */ |
to be used by other code? TODO */ |
517 |
r[8 /* o0..o5 */ |
r[8 /* o0..o5 */ |
518 |
#endif |
#endif |
519 |
+ x]; |
+ x]; |
520 |
#endif |
|
521 |
symbol = get_symbol_name(&cpu->machine->symbol_context, d, &ot); |
symbol = get_symbol_name(&cpu->machine->symbol_context, d, &ot); |
522 |
|
|
523 |
if (d > -256 && d < 256) |
if (d > -256 && d < 256) |
557 |
{ |
{ |
558 |
struct DYNTRANS_TC_PHYSPAGE *ppp; |
struct DYNTRANS_TC_PHYSPAGE *ppp; |
559 |
|
|
|
native_commit(cpu); |
|
|
|
|
560 |
ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache |
ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache |
561 |
+ cpu->translation_cache_cur_ofs); |
+ cpu->translation_cache_cur_ofs); |
562 |
|
|
742 |
physpage_ofs = ppp->next_ofs; |
physpage_ofs = ppp->next_ofs; |
743 |
} |
} |
744 |
|
|
745 |
/* If the offset is 0 (or ppp is NULL), then we need to create a |
/* |
746 |
new "default" empty translation page. */ |
* If the offset is 0, then no translation exists yet for this |
747 |
|
* physical address. Let's create a new page, and add it first in |
748 |
|
* the chain. |
749 |
|
*/ |
750 |
|
if (physpage_ofs == 0) { |
751 |
|
uint32_t previous_first_page_in_chain; |
752 |
|
|
|
if (ppp == NULL) { |
|
753 |
/* fatal("CREATING page %lli (physaddr 0x%"PRIx64"), table " |
/* fatal("CREATING page %lli (physaddr 0x%"PRIx64"), table " |
754 |
"index %i\n", (long long)pagenr, (uint64_t)physaddr, |
"index %i\n", (long long)pagenr, (uint64_t)physaddr, |
755 |
(int)table_index); */ |
(int)table_index); */ |
756 |
native_commit(cpu); |
|
757 |
|
previous_first_page_in_chain = *physpage_entryp; |
758 |
|
|
759 |
|
/* Insert the new page first in the chain: */ |
760 |
*physpage_entryp = physpage_ofs = |
*physpage_entryp = physpage_ofs = |
761 |
cpu->translation_cache_cur_ofs; |
cpu->translation_cache_cur_ofs; |
762 |
|
|
765 |
|
|
766 |
ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache |
ppp = (struct DYNTRANS_TC_PHYSPAGE *)(cpu->translation_cache |
767 |
+ physpage_ofs); |
+ physpage_ofs); |
768 |
|
|
769 |
|
/* Point to the other pages in the same chain: */ |
770 |
|
ppp->next_ofs = previous_first_page_in_chain; |
771 |
} |
} |
772 |
|
|
773 |
|
/* Here, ppp points to a valid physical page struct. */ |
774 |
|
|
775 |
#ifdef MODE32 |
#ifdef MODE32 |
776 |
if (cpu->cd.DYNTRANS_ARCH.host_load[index] != NULL) |
if (cpu->cd.DYNTRANS_ARCH.host_load[index] != NULL) |
777 |
cpu->cd.DYNTRANS_ARCH.phys_page[index] = ppp; |
cpu->cd.DYNTRANS_ARCH.phys_page[index] = ppp; |
1276 |
|
|
1277 |
/* If there is no translation, there is no need to go |
/* If there is no translation, there is no need to go |
1278 |
on and try to remove it from the vph_tlb_entry array: */ |
on and try to remove it from the vph_tlb_entry array: */ |
1279 |
if (ppp == NULL) |
if (physpage_ofs == 0) |
1280 |
return; |
return; |
1281 |
|
|
1282 |
#if 0 |
#if 0 |