Index: linux-2.6.30.9/arch/rlx/kernel/traps.c =================================================================== --- linux-2.6.30.9.orig/arch/rlx/kernel/traps.c 2011-12-04 15:31:07.000000000 +0000 +++ linux-2.6.30.9/arch/rlx/kernel/traps.c 2011-12-04 15:31:39.000000000 +0000 @@ -451,6 +451,55 @@ } #endif + +/* + * Simulate trapping 'rdhwr' instructions to provide user accessible + * registers not implemented in hardware. + */ +static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode) +{ + struct thread_info *ti = task_thread_info(current); + + if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) { + int rd = (opcode & RD) >> 11; + int rt = (opcode & RT) >> 16; + switch (rd) { + case 0: /* CPU number */ + regs->regs[rt] = smp_processor_id(); + return 0; + case 1: /* SYNCI length */ + regs->regs[rt] = min(current_cpu_data.dcache.linesz, + current_cpu_data.icache.linesz); + return 0; + case 2: /* Read count register */ + regs->regs[rt] = read_c0_count(); + return 0; + case 3: /* Count register resolution */ + switch (current_cpu_data.cputype) { +#if 0 + case CPU_20KC: + case CPU_25KF: + regs->regs[rt] = 1; + break; +#endif + default: + regs->regs[rt] = 2; + } + return 0; + case 29: + regs->regs[rt] = ti->tp_value; + return 0; + default: + return -1; + } + } + + /* Not ours. */ + return -1; +} + + + #ifndef CONFIG_CPU_HAS_SYNC static int simulate_sync(struct pt_regs *regs, unsigned int opcode) { @@ -567,7 +616,7 @@ status = simulate_llsc(regs, opcode); #endif -#if 0 +#if 1 if (status < 0) status = simulate_rdhwr(regs, opcode); #endif @@ -616,7 +665,7 @@ status = simulate_llsc(regs, opcode); #endif -#if 0 +#if 1 if (status < 0) status = simulate_rdhwr(regs, opcode); #endif