From: "Jan Beulich" Subject: [PATCH 3/4] x86/traps: replace plain numbers Date: Thu, 22 Jan 2015 14:00:12 +0000 Message-ID: <54C1107C0200007800058299@mail.emea.novell.com> References: <54C10EE1020000780005827E@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part83B61B7C.1__=" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YEIIv-0004nq-GF for xen-devel@lists.xenproject.org; Thu, 22 Jan 2015 14:00:13 +0000 In-Reply-To: <54C10EE1020000780005827E@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Andrew Cooper , Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part83B61B7C.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... making the code better document itself. No functional change intended. Note that for now (as we don't support RTM yet) DR_STATUS_RESERVED_ONE and its users don't take DR_NOT_RTM into consideration yet. Signed-off-by: Jan Beulich --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -531,9 +531,9 @@ static void instruction_done( regs->eflags &=3D ~X86_EFLAGS_RF; if ( bpmatch || (regs->eflags & X86_EFLAGS_TF) ) { - current->arch.debugreg[6] |=3D bpmatch | 0xffff0ff0; + current->arch.debugreg[6] |=3D bpmatch | DR_STATUS_RESERVED_ONE; if ( regs->eflags & X86_EFLAGS_TF ) - current->arch.debugreg[6] |=3D 0x4000; + current->arch.debugreg[6] |=3D DR_STEP; do_guest_trap(TRAP_debug, regs, 0); } } @@ -3872,8 +3872,8 @@ long set_debugreg(struct vcpu *v, unsign * DR6: Bits 4-11,16-31 reserved (set to 1). * Bit 12 reserved (set to 0). */ - value &=3D 0xffffefff; /* reserved bits =3D> 0 */ - value |=3D 0xffff0ff0; /* reserved bits =3D> 1 */ + value &=3D ~DR_STATUS_RESERVED_ZERO; /* reserved bits =3D> 0 */ + value |=3D DR_STATUS_RESERVED_ONE; /* reserved bits =3D> 1 */ if ( v =3D=3D curr )=20 write_debugreg(6, value); break; --- a/xen/include/asm-x86/debugreg.h +++ b/xen/include/asm-x86/debugreg.h @@ -21,6 +21,8 @@ #define DR_STEP (0x4000) /* single-step */ #define DR_SWITCH (0x8000) /* task switch */ #define DR_NOT_RTM (0x10000) /* clear: #BP inside RTM region = */ +#define DR_STATUS_RESERVED_ZERO (~0xffffeffful) /* Reserved, read as zero = */ +#define DR_STATUS_RESERVED_ONE 0xffff0ff0ul /* Reserved, read as one */ =20 /* Now define a bunch of things for manipulating the control register. The top two bytes of the control register consist of 4 fields of 4 --=__Part83B61B7C.1__= Content-Type: text/plain; name="x86-traps-literals.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-traps-literals.patch" x86/traps: replace plain numbers=0A=0A... making the code better document = itself. No functional change=0Aintended.=0A=0ANote that for now (as we = don't support RTM yet) DR_STATUS_RESERVED_ONE=0Aand its users don't take = DR_NOT_RTM into consideration yet.=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/traps.c=0A+++ b/xen/arch/x86/tr= aps.c=0A@@ -531,9 +531,9 @@ static void instruction_done(=0A regs->efla= gs &=3D ~X86_EFLAGS_RF;=0A if ( bpmatch || (regs->eflags & X86_EFLAGS_T= F) )=0A {=0A- current->arch.debugreg[6] |=3D bpmatch | = 0xffff0ff0;=0A+ current->arch.debugreg[6] |=3D bpmatch | DR_STATUS_R= ESERVED_ONE;=0A if ( regs->eflags & X86_EFLAGS_TF )=0A- = current->arch.debugreg[6] |=3D 0x4000;=0A+ current->arch.debugre= g[6] |=3D DR_STEP;=0A do_guest_trap(TRAP_debug, regs, 0);=0A = }=0A }=0A@@ -3872,8 +3872,8 @@ long set_debugreg(struct vcpu *v, unsign=0A = * DR6: Bits 4-11,16-31 reserved (set to 1).=0A * = Bit 12 reserved (set to 0).=0A */=0A- value &=3D 0xffffefff= ; /* reserved bits =3D> 0 */=0A- value |=3D 0xffff0ff0; /* reserved = bits =3D> 1 */=0A+ value &=3D ~DR_STATUS_RESERVED_ZERO; /* reserved = bits =3D> 0 */=0A+ value |=3D DR_STATUS_RESERVED_ONE; /* reserved = bits =3D> 1 */=0A if ( v =3D=3D curr ) =0A write_debugr= eg(6, value);=0A break;=0A--- a/xen/include/asm-x86/debugreg.h=0A++= + b/xen/include/asm-x86/debugreg.h=0A@@ -21,6 +21,8 @@=0A #define DR_STEP = (0x4000) /* single-step */=0A #define DR_SWITCH = (0x8000) /* task switch */=0A #define DR_NOT_RTM (0x10000) = /* clear: #BP inside RTM region */=0A+#define DR_STATUS_RESERVED_ZERO = (~0xffffeffful) /* Reserved, read as zero */=0A+#define DR_STATUS_RESERVED_= ONE 0xffff0ff0ul /* Reserved, read as one */=0A =0A /* Now define a bunch = of things for manipulating the control register.=0A The top two bytes = of the control register consist of 4 fields of 4=0A --=__Part83B61B7C.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part83B61B7C.1__=--