qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: Blue Swirl <blauwirbel@gmail.com>, Richard Henderson <rth@twiddle.net>
Subject: [Qemu-devel] target-sparc has inverse cwp logic for SAVE/RESTORE?
Date: Sun, 18 May 2014 13:48:48 +0100	[thread overview]
Message-ID: <5378AC30.9090900@ilande.co.uk> (raw)

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	other threads:[~2014-05-18 12:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18 12:48 Mark Cave-Ayland [this message]
2014-05-18 16:06 ` [Qemu-devel] target-sparc has inverse cwp logic for SAVE/RESTORE? Olivier Danet
2014-05-19 10:56   ` Mark Cave-Ayland
2014-05-24  6:26     ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5378AC30.9090900@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).