From patchwork Mon Apr 1 07:42:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10879267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B523A15AC for ; Mon, 1 Apr 2019 07:45:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94674285BE for ; Mon, 1 Apr 2019 07:45:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83DFE28745; Mon, 1 Apr 2019 07:45:15 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 20F44285BE for ; Mon, 1 Apr 2019 07:45:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hArat-000667-Vv; Mon, 01 Apr 2019 07:42:59 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hArat-000662-4v for xen-devel@lists.xenproject.org; Mon, 01 Apr 2019 07:42:59 +0000 X-Inumbo-ID: c45ce0ae-5451-11e9-bc90-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c45ce0ae-5451-11e9-bc90-bc764e045a96; Mon, 01 Apr 2019 07:42:57 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Mon, 01 Apr 2019 01:42:57 -0600 Message-Id: <5CA1C0F902000078002236A3@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Mon, 01 Apr 2019 01:42:49 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] x86emul/fuzz: extend canonicalization to 57-bit linear address width case X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: George Dunlap , Andrew Cooper , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Don't enforce any other dependencies for now, just like we don't enforce e.g. PAE enabled as a prereq for long mode. Signed-off-by: Jan Beulich Acked-by: George Dunlap --- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c +++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c @@ -662,21 +662,21 @@ static void set_sizes(struct x86_emulate } } -#define CANONICALIZE(x) \ +#define CANONICALIZE(x, bits) \ do { \ uint64_t _y = (x); \ - if ( _y & (1ULL << 47) ) \ - _y |= (~0ULL) << 48; \ + if ( _y & (1ULL << ((bits) - 1)) ) \ + _y |= (~0ULL) << (bits); \ else \ - _y &= (1ULL << 48)-1; \ + _y &= (1ULL << (bits)) - 1; \ printf("Canonicalized %" PRIx64 " to %" PRIx64 "\n", x, _y); \ (x) = _y; \ } while( 0 ) -/* Expects bitmap and regs to be defined */ +/* Expects bitmap, regs, and c to be defined */ #define CANONICALIZE_MAYBE(reg) \ if ( !(bitmap & (1 << CANONICALIZE_##reg)) ) \ - CANONICALIZE(regs->reg); \ + CANONICALIZE(regs->reg, c->cr[4] & X86_CR4_LA57 ? 57 : 48); \ enum { HOOK_read, --- a/xen/include/asm-x86/x86-defns.h +++ b/xen/include/asm-x86/x86-defns.h @@ -64,6 +64,7 @@ #define X86_CR4_OSFXSR 0x00000200 /* enable fast FPU save and restore */ #define X86_CR4_OSXMMEXCPT 0x00000400 /* enable unmasked SSE exceptions */ #define X86_CR4_UMIP 0x00000800 /* enable UMIP */ +#define X86_CR4_LA57 0x00001000 /* enable 5-level paging */ #define X86_CR4_VMXE 0x00002000 /* enable VMX */ #define X86_CR4_SMXE 0x00004000 /* enable SMX */ #define X86_CR4_FSGSBASE 0x00010000 /* enable {rd,wr}{fs,gs}base */