From: Edgar E. Iglesias Date: Mon, 5 Jul 2010 08:15:10 +0000 (+0200) Subject: cris: Break out rand LFSR update into a separate func. X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~7466 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=253248a3beb2440561bb28b48292ead9c2fd157f;p=sdk%2Femulator%2Fqemu.git cris: Break out rand LFSR update into a separate func. Signed-off-by: Edgar E. Iglesias --- diff --git a/target-cris/mmu.c b/target-cris/mmu.c index d09e921..07967dd 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;