Jochen Becher
2007-03-26 22:19:31 UTC
Hi,
in the current CVS source I replaced the main function with the
following code. This is a simple test that maps effective address
0xfff00000 to physical address 0x00800000. Then the code translates the
same effective address to the physical address - but the result is
0x07f00000. I debugged into that code - there is some calculation of a
vairable pte which defines what page is mapped to what physical address.
Unfortunatly the same pte is already stored in the same mmu page entry
mapping that page to 0x07f00000.
Is this a bug in the MMU emulation code?
Regards, Jochen
int main(int argc, char *argv[])
{
setvbuf(stdout, 0, _IONBF, 0);
if (!ppc_init_physical_memory(128 * 1024 * 1024)) {
ht_printf("cannot initialize memory.\n");
exit(1);
}
if (!ppc_cpu_init()) {
ht_printf("cpu_init failed! Out of memory?\n");
exit(1);
}
// initialize initial paging (for prom)
uint32 PAGE_TABLE_ADDR = 104857600;
// 256 Kbytes Pagetable, 2^15 Pages, 2^12 PTEGs
if (!ppc_prom_set_sdr1(PAGE_TABLE_ADDR+0x03, false)) {
ht_printf("internal error setting sdr1.\n");
return 1;
}
// clear pagetable
if (!ppc_dma_set(PAGE_TABLE_ADDR, 0, 256*1024)) {
ht_printf("cannot access page table.\n");
return 1;
}
prom_mem_init();
// turn on address translation
ppc_cpu_set_msr(0, MSR_IR | MSR_DR | MSR_FP);
if ((ppc_cpu_get_pvr(0) & 0xffff0000) == 0x000c0000) {
ppc_cpu_set_msr(0, MSR_IR | MSR_DR | MSR_FP | MSR_VEC);
}
// lock pagetable
for (uint32 pa = PAGE_TABLE_ADDR; pa < (PAGE_TABLE_ADDR + 256*1024); pa
+= 4096) {
if (!prom_claim_page(pa)) {
ht_printf("cannot claim page table memory.\n");
exit(1);
}
}
prom_claim_page(0x00800000);
ppc_prom_page_create(0xfff00000, 0x00800000);
uint32 ea;
ppc_effective_to_physical(0xfff00000, PPC_MMU_READ | PPC_MMU_CODE, ea);
ht_printf("ea = 0x%08lx\n",ea);
return 0;
}
in the current CVS source I replaced the main function with the
following code. This is a simple test that maps effective address
0xfff00000 to physical address 0x00800000. Then the code translates the
same effective address to the physical address - but the result is
0x07f00000. I debugged into that code - there is some calculation of a
vairable pte which defines what page is mapped to what physical address.
Unfortunatly the same pte is already stored in the same mmu page entry
mapping that page to 0x07f00000.
Is this a bug in the MMU emulation code?
Regards, Jochen
int main(int argc, char *argv[])
{
setvbuf(stdout, 0, _IONBF, 0);
if (!ppc_init_physical_memory(128 * 1024 * 1024)) {
ht_printf("cannot initialize memory.\n");
exit(1);
}
if (!ppc_cpu_init()) {
ht_printf("cpu_init failed! Out of memory?\n");
exit(1);
}
// initialize initial paging (for prom)
uint32 PAGE_TABLE_ADDR = 104857600;
// 256 Kbytes Pagetable, 2^15 Pages, 2^12 PTEGs
if (!ppc_prom_set_sdr1(PAGE_TABLE_ADDR+0x03, false)) {
ht_printf("internal error setting sdr1.\n");
return 1;
}
// clear pagetable
if (!ppc_dma_set(PAGE_TABLE_ADDR, 0, 256*1024)) {
ht_printf("cannot access page table.\n");
return 1;
}
prom_mem_init();
// turn on address translation
ppc_cpu_set_msr(0, MSR_IR | MSR_DR | MSR_FP);
if ((ppc_cpu_get_pvr(0) & 0xffff0000) == 0x000c0000) {
ppc_cpu_set_msr(0, MSR_IR | MSR_DR | MSR_FP | MSR_VEC);
}
// lock pagetable
for (uint32 pa = PAGE_TABLE_ADDR; pa < (PAGE_TABLE_ADDR + 256*1024); pa
+= 4096) {
if (!prom_claim_page(pa)) {
ht_printf("cannot claim page table memory.\n");
exit(1);
}
}
prom_claim_page(0x00800000);
ppc_prom_page_create(0xfff00000, 0x00800000);
uint32 ea;
ppc_effective_to_physical(0xfff00000, PPC_MMU_READ | PPC_MMU_CODE, ea);
ht_printf("ea = 0x%08lx\n",ea);
return 0;
}