From patchwork Mon Dec 5 10:09:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9460767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D51760459 for ; Mon, 5 Dec 2016 10:11:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2621222ADC for ; Mon, 5 Dec 2016 10:11:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A5D726490; Mon, 5 Dec 2016 10:11:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A4A2A22ADC for ; Mon, 5 Dec 2016 10:11:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDqDQ-0007pu-ME; Mon, 05 Dec 2016 10:09:44 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cDqDP-0007n8-Iu for xen-devel@lists.xen.org; Mon, 05 Dec 2016 10:09:43 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id FB/5B-31715-6EC35485; Mon, 05 Dec 2016 10:09:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsXitHRDpO4zG9c Igw0zuS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyee1eZC7o1Kx68O8PWwLhJoYuRk0NCwF9i 6ZcvjCA2m4C+xO4Xn5hAbBEBdYnTHRdZuxg5OJgF/CQOPfAFCQsLuEp8WPiDBcRmEVCRePfrI Vg5r4CnxPy3/5kgRspJnD/+kxnE5hTwklg6eytYvRBQze+PfUwQtprEtf5L7BC9ghInZz4Bq2 EWkJA4+OIF8wRG3llIUrOQpBYwMq1i1ChOLSpLLdI1MtZLKspMzyjJTczM0TU0MNbLTS0uTkx PzUlMKtZLzs/dxAgMnXoGBsYdjH17/Q4xSnIwKYnythi6RgjxJeWnVGYkFmfEF5XmpBYfYpTh 4FCS4G2xBsoJFqWmp1akZeYAgxgmLcHBoyTCux0kzVtckJhbnJkOkTrFqMsx7dnip0xCLHn5e alS4rwnQIoEQIoySvPgRsAi6hKjrJQwLyMDA4MQT0FqUW5mCar8K0ZxDkYlYd4zIFN4MvNK4D a9AjqCCeiIE8edQY4oSURISTUwdhVOnnyu2VyPtW57wFbDy0fe+W405v0ewceROu1/7fL35/r WfDvkkLbtRvPTW3sXOidpnjuq8FOATdAp/9PF678lrt7Qk1roX6n+8Ywzk8zlLpfeaX8mlx9R /ln4ZKn/yduye7/N87/24Nx14asvlqYZVb75t+aX55wHDOoHNilw315urxdpcUuJpTgj0VCLu ag4EQCOsAIcowIAAA== X-Env-Sender: prvs=140b549e8=Andrew.Cooper3@citrix.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1480932577!57653486!4 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53121 invoked from network); 5 Dec 2016 10:09:41 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-12.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 5 Dec 2016 10:09:41 -0000 X-IronPort-AV: E=Sophos;i="5.33,747,1477958400"; d="scan'208";a="393002856" From: Andrew Cooper To: Xen-devel Date: Mon, 5 Dec 2016 10:09:27 +0000 Message-ID: <1480932571-23547-5-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1480932571-23547-1-git-send-email-andrew.cooper3@citrix.com> References: <1480932571-23547-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Jan Beulich Subject: [Xen-devel] [PATCH 4/8] x86/emul: Drop the last remaining uses of bool_t X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP And drop the compatibility typedef from the userspace harness Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich --- tools/tests/x86_emulator/x86_emulate.c | 2 -- xen/arch/x86/x86_emulate/x86_emulate.c | 43 ++++++++++++++++++---------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/tools/tests/x86_emulator/x86_emulate.c b/tools/tests/x86_emulator/x86_emulate.c index 897b9ab..14a6fc2 100644 --- a/tools/tests/x86_emulator/x86_emulate.c +++ b/tools/tests/x86_emulator/x86_emulate.c @@ -8,8 +8,6 @@ #include "x86_emulate/x86_emulate.h" -typedef bool bool_t; - #define is_canonical_address(x) (((int64_t)(x) >> 47) == ((int64_t)(x) >> 63)) #define EFER_SCE (1 << 0) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index 108ff8a..877023d 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -692,7 +692,7 @@ static inline int mkec(uint8_t e, int32_t ec, ...) * Given byte has even parity (even number of 1s)? SDM Vol. 1 Sec. 3.4.3.1, * "Status Flags": EFLAGS.PF reflects parity of least-sig. byte of result only. */ -static bool_t even_parity(uint8_t v) +static bool even_parity(uint8_t v) { #ifdef __GCC_ASM_FLAG_OUTPUTS__ asm ( "test %1,%1" : "=@ccp" (v) : "q" (v) ); @@ -997,9 +997,9 @@ static int read_ulong( * IN: Multiplicand=m[0], Multiplier=m[1] * OUT: Return CF/OF (overflow status); Result=m[1]:m[0] */ -static bool_t mul_dbl(unsigned long m[2]) +static bool mul_dbl(unsigned long m[2]) { - bool_t rc; + bool rc; #ifdef __GCC_ASM_FLAG_OUTPUTS__ asm ( "mul %1" : "+a" (m[0]), "+d" (m[1]), "=@cco" (rc) ); @@ -1016,9 +1016,9 @@ static bool_t mul_dbl(unsigned long m[2]) * IN: Multiplicand=m[0], Multiplier=m[1] * OUT: Return CF/OF (overflow status); Result=m[1]:m[0] */ -static bool_t imul_dbl(unsigned long m[2]) +static bool imul_dbl(unsigned long m[2]) { - bool_t rc; + bool rc; #ifdef __GCC_ASM_FLAG_OUTPUTS__ asm ( "imul %1" : "+a" (m[0]), "+d" (m[1]), "=@cco" (rc) ); @@ -1036,7 +1036,7 @@ static bool_t imul_dbl(unsigned long m[2]) * OUT: Return 1: #DE * Return 0: Quotient=u[0], Remainder=u[1] */ -static bool_t div_dbl(unsigned long u[2], unsigned long v) +static bool div_dbl(unsigned long u[2], unsigned long v) { if ( (v == 0) || (u[1] >= v) ) return 1; @@ -1052,9 +1052,9 @@ static bool_t div_dbl(unsigned long u[2], unsigned long v) * NB. We don't use idiv directly as it's moderately hard to work out * ahead of time whether it will #DE, which we cannot allow to happen. */ -static bool_t idiv_dbl(unsigned long u[2], long v) +static bool idiv_dbl(unsigned long u[2], long v) { - bool_t negu = (long)u[1] < 0, negv = v < 0; + bool negu = (long)u[1] < 0, negv = v < 0; /* u = abs(u) */ if ( negu ) @@ -1086,7 +1086,7 @@ static bool_t idiv_dbl(unsigned long u[2], long v) return 0; } -static bool_t +static bool test_cc( unsigned int condition, unsigned int flags) { @@ -1218,7 +1218,7 @@ static int ioport_access_check( return rc; } -static bool_t +static bool in_realmode( struct x86_emulate_ctxt *ctxt, const struct x86_emulate_ops *ops) @@ -1233,7 +1233,7 @@ in_realmode( return (!rc && !(cr0 & CR0_PE)); } -static bool_t +static bool in_protmode( struct x86_emulate_ctxt *ctxt, const struct x86_emulate_ops *ops) @@ -1246,7 +1246,7 @@ in_protmode( #define EDX 2 #define EBX 3 -static bool_t vcpu_has( +static bool vcpu_has( unsigned int eax, unsigned int reg, unsigned int bit, @@ -1350,7 +1350,7 @@ realmode_load_seg( static int protmode_load_seg( enum x86_segment seg, - uint16_t sel, bool_t is_ret, + uint16_t sel, bool is_ret, struct segment_register *sreg, struct x86_emulate_ctxt *ctxt, const struct x86_emulate_ops *ops) @@ -1527,7 +1527,7 @@ protmode_load_seg( static int load_seg( enum x86_segment seg, - uint16_t sel, bool_t is_ret, + uint16_t sel, bool is_ret, struct segment_register *sreg, struct x86_emulate_ctxt *ctxt, const struct x86_emulate_ops *ops) @@ -4864,9 +4864,10 @@ x86_emulate( break; } - case X86EMUL_OPC(0x0f, 0x35): /* sysexit */ { + case X86EMUL_OPC(0x0f, 0x35): /* sysexit */ + { uint64_t msr_content; - bool_t user64 = !!(rex_prefix & REX_W); + bool user64 = rex_prefix & REX_W; generate_exception_if(!mode_ring0(), EXC_GP, 0); generate_exception_if(!in_protmode(ctxt, ops), EXC_GP, 0); @@ -5191,8 +5192,9 @@ x86_emulate( emulate_2op_SrcV_nobyte("btc", src, dst, _regs.eflags); break; - case X86EMUL_OPC(0x0f, 0xbc): /* bsf or tzcnt */ { - bool_t zf; + case X86EMUL_OPC(0x0f, 0xbc): /* bsf or tzcnt */ + { + bool zf; #ifdef __GCC_ASM_FLAG_OUTPUTS__ asm ( "bsf %2,%0" @@ -5223,8 +5225,9 @@ x86_emulate( break; } - case X86EMUL_OPC(0x0f, 0xbd): /* bsr or lzcnt */ { - bool_t zf; + case X86EMUL_OPC(0x0f, 0xbd): /* bsr or lzcnt */ + { + bool zf; #ifdef __GCC_ASM_FLAG_OUTPUTS__ asm ( "bsr %2,%0"