From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] x86 emulator: Add 'push/pop sreg' instructions Date: Wed, 19 Aug 2009 16:03:54 +0300 Message-ID: <4A8BF83A.4090306@redhat.com> References: <1250655104-437-1-git-send-email-m.gamal005@gmail.com> <4A8BB8AA.5020401@redhat.com> <52d4a3890908190552y51f0d38fnbb2919d5581fb931@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34823 "EHLO mx2.redhat.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752242AbZHSND4 (ORCPT ); Wed, 19 Aug 2009 09:03:56 -0400 In-Reply-To: <52d4a3890908190552y51f0d38fnbb2919d5581fb931@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/19/2009 03:52 PM, Mohammed Gamal wrote: > >>> +static void emulate_push_sreg(struct x86_emulate_ctxt *ctxt, int seg) >>> +{ >>> + struct decode_cache *c =&ctxt->decode; >>> + struct kvm_segment segment; >>> + >>> + if (ctxt->mode == X86EMUL_MODE_PROT64&& (seg != VCPU_SREG_FS || >>> + seg != VCPU_SREG_GS)) { >>> + kvm_queue_exception(ctxt->vcpu, UD_VECTOR); >>> + return; >>> + } >>> >>> >> It's better to check at the callsite, in case the opcode is ever reused for >> a new instruction. Or even better, add a new decode flag No64 so we can do >> this during the decode stage. >> > Good idea, but I believe it'd be better to introduce it in a separate > patch so that we can update all instructions incompatible with long > mode in one go. I'll move the checks to the call site for the time > being. > Sure. Or do the No64 patch first. -- error compiling committee.c: too many arguments to function