Revision 9fb63ac2 target-mips/helper.c

b/target-mips/helper.c
17 17
 * License along with this library; if not, write to the Free Software
18 18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 19
 */
20

  
21 20
#include "exec.h"
22 21

  
23 22
/* MIPS32 4K MMU emulation */
24
#if MIPS_USES_4K_TLB
23
#ifdef MIPS_USES_R4K_TLB
25 24
static int map_address (CPUState *env, target_ulong *physical, int *prot,
26 25
                        target_ulong address, int rw, int access_type)
27 26
{
......
44 43
            /* Check access rights */
45 44
            if ((tlb->V[n] & 2) && (rw == 0 || (tlb->D[n] & 4))) {
46 45
                *physical = tlb->PFN[n] | (address & 0xFFF);
47
                *prot = PROT_READ;
46
                *prot = PAGE_READ;
48 47
                if (tlb->D[n])
49
                    *prot |= PROT_WRITE;
48
                    *prot |= PAGE_WRITE;
50 49
                return 0;
51 50
            } else if (!(tlb->V[n] & 2)) {
52 51
                return -3;
......
78 77
        return -1;
79 78
    ret = 0;
80 79
    if (address < 0x80000000UL) {
81
        if (user_mode || !(env->hflags & MIPS_HFLAG_ERL)) {
82
#if MIPS_USES_4K_TLB
83
            ret = map_address(env, physical, prot, address, rw);
80
        if (!(env->hflags & MIPS_HFLAG_ERL)) {
81
#ifdef MIPS_USES_R4K_TLB
82
            ret = map_address(env, physical, prot, address, rw, access_type);
84 83
#else
85 84
            *physical = address + 0x40000000UL;
86 85
            *prot = PAGE_READ | PAGE_WRITE;
......
101 100
        *prot = PAGE_READ | PAGE_WRITE;
102 101
    } else if (address < 0xE0000000UL) {
103 102
        /* kseg2 */
104
#if MIPS_USES_4K_TLB
105
        ret = map_address(env, physical, prot, address, rw);
103
#ifdef MIPS_USES_R4K_TLB
104
        ret = map_address(env, physical, prot, address, rw, access_type);
106 105
#else
107 106
        *physical = address;
108 107
        *prot = PAGE_READ | PAGE_WRITE;
......
111 110
        /* kseg3 */
112 111
        /* XXX: check supervisor mode */
113 112
        /* XXX: debug segment is not emulated */
114
#if MIPS_USES_4K_TLB
115
        ret = map_address(env, physical, prot, address, rw);
113
#ifdef MIPS_USES_R4K_TLB
114
        ret = map_address(env, physical, prot, address, rw, access_type);
116 115
#else
117 116
        *physical = address;
118 117
        *prot = PAGE_READ | PAGE_WRITE;
......
332 331
        pc = 0xBFC00480;
333 332
        break;
334 333
    case EXCP_RESET:
335
#if defined (MIPS_USES_R4K_TLB)
334
#ifdef MIPS_USES_R4K_TLB
336 335
        env->CP0_random = MIPS_TLB_NB - 1;
337 336
#endif
338 337
        env->CP0_Wired = 0;

Also available in: Unified diff