From patchwork Mon Jun 4 21:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Programmingkid X-Patchwork-Id: 10447347 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 A9BAB601A1 for ; Mon, 4 Jun 2018 21:12:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A9B2292DA for ; Mon, 4 Jun 2018 21:12:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F6C6292DD; Mon, 4 Jun 2018 21:12:24 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43CA5292DA for ; Mon, 4 Jun 2018 21:12:24 +0000 (UTC) Received: from localhost ([::1]:41980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPwm7-00030I-ER for patchwork-qemu-devel@patchwork.kernel.org; Mon, 04 Jun 2018 17:12:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPwl8-0002Ra-EL for qemu-devel@nongnu.org; Mon, 04 Jun 2018 17:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPwl5-00029D-75 for qemu-devel@nongnu.org; Mon, 04 Jun 2018 17:11:22 -0400 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]:38626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPwl5-00028x-32 for qemu-devel@nongnu.org; Mon, 04 Jun 2018 17:11:19 -0400 Received: by mail-it0-x241.google.com with SMTP id v83-v6so757917itc.3 for ; Mon, 04 Jun 2018 14:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=wIUC2S2uZPQDVE0HHtFoPhjjTO+fX4wKmJbeIlYc1MQ=; b=m55k4EiGt8YX5DGh0SPPn7wCeSFz2wvb5OQJ+EZTCE3CkJLeL8YVL1jciQiPU8/Z/H VJjulvLDJrId6wEWWryD/0ViBTcuJm3dA+I7PaYAG0TeXONR4LS2rdVdKfBNGEDsykd3 qSNT+QvP7AOcsNAaSd+8vhFLvJfLayjFw6YDm9plyXoezEW+dZoQK/tAHmNpP3Js5YnK uuLEOKj+WCkAAKEGFQZXaS5lVaEhONKKQBko+VyAg1/2X7buX6naIyosGNfLfh2VGajN +4+e28eWWwFKz+gLOwYhLflIbvT3r4kYtKfrrK+zqQNPftBytAR3HdWbIOG0gvevxbVS idyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=wIUC2S2uZPQDVE0HHtFoPhjjTO+fX4wKmJbeIlYc1MQ=; b=BZl8+6EMf+6I0xqYGYHGONN32KBiCLsP9SJhFka5bqpYFVrfzkDSWOXDJsoxlLRMSQ Ii0z0H9kGFJ3pY/fjvr8fjrMt3RuHuDpwoZi+Hxzhb6QU9X+o3Rv813dmed7ASFqykNJ tlA+tGBVF2E8JdyZF3hsrHSLWdrHSW6/5zZg+SNVNnESnWR9FP762vWKHkwHck/cniwC ARXFVz1ZGz37j2FJLr964s45zeWQvCGVviRiQmHyoCNPsr4dPOTF7QRqpkGgi/uVaZ/Z yuD3d9dH74On81nCc8d8CGK2cOTYf70ASekuABX6yykDSAm2m8/hWjs+uhg+EpZp83RT 7A+g== X-Gm-Message-State: APt69E2x/sx3CvW0zVTIpDexpajDptAB2BEnZ8m+7IS3mBztlgCqlYRb kPiHJhydVk77L8y2ROgK35o= X-Google-Smtp-Source: ADUXVKIX/9E3WpfIezUZbSzJqH31wIhG2+gxY6ocOkCvkGl3QUFm73bcOgxiarDL3/uUxvKU7tByHg== X-Received: by 2002:a24:43cf:: with SMTP id s198-v6mr15178127itb.28.1528146678309; Mon, 04 Jun 2018 14:11:18 -0700 (PDT) Received: from localhost.localdomain ([69.14.184.20]) by smtp.gmail.com with ESMTPSA id n23-v6sm4182610ioj.43.2018.06.04.14.11.16 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 04 Jun 2018 14:11:17 -0700 (PDT) From: John Arbuckle To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Mon, 4 Jun 2018 17:11:06 -0400 Message-Id: <20180604211106.4442-1-programmingkidx@gmail.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4001:c0b::241 Subject: [Qemu-devel] [PATCH] tcg-target.inc.c: Use byte form of xgetbv instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The assembler in most versions of Mac OS X is pretty old and does not support the xgetbv instruction. To go around this problem the raw encoding of the instruction is used instead. Signed-off-by: John Arbuckle --- tcg/i386/tcg-target.inc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5357909..82e004a 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3501,7 +3501,11 @@ static void tcg_target_init(TCGContext *s) sure of not hitting invalid opcode. */ if (c & bit_OSXSAVE) { unsigned xcrl, xcrh; - asm ("xgetbv" : "=a" (xcrl), "=d" (xcrh) : "c" (0)); + /* + * The xgetbv instruction is not available to older versions of the + * assembler, so we encode the instruction manually. + */ + asm (".byte 0x0f, 0x01, 0xd0": "=a" (xcrl), "=d" (xcrh) : "c" (0)); if ((xcrl & 6) == 6) { have_avx1 = (c & bit_AVX) != 0; have_avx2 = (b7 & bit_AVX2) != 0;