* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-
#include "exec.h"
/* MIPS32 4K MMU emulation */
-#if MIPS_USES_4K_TLB
+#ifdef MIPS_USES_R4K_TLB
static int map_address (CPUState *env, target_ulong *physical, int *prot,
target_ulong address, int rw, int access_type)
{
/* Check access rights */
if ((tlb->V[n] & 2) && (rw == 0 || (tlb->D[n] & 4))) {
*physical = tlb->PFN[n] | (address & 0xFFF);
- *prot = PROT_READ;
+ *prot = PAGE_READ;
if (tlb->D[n])
- *prot |= PROT_WRITE;
+ *prot |= PAGE_WRITE;
return 0;
} else if (!(tlb->V[n] & 2)) {
return -3;
return -1;
ret = 0;
if (address < 0x80000000UL) {
- if (user_mode || !(env->hflags & MIPS_HFLAG_ERL)) {
-#if MIPS_USES_4K_TLB
- ret = map_address(env, physical, prot, address, rw);
+ if (!(env->hflags & MIPS_HFLAG_ERL)) {
+#ifdef MIPS_USES_R4K_TLB
+ ret = map_address(env, physical, prot, address, rw, access_type);
#else
*physical = address + 0x40000000UL;
*prot = PAGE_READ | PAGE_WRITE;
*prot = PAGE_READ | PAGE_WRITE;
} else if (address < 0xE0000000UL) {
/* kseg2 */
-#if MIPS_USES_4K_TLB
- ret = map_address(env, physical, prot, address, rw);
+#ifdef MIPS_USES_R4K_TLB
+ ret = map_address(env, physical, prot, address, rw, access_type);
#else
*physical = address;
*prot = PAGE_READ | PAGE_WRITE;
/* kseg3 */
/* XXX: check supervisor mode */
/* XXX: debug segment is not emulated */
-#if MIPS_USES_4K_TLB
- ret = map_address(env, physical, prot, address, rw);
+#ifdef MIPS_USES_R4K_TLB
+ ret = map_address(env, physical, prot, address, rw, access_type);
#else
*physical = address;
*prot = PAGE_READ | PAGE_WRITE;
pc = 0xBFC00480;
break;
case EXCP_RESET:
-#if defined (MIPS_USES_R4K_TLB)
+#ifdef MIPS_USES_R4K_TLB
env->CP0_random = MIPS_TLB_NB - 1;
#endif
env->CP0_Wired = 0;