qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] target-sparc has inverse cwp logic for SAVE/RESTORE?


From: Mark Cave-Ayland
Subject: [Qemu-devel] target-sparc has inverse cwp logic for SAVE/RESTORE?
Date: Sun, 18 May 2014 13:48:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0

Hi all,

I've been working on debugging a window-related OpenBIOS issue and noticed that the cwp register logic in QEMU appears to be backwards according to the SPARCv9 specification. From sections 6.3.6.1 and 6.3.6.2:

"The SAVE instruction allocates a new register window and saves the caller’s register window by incrementing the CWP register."

"The RESTORE instruction restores the previous register window by decrementing the CWP register."

In target-sparc/win_helper.c the logic in helper_save() and helper_restore() is inverted, i.e. executing SAVE decrements cwp while executing RESTORE increments cwp.

The surprise here was that executing SAVE when cwp == 0 changed cwp to 7 rather than 1. AFAICT there should be no functional difference, but it would make things less confusing when debugging window traps if the logic from the specification was followed. Does anyone know why this is currently done this way?


ATB,

Mark.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]