public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
To: Kevin Wolf <kwolf@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC PATCH] emulator: Fix task switch into/out of VM86
Date: Tue, 10 Jan 2012 13:07:08 +0900	[thread overview]
Message-ID: <4F0BB96C.2020504@oss.ntt.co.jp> (raw)
In-Reply-To: <1326139810-5448-1-git-send-email-kwolf@redhat.com>

(2012/01/10 5:10), Kevin Wolf wrote:

> @@ -2254,7 +2258,14 @@ static int load_state_from_tss32(struct x86_emulate_ctxt *ctxt,
>   	if (ctxt->ops->set_cr(ctxt, 3, tss->cr3))
>   		return emulate_gp(ctxt, 0);
>   	ctxt->_eip = tss->eip;
> +
>   	ctxt->eflags = tss->eflags | 2;

(Though not directly related to this RFC ...)

What is this 2 for?
Do we need to set a reserved bit?

> +	if (ctxt->eflags & 0x20000)

You can use a macro to indicate the flag.

1. from arch/x86/kvm/emulate.c:

/* EFLAGS bit definitions. */
#define EFLG_ID (1<<21)
#define EFLG_VIP (1<<20)
#define EFLG_VIF (1<<19)
#define EFLG_AC (1<<18)
#define EFLG_VM (1<<17)
#define EFLG_RF (1<<16)
...

#define EFLG_RESERVED_ZEROS_MASK 0xffc0802a
#define EFLG_RESERVED_ONE_MASK 2

2. from arch/x86/include/asm/processor-flags.h

/*
 * EFLAGS bits
 */
#define X86_EFLAGS_CF   0x00000001 /* Carry Flag */
#define X86_EFLAGS_PF   0x00000004 /* Parity Flag */
...
#define X86_EFLAGS_VM   0x00020000 /* Virtual Mode */
#define X86_EFLAGS_AC   0x00040000 /* Alignment Check */
#define X86_EFLAGS_VIF  0x00080000 /* Virtual Interrupt Flag */
#define X86_EFLAGS_VIP  0x00100000 /* Virtual Interrupt Pending */
#define X86_EFLAGS_ID   0x00200000 /* CPUID detection flag */


Two possibilities, not nice, but both are used in emulate.c.

	Takuya

  parent reply	other threads:[~2012-01-10  4:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 20:10 [RFC PATCH] emulator: Fix task switch into/out of VM86 Kevin Wolf
2012-01-10  3:08 ` Takuya Yoshikawa
2012-01-10  4:07 ` Takuya Yoshikawa [this message]
2012-01-10  9:01 ` Gleb Natapov
2012-01-10  9:28   ` Kevin Wolf
2012-01-10 10:17     ` Gleb Natapov
2012-01-10 11:25     ` Kevin Wolf
2012-01-10 11:30       ` Gleb Natapov
2012-01-10 17:51         ` Joerg Roedel
2012-01-16 15:37           ` Kevin Wolf
2012-01-16 15:57             ` Joerg Roedel

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=4F0BB96C.2020504@oss.ntt.co.jp \
    --to=yoshikawa.takuya@oss.ntt.co.jp \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    /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