Revision 6ebbf390 target-alpha/op_helper.c

b/target-alpha/op_helper.c
1164 1164
void helper_ld_phys_to_virt (void)
1165 1165
{
1166 1166
    uint64_t tlb_addr, physaddr;
1167
    int index, is_user;
1167
    int index, mmu_idx;
1168 1168
    void *retaddr;
1169 1169

  
1170
    is_user = (env->ps >> 3) & 3;
1170
    mmu_idx = cpu_mmu_index(env);
1171 1171
    index = (T0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
1172 1172
 redo:
1173
    tlb_addr = env->tlb_table[is_user][index].addr_read;
1173
    tlb_addr = env->tlb_table[mmu_idx][index].addr_read;
1174 1174
    if ((T0 & TARGET_PAGE_MASK) ==
1175 1175
        (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
1176
        physaddr = T0 + env->tlb_table[is_user][index].addend;
1176
        physaddr = T0 + env->tlb_table[mmu_idx][index].addend;
1177 1177
    } else {
1178 1178
        /* the page is not in the TLB : fill it */
1179 1179
        retaddr = GETPC();
1180
        tlb_fill(T0, 0, is_user, retaddr);
1180
        tlb_fill(T0, 0, mmu_idx, retaddr);
1181 1181
        goto redo;
1182 1182
    }
1183 1183
    T0 = physaddr;
......
1186 1186
void helper_st_phys_to_virt (void)
1187 1187
{
1188 1188
    uint64_t tlb_addr, physaddr;
1189
    int index, is_user;
1189
    int index, mmu_idx;
1190 1190
    void *retaddr;
1191 1191

  
1192
    is_user = (env->ps >> 3) & 3;
1192
    mmu_idx = cpu_mmu_index(env);
1193 1193
    index = (T0 >> TARGET_PAGE_BITS) & (CPU_TLB_SIZE - 1);
1194 1194
 redo:
1195
    tlb_addr = env->tlb_table[is_user][index].addr_write;
1195
    tlb_addr = env->tlb_table[mmu_idx][index].addr_write;
1196 1196
    if ((T0 & TARGET_PAGE_MASK) ==
1197 1197
        (tlb_addr & (TARGET_PAGE_MASK | TLB_INVALID_MASK))) {
1198
        physaddr = T0 + env->tlb_table[is_user][index].addend;
1198
        physaddr = T0 + env->tlb_table[mmu_idx][index].addend;
1199 1199
    } else {
1200 1200
        /* the page is not in the TLB : fill it */
1201 1201
        retaddr = GETPC();
1202
        tlb_fill(T0, 1, is_user, retaddr);
1202
        tlb_fill(T0, 1, mmu_idx, retaddr);
1203 1203
        goto redo;
1204 1204
    }
1205 1205
    T0 = physaddr;
......
1223 1223
   NULL, it means that the function was called in C code (i.e. not
1224 1224
   from generated code or from helper.c) */
1225 1225
/* XXX: fix it to restore all registers */
1226
void tlb_fill (target_ulong addr, int is_write, int is_user, void *retaddr)
1226
void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
1227 1227
{
1228 1228
    TranslationBlock *tb;
1229 1229
    CPUState *saved_env;
......
1234 1234
       generated code */
1235 1235
    saved_env = env;
1236 1236
    env = cpu_single_env;
1237
    ret = cpu_alpha_handle_mmu_fault(env, addr, is_write, is_user, 1);
1237
    ret = cpu_alpha_handle_mmu_fault(env, addr, is_write, mmu_idx, 1);
1238 1238
    if (!likely(ret == 0)) {
1239 1239
        if (likely(retaddr)) {
1240 1240
            /* now we have a real cpu fault */

Also available in: Unified diff