All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Avi Kivity <avi@qumranet.com>,
	Anthony Liguori <aliguori@linux.vnet.ibm.com>,
	Mohammed Gamal <m.gamal005@gmail.com>,
	"Kamble, Nitin A" <nitin.a.kamble@intel.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	laurent.vivier@bull.net, Alexander Graf <alex@csgraf.de>
Subject: Re: [Patch 4/7] RealMode: Adds support for jmp far 0xea
Date: Tue, 27 May 2008 13:32:40 -0500	[thread overview]
Message-ID: <483C53C8.6030400@us.ibm.com> (raw)
In-Reply-To: <20080527101908.749cff41@frecb000711.frec.bull.fr>

Guillaume Thouvenin wrote:
>  Adds support for jmp far 0xea instruction
>
>
> Signed-off-by: Guillaume Thouvenin <guillaume.thouvenin@ext.bull.net>
> Signed-off-by: Laurent Vivier <laurent.vivier@bull.net>
>
> ---
>  arch/x86/kvm/x86_emulate.c |   31 +++++++++++++++++++++++++++++--
>  1 files changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
> index a928aa6..48b62cc 100644
> --- a/arch/x86/kvm/x86_emulate.c
> +++ b/arch/x86/kvm/x86_emulate.c
> @@ -168,7 +168,8 @@ static u16 opcode_table[256] = {
>  	/* 0xE0 - 0xE7 */
>  	0, 0, 0, 0, 0, 0, 0, 0,
>  	/* 0xE8 - 0xEF */
> -	ImplicitOps | Stack, SrcImm|ImplicitOps, 0, SrcImmByte|ImplicitOps,
> +	ImplicitOps | Stack, SrcImm | ImplicitOps,
> +	ImplicitOps, SrcImmByte | ImplicitOps,
>  	0, 0, 0, 0,
>  	/* 0xF0 - 0xF7 */
>  	0, 0, 0, 0,
> @@ -1661,7 +1662,33 @@ special_insn:
>  		break;
>  	}
>  	case 0xe9: /* jmp rel */
> -	case 0xeb: /* jmp rel short */
> +		goto jmp;
>   

The cases don't have to be in ascending order.  Much better to leave 
0xeb here then have a jmp cross case boundaries.

Regards,

Anthony Liguori

> +	case 0xea: /* jmp far */ {
> +		uint32_t eip;
> +		uint16_t sel;
> +
> +		switch (c->op_bytes) {
> +		case 2:
> +			eip = insn_fetch(u16, 2, c->eip);
> +			break;
> +		case 4:
> +			eip = insn_fetch(u32, 4, c->eip);
> +			break;
> +		default:
> +			DPRINTF("jmp far: Invalid op_bytes\n");
> +			goto cannot_emulate;
> +		}
> +		sel = insn_fetch(u16, 2, c->eip);
> +		if (kvm_load_segment_descriptor(ctxt->vcpu, sel, 9, VCPU_SREG_CS) < 0) {
> +			DPRINTF("jmp far: Failed to load CS descriptor\n");
> +			goto cannot_emulate;
> +		}
> +
> +		c->eip = eip;
> +		break;
> +	}
> +	case 0xeb:
> +	      jmp:		/* jmp rel short */
>  		jmp_rel(c, c->src.val);
>  		c->dst.type = OP_NONE; /* Disable writeback. */
>  		break;
>   


  parent reply	other threads:[~2008-05-27 18:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080527084115.2b0cfae1@frecb000711.frec.bull.fr>
     [not found] ` <20080527101923.77e62e21@frecb000711.frec.bull.fr>
2008-05-27 10:12   ` [Patch 6/7] RealMode: Adds support for mov seg, r (0x8e) instruction Avi Kivity
2008-05-27 12:49     ` Guillaume Thouvenin
     [not found] ` <20080527101933.68cdc7de@frecb000711.frec.bull.fr>
2008-05-27 10:14   ` [Patch 7/7] RealMode: Adds support for mov r, sreg (0x8c) instruction Avi Kivity
2008-05-27 13:05     ` Guillaume Thouvenin
2008-05-27 13:13       ` Guillaume Thouvenin
     [not found] ` <20080527101908.749cff41@frecb000711.frec.bull.fr>
2008-05-27 18:32   ` Anthony Liguori [this message]
2008-05-28  6:30     ` [Patch 4/7] RealMode: Adds support for jmp far 0xea Avi Kivity

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=483C53C8.6030400@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=alex@csgraf.de \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=avi@qumranet.com \
    --cc=guillaume.thouvenin@ext.bull.net \
    --cc=kvm@vger.kernel.org \
    --cc=laurent.vivier@bull.net \
    --cc=m.gamal005@gmail.com \
    --cc=mtosatti@redhat.com \
    --cc=nitin.a.kamble@intel.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 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.