From: "Jan Beulich" Subject: Re: [PATCH for-4.5 2/2] x86/hvm: Improve "Emulation failed @" error messages Date: Fri, 26 Sep 2014 12:39:40 +0100 Message-ID: <54256C9C0200007800039985@mail.emea.novell.com> References: <1411726207-2689-1-git-send-email-andrew.cooper3@citrix.com> <1411726207-2689-3-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1411726207-2689-3-git-send-email-andrew.cooper3@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: Kevin Tian , Keir Fraser , Tim Deegan , Eddie Dong , Xen-devel , Jun Nakajima List-Id: xen-devel@lists.xenproject.org >>> On 26.09.14 at 12:10, wrote: > @@ -1449,6 +1441,37 @@ 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: > + return "Real"; > + case 1: > + return "v8086"; > + case 2: return "16bit"; > + case 4: > + return "32bit"; > + case 8: > + return "64bit"; > + default: > + return "Unknown"; > + } > +} > + > +void hvm_dump_emulation_state(const char *prefix, > + struct hvm_emulate_ctxt *hvmemul_ctxt) > +{ > + struct vcpu *curr = current; > + const char *mode_str = guest_x86_mode_to_str(hvm_guest_x86_mode(curr)); > + struct segment_register *cs = hvmemul_get_seg_reg(x86_seg_cs, hvmemul_ctxt); Long line. And perhaps add "const"? > + > + printk("%s emulation failed: %pv %s mode, %u bytes @ %04x:%lx: %*ph\n", > + prefix, curr, mode_str, hvmemul_ctxt->insn_buf_bytes, Do you really need to print the byte count as a number when the new formatting will suitably limit output anyway? Jan