All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [5318] SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf).
Date: Mon, 29 Sep 2008 18:20:09 +0200	[thread overview]
Message-ID: <48E10039.8000104@suse.de> (raw)
In-Reply-To: <48E0FE12.5080408@codemonkey.ws>

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

Anthony Liguori wrote:
> Andrzej Zaborowski wrote:
>> Revision: 5318
>>           http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5318
>> Author:   balrog
>> Date:     2008-09-25 18:16:18 +0000 (Thu, 25 Sep 2008)
>>
>> Log Message:
>> -----------
>> SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf).
>>
>> On Intel CPUs, sysenter and sysexit are valid in 64-bit mode. This patch
>> makes both 64-bit aware and enables them for Intel CPUs.
>> Add cpu save/load for 64-bit wide sysenter variables.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>   
>
> This change broke save/restore.  It was already broken when this 
> commit happened so it really just further broke it :-)
>
>> Modified: trunk/target-i386/cpu.h
>> ===================================================================
>> --- trunk/target-i386/cpu.h    2008-09-25 18:11:30 UTC (rev 5317)
>> +++ trunk/target-i386/cpu.h    2008-09-25 18:16:18 UTC (rev 5318)
>> @@ -549,8 +549,8 @@
>>  
>>      /* sysenter registers */
>>      uint32_t sysenter_cs;
>>   
>
> is a u32
>
>> -    uint32_t sysenter_esp;
>> -    uint32_t sysenter_eip;
>> +    target_ulong sysenter_esp;
>> +    target_ulong sysenter_eip;
>>      uint64_t efer;
>>      uint64_t star;
>>   
>
> But is being saved as a target_ulong.
>
>> -    qemu_put_be32s(f, &env->sysenter_cs);
>> -    qemu_put_be32s(f, &env->sysenter_esp);
>> -    qemu_put_be32s(f, &env->sysenter_eip);
>> +    qemu_put_betls(f, &env->sysenter_cs);
>> +    qemu_put_betls(f, &env->sysenter_esp);
>> +    qemu_put_betls(f, &env->sysenter_eip);
>>  
>>      qemu_put_betls(f, &env->cr[0]);
>>      qemu_put_betls(f, &env->cr[2]);
>> @@ -169,7 +169,7 @@
>
> And loaded as a u32.
>
>>  
>>      qemu_get_be32s(f, &env->sysenter_cs);
>> -    qemu_get_be32s(f, &env->sysenter_esp);
>> -    qemu_get_be32s(f, &env->sysenter_eip);
>> +    if (version_id >= 7) {
>> +        qemu_get_betls(f, &env->sysenter_esp);
>> +        qemu_get_betls(f, &env->sysenter_eip);
>> +    } else {
>> +        qemu_get_be32s(f, &env->sysenter_esp);
>> +        qemu_get_be32s(f, &env->sysenter_eip);
>> +    }
>>  
>
> When making changes to target-i386, please make sure to test both qemu 
> and qemu-system-x86_64.  In this case, the code would have worked with 
> qemu but it doesn't work with qemu-system-x86_64.

Ouch, thanks for the catch. Please  double-check and apply :-).

Alex

[-- Attachment #2: sysenter-save.patch --]
[-- Type: text/x-patch, Size: 440 bytes --]

Index: target-i386/machine.c
===================================================================
--- target-i386/machine.c	(revision 5350)
+++ target-i386/machine.c	(working copy)
@@ -88,7 +88,7 @@
     cpu_put_seg(f, &env->gdt);
     cpu_put_seg(f, &env->idt);
 
-    qemu_put_betls(f, &env->sysenter_cs);
+    qemu_put_be32s(f, &env->sysenter_cs);
     qemu_put_betls(f, &env->sysenter_esp);
     qemu_put_betls(f, &env->sysenter_eip);
 

  reply	other threads:[~2008-09-29 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 18:16 [Qemu-devel] [5318] SYSENTER/SYSEXIT IA-32e implementation (Alexander Graf) Andrzej Zaborowski
2008-09-29 16:10 ` Anthony Liguori
2008-09-29 16:20   ` Alexander Graf [this message]
2008-09-29 16:28     ` Anthony Liguori

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=48E10039.8000104@suse.de \
    --to=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.