qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Luis Pureza" <pureza@student.dei.uc.pt>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] PATCH: Fix Sparc32 save & load
Date: Fri, 1 Aug 2008 12:01:14 +0100	[thread overview]
Message-ID: <3e1533500808010401p2535b7c4v6af2cde623edc8a3@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]

The following patch fixes some issues with Sparc32 save & load operations.

The most significant change is the call to cpu_set_cwp(), just prior
to saving, to make sure the overflow registers are copied to the first
window if the cwp is the last window. Thus, on load, all registers
will have the correct values.

Also, I'm saving & loading two more fields of the CPUState -
interrupt_index and pil_in. I wonder if these are enough.

Finally, on SPARC64 saving code, I noticed a call to qemu_get_ptimer()
and replaced it with qemu_put_ptimer().

Best regards,

Luis Pureza

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix_Sparc32_load_restore.patch --]
[-- Type: text/x-diff; name=Fix_Sparc32_load_restore.patch, Size: 1276 bytes --]

Index: target-sparc/machine.c
===================================================================
--- target-sparc/machine.c	(revision 4975)
+++ target-sparc/machine.c	(working copy)
@@ -31,6 +31,10 @@
     int i;
     uint32_t tmp;
 
+    // if env->cwp == env->nwindows - 1, this will set the ins of the last
+    // window as the outs of the first window
+    cpu_set_cwp(env, env->cwp);
+
     for(i = 0; i < 8; i++)
         qemu_put_betls(f, &env->gregs[i]);
     qemu_put_be32s(f, &env->nwindows);
@@ -54,6 +58,8 @@
     qemu_put_be32(f, tmp);
     qemu_put_betls(f, &env->fsr);
     qemu_put_betls(f, &env->tbr);
+    qemu_put_be32s(f, &env->interrupt_index);
+    qemu_put_be32s(f, &env->pil_in);
 #ifndef TARGET_SPARC64
     qemu_put_be32s(f, &env->wim);
     /* MMU */
@@ -110,7 +116,7 @@
     qemu_put_be64s(f, &env->hver);
     qemu_put_be64s(f, &env->hstick_cmpr);
     qemu_put_be64s(f, &env->ssr);
-    qemu_get_ptimer(f, env->hstick);
+    qemu_put_ptimer(f, env->hstick);
 #endif
 }
 
@@ -147,6 +153,8 @@
     PUT_PSR(env, tmp);
     qemu_get_betls(f, &env->fsr);
     qemu_get_betls(f, &env->tbr);
+    qemu_get_be32s(f, &env->interrupt_index);
+    qemu_get_be32s(f, &env->pil_in);
 #ifndef TARGET_SPARC64
     qemu_get_be32s(f, &env->wim);
     /* MMU */

                 reply	other threads:[~2008-08-01 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3e1533500808010401p2535b7c4v6af2cde623edc8a3@mail.gmail.com \
    --to=pureza@student.dei.uc.pt \
    --cc=qemu-devel@nongnu.org \
    /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).