From: "Jan Beulich" Subject: Re: [PATCH for 4.5 v2 2/2] x86/hvm: Improve "Emulation failed @" error messages Date: Mon, 29 Sep 2014 10:35:07 +0100 Message-ID: <542943EB020000780003A54E@mail.emea.novell.com> References: <1411748677-21069-1-git-send-email-andrew.cooper3@citrix.com> <1411748677-21069-3-git-send-email-andrew.cooper3@citrix.com> <542935B0020000780003A467@mail.emea.novell.com> <54292518.9070609@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54292518.9070609@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: KeirFraser , Kevin Tian , EddieDong , Jun Nakajima , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 29.09.14 at 11:23, wrote: > On 29/09/14 09:34, Jan Beulich wrote: >>>>> On 26.09.14 at 18:24, wrote: >>> @@ -1449,6 +1441,30 @@ struct segment_register *hvmemul_get_seg_reg( >>> return &hvmemul_ctxt->seg_reg[seg]; >>> } >>> >>> +static const char *guest_x86_mode_to_str(int mode) >>> +{ >>> + switch ( mode ) >>> + { >>> + case 0 ... 2: return "16bit"; >> I don't really follow why you dropped the real and vm86 mode >> special casing here (nor do I think ???_guest_x86_mode() is >> producing insufficient detail for the purposes here or elsewhere). > > I specifically want to avoid having specifics like "Real" and "v86" > along side more generic terms such as "16bit", because I can see even > myself as the author getting confused in the future. > > One option would be to borrow the terminology from > http://sandpile.org/x86/mode.htm which is unambiguous, and provides > rather more information than just how to decode the instructions. > Unfortunately, ???_guest_x86_mode() is insufficiently expressive to > express this complete set. The distinction there clearly goes too far for the purposes here. Knowing whether the code was executing in protected or real/vm86 modes may be useful though for assigning proper meaning to the printed code selector value. And implying protected mode from "NNbit" being printed isn't that hard a task. Jan