--- trunk/src/cpus/memory_arm.c 2007/10/08 16:19:56 24 +++ trunk/src/cpus/memory_arm.c 2007/10/08 16:20:26 28 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: memory_arm.c,v 1.34 2006/06/02 18:11:38 debug Exp $ + * $Id: memory_arm.c,v 1.36 2006/07/14 16:33:28 debug Exp $ * * * TODO/NOTE: The B and/or C bits could also cause the return value to @@ -48,14 +48,16 @@ /* - * arm_translate_address(): + * arm_translate_v2p(): * - * Address translation with the MMU disabled. + * Address translation with the MMU disabled. (Just treat the virtual address + * as a physical address.) */ -int arm_translate_address(struct cpu *cpu, uint64_t vaddr64, - uint64_t *return_addr, int flags) +int arm_translate_v2p(struct cpu *cpu, uint64_t vaddr64, + uint64_t *return_paddr, int flags) { - *return_addr = vaddr64 & 0xffffffff; + *return_paddr = vaddr64 & 0xffffffff; + return 2; } @@ -101,7 +103,7 @@ /* - * arm_translate_address_mmu(): + * arm_translate_v2p_mmu(): * * Don't call this function is userland_emul is non-NULL, or cpu is NULL. * @@ -113,8 +115,8 @@ * If this is a 1KB page access, then the return value is ORed with * MEMORY_NOT_FULL_PAGE. */ -int arm_translate_address_mmu(struct cpu *cpu, uint64_t vaddr64, - uint64_t *return_addr, int flags) +int arm_translate_v2p_mmu(struct cpu *cpu, uint64_t vaddr64, + uint64_t *return_paddr, int flags) { unsigned char *q; uint32_t addr, d=0, d2 = (uint32_t)(int32_t)-1, ptba, vaddr = vaddr64; @@ -134,13 +136,8 @@ if (cpu->cd.arm.translation_table == NULL || cpu->cd.arm.ttb != cpu->cd.arm.last_ttb) { - uint32_t ofs; cpu->cd.arm.translation_table = memory_paddr_to_hostaddr( cpu->mem, cpu->cd.arm.ttb & 0x0fffffff, 0); - if (cpu->cd.arm.translation_table != NULL) { - ofs = cpu->cd.arm.ttb & ((1 << BITS_PER_MEMBLOCK) - 1); - cpu->cd.arm.translation_table += ofs; - } cpu->cd.arm.last_ttb = cpu->cd.arm.ttb; } @@ -178,7 +175,7 @@ printf("arm memory blah blah adfh asfg asdgasdg\n"); exit(1); } - d2 = *(uint32_t *)(q + (addr & ((1 << BITS_PER_MEMBLOCK) - 1))); + d2 = *(uint32_t *)(q); #ifdef HOST_LITTLE_ENDIAN if (cpu->byte_order == EMUL_BIG_ENDIAN) #else @@ -198,7 +195,7 @@ case 0xc000: ap >>= 6; break; } ap &= 3; - *return_addr = (d2 & 0xffff0000) | (vaddr & 0x0000ffff); + *return_paddr = (d2 & 0xffff0000)|(vaddr & 0x0000ffff); break; case 3: if (cpu->cd.arm.cpu_type.flags & ARM_XSCALE) { /* 4KB page (Xscale) */ @@ -207,7 +204,7 @@ /* 1KB page */ subpage = 1; ap = (d2 >> 4) & 3; - *return_addr = (d2 & 0xfffffc00) | + *return_paddr = (d2 & 0xfffffc00) | (vaddr & 0x000003ff); break; } @@ -231,7 +228,7 @@ if (ap0 != ap1 || ap0 != ap2 || ap0 != ap3) subpage = 1; } - *return_addr = (d2 & 0xfffff000) | (vaddr & 0x00000fff); + *return_paddr = (d2 & 0xfffff000)|(vaddr & 0x00000fff); break; } access = arm_check_access(cpu, ap, dav, user); @@ -245,7 +242,7 @@ fs = FAULT_DOMAIN_S; goto exception_return; } - *return_addr = (d & 0xfff00000) | (vaddr & 0x000fffff); + *return_paddr = (d & 0xfff00000) | (vaddr & 0x000fffff); ap = (d >> 10) & 3; access = arm_check_access(cpu, ap, dav, user); if (access > writeflag)