target-arm: refactor cp15.c13 register access

Access the cp15.c13 TLS registers directly with TCG ops instead of with
a slow helper. If the the cp15 read/write was not TLS register access,
fall back to the cp15 helper.

This makes accessing __thread variables in linux-user when apps are compiled
with -mtp=cp15 possible. legal cp15 register to acces from linux-user are
already checked in cp15_user_ok.

While at it, make the cp15.c13 Thread ID registers available only on
ARMv6K and newer.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
This commit is contained in:
Riku Voipio 2010-01-25 15:17:32 +02:00 committed by Aurelien Jarno
parent fd052bf63a
commit 3f26c1227e
2 changed files with 55 additions and 16 deletions

View file

@ -511,7 +511,6 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
{
cpu_abort(env, "cp15 insn %08x\n", insn);
return 0;
}
/* These should probably raise undefined insn exceptions. */
@ -1491,15 +1490,6 @@ void HELPER(set_cp15)(CPUState *env, uint32_t insn, uint32_t val)
tlb_flush(env, 0);
env->cp15.c13_context = val;
break;
case 2:
env->cp15.c13_tls1 = val;
break;
case 3:
env->cp15.c13_tls2 = val;
break;
case 4:
env->cp15.c13_tls3 = val;
break;
default:
goto bad_reg;
}
@ -1779,12 +1769,6 @@ uint32_t HELPER(get_cp15)(CPUState *env, uint32_t insn)
return env->cp15.c13_fcse;
case 1:
return env->cp15.c13_context;
case 2:
return env->cp15.c13_tls1;
case 3:
return env->cp15.c13_tls2;
case 4:
return env->cp15.c13_tls3;
default:
goto bad_reg;
}