From patchwork Tue Jan 26 23:11:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: sparc64: correct write extra bits to cwp Date: Tue, 26 Jan 2010 13:11:06 -0000 From: "Igor V. Kovalenko" X-Patchwork-Id: 43752 Message-Id: <20100126231106.22550.1006.stgit@skyserv> To: qemu-devel@nongnu.org From: Igor V. Kovalenko - correctly fit to cwp if provided window number is out of range Signed-off-by: Igor V. Kovalenko --- target-sparc/cpu.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 50859c7..842a2f4 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -519,7 +519,7 @@ static inline void PUT_PSR(CPUSPARCState *env1, target_ulong val) static inline void PUT_CWP64(CPUSPARCState *env1, int cwp) { if (unlikely(cwp >= env1->nwindows || cwp < 0)) - cwp = 0; + cwp %= env1->nwindows; cpu_set_cwp(env1, env1->nwindows - 1 - cwp); } #endif