Revision 878d3096 target-sparc/helper.c

b/target-sparc/helper.c
44 44
                               int is_user, int is_softmmu)
45 45
{
46 46
    env->mmuregs[4] = address;
47
    env->exception_index = 0; /* XXX: must be incorrect */
48
    env->error_code = -2; /* XXX: is it really used ! */
47
    if (rw & 2)
48
        env->exception_index = TT_TFAULT;
49
    else
50
        env->exception_index = TT_DFAULT;
49 51
    return 1;
50 52
}
51 53

  
......
95 97
                cpu_restore_state(tb, env, pc, NULL);
96 98
            }
97 99
        }
98
        raise_exception(ret);
100
        cpu_loop_exit();
99 101
    }
100 102
    env = saved_env;
101 103
}
......
229 231
int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
230 232
                              int is_user, int is_softmmu)
231 233
{
232
    int exception = 0;
233 234
    target_ulong virt_addr;
234 235
    target_phys_addr_t paddr;
235 236
    unsigned long vaddr;
......
248 249
    env->mmuregs[3] |= (access_index << 5) | (error_code << 2) | 2;
249 250
    env->mmuregs[4] = address; /* Fault address register */
250 251

  
251
    if (env->mmuregs[0] & MMU_NF || env->psret == 0) // No fault
252
	return 0;
253
    env->exception_index = exception;
254
    env->error_code = error_code;
255
    return error_code;
252
    if ((env->mmuregs[0] & MMU_NF) || env->psret == 0)  {
253
        // No fault
254
	cpu_abort(env, "Unsupported MMU no fault case");
255
    }
256
    if (rw & 2)
257
        env->exception_index = TT_TFAULT;
258
    else
259
        env->exception_index = TT_DFAULT;
260
    return 1;
256 261
}
257 262
#endif
258 263

  
......
289 294
    env = saved_env;
290 295
}
291 296

  
292
void do_interrupt(int intno, int error_code)
297
void do_interrupt(int intno)
293 298
{
294 299
    int cwp;
295 300

  
296 301
#ifdef DEBUG_PCALL
297 302
    if (loglevel & CPU_LOG_INT) {
298 303
	static int count;
299
	fprintf(logfile, "%6d: v=%02x e=%04x pc=%08x npc=%08x SP=%08x\n",
300
                count, intno, error_code,
304
	fprintf(logfile, "%6d: v=%02x pc=%08x npc=%08x SP=%08x\n",
305
                count, intno,
301 306
                env->pc,
302 307
                env->npc, env->regwptr[6]);
303 308
#if 1
......
319 324
#endif
320 325
#if !defined(CONFIG_USER_ONLY) 
321 326
    if (env->psret == 0) {
322
        cpu_abort(cpu_single_env, "Trap while interrupts disabled, Error state");
327
        cpu_abort(cpu_single_env, "Trap 0x%02x while interrupts disabled, Error state", env->exception_index);
323 328
	return;
324 329
    }
325 330
#endif
326 331
    env->psret = 0;
327 332
    cwp = (env->cwp - 1) & (NWINDOWS - 1); 
328 333
    set_cwp(cwp);
329
    if (intno & 0x80) {
330
	env->regwptr[9] = env->pc;
331
	env->regwptr[10] = env->npc;
332
    } else {
333
        /* XXX: this code is clearly incorrect - npc should have the
334
           incorrect value */
335
	env->regwptr[9] = env->pc - 4; // XXX?
336
	env->regwptr[10] = env->pc;
337
    }
334
    env->regwptr[9] = env->pc;
335
    env->regwptr[10] = env->npc;
338 336
    env->psrps = env->psrs;
339 337
    env->psrs = 1;
340 338
    env->tbr = (env->tbr & TBR_BASE_MASK) | (intno << 4);

Also available in: Unified diff