summaryrefslogtreecommitdiff
path: root/target-cris
diff options
context:
space:
mode:
authorEdgar E. Iglesias <edgar.iglesias@gmail.com>2010-07-05 10:15:10 +0200
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2010-07-05 10:15:10 +0200
commit253248a3beb2440561bb28b48292ead9c2fd157f (patch)
tree6baa2684e9d276d100f3a1609285493286153b9c /target-cris
parent08af49da7e3c3ed72cdffe3d43a6618165406f34 (diff)
cris: Break out rand LFSR update into a separate func.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@axis.com>
Diffstat (limited to 'target-cris')
-rw-r--r--target-cris/mmu.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/target-cris/mmu.c b/target-cris/mmu.c
index d09e92123..07967dddb 100644
--- a/target-cris/mmu.c
+++ b/target-cris/mmu.c
@@ -55,6 +55,17 @@ static inline unsigned int compute_polynom(unsigned int sr)
return f;
}
+static void cris_mmu_update_rand_lfsr(CPUState *env)
+{
+ unsigned int f;
+
+ /* Update lfsr at every fault. */
+ f = compute_polynom(env->mmu_rand_lfsr);
+ env->mmu_rand_lfsr >>= 1;
+ env->mmu_rand_lfsr |= (f << 15);
+ env->mmu_rand_lfsr &= 0xffff;
+}
+
static inline int cris_mmu_enabled(uint32_t rw_gc_cfg)
{
return (rw_gc_cfg & 12) != 0;
@@ -251,14 +262,8 @@ static int cris_mmu_translate_page(struct cris_mmu_result *res,
}
if (!match) {
- unsigned int f;
-
- /* Update lfsr at every fault. */
- f = compute_polynom(env->mmu_rand_lfsr);
- env->mmu_rand_lfsr >>= 1;
- env->mmu_rand_lfsr |= (f << 15);
- env->mmu_rand_lfsr &= 0xffff;
-
+ cris_mmu_update_rand_lfsr(env);
+
/* Compute index. */
idx = vpage & 15;