From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644404; cv=none; d=zoho.com; s=zohoarc; b=fLa9Lxj065RCIoAfTmAu0lWBqDc+qd+GvwxSZrg5hx7/88MPmAjuHG98roTNvCHwZOZx/S+KyWqY5O4RXNsoyg+5B8ojej69D0djO4W3Cmhjyb2Zl3/Imf/Mc45dhwHJVuQa+RphfSzLMaTq4YtM2/KeAtycc9LpPmVOQWTHGhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=APMSNSqtnnFNaM+yj1wHvrpXrKFzgMoEIGWJUZ5RW6k=; b=Wk5KnaiJlTOoMfuTBFjXc/uzNC4PjxvaSPQ1P/VXQaWkYBgIU9iaaBsKOK4A/50yAAFYy6ScqV1UNo1jaf1xflNIE8FIVxGBvXdOL3SW5tunro57LcubiL+kiau6QzdyzPMCvdvE7+aO3XFCUradXV/nDK8ZQiFVuY3rEv9r/98= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644404104517.4071254656377; Thu, 23 May 2019 13:46:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:43091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTubi-0007CY-2N for importer@patchew.org; Thu, 23 May 2019 16:46:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37300) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZg-0005wM-PI for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZf-0002wD-C2 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:28 -0400 Received: from mail-yw1-xc2d.google.com ([2607:f8b0:4864:20::c2d]:35896) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZf-0002tm-7I for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:27 -0400 Received: by mail-yw1-xc2d.google.com with SMTP id e68so2793885ywf.3 for ; Thu, 23 May 2019 13:44:27 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:25 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=APMSNSqtnnFNaM+yj1wHvrpXrKFzgMoEIGWJUZ5RW6k=; b=JV4g+Jd9G4uHzV8WwmEzYOVJwTMSC+dLPipIHVzoLm2jZE7f9P69rq6hAAnOEmDW8h pMPKjNKGZfvpJz/lFSw5kbY99DPpwxUI8Q0ygc12vgLg5AdmRJhYsCw/HA8kgzE9YKDO xNab/Q1pckAdd/3pDmyCExvJ2WMQVN+w78h1CwUOvr5SrFHNsb7+l0OCb0zuN32ae8PM 9TViObmDTBdI42QjRX45F8fTJ1t9XEVMbwjj0MOnyxiil9BUDCaRFTE5YdSVYXa7pf64 s/TJz/vFUqnEiYpLJ0aKK17gYwMKEWFvwb/1k0rVWYPkCd5iq7pbB+ixO3MmoPsfjyCw WjZw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=APMSNSqtnnFNaM+yj1wHvrpXrKFzgMoEIGWJUZ5RW6k=; b=aSP0kn+HHqRtMa4nA5e0RsiCfrcBzoRwEU1E6nsOh5Z+u37++tmsekuvhpw4BmBzj9 rqNyb8GI/vy0EVbLOoJo31Z+M5orz7+mEWByJiMpX9J/uTJRxISBS1kH4JfQmkzu56By TyRJmlapE7JP44yp2bNA33WdrUjf/Mf595Fz1ib65wWsRo/bMDG2rbC0krBi+yPxOTNN pf601D8IAnX42nt4H+IGugxZqWKGQqMJNauKAfj5iKQBU6hyYmUsENGL4r8c3cKiZfVO 0Oonokvu7tl90SxNMGtof9lkit+wv5tj5CI3flmgcNzkDi4E10djm9nYOQ5Gc4q9pfR4 5oLw== X-Gm-Message-State: APjAAAUtvLxLcQypFD5IUEoeN3fjoemBW0lV2Om2YqEgAHaJmd9sZDEy GL0Wxjjjw31yLllriFixUvtCDcFt X-Google-Smtp-Source: APXvYqwZ7n9EdgML+6JYE4JFsm1aoRSS4H2W3v35gCM3dJVf/PvS0H4ElHywFrgnxczTc7F2tczpAA== X-Received: by 2002:a81:300c:: with SMTP id w12mr47550161yww.57.1558644266428; Thu, 23 May 2019 13:44:26 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:43:59 -0400 Message-Id: <20190523204409.21068-2-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c2d Subject: [Qemu-devel] [RISU v3 01/11] Makefile: undefine the arch name symbol 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) At least GCC defines the symbol "i386" to 1 to signal the target platform. We need to use "i386" as an undefined symbol in order to correctly include risu_reginfo_i386.h from risu.h. Add an -U option to the build command to make sure the symbol remains undefined. Suggested-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4aad448..b362dbe 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ VPATH=3D$(SRCDIR) =20 CFLAGS ?=3D -g =20 -ALL_CFLAGS =3D -Wall -D_GNU_SOURCE -DARCH=3D$(ARCH) $(BUILD_INC) $(CFLAGS)= $(EXTRA_CFLAGS) +ALL_CFLAGS =3D -Wall -D_GNU_SOURCE -DARCH=3D$(ARCH) -U$(ARCH) $(BUILD_INC)= $(CFLAGS) $(EXTRA_CFLAGS) =20 PROG=3Drisu SRCS=3Drisu.c comms.c reginfo.c risu_$(ARCH).c risu_reginfo_$(ARCH).c --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644587; cv=none; d=zoho.com; s=zohoarc; b=D63MLMoukUA/XVc1XKxai0V0Wzf8pkmL6qLCwuLm3jMfuSUnew2msCzN4lnSEGl1zKju5xRgGCL+aa7oYDyaUrsiJ8PQwjMcCpKRxdZ9pVBnlhTTGsEHmPxR9zxGBdJvDUo81XBDeWQDx9RWIuLO1j7mRdCRHi5iA3ews+IteAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644587; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1BkgmbBnhQ3KAFq5DgAQAGgNp6ECl3V3D5Qd7pmmCaE=; b=QC63jdO3i/HYp3GeBZ48D/QjW9Eha8RQpvKNtd2zYnn9q+IomwoEsKzoh9H8cQum9rA5z0CDMmHHGLE8JMPKIF+DCCpGmkEHrtJSNsSVBcwt56uAXoPzt6oDvf3qrK//KWTwascsVwz15eAI0oV3P9RYWM0DdaGWEKDmqkuq72o= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644587448248.1691148319685; Thu, 23 May 2019 13:49:47 -0700 (PDT) Received: from localhost ([127.0.0.1]:43113 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuec-00010h-6E for importer@patchew.org; Thu, 23 May 2019 16:49:34 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZj-0005yJ-Ox for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZh-0002y0-Gs for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:31 -0400 Received: from mail-yw1-xc42.google.com ([2607:f8b0:4864:20::c42]:45608) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZh-0002xM-4H for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:29 -0400 Received: by mail-yw1-xc42.google.com with SMTP id w18so2772920ywa.12 for ; Thu, 23 May 2019 13:44:29 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=1BkgmbBnhQ3KAFq5DgAQAGgNp6ECl3V3D5Qd7pmmCaE=; b=Pj4foZ+/mtylVuJ+ZQh9biP5oJWScNf5UGRBhb+Z5FJN0LWvUBRMh0SLZ9y2gQ1cwS zuD+dobZy4FX6OqcjGdwSl2AIf4K25eDJPnvrxDV2kdv5saa6CV4of0AOndAb9/e5c+P O6y40lnAFvhI+PXHZHqYgmPI0aBFJeg+QLsAw90g4cR4rcoiZknuHz/Bu/Aa3pWBcP35 HgTRvwSISH7unaxfjV9k7jogPxiDfuYQHJ8KQfQeOce7TLVAl2c61hcLX42IRnkZkTHR orhvXo0d7yIIIaxkWyGj63H3Q3PpkamZitQi+k2TgHXizRYDUymuTPnB4ZI4BdglNJNx r7JQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=1BkgmbBnhQ3KAFq5DgAQAGgNp6ECl3V3D5Qd7pmmCaE=; b=aHswg/vUOjbOQJsYcbcVrRWz6yGhyle72C7aF2ycJSMaMw6cshC8eY4xTWnNxZBi2a BtytyqBZy7NnI4XCARuGiI+rCcwzHxOHp8bs72drvxwfUmpfWiTXYVz+nELHlh9f1cUV PK+ag6aeWzZhSRcIKgF29Oj3kYiZcLqndJwHQEWsWSJAU4EILzUJN7PvHhzuoFbe/vyV LSf/yHDuBJZuhERlQ3LV+mhT1lLpTT1DpHWgVYu0UE+lGy+Mpd0Lydf9G6eofGOBHz+B 5dhM3xDrGP7xCO+aD7YG2W9g4hwdhwsnJ5hoQGCcDn+ho251ggXsZ5o8aPhQbzXtVNpc cxvQ== X-Gm-Message-State: APjAAAUietTf/mvSz7IGlE2dG2Z0qLSqsHOVivM+k00pPubmBnCR13Zv TsG+knkxlmzrTg5c5sJFuEQ0DxS3 X-Google-Smtp-Source: APXvYqzbY56sIs/BNnlLHq423Gj5R+OjXObRFtoz8XXpJVtDtYfENmoDXLc9OepMeX3PSVHn2Go3YQ== X-Received: by 2002:a81:7cc5:: with SMTP id x188mr6215839ywc.381.1558644268147; Thu, 23 May 2019 13:44:28 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:00 -0400 Message-Id: <20190523204409.21068-3-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c42 Subject: [Qemu-devel] [RISU v3 02/11] risu_i386: move reginfo_t and related defines to risu_reginfo_i386.h 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In order to build risu successfully for i386, we need files risu_reginfo_i386.{h,c}; this patch adds the former by extracting the relevant code from risu_i386.c. This patch is pure code motion; no functional changes were made. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_reginfo_i386.h | 37 +++++++++++++++++++++++++++++++++++++ risu_i386.c | 23 +---------------------- 2 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 risu_reginfo_i386.h diff --git a/risu_reginfo_i386.h b/risu_reginfo_i386.h new file mode 100644 index 0000000..5bba439 --- /dev/null +++ b/risu_reginfo_i386.h @@ -0,0 +1,37 @@ +/*************************************************************************= ****** + * Copyright (c) 2010 Linaro Limited + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Peter Maydell (Linaro) - initial implementation + *************************************************************************= *****/ + +#ifndef RISU_REGINFO_I386_H +#define RISU_REGINFO_I386_H + +/* This is the data structure we pass over the socket. + * It is a simplified and reduced subset of what can + * be obtained with a ucontext_t* + */ +struct reginfo { + uint32_t faulting_insn; + gregset_t gregs; +}; + +#ifndef REG_GS +/* Assume that either we get all these defines or none */ +# define REG_GS 0 +# define REG_FS 1 +# define REG_ES 2 +# define REG_DS 3 +# define REG_ESP 7 +# define REG_TRAPNO 12 +# define REG_EIP 14 +# define REG_EFL 16 +# define REG_UESP 17 +#endif /* !defined(REG_GS) */ + +#endif /* RISU_REGINFO_I386_H */ diff --git a/risu_i386.c b/risu_i386.c index 5e7e01d..6798a78 100644 --- a/risu_i386.c +++ b/risu_i386.c @@ -14,28 +14,7 @@ #include =20 #include "risu.h" - -/* This is the data structure we pass over the socket. - * It is a simplified and reduced subset of what can - * be obtained with a ucontext_t* - */ -struct reginfo { - uint32_t faulting_insn; - gregset_t gregs; -}; - -#ifndef REG_GS -/* Assume that either we get all these defines or none */ -#define REG_GS 0 -#define REG_FS 1 -#define REG_ES 2 -#define REG_DS 3 -#define REG_ESP 7 -#define REG_TRAPNO 12 -#define REG_EIP 14 -#define REG_EFL 16 -#define REG_UESP 17 -#endif +#include "risu_reginfo_i386.h" =20 struct reginfo master_ri, apprentice_ri; =20 --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644418; cv=none; d=zoho.com; s=zohoarc; b=M3qkkF0NE9wUYq9ydtaGmxzyrj1dwGcfAgGJ8ITfx1gomsQCoupELPW+06NK22wj68Xzo9+ZYz7j5MA7gDEvt3tcvpxzMqX95qo7DVGr/n5gMS7J0ppYb99vr/DTd6IP3uxxJBfa9oHb2Z8k8YcPouY+cDiETD6PhHeqb46fbGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644418; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=LLAjkendyCCLXqfpTYsTCZfUvlnmPcJC9iKwt8jzfEU=; b=C+n1w5zjUrceIaeRQk8dRVoegVUfTgQSQYApawqufgYklz7/zFgciJNqPy3cLW4+MGj9YRdLed9lHwQgcFqoRq8i8Rxbuu2UY//yc7NcYC7E0ld4x/eYwQrFrpI9oojQfuwkHV0fgqfK64ur9Yw4Z3EO3vxVgXACr7dsQYebIQw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644418290548.8572881429938; Thu, 23 May 2019 13:46:58 -0700 (PDT) Received: from localhost ([127.0.0.1]:43093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuc2-0007PY-7l for importer@patchew.org; Thu, 23 May 2019 16:46:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZn-00061J-IA for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZj-0002zt-Q7 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:33 -0400 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]:33774) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZi-0002yQ-De for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:31 -0400 Received: by mail-yb1-xb43.google.com with SMTP id w127so923166yba.0 for ; Thu, 23 May 2019 13:44:30 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:28 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=LLAjkendyCCLXqfpTYsTCZfUvlnmPcJC9iKwt8jzfEU=; b=LaFtcPSz5Z7d4hOwdFL2n/TzIHXq5p+GaPfe0yaYBUzpPybqrLR0fGjaTayr2nLlvW TINZmupoiZV+6nIZiUO17KB1Dn8CGx1Qt7127YWYmOPeRFh+YX7kPib3A7y+NPC9b333 0QgEyyeVZn1bprty/7RgnBaJUWAKEe7Fr3Kg/gxW5zzqnCFg/pKgwqGxDJ2ubHwx34QC 325eVBnyilobLuqUe7BRiqr0ZPpWdjoIGlLDxTxFdpi4Yn49uEf1eERc3FtYvoiIBUFS 0Ebi/psNYxS+ND1dNU/kDiUbY9pokLmuu+IzmGkpfxL0ROcthVsbJ3x1UhJiyrFQMnR0 u2Ag== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=LLAjkendyCCLXqfpTYsTCZfUvlnmPcJC9iKwt8jzfEU=; b=U7f5O3aV3TuJAQUaWvH5m745rIm8Qu+mBDkMdNGhFiiFwqi70YM//0IdcCJch2uj1H kf6Lw0pVNEqJ/bLh4Jp0dPAJncqKPSC2xsv/3EvARXzl8UeYhpVC2RP78/Swbn+idCaK ad8SbpfBrEFgbdjgdhUN7TnMKoSjZJopWXkNe9CR3bO7eHRpJZuc2tCOfmlrO2/gnAoO pXEKis32hNppAqgJAwF4gxeCZBxv0B8oDfozf9Mh5bcycVJDsy9IBth8hDJ/7YlMQEkn 4Ggt5l3kkCTl8ppHBDc/aXYzhTVvVk8rz7tXhwJiweE3ZUhbiekphTZc9d5NJY6RbSWo CmxQ== X-Gm-Message-State: APjAAAW3SDlteSgXz0CTc1El1LwUV5TIAsnjkEWXpPLOPUXS6qdxEzsx LIq+EdQbPwFrjxX5nmoaz3FVnMbR X-Google-Smtp-Source: APXvYqzALE5y5yGNAofxJf8PgYr8o7vfs37hmxplafbF8QNX+ay07rxUSYIj85cShjhAZ5HykEqpRw== X-Received: by 2002:a25:cac6:: with SMTP id a189mr1069901ybg.74.1558644269385; Thu, 23 May 2019 13:44:29 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:01 -0400 Message-Id: <20190523204409.21068-4-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b43 Subject: [Qemu-devel] [RISU v3 03/11] risu_i386: move reginfo-related code to risu_reginfo_i386.c 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In order to build risu successfully for i386, we need files risu_reginfo_i386.{h,c}; this patch adds the latter by extracting the relevant code from risu_i386.c. This patch is pure code motion; no functional changes were made. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_i386.c | 54 ----------------------------------- risu_reginfo_i386.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 54 deletions(-) create mode 100644 risu_reginfo_i386.c diff --git a/risu_i386.c b/risu_i386.c index 6798a78..2d2f325 100644 --- a/risu_i386.c +++ b/risu_i386.c @@ -33,43 +33,6 @@ void advance_pc(void *vuc) uc->uc_mcontext.gregs[REG_EIP] +=3D 2; } =20 -static void fill_reginfo(struct reginfo *ri, ucontext_t * uc) -{ - int i; - for (i =3D 0; i < NGREG; i++) { - switch (i) { - case REG_ESP: - case REG_UESP: - case REG_GS: - case REG_FS: - case REG_ES: - case REG_DS: - case REG_TRAPNO: - case REG_EFL: - /* Don't store these registers as it results in mismatches. - * In particular valgrind has different values for some - * segment registers, and they're boring anyway. - * We really shouldn't be ignoring EFL but valgrind doesn't - * seem to set it right and I don't care to investigate. - */ - ri->gregs[i] =3D 0xDEADBEEF; - break; - case REG_EIP: - /* Store the offset from the start of the test image */ - ri->gregs[i] =3D uc->uc_mcontext.gregs[i] - image_start_addres= s; - break; - default: - ri->gregs[i] =3D uc->uc_mcontext.gregs[i]; - break; - } - } - /* x86 insns aren't 32 bit but we're not really testing x86 so - * this is just to distinguish 'do compare' from 'stop' - */ - ri->faulting_insn =3D *((uint32_t *) uc->uc_mcontext.gregs[REG_EIP]); -} - - int send_register_info(int sock, void *uc) { struct reginfo ri; @@ -100,23 +63,6 @@ int recv_and_compare_register_info(int sock, void *uc) return resp; } =20 -static char *regname[] =3D { - "GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP", - "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", - "CS", "EFL", "UESP", "SS", 0 -}; - -static void dump_reginfo(struct reginfo *ri) -{ - int i; - fprintf(stderr, " faulting insn %x\n", ri->faulting_insn); - for (i =3D 0; i < NGREG; i++) { - fprintf(stderr, " %s: %x\n", regname[i] ? regname[i] : "???", - ri->gregs[i]); - } -} - - /* Print a useful report on the status of the last comparison * done in recv_and_compare_register_info(). This is called on * exit, so need not restrict itself to signal-safe functions. diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c new file mode 100644 index 0000000..e8d671f --- /dev/null +++ b/risu_reginfo_i386.c @@ -0,0 +1,68 @@ +/*************************************************************************= ****** + * Copyright (c) 2010 Linaro Limited + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Peter Maydell (Linaro) - initial implementation + *************************************************************************= *****/ + +#include +#include + +#include "risu.h" +#include "risu_reginfo_i386.h" + +static void fill_reginfo(struct reginfo *ri, ucontext_t * uc) +{ + int i; + for (i =3D 0; i < NGREG; i++) { + switch (i) { + case REG_ESP: + case REG_UESP: + case REG_GS: + case REG_FS: + case REG_ES: + case REG_DS: + case REG_TRAPNO: + case REG_EFL: + /* Don't store these registers as it results in mismatches. + * In particular valgrind has different values for some + * segment registers, and they're boring anyway. + * We really shouldn't be ignoring EFL but valgrind doesn't + * seem to set it right and I don't care to investigate. + */ + ri->gregs[i] =3D 0xDEADBEEF; + break; + case REG_EIP: + /* Store the offset from the start of the test image */ + ri->gregs[i] =3D uc->uc_mcontext.gregs[i] - image_start_addres= s; + break; + default: + ri->gregs[i] =3D uc->uc_mcontext.gregs[i]; + break; + } + } + /* x86 insns aren't 32 bit but we're not really testing x86 so + * this is just to distinguish 'do compare' from 'stop' + */ + ri->faulting_insn =3D *((uint32_t *) uc->uc_mcontext.gregs[REG_EIP]); +} + +static char *regname[] =3D { + "GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP", + "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", + "CS", "EFL", "UESP", "SS", 0 +}; + +static void dump_reginfo(struct reginfo *ri) +{ + int i; + fprintf(stderr, " faulting insn %x\n", ri->faulting_insn); + for (i =3D 0; i < NGREG; i++) { + fprintf(stderr, " %s: %x\n", regname[i] ? regname[i] : "???", + ri->gregs[i]); + } +} --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644608; cv=none; d=zoho.com; s=zohoarc; b=XTItvPU38kcGyyWO0ibTZK/UmUl/LZp77+tXH8t4C+072ONtjZ9TKq7GQK9rAJvRK+TGUkh+9kTswL30A79TW6rYoiHeOw8W/rICPsB5iTwN9Q9WzDyzGrGz/WS2JnEX3BfSHSxgERPzZEy/IGsQU5nCjY9ii8cc5gfzXdKb8nQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644608; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aODOLM3NOnu56JKijoWk061uBitwLRabA4Po4UrCVRU=; b=QbbMtd1hDV9B4GCViO1c6EHsjr5KwIGAtvGTX2deR1njVUiLf/xH+hKzeEsepAOKZLlF19M0HMJuM/5zB1RMBeeuKfwVO+ELGSNhtSDe4spx5fQi5+6S3ysCovzbCg8zE9NMdlE1YQPGkNswGwjQq4V/ple9nzhYQgEu/URJ4O0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644608634416.4304872962738; Thu, 23 May 2019 13:50:08 -0700 (PDT) Received: from localhost ([127.0.0.1]:43119 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuf6-0001Lz-IH for importer@patchew.org; Thu, 23 May 2019 16:50:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZr-00064W-FQ for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZp-000362-Is for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:39 -0400 Received: from mail-yw1-xc43.google.com ([2607:f8b0:4864:20::c43]:42415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZp-00030k-63 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:37 -0400 Received: by mail-yw1-xc43.google.com with SMTP id s5so2780904ywd.9 for ; Thu, 23 May 2019 13:44:33 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:31 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=aODOLM3NOnu56JKijoWk061uBitwLRabA4Po4UrCVRU=; b=ANYlbfUEWYQgbUCsFIcX4Vh0BrMTTf6WphjMjJN52U3v9s6w/PJWKYLBcQiO5Bm5W2 NpqH926IMiFjk0X0PcnaPktGVmbG1rb2IfFwdvyqV8AO4ax8CQVB169bjRdZQIsT5hD+ e1A3VrTwlk7EAwy3KiEUwuRFkpjYXtIx4Ni+7ahXR0uoiy34sbvElMcq1IgXEhUVNDz/ AskDVebsvEKcoBgbPO1VnsDwpmeqom/Jf1snlCmniADJgWC5NWes/IvNwy7qaW70Z6kd ditWTi15IyMwD481VTqUGPMNyvWU4joFxMzDzlk9jBObITDCJK/3pTYaOtAPdYBECMNQ 0q+w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aODOLM3NOnu56JKijoWk061uBitwLRabA4Po4UrCVRU=; b=YoQylO7HEKtWHWg/f0gbkgsuTxruvfLzCZL9Ho8SjUI5ZpU5hKPKsf07Olt3hmNW+Z q4miN0jCNhbHRqJtO48sxazlbHVsVx3VUOO7w95xdu2kx2lnC9iJ95Luxrq+AYaN1v8X ibK/Zig6CUZvom/RlqIojMyJddKNRublBikAYlvoRGML3IZkK8Bxx3wwB2Gi7nxHv0ps +K1J9tglq+N+/i3A5mpQIC/bTLXBNKtdMzc3VvBY4EOu6fa4h/k6enN4DYvkaArwl8rq 7cYymGVWFLuvYcg3gsyjARj8UHl2pGsBNmx/Mxw+thhOuBH71YfkgrXEZ5AUu8m39g4w +u5Q== X-Gm-Message-State: APjAAAVpuOnFp+aPngCVNWFNreXsjYPRPjadE+rYuYoBdtxO9EV3UoV2 Tyoc80waJ0DkHbEmnxAg/PNLsd50 X-Google-Smtp-Source: APXvYqwepg/w0SlHOAzbaYRP7cp+qwxdpnJxMAUq5QgI849Y+p2gN0l9cHTALhkeOxP4jZFhYv9G8g== X-Received: by 2002:a0d:db91:: with SMTP id d139mr25144807ywe.300.1558644272326; Thu, 23 May 2019 13:44:32 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:02 -0400 Message-Id: <20190523204409.21068-5-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c43 Subject: [Qemu-devel] [RISU v3 04/11] risu_reginfo_i386: implement arch-specific reginfo interface 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) CPU-specific code in risu_reginfo_* is expected to define and export the following symbols: - arch_long_opts, arch_extra_help, process_arch_opt - reginfo_size - reginfo_init - reginfo_is_eq - reginfo_dump, reginfo_dump_mismatch Make risu_reginfo_i386.c implement this interface; and while we're at it, expand the support to x86_64 as well. Suggested-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_reginfo_i386.h | 24 ++++---- risu_reginfo_i386.c | 147 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 127 insertions(+), 44 deletions(-) diff --git a/risu_reginfo_i386.h b/risu_reginfo_i386.h index 5bba439..e350f01 100644 --- a/risu_reginfo_i386.h +++ b/risu_reginfo_i386.h @@ -12,7 +12,8 @@ #ifndef RISU_REGINFO_I386_H #define RISU_REGINFO_I386_H =20 -/* This is the data structure we pass over the socket. +/* + * This is the data structure we pass over the socket. * It is a simplified and reduced subset of what can * be obtained with a ucontext_t* */ @@ -21,17 +22,14 @@ struct reginfo { gregset_t gregs; }; =20 -#ifndef REG_GS -/* Assume that either we get all these defines or none */ -# define REG_GS 0 -# define REG_FS 1 -# define REG_ES 2 -# define REG_DS 3 -# define REG_ESP 7 -# define REG_TRAPNO 12 -# define REG_EIP 14 -# define REG_EFL 16 -# define REG_UESP 17 -#endif /* !defined(REG_GS) */ +/* + * For i386, the defines are named REG_EAX, etc. + * For x86_64, the defines are named REG_RAX, etc. + */ +#ifdef __x86_64__ +# define REG_E(X) REG_R##X +#else +# define REG_E(X) REG_E##X +#endif =20 #endif /* RISU_REGINFO_I386_H */ diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index e8d671f..c4dc14a 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -10,59 +10,144 @@ *************************************************************************= *****/ =20 #include +#include +#include #include +#include =20 #include "risu.h" #include "risu_reginfo_i386.h" =20 -static void fill_reginfo(struct reginfo *ri, ucontext_t * uc) +const struct option * const arch_long_opts; +const char * const arch_extra_help; + +void process_arch_opt(int opt, const char *arg) +{ + abort(); +} + +const int reginfo_size(void) +{ + return sizeof(struct reginfo); +} + +/* reginfo_init: initialize with a ucontext */ +void reginfo_init(struct reginfo *ri, ucontext_t *uc) { int i; + + memset(ri, 0, sizeof(*ri)); + for (i =3D 0; i < NGREG; i++) { switch (i) { - case REG_ESP: - case REG_UESP: - case REG_GS: - case REG_FS: - case REG_ES: - case REG_DS: - case REG_TRAPNO: - case REG_EFL: - /* Don't store these registers as it results in mismatches. - * In particular valgrind has different values for some - * segment registers, and they're boring anyway. - * We really shouldn't be ignoring EFL but valgrind doesn't - * seem to set it right and I don't care to investigate. - */ - ri->gregs[i] =3D 0xDEADBEEF; - break; - case REG_EIP: - /* Store the offset from the start of the test image */ + case REG_E(IP): + /* Store the offset from the start of the test image. */ ri->gregs[i] =3D uc->uc_mcontext.gregs[i] - image_start_addres= s; break; - default: + case REG_EFL: + /* Store only the "flaggy" bits: SF, ZF, AF, PF, CF. */ + ri->gregs[i] =3D uc->uc_mcontext.gregs[i] & 0xd5; + break; + case REG_E(SP): + /* Ignore the stack. */ + ri->gregs[i] =3D 0xdeadbeef; + break; + case REG_E(AX): + case REG_E(BX): + case REG_E(CX): + case REG_E(DX): + case REG_E(DI): + case REG_E(SI): + case REG_E(BP): +#ifdef __x86_64__ + case REG_R8: + case REG_R9: + case REG_R10: + case REG_R11: + case REG_R12: + case REG_R13: + case REG_R14: + case REG_R15: +#endif ri->gregs[i] =3D uc->uc_mcontext.gregs[i]; break; } } - /* x86 insns aren't 32 bit but we're not really testing x86 so - * this is just to distinguish 'do compare' from 'stop' + + /* + * x86 insns aren't 32 bit but 3 bytes are sufficient to + * distinguish 'do compare' from 'stop'. */ - ri->faulting_insn =3D *((uint32_t *) uc->uc_mcontext.gregs[REG_EIP]); + ri->faulting_insn =3D *(uint32_t *)uc->uc_mcontext.gregs[REG_E(IP)]; } =20 -static char *regname[] =3D { - "GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP", - "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", - "CS", "EFL", "UESP", "SS", 0 +/* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ +int reginfo_is_eq(struct reginfo *m, struct reginfo *a) +{ + return 0 =3D=3D memcmp(m, a, sizeof(*m)); +} + +static const char *const regname[NGREG] =3D { + [REG_EFL] =3D "eflags", +#ifdef __x86_64__ + [REG_RIP] =3D "rip", + [REG_RAX] =3D "rax", + [REG_RBX] =3D "rbx", + [REG_RCX] =3D "rcx", + [REG_RDX] =3D "rdx", + [REG_RDI] =3D "rdi", + [REG_RSI] =3D "rsi", + [REG_RBP] =3D "rbp", + [REG_RSP] =3D "rsp", + [REG_R8] =3D "r8", + [REG_R9] =3D "r9", + [REG_R10] =3D "r10", + [REG_R11] =3D "r11", + [REG_R12] =3D "r12", + [REG_R13] =3D "r13", + [REG_R14] =3D "r14", + [REG_R15] =3D "r15", +#else + [REG_EIP] =3D "eip", + [REG_EAX] =3D "eax", + [REG_EBX] =3D "ebx", + [REG_ECX] =3D "ecx", + [REG_EDX] =3D "edx", + [REG_EDI] =3D "edi", + [REG_ESI] =3D "esi", + [REG_EBP] =3D "ebp", + [REG_ESP] =3D "esp", +#endif }; =20 -static void dump_reginfo(struct reginfo *ri) +#ifdef __x86_64__ +# define PRIxREG "%016llx" +#else +# define PRIxREG "%08x" +#endif + +/* reginfo_dump: print state to a stream, returns nonzero on success */ +int reginfo_dump(struct reginfo *ri, FILE *f) { int i; - fprintf(stderr, " faulting insn %x\n", ri->faulting_insn); + fprintf(f, " faulting insn %x\n", ri->faulting_insn); for (i =3D 0; i < NGREG; i++) { - fprintf(stderr, " %s: %x\n", regname[i] ? regname[i] : "???", - ri->gregs[i]); + if (regname[i]) { + fprintf(f, " %-6s: " PRIxREG "\n", regname[i], ri->gregs[i]); + } } + return !ferror(f); +} + +int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) +{ + int i; + for (i =3D 0; i < NGREG; i++) { + if (m->gregs[i] !=3D a->gregs[i]) { + assert(regname[i]); + fprintf(f, "Mismatch: %s: " PRIxREG " v " PRIxREG "\n", + regname[i], m->gregs[i], a->gregs[i]); + } + } + return !ferror(f); } --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644610; cv=none; d=zoho.com; s=zohoarc; b=FjRLScbpMvVb4eB02/sgdO5xKBNp2GkEFKkU+RXGbFgKgdoCk8qW6q/4h5N/epNf3GKGsrdS6lshf4Fsf0/Ez8qQ/jyhBcrvu1Zdeaw9PlGpZ8M/BecKAfhgXmTnVyAMgHYaiDndWBf8wU3tUpe77gYh65z1EysVi4STxivQ6SY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644610; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OnMHZ0fdYIXqikgMNKphGLIOokAtEwVDQyD+tAg9EUc=; b=i9Bl+g7LinBV4E4XKIZa/wCFAKsnUr//Xek64jbv5yZFqCXchbV3zOk6Gbr+wXvxQ3H54TxKDEN0295q1LrZ3j7IfcEx6+uwdqnmnqgbEi3kIkMksVJCK1f0cvUBeykttoID9dD6turJNAzp9z7IXjimcf5fcfMLQzywO4kLh4E= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644610232952.1780678522149; Thu, 23 May 2019 13:50:10 -0700 (PDT) Received: from localhost ([127.0.0.1]:43117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuf2-0001Jp-64 for importer@patchew.org; Thu, 23 May 2019 16:50:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZt-00066C-EI for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZr-00039p-EB for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:41 -0400 Received: from mail-yb1-xb44.google.com ([2607:f8b0:4864:20::b44]:41858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZp-00031p-EX for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:37 -0400 Received: by mail-yb1-xb44.google.com with SMTP id d2so2783293ybh.8 for ; Thu, 23 May 2019 13:44:33 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:32 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=OnMHZ0fdYIXqikgMNKphGLIOokAtEwVDQyD+tAg9EUc=; b=FOpxkuiLmyiUfliFGoath1TzofiBGDO+2qccUdK2Mq+8TzGuYqAcBfE0JRXgmG3WBz Zxj+sOAc/Ndis9bhcGChu6NhwqhoEzXw2vMZQ8FKnIvX1PJuCvaTqxD+S+ypMjtNbFw0 p5SMMFtxEMMmYTJ+60T19DdXy7rvkmnwQSQqiCjLy9qJUx8M2drGNv++EO38x2d+Xgik WOQsPaY6yJ+nLoV2qyQdNsBpDuaa2ykWO40DZlhypPsrb95Jh0XPQWgij5zM/+68y/JF WGOIb+WHUKAsJHJKfgV9OmznUpFTFALjumZXt3HcXwbKQGfyYZIisHF4owdAWR8PII7n jEbQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=OnMHZ0fdYIXqikgMNKphGLIOokAtEwVDQyD+tAg9EUc=; b=NgLWQaKgQvhtBTFdTxv1VYqkPUSG71rB+o6ycHmzKiJZAVgjkaRJzhpCpBobOdKAzv qKszdf7/MCb89eTS1FNruurrr19WKJNMAyQ7Wr/KV8O6JyEdizGUsokKSbh/4LAegd+e Q64I/bzgzOMDTJv6kwVTN9N+zEIU8FMhA7f7Aeic451Nv/nYT/y5VJAW4aOr3aqs636K 4f7Ti7Lmk2XoKPwDtn0na+/S3WM1zr6U+dclUhO1m6MvVMhKpZnoGmRtPvPt+HbC8Ts2 ie1IiFi8WsTUQtUC2w6H9bqYcyv0j3uB4Yed0Qo2cKEMY81E82T0lb83jDnJ9c10DesH 1b8g== X-Gm-Message-State: APjAAAWk7fqfeX5oNk1Jw0fDqAr3kLFUa04VI8Y+GP6tWX+UlY879s5Q Ax0EcBL2eAnH6KOFbsEwlSnezxCk X-Google-Smtp-Source: APXvYqxRPhec6oKkwVoPPUpAwDTWE7/4UBTRvgqZ+0HfsilI0Ger5lJl8O6oAOBUqnjsESYXh5lZJg== X-Received: by 2002:a5b:707:: with SMTP id g7mr45570918ybq.267.1558644272992; Thu, 23 May 2019 13:44:32 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:03 -0400 Message-Id: <20190523204409.21068-6-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b44 Subject: [Qemu-devel] [RISU v3 05/11] risu_i386: implement missing CPU-specific functions 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) risu_i386.c is expected to implement the following functions: - advance_pc - get_reginfo_paramreg, set_ucontext_paramreg - get_risuop - get_pc This patch adds the necessary code. We use EAX as the parameter register and opcode "UD1 %xxx,%eax" for triggering RISU actions. Suggested-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_i386.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/risu_i386.c b/risu_i386.c index 2d2f325..06d95e5 100644 --- a/risu_i386.c +++ b/risu_i386.c @@ -25,12 +25,37 @@ static int insn_is_ud2(uint32_t insn) =20 void advance_pc(void *vuc) { - /* We assume that this is either UD1 or UD2. - * This would need tweaking if we want to test - * expected undefs on x86. + ucontext_t *uc =3D (ucontext_t *) vuc; + + /* + * We assume that this is UD1 as per get_risuop below. + * This would need tweaking if we want to test expected undefs. */ - ucontext_t *uc =3D vuc; - uc->uc_mcontext.gregs[REG_EIP] +=3D 2; + uc->uc_mcontext.gregs[REG_E(IP)] +=3D 3; +} + +void set_ucontext_paramreg(void *vuc, uint64_t value) +{ + ucontext_t *uc =3D (ucontext_t *) vuc; + uc->uc_mcontext.gregs[REG_E(AX)] =3D value; +} + +uint64_t get_reginfo_paramreg(struct reginfo *ri) +{ + return ri->gregs[REG_E(AX)]; +} + +int get_risuop(struct reginfo *ri) +{ + if ((ri->faulting_insn & 0xf8ffff) =3D=3D 0xc0b90f) { /* UD1 %xxx,%eax= */ + return (ri->faulting_insn >> 16) & 7; + } + return -1; +} + +uintptr_t get_pc(struct reginfo *ri) +{ + return ri->gregs[REG_E(IP)]; } =20 int send_register_info(int sock, void *uc) --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644425; cv=none; d=zoho.com; s=zohoarc; b=Ag251rbInJYR+sy46NycVemuA2EE9v26xz2uVRARQoVL9R3A3k+vT5KUXxNjz+famThj6ZGJewnp3BjSOnT6uyDEd7dx8CVKWlLVf152zXXcdtPnt6WNnTU+zqhe7YHR/WIiyJD4sku2gUJ1Mvh3iely870Vt4iX/Dr0GEMeDLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644425; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DWaxu9uiHa4VqUgpO4mPbqlseFRB8XqATreonAM1ocs=; b=UJdGIw05fPsPZ4bOQ+o3hhWpTqbuwIXPxR7baNy/WjPyVmjwhAyzoywP/tWOCKwQe9/oFRyCulQ1dAcSaiU2HNhssEm/QQr1YJBahq9F/EUCH2yZ/ocRQZFBDC/a3fTDJGR8T2mw8FxE7tIO2eE7nSjJpmigXiB/ogXDrUWwfac= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644425128193.63233434317692; Thu, 23 May 2019 13:47:05 -0700 (PDT) Received: from localhost ([127.0.0.1]:43095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuc2-0007Rl-SG for importer@patchew.org; Thu, 23 May 2019 16:46:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZr-00064V-Er for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZp-00035s-It for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:39 -0400 Received: from mail-yb1-xb42.google.com ([2607:f8b0:4864:20::b42]:35350) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZn-000333-KJ for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:37 -0400 Received: by mail-yb1-xb42.google.com with SMTP id s69so2620303ybi.2 for ; Thu, 23 May 2019 13:44:34 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:33 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=DWaxu9uiHa4VqUgpO4mPbqlseFRB8XqATreonAM1ocs=; b=omd2HmvHUWB31GaHLP728PLGg48qZ7ELwgtPgcYJXYiFNo97N0QqsmQEubo0DpUtqw WWa1jv1zeCpavvHRCHBbjK29hAf0fEqzCdJGb+wOoJyzkDBKj2FLrTLTMpRuYD/nelnf VHsscQ5hnrc8d6o8F/Yzq24apajNtgmSlsQRcBVw8xxrWYshQXNJLOcgy+2gbTJzNBPl BeKg95dtY3HS0yTU2a7XQL2r2CY0CzCygVBFHGBwCnQ43O0Jk2YP0m2Dyog+MklQ9q4n azOyJk/bzMMk7N5NJzBU+GE/cN24CpYkZprFZgR0g2kUPCOuXj8PfND8eS+GVrb7clxH myHw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DWaxu9uiHa4VqUgpO4mPbqlseFRB8XqATreonAM1ocs=; b=eS7oGA2KmDmznwaFRcbHzz8I936xUaevsA8MpmroQfdjX3vu3Ko16b/61GVyhShKE7 tXM0Pj2eGaCWDQrN069XazAVytD07Tzuj7NuWsRppxATcqWmvD4VwoRg8TDUA4QbgH8y doAI0gwQPoFwdqhP2mXrPD19F6yzSpjiyhNJHELHk2d6CZZrKNwQn3sczgclgcRv3Vwb Cb2pwj5yOIWSEUrkID3R/+rkhlRdsE9t/GdVBHyGzpTTGrWFGKGe4ejcYF+O4cmyBOPG aYUNzFvQWrFrFnjZvz7V8jMGpFZzDDkgS580CWC4hvFD7o+EoS1j2/fkvj/b+KqEBeAa Cnzw== X-Gm-Message-State: APjAAAXE04dfz49CqwWCFZdXb8nf4aydXi/JLSbfghYxEFJX2hBMaLGe siEp/Pe3EpytUOQHeOBidPFXWibl X-Google-Smtp-Source: APXvYqzntVuupXDMaMa1iu+UoYxRRIOmiHWXUfxIbYzIRk+GIObfiwnwuYPkXyT/G/XJwCldK1lLjw== X-Received: by 2002:a25:cb43:: with SMTP id b64mr24063415ybg.509.1558644273827; Thu, 23 May 2019 13:44:33 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:04 -0400 Message-Id: <20190523204409.21068-7-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b42 Subject: [Qemu-devel] [RISU v3 06/11] risu_i386: remove old unused code 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The code being removed is a remnant of the past implementation; it has since been replaced by its more powerful, architecture-independent counterpart in reginfo.c. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_i386.c | 58 ----------------------------------------------------- 1 file changed, 58 deletions(-) diff --git a/risu_i386.c b/risu_i386.c index 06d95e5..9962b8f 100644 --- a/risu_i386.c +++ b/risu_i386.c @@ -16,13 +16,6 @@ #include "risu.h" #include "risu_reginfo_i386.h" =20 -struct reginfo master_ri, apprentice_ri; - -static int insn_is_ud2(uint32_t insn) -{ - return ((insn & 0xffff) =3D=3D 0x0b0f); -} - void advance_pc(void *vuc) { ucontext_t *uc =3D (ucontext_t *) vuc; @@ -57,54 +50,3 @@ uintptr_t get_pc(struct reginfo *ri) { return ri->gregs[REG_E(IP)]; } - -int send_register_info(int sock, void *uc) -{ - struct reginfo ri; - fill_reginfo(&ri, uc); - return send_data_pkt(sock, &ri, sizeof(ri)); -} - -/* Read register info from the socket and compare it with that from the - * ucontext. Return 0 for match, 1 for end-of-test, 2 for mismatch. - * NB: called from a signal handler. - */ -int recv_and_compare_register_info(int sock, void *uc) -{ - int resp; - fill_reginfo(&master_ri, uc); - recv_data_pkt(sock, &apprentice_ri, sizeof(apprentice_ri)); - if (memcmp(&master_ri, &apprentice_ri, sizeof(master_ri)) !=3D 0) { - /* mismatch */ - resp =3D 2; - } else if (insn_is_ud2(master_ri.faulting_insn)) { - /* end of test */ - resp =3D 1; - } else { - /* either successful match or expected undef */ - resp =3D 0; - } - send_response_byte(sock, resp); - return resp; -} - -/* Print a useful report on the status of the last comparison - * done in recv_and_compare_register_info(). This is called on - * exit, so need not restrict itself to signal-safe functions. - * Should return 0 if it was a good match (ie end of test) - * and 1 for a mismatch. - */ -int report_match_status(void) -{ - fprintf(stderr, "match status...\n"); - fprintf(stderr, "master reginfo:\n"); - dump_reginfo(&master_ri); - fprintf(stderr, "apprentice reginfo:\n"); - dump_reginfo(&apprentice_ri); - if (memcmp(&master_ri, &apprentice_ri, sizeof(master_ri)) =3D=3D 0) { - fprintf(stderr, "match!\n"); - return 0; - } - fprintf(stderr, "mismatch!\n"); - return 1; -} --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644813; cv=none; d=zoho.com; s=zohoarc; b=lMaiqs7kcIt9M0/VDOS9ARohMwOzUd1pUUqfSkKX3gzQr1YBa3VSXMDNnvDYjYRNulXTFmBnSemGlSlaxfUQovJ8jo+r1YvTsj5Kl90Xc5LsOF1iB/T6pav3HZ4SvXnAcbK+XYn6e1F+62iGVc1RW5UcwY9N7iQGA9SxoL8n91s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644813; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Wv0YAF1rZ6KrPU3tosAjlI/qAdfuoWauzAhliLX3BEs=; b=jmj3/UbDrZcWrHmDyDOrazGt3bCZuVb/dV1C/5YHM46XwkbyfZiuJLl7kMvvnVdYTlGiKMOVsUT8MVTSdE2aONZLPWx7kFsW7h8iwoazGKEa32ZIbqkP4laNmdeRiGOXWEwkyHFHFsQqAJV8einjIBZit/oOTMin5FUdX5GYMFQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644813324567.2624684201473; Thu, 23 May 2019 13:53:33 -0700 (PDT) Received: from localhost ([127.0.0.1]:43170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuhm-0004Bu-10 for importer@patchew.org; Thu, 23 May 2019 16:52:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZz-0006CM-4A for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZt-0003CZ-Gv for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:45 -0400 Received: from mail-yw1-xc43.google.com ([2607:f8b0:4864:20::c43]:39385) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZr-00038v-LC for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:41 -0400 Received: by mail-yw1-xc43.google.com with SMTP id w21so2786526ywd.6 for ; Thu, 23 May 2019 13:44:38 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:37 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=Wv0YAF1rZ6KrPU3tosAjlI/qAdfuoWauzAhliLX3BEs=; b=Sfs7P+1AxsKND4DQAlJwytdjXiqMzxGbiZcmdLnpm+Haqzc4uKX6sB5lerTw8VL0mR QiGXg8k/X6zsWUQs+8fHu8ohQcKRZqWd0lFzWl2kmKjJVJUSW4+T1eAXiQOjxznXlpc5 QwQM1BcUmTvqyr3mJ4EtBbtBb+G+2KajREVH+WtbXBHKHTCm4frcFNsUjgrkqiq8h5zE 4kiTSEl1UvgZF05MUpEDLJ3vGfBQNOBopxqJWH/Ng51TXSQdOi3ZSW1MadZABH6puxCV 5dERXMooTC7QhcXdbXqj2WVncA5VkCNOT3d38Pv8NZYRPKl3xgM/l1ve8Nive41q2tVf 7REA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Wv0YAF1rZ6KrPU3tosAjlI/qAdfuoWauzAhliLX3BEs=; b=AGMV6TarX10v3sUZBgsGj0zvKfPTavzr1aTZnKkDc8RKDLiYgZFEG6vkpNCmArsikt l2RvEi2c7+KjsAPdNQeEuLvcdak2d3apjELKYX/6Qoj2h+76Nh0BN7hQYDv0J8feTFc8 vXIDXY4tHALrRRTIuuLKlNoeZTZDKpuJfxFU4HEHtsKVjZ1m2E09LWMOr+kvMX34Wqnt 5ESZsFJenTFEXjy1a9R+WR6aOQHkrmabuPXo37ZATJUXTL79MIUVplMfv+eXm5QqbYl9 wyrdF/ynf6qEdXxl+t9725DbAd8Jn3DKZGwJGLt5xz/LPwFHUUffj0X6UIKxNjxcXsEQ QZcA== X-Gm-Message-State: APjAAAXYkgbsw4nBqrWjjV9Uc+BdAkE/MT/Qx8sdE1luxPv5kqehDImD jJGPjhqN1I8N5Artrorm+JCCio16 X-Google-Smtp-Source: APXvYqxVah+fMA7SaNhiHbvkHANBwiv0gcpjsAkLQsS6K/fWvYhk7U3wUwA0f+vQP+qr7lpPuVFK5Q== X-Received: by 2002:a81:b3c4:: with SMTP id r187mr19261194ywh.217.1558644278092; Thu, 23 May 2019 13:44:38 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:05 -0400 Message-Id: <20190523204409.21068-8-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::c43 Subject: [Qemu-devel] [RISU v3 07/11] test_i386: change syntax from nasm to gas 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This allows us to drop dependency on NASM and build the test image with GCC only. Adds support for x86_64, too. Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek Reviewed-by: Alex Benn=C3=A9e --- Makefile | 3 +++ test_i386.S | 41 +++++++++++++++++++++++++++++++++++++++++ test_i386.s | 27 --------------------------- 3 files changed, 44 insertions(+), 27 deletions(-) create mode 100644 test_i386.S delete mode 100644 test_i386.s diff --git a/Makefile b/Makefile index b362dbe..6ab014a 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,9 @@ $(PROG): $(OBJS) %_$(ARCH).elf: %_$(ARCH).s $(AS) -o $@ $< =20 +%_$(ARCH).elf: %_$(ARCH).S + $(CC) $(CPPFLAGS) -o $@ -c $< + clean: rm -f $(PROG) $(OBJS) $(BINS) =20 diff --git a/test_i386.S b/test_i386.S new file mode 100644 index 0000000..456b99c --- /dev/null +++ b/test_i386.S @@ -0,0 +1,41 @@ +/*########################################################################= ##### + * Copyright (c) 2010 Linaro Limited + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Peter Maydell (Linaro) - initial implementation + *########################################################################= ###*/ + +/* A trivial test image for x86 */ + +/* Initialise the registers to avoid spurious mismatches */ + xor %eax, %eax + sahf /* init eflags */ + + mov $0x12345678, %eax + mov $0x9abcdef0, %ebx + mov $0x97361234, %ecx + mov $0x84310284, %edx + mov $0x83624173, %edi + mov $0xfaebfaeb, %esi + mov $0x84610123, %ebp + +#ifdef __x86_64__ + movq $0x123456789abcdef0, %r8 + movq $0xaaaabbbbccccdddd, %r9 + movq $0x1010101010101010, %r10 + movq $0x1111111111111111, %r11 + movq $0x1212121212121212, %r12 + movq $0x1313131313131313, %r13 + movq $0x1414141414141414, %r14 + movq $0x1515151515151515, %r15 +#endif + +/* do compare */ + ud1 %eax, %eax + +/* exit test */ + ud1 %ecx, %eax diff --git a/test_i386.s b/test_i386.s deleted file mode 100644 index a2140a0..0000000 --- a/test_i386.s +++ /dev/null @@ -1,27 +0,0 @@ -;#########################################################################= ###### -;# Copyright (c) 2010 Linaro Limited -;# All rights reserved. This program and the accompanying materials -;# are made available under the terms of the Eclipse Public License v1.0 -;# which accompanies this distribution, and is available at -;# http://www.eclipse.org/legal/epl-v10.html -;# -;# Contributors: -;# Peter Maydell (Linaro) - initial implementation -;#########################################################################= ###### - -; A trivial test image for x86 - -BITS 32 -; Initialise the registers to avoid spurious mismatches -mov eax, 0x12345678 -mov ebx, 0x9abcdef0 -mov ecx, 0x97361234 -mov edx, 0x84310284 -mov edi, 0x83624173 -mov esi, 0xfaebfaeb -mov ebp, 0x84610123 -; UD1 : do compare -UD1 - -; UD2 : exit test -UD2 --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644591; cv=none; d=zoho.com; s=zohoarc; b=TeBxMnrbg3NHJWoEkKUxf10gKRik/igFgiLrSzczUYXcqgJxu+0c0/TZKJoEqlAvuv/qwdFL0Xzj5ZBtomcWTUPr8H4Z4J/OEOWNVVqibDzU3gBPVMYjSnspDJ05v2CHtStUmp26tBMs8QE2z8wr/h1Y7rScBh3chRGBOC6r0UA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644591; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=0ilxUhOWtdPal8guoafu7uVUdV65rxKS1rgM4/OQmO8=; b=f3mnGj08+XTMjgQbPoIpA2ks/dVGulANrw+f41sEpTjV1Xk+lyT07JxerDcU65lYxCHIbhYXSvJ+ejM5VrcWpy1OJBlH4/8UiM2jCR2Xs2DbB/k7gkUbR9eOT9sFiRsGZIi7P+CNQY3jkN7g3zDhMqGF99s5BKR9JlpqkDSX1Q4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644591286386.91591102223447; Thu, 23 May 2019 13:49:51 -0700 (PDT) Received: from localhost ([127.0.0.1]:43115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTueo-00019j-7O for importer@patchew.org; Thu, 23 May 2019 16:49:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZv-00068T-GW for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZt-0003Bx-Dd for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:43 -0400 Received: from mail-yb1-xb35.google.com ([2607:f8b0:4864:20::b35]:33080) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZr-00039B-FI for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:39 -0400 Received: by mail-yb1-xb35.google.com with SMTP id w127so923288yba.0 for ; Thu, 23 May 2019 13:44:39 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:38 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0ilxUhOWtdPal8guoafu7uVUdV65rxKS1rgM4/OQmO8=; b=LzP7DIAH6TxVJw/RAarL1dKOcYuOiX+hKY3O1MbhUb4ASnwz6WNEtCGXyNEN3tfyHt 0MVr/wbodOMkUHADYui3do0igVL/R1b2kcSbl1vRPQxqv1HanXPZC3j+cqbC6LnSrIsM P+uQyhmcqpGsuefqY8VVpEhwKpZTkAXyWF4IEOl+cBAXL2ZK8pFkj9arCQQnW48pRWH0 vCulNdn7yeViSICbH181aG80/WL1FAVqnIyKjCVWWudYJkYZ+s5aY9OI3MRgtDoDiY6y 7l+qZQsndh+nHMAz9kLTQaXVAlxX655tgNejOxNLZzPj6Zcaw07JVfD4V5xKtOfEsPyT j8wQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0ilxUhOWtdPal8guoafu7uVUdV65rxKS1rgM4/OQmO8=; b=p3i//iMUbNOTlXeDnzx6kbKosZbBosgzD9AruOG7H+NbiIGDzpN4tjpBgmK/cN+/y4 V+v8oRiQvTs+scxigNyVK8zQQF8B+ng1gXhKGNuImYeaxR5XRrvkavWADRqcM+J6CZMh 0UfWOnnThU/heYYtskcVH03i1C97EviXDBRokRhMQbrVzlH1V5eGzGChTn/UVd2n7FRu DM12n4AJzFAbuBvfJBix37MCZRwXg6xPQ+CuiMc5w1223Be5uqE+iRrNFnLRMWEg3NoF 5z29AlMVfAAu4+1r5HBrpt9E4q6hDzR22p2sMn1yYaTeo5RQXv3Ymaf+OGQ1ggIfTR3X eY9Q== X-Gm-Message-State: APjAAAWSbhmgx6oGb5DteBqf93q0+8QVmE4VElPvlpk5gO2/IAlDxuW4 zV67wzz5cyY5a5DpML0XD5NfYeQS X-Google-Smtp-Source: APXvYqxPBDcpajJyswcRAX4EdZ2FVVxWMb1TAzYN9CCyvlVVj+GeEOLc26DxNNRVWd7xTi7Wg6uLYA== X-Received: by 2002:a25:b70c:: with SMTP id t12mr6654762ybj.67.1558644278596; Thu, 23 May 2019 13:44:38 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:06 -0400 Message-Id: <20190523204409.21068-9-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b35 Subject: [Qemu-devel] [RISU v3 08/11] configure: add i386/x86_64 architectures 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that i386 and x86_64 architectures are supported by RISU, we want to detect them and build RISU for them automatically. Suggested-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- configure | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 65e1819..ca2d7db 100755 --- a/configure +++ b/configure @@ -48,12 +48,14 @@ EOF } =20 guess_arch() { - if check_define __m68k__ ; then - ARCH=3D"m68k" + if check_define __aarch64__ ; then + ARCH=3D"aarch64" elif check_define __arm__ ; then ARCH=3D"arm" - elif check_define __aarch64__ ; then - ARCH=3D"aarch64" + elif check_define __i386__ || check_define __x86_64__ ; then + ARCH=3D"i386" + elif check_define __m68k__ ; then + ARCH=3D"m68k" elif check_define __powerpc64__ ; then ARCH=3D"ppc64" else --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644792; cv=none; d=zoho.com; s=zohoarc; b=PX8JvD/WA93rzON+zli3IC1xrKpcNV5qGOOvNiPIy6k/7lwyVTLSH9JmgJTzCRmOB13algxGrXreb8PGTkOZs4tvk0+HYR1AQu7nFeFuy/djW8LN/3uDV5d1XaHcxtletclFtstvjQEOJCNzsgo7ILs4QpitQzTzetcUONDWyVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644792; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=dgGhNtzAW4e5HQFtFo/WG0Nzt03w15qZgzxKHgtzV9k=; b=Za83xChDki78zlaQ8KgiN8xtrT9FEdg/f4fonpFFAh9uH/oRpE5ihDi9e5nkhIZojk6WcU52B3WPEuLoRMbO3/g39RKO2/i5ZQAmhlIvhKpTBAH9TIljxxxDkQ8DrNkjbYzNcEnr1Bw+gdXG6AhQt+t98f1Z0csEO1Rar2za/uk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644792205834.5824900469493; Thu, 23 May 2019 13:53:12 -0700 (PDT) Received: from localhost ([127.0.0.1]:43174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTui2-0004PQ-GT for importer@patchew.org; Thu, 23 May 2019 16:53:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZz-0006CI-43 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZv-0003Fq-Ly for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:45 -0400 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]:33775) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZv-0003Ef-FY for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:43 -0400 Received: by mail-yb1-xb43.google.com with SMTP id w127so923378yba.0 for ; Thu, 23 May 2019 13:44:43 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:41 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=dgGhNtzAW4e5HQFtFo/WG0Nzt03w15qZgzxKHgtzV9k=; b=afTeAsOng5t/U9KgXwNn8SNdgxrlcz32rmOoAY5Rw7sypF3FK6Vh837DkrxnxV9JES g1TZBHxj1n3gSWL5XLtLyRzJclK865j8wnJhMvMn4K+udFufJ6haYeGbszLt6o0Qlpps 245sqEaw7kNJ3GOAegxGFekNmrGl2b31lxJzPmcpmR89sqxZwtQ8a4HWDcxFaZj/iWBa CwTPJR5iWF9pXEz2wv+uZmqZ37WVvQj2KlMdAk2DjQx83Yf8HZejhtmCa2Gap1EBNY3y kuM/nUJfhJXxWMVABKd+4DdRl31+P2gRK1Dp8ZLHLaG2ViLkOTf6kryYjtN/wnKYKjgs Nfaw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=dgGhNtzAW4e5HQFtFo/WG0Nzt03w15qZgzxKHgtzV9k=; b=LA3DfYDv7h2oNxaqk1TqY79l/QRqz0tDG4sJKbnXEB01FVlxXb8BTHQydqJHGG+KSs p4H/nDn7i/x8MA/CreLHoEnrAAhKpOMORr1xrR/Va8hN0Hz8Ude+31B31S3hxBKyJ/rm skT0uugqOsbwRxUunrJrl5NsM3AO4Inp/CsH5pLf73Vo7p7NZfIagF9Vfatioe0dUVJR ctpkFWlI8MZzJ9T75ZWfdG6FQ4avCQggZfxWPb3WjN5YIJM2sul3iSu5zbaCZFqM6gpj zz1HqeZLilhzAi+CnmQKVkbDr+fsPFyI8QeAFf2ARhR8wmeb/Ntl/kzJMmIiQc76zOmW 5YMQ== X-Gm-Message-State: APjAAAVriKZ7RbAot9zCRxyLf9K8GLvYDlgf4g06UhzvLf12fpzX/Xx/ Gea+QkIaPOUeIbtnseuQ/awn0WmK X-Google-Smtp-Source: APXvYqyzrtBYhwXaGqpxjszYpxIT3+HbFSJin6mxAfijYnYdTDY+cqsxthM0kTpjx2WLwPUm/5FP7w== X-Received: by 2002:a25:2487:: with SMTP id k129mr5834238ybk.91.1558644282316; Thu, 23 May 2019 13:44:42 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:07 -0400 Message-Id: <20190523204409.21068-10-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b43 Subject: [Qemu-devel] [RISU v3 09/11] i386: Add avx512 state to reginfo_t 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Richard Henderson The state expected for a given test must be specifically requested with the --xfeatures=3Dmask command-line argument. This is recorded with the saved state so that it is obvious if the apprentice is given a different argument. Any features beyond what are present on the running cpu will read as zero. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e --- risu_reginfo_i386.h | 14 +++ risu_reginfo_i386.c | 228 ++++++++++++++++++++++++++++++++++++++++++-- test_i386.S | 39 ++++++++ 3 files changed, 273 insertions(+), 8 deletions(-) diff --git a/risu_reginfo_i386.h b/risu_reginfo_i386.h index e350f01..b468f79 100644 --- a/risu_reginfo_i386.h +++ b/risu_reginfo_i386.h @@ -12,6 +12,10 @@ #ifndef RISU_REGINFO_I386_H #define RISU_REGINFO_I386_H =20 +struct avx512_reg { + uint64_t q[8]; +}; + /* * This is the data structure we pass over the socket. * It is a simplified and reduced subset of what can @@ -19,7 +23,17 @@ */ struct reginfo { uint32_t faulting_insn; + uint32_t mxcsr; + uint64_t xfeatures; + gregset_t gregs; + +#ifdef __x86_64__ + struct avx512_reg vregs[32]; +#else + struct avx512_reg vregs[8]; +#endif + uint64_t kregs[8]; }; =20 /* diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index c4dc14a..83f9541 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -11,19 +11,32 @@ =20 #include #include +#include #include #include #include +#include =20 #include "risu.h" #include "risu_reginfo_i386.h" =20 -const struct option * const arch_long_opts; -const char * const arch_extra_help; +#include + +static uint64_t xfeatures =3D 3; /* SSE */ + +static const struct option extra_ops[] =3D { + {"xfeatures", required_argument, NULL, FIRST_ARCH_OPT }, + {0, 0, 0, 0} +}; + +const struct option * const arch_long_opts =3D extra_ops; +const char * const arch_extra_help + =3D " --xfeatures=3D Use features in mask for XSAVE\n"; =20 void process_arch_opt(int opt, const char *arg) { - abort(); + assert(opt =3D=3D FIRST_ARCH_OPT); + xfeatures =3D strtoull(arg, 0, 0); } =20 const int reginfo_size(void) @@ -31,13 +44,37 @@ const int reginfo_size(void) return sizeof(struct reginfo); } =20 +static void *xsave_feature_buf(struct _xstate *xs, int feature) +{ + unsigned int eax, ebx, ecx, edx; + int ok; + + /* + * Get the location of the XSAVE feature from the cpuid leaf. + * Given that we know the xfeature bit is set, this must succeed. + */ + ok =3D __get_cpuid_count(0xd, feature, &eax, &ebx, &ecx, &edx); + assert(ok); + + /* Sanity check that the frame stored by the kernel contains the data.= */ + assert(xs->fpstate.sw_reserved.extended_size >=3D eax + ebx); + + return (void *)xs + ebx; +} + /* reginfo_init: initialize with a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc) { - int i; + int i, nvecregs; + struct _fpstate *fp; + struct _xstate *xs; + uint64_t features; =20 memset(ri, 0, sizeof(*ri)); =20 + /* Require master and apprentice to be given the same arguments. */ + ri->xfeatures =3D xfeatures; + for (i =3D 0; i < NGREG; i++) { switch (i) { case REG_E(IP): @@ -79,12 +116,89 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) * distinguish 'do compare' from 'stop'. */ ri->faulting_insn =3D *(uint32_t *)uc->uc_mcontext.gregs[REG_E(IP)]; + + /* + * FP state is omitted if unused (aka in init state). + * Use the struct for access to AVX state. + */ + + fp =3D (struct _fpstate *)uc->uc_mcontext.fpregs; + if (fp =3D=3D NULL) { + return; + } + +#ifdef __x86_64__ + nvecregs =3D 16; +#else + /* We don't (currently) care about the 80387 state, only SSE+. */ + if (fp->magic !=3D X86_FXSR_MAGIC) { + return; + } + nvecregs =3D 8; +#endif + + /* + * Now we know that _fpstate contains FXSAVE data. + */ + ri->mxcsr =3D fp->mxcsr; + + for (i =3D 0; i < nvecregs; ++i) { +#ifdef __x86_64__ + memcpy(&ri->vregs[i], &fp->xmm_space[i * 4], 16); +#else + memcpy(&ri->vregs[i], &fp->_xmm[i], 16); +#endif + } + + if (fp->sw_reserved.magic1 !=3D FP_XSTATE_MAGIC1) { + return; + } + xs =3D (struct _xstate *)fp; + features =3D xfeatures & xs->xstate_hdr.xfeatures; + + /* + * Now we know that _fpstate contains XSAVE data. + */ + + if (features & (1 << 2)) { + /* YMM_Hi128 state */ + void *buf =3D xsave_feature_buf(xs, 2); + for (i =3D 0; i < nvecregs; ++i) { + memcpy(&ri->vregs[i].q[2], buf + 16 * i, 16); + } + } + + if (features & (1 << 5)) { + /* Opmask state */ + uint64_t *buf =3D xsave_feature_buf(xs, 5); + for (i =3D 0; i < 8; ++i) { + ri->kregs[i] =3D buf[i]; + } + } + + if (features & (1 << 6)) { + /* ZMM_Hi256 state */ + void *buf =3D xsave_feature_buf(xs, 6); + for (i =3D 0; i < nvecregs; ++i) { + memcpy(&ri->vregs[i].q[4], buf + 32 * i, 32); + } + } + +#ifdef __x86_64__ + if (features & (1 << 7)) { + /* Hi16_ZMM state */ + void *buf =3D xsave_feature_buf(xs, 7); + for (i =3D 0; i < 16; ++i) { + memcpy(&ri->vregs[i + 16], buf + 64 * i, 64); + } + } +#endif } =20 /* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ int reginfo_is_eq(struct reginfo *m, struct reginfo *a) { - return 0 =3D=3D memcmp(m, a, sizeof(*m)); + return !memcmp(m, a, sizeof(*m)); } =20 static const char *const regname[NGREG] =3D { @@ -126,28 +240,126 @@ static const char *const regname[NGREG] =3D { # define PRIxREG "%08x" #endif =20 +static int get_nvecregs(uint64_t features) +{ +#ifdef __x86_64__ + return features & (1 << 7) ? 32 : 16; +#else + return 8; +#endif +} + +static int get_nvecquads(uint64_t features) +{ + if (features & (1 << 6)) { + return 8; + } else if (features & (1 << 2)) { + return 4; + } else { + return 2; + } +} + +static char get_vecletter(uint64_t features) +{ + if (features & (1 << 6 | 1 << 7)) { + return 'z'; + } else if (features & (1 << 2)) { + return 'y'; + } else { + return 'x'; + } +} + /* reginfo_dump: print state to a stream, returns nonzero on success */ int reginfo_dump(struct reginfo *ri, FILE *f) { - int i; + uint64_t features; + int i, j, n, w; + char r; + fprintf(f, " faulting insn %x\n", ri->faulting_insn); for (i =3D 0; i < NGREG; i++) { if (regname[i]) { fprintf(f, " %-6s: " PRIxREG "\n", regname[i], ri->gregs[i]); } } + + fprintf(f, " mxcsr : %x\n", ri->mxcsr); + fprintf(f, " xfeat : %" PRIx64 "\n", ri->xfeatures); + + features =3D ri->xfeatures; + n =3D get_nvecregs(features); + w =3D get_nvecquads(features); + r =3D get_vecletter(features); + + for (i =3D 0; i < n; i++) { + fprintf(f, " %cmm%-3d: ", r, i); + for (j =3D w - 1; j >=3D 0; j--) { + fprintf(f, "%016" PRIx64 "%c", + ri->vregs[i].q[j], j =3D=3D 0 ? '\n' : ' '); + } + } + + if (features & (1 << 5)) { + for (i =3D 0; i < 8; i++) { + fprintf(f, " k%-5d: %016" PRIx64 "\n", i, ri->kregs[i]); + } + } + return !ferror(f); } =20 int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f) { - int i; + int i, j, n, w; + uint64_t features; + char r; + + fprintf(f, "Mismatch (master v apprentice):\n"); + for (i =3D 0; i < NGREG; i++) { if (m->gregs[i] !=3D a->gregs[i]) { assert(regname[i]); - fprintf(f, "Mismatch: %s: " PRIxREG " v " PRIxREG "\n", + fprintf(f, " %-6s: " PRIxREG " v " PRIxREG "\n", regname[i], m->gregs[i], a->gregs[i]); } } + + if (m->mxcsr !=3D a->mxcsr) { + fprintf(f, " mxcsr : %x v %x\n", m->mxcsr, a->mxcsr); + } + if (m->xfeatures !=3D a->xfeatures) { + fprintf(f, " xfeat : %" PRIx64 " v %" PRIx64 "\n", + m->xfeatures, a->xfeatures); + } + + features =3D m->xfeatures; + n =3D get_nvecregs(features); + w =3D get_nvecquads(features); + r =3D get_vecletter(features); + + for (i =3D 0; i < n; i++) { + if (memcmp(&m->vregs[i], &a->vregs[i], w * 8)) { + fprintf(f, " %cmm%-3d: ", r, i); + for (j =3D w - 1; j >=3D 0; j--) { + fprintf(f, "%016" PRIx64 "%c", + m->vregs[i].q[j], j =3D=3D 0 ? '\n' : ' '); + } + fprintf(f, " v: "); + for (j =3D w - 1; j >=3D 0; j--) { + fprintf(f, "%016" PRIx64 "%c", + a->vregs[i].q[j], j =3D=3D 0 ? '\n' : ' '); + } + } + } + + for (i =3D 0; i < 8; i++) { + if (m->kregs[i] !=3D a->kregs[i]) { + fprintf(f, " k%-5d: %016" PRIx64 " v %016" PRIx64 "\n", + i, m->kregs[i], a->kregs[i]); + } + } + return !ferror(f); } diff --git a/test_i386.S b/test_i386.S index 456b99c..05344d7 100644 --- a/test_i386.S +++ b/test_i386.S @@ -12,6 +12,37 @@ /* A trivial test image for x86 */ =20 /* Initialise the registers to avoid spurious mismatches */ + +#ifdef __x86_64__ +#define BASE %rax + lea 2f(%rip), BASE +#else +#define BASE %eax + call 1f +1: pop BASE + add $2f-1b, BASE +#endif + + movdqa 0(BASE), %xmm0 + movdqa 1*16(BASE), %xmm1 + movdqa 2*16(BASE), %xmm2 + movdqa 3*16(BASE), %xmm3 + movdqa 4*16(BASE), %xmm4 + movdqa 5*16(BASE), %xmm5 + movdqa 6*16(BASE), %xmm6 + movdqa 7*16(BASE), %xmm7 + +#ifdef __x86_64__ + movdqa 8*16(BASE), %xmm8 + movdqa 9*16(BASE), %xmm9 + movdqa 10*16(BASE), %xmm10 + movdqa 11*16(BASE), %xmm11 + movdqa 12*16(BASE), %xmm12 + movdqa 13*16(BASE), %xmm13 + movdqa 14*16(BASE), %xmm14 + movdqa 15*16(BASE), %xmm15 +#endif + xor %eax, %eax sahf /* init eflags */ =20 @@ -39,3 +70,11 @@ =20 /* exit test */ ud1 %ecx, %eax + + .p2align 16 +2: + .set i, 0 + .rept 256 + .byte i + .set i, i + 1 + .endr --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644764; cv=none; d=zoho.com; s=zohoarc; b=hcPFDh4RDny+1hgIIcuYorC96tZ+NoMHOpGVVdyqirht12quxAZex6W7eCOSLYfXD/MDosJgn/O2Pz6mLl68edAdQSFTRZcq+lZrzU2+ZON2EopEu5f6SDjRlBEqojtwIqIO6QkQajh3X9CG63AAM6Ape7vS74ESpbdLLkcX/Xw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644764; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=06P+BrsS8Wgfkpmivdl7rtQvDnn06OvuBRIH+NIQTdk=; b=Wtaq8OyYOAekR+6P7jew1dGiri9eLxmHqEMo9RROa7ZZ7zCU5f7z7/5yym7kz5+bd878qBujs9foxzl/n7Aa1LdnXHKBGSmFlpFnyUWf5Knhh2bOiC9QLAcQfUft2Br1fUZmFTwae+QBvn6pLobF6qnNYcJOIwSIOWRno3Vpt4E= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644764731887.3690290394068; Thu, 23 May 2019 13:52:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:43168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuha-0003wm-GI for importer@patchew.org; Thu, 23 May 2019 16:52:38 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuZz-0006CL-4A for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZw-0003Ho-1c for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:45 -0400 Received: from mail-yb1-xb2b.google.com ([2607:f8b0:4864:20::b2b]:42636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZv-0003Ff-SO for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:43 -0400 Received: by mail-yb1-xb2b.google.com with SMTP id a21so2782555ybg.9 for ; Thu, 23 May 2019 13:44:43 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:42 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=06P+BrsS8Wgfkpmivdl7rtQvDnn06OvuBRIH+NIQTdk=; b=iMn9KZ/dPRhsy0owQd++Y+KxKPwSakEro6GIGJ83BUKA+WiPhty6qjoA0qE29TsK3a dSetkpaw6o1evI4SA1IEFIdjSGCJj4Xbdv6Q1yQTRGAjSL++RLWj/7YlQa1ERjJ1GYXW 2A6zMR5rwO07Xuxqt9QvhsbjKXl6zwjfoZHh0hJmOUMc2WlRqlhwRNuGAukyKMt4kXTp IxV5eo+Uz91SmuDldM7IViYnjZ+H5q98ZnwCTMnBoKEsHF1KfaDKc6Sp2/OeHz88MxRo gNASwAYoTg8pCPPBCKC1eyZq2zmc4MJROdKfpQeY/OSuEuwMdLLEgr4N4f1x8WQIcGzt 54fQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=06P+BrsS8Wgfkpmivdl7rtQvDnn06OvuBRIH+NIQTdk=; b=ds3QKt4e5Ho9jchN5YNy+2dPIQcB7T+X/SY+vT2SL0vll36kMN8ELvuQ21MQ8km55e /15l/NLEVcCEZtb8UZIDYTR+Q4kENGdXKilu/OkC/4FXsm7DaV96PQKpTzjYePutJyP9 ah7lDJiQjIMoP0/gIsWd2aAUdqR6As28GVvUc7EHdK7TEiL6MDkJ8lPUv15CcNKnntBJ jXz3txtJZmGin02FdAqXcA/qmjfuB4ChfbeoGLcqikEk++vBIFdAcuomKcB0oZWYnLpX to7mcsTri37HwNJiz8ZP2Odb50S303jXsMRD4D2lUWTOZpCjjk+655adtfxeXzYdrdMY +wQA== X-Gm-Message-State: APjAAAUTOhaf1qjC4h4oMtTfE9fU39crX3rFLZPYIk8CdUKsJL5XitWK 1XTWWpulYv5R6l5/lrVu/slOXCF3 X-Google-Smtp-Source: APXvYqz1C2Id0Koqf+UbbDJjqnM3Pc0qym0TMk258BksGxRjlnNW80bBTo6VFuTTeDl1BR+KnMU8UA== X-Received: by 2002:a25:138a:: with SMTP id 132mr45212293ybt.127.1558644282987; Thu, 23 May 2019 13:44:42 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:08 -0400 Message-Id: <20190523204409.21068-11-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b2b Subject: [Qemu-devel] [RISU v3 10/11] risu_reginfo_i386: replace xfeature constants with symbolic names 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The original code used "magic numbers", which made it unclear in some places. Include a reference to the Intel manual where the constants' meaning is discussed. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Signed-off-by: Jan Bobek --- risu_reginfo_i386.c | 48 +++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 83f9541..01ea179 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -22,7 +22,25 @@ =20 #include =20 -static uint64_t xfeatures =3D 3; /* SSE */ +/* + * Refer to "Intel(R) 64 and IA-32 Architectures Software Developer's + * Manual", Volume 1, Section 13.1 "XSAVE-Supported Features and + * State-Component Bitmaps" for detailed discussion of these constants + * and their meaning. + */ +enum { + XFEAT_X87 =3D 1 << 0, + XFEAT_SSE =3D 1 << 1, + XFEAT_AVX =3D 1 << 2, + XFEAT_AVX512_OPMASK =3D 1 << 5, + XFEAT_AVX512_ZMM_HI256 =3D 1 << 6, + XFEAT_AVX512_HI16_ZMM =3D 1 << 7, + XFEAT_AVX512 =3D XFEAT_AVX512_OPMASK + | XFEAT_AVX512_ZMM_HI256 + | XFEAT_AVX512_HI16_ZMM +}; + +static uint64_t xfeatures =3D XFEAT_X87 | XFEAT_SSE; =20 static const struct option extra_ops[] =3D { {"xfeatures", required_argument, NULL, FIRST_ARCH_OPT }, @@ -160,34 +178,34 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) * Now we know that _fpstate contains XSAVE data. */ =20 - if (features & (1 << 2)) { + if (features & XFEAT_AVX) { /* YMM_Hi128 state */ - void *buf =3D xsave_feature_buf(xs, 2); + void *buf =3D xsave_feature_buf(xs, XFEAT_AVX); for (i =3D 0; i < nvecregs; ++i) { memcpy(&ri->vregs[i].q[2], buf + 16 * i, 16); } } =20 - if (features & (1 << 5)) { + if (features & XFEAT_AVX512_OPMASK) { /* Opmask state */ - uint64_t *buf =3D xsave_feature_buf(xs, 5); + uint64_t *buf =3D xsave_feature_buf(xs, XFEAT_AVX512_OPMASK); for (i =3D 0; i < 8; ++i) { ri->kregs[i] =3D buf[i]; } } =20 - if (features & (1 << 6)) { + if (features & XFEAT_AVX512_ZMM_HI256) { /* ZMM_Hi256 state */ - void *buf =3D xsave_feature_buf(xs, 6); + void *buf =3D xsave_feature_buf(xs, XFEAT_AVX512_ZMM_HI256); for (i =3D 0; i < nvecregs; ++i) { memcpy(&ri->vregs[i].q[4], buf + 32 * i, 32); } } =20 #ifdef __x86_64__ - if (features & (1 << 7)) { + if (features & XFEAT_AVX512_HI16_ZMM) { /* Hi16_ZMM state */ - void *buf =3D xsave_feature_buf(xs, 7); + void *buf =3D xsave_feature_buf(xs, XFEAT_AVX512_HI16_ZMM); for (i =3D 0; i < 16; ++i) { memcpy(&ri->vregs[i + 16], buf + 64 * i, 64); } @@ -243,7 +261,7 @@ static const char *const regname[NGREG] =3D { static int get_nvecregs(uint64_t features) { #ifdef __x86_64__ - return features & (1 << 7) ? 32 : 16; + return features & XFEAT_AVX512_HI16_ZMM ? 32 : 16; #else return 8; #endif @@ -251,9 +269,9 @@ static int get_nvecregs(uint64_t features) =20 static int get_nvecquads(uint64_t features) { - if (features & (1 << 6)) { + if (features & XFEAT_AVX512_ZMM_HI256) { return 8; - } else if (features & (1 << 2)) { + } else if (features & XFEAT_AVX) { return 4; } else { return 2; @@ -262,9 +280,9 @@ static int get_nvecquads(uint64_t features) =20 static char get_vecletter(uint64_t features) { - if (features & (1 << 6 | 1 << 7)) { + if (features & (XFEAT_AVX512_ZMM_HI256 | XFEAT_AVX512_HI16_ZMM)) { return 'z'; - } else if (features & (1 << 2)) { + } else if (features & XFEAT_AVX) { return 'y'; } else { return 'x'; @@ -301,7 +319,7 @@ int reginfo_dump(struct reginfo *ri, FILE *f) } } =20 - if (features & (1 << 5)) { + if (features & XFEAT_AVX512_OPMASK) { for (i =3D 0; i < 8; i++) { fprintf(f, " k%-5d: %016" PRIx64 "\n", i, ri->kregs[i]); } --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1558644789; cv=none; d=zoho.com; s=zohoarc; b=RKSYXvP3hi4t4nJyxjHxN7ioR8zdMoAPoeWlG3dlR70BPIfEuIjJEdgHTqrhLML6yW8pQl/5GVTgJR6b0Z8gyuMxJ9KUc9ObDXQMqxBD5LiN+hET/1Nv9g3TMtcAvTw+CdGQhqH7Db/S/9+zOK/vvMVcUcYj7AJZnbKy8APfh6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558644789; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=yaZVlZDEXWfOSBbbJA3wQfauT8Jz80fWSW3uiWNB6mc=; b=RNbqQy9igvgyRSxoLcH/FC0zXjlkCSngjJ62gPE7EI+fJOzxHX7zxpFTNVgVrURgC+wzorqrvpjFGmD3JGFB86MJFrURKDMnBe+N2pkKi0fZexMwNFXCDJNI5uZpSncsKIG21K3ZD1Aq99DVKys/gXVKhQsJZQM8bKlfIGF8SZ0= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558644789503709.3271250096648; Thu, 23 May 2019 13:53:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:43172 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTuhz-0004NQ-Ej for importer@patchew.org; Thu, 23 May 2019 16:53:03 -0400 Received: from eggs.gnu.org ([209.51.188.92]:37477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTua0-0006DQ-66 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTuZz-0003Pt-6F for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:48 -0400 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]:40884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hTuZx-0003H7-H8 for qemu-devel@nongnu.org; Thu, 23 May 2019 16:44:45 -0400 Received: by mail-yb1-xb2e.google.com with SMTP id g62so2785714ybg.7 for ; Thu, 23 May 2019 13:44:44 -0700 (PDT) Received: from dionysus.attlocal.net (69-222-133-165.lightspeed.tukrga.sbcglobal.net. [69.222.133.165]) by smtp.gmail.com with ESMTPSA id p12sm87590ywg.72.2019.05.23.13.44.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 13:44:43 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=yaZVlZDEXWfOSBbbJA3wQfauT8Jz80fWSW3uiWNB6mc=; b=YTesA8IY48HUlfRoiX1Ns79o4itVfEyRQzvF5xWbK2lBb/S1tdqwmOGsdrt1U765Yq CkqIQaWqD7/8L8dwou379tWjGbm14ttiauKwpXIgT5bEDhKqzsSHT8NyvA18++P01bo1 z2aTvKgasJkKrs0ltYaGqfHjjBvn547FuAEE0uTuIN0XWQ6cS+kW1z7LpcXNnm+ZLWtY EpqA4GvuiLaC9m8oWIWlJAaHBDu0pyGuv8MlyLVDXmvcVZuWSuYMUZjRByxSsWeHo72I zmR6K+R8muIZ92oLX/1JE3Qle/zmiw/Oh6AXX7Ua5E10DQysXFTul0ws6mn4u94cB6MZ D2nw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=yaZVlZDEXWfOSBbbJA3wQfauT8Jz80fWSW3uiWNB6mc=; b=bt230IPqQZ4tHLVha67D3hrDzkGTzRjKyA5PNcmq4R+lKYeMSn3Ib6ltW8/4s04UU+ C1y46HHh96X+KadLrBquOZThxjybx1AKULJNobxZm1ZrxGZ4LpeDe8WyW3X+/v7Z5Hbb BqJYAAlJ+/3yeofRI0xLlePk0L+Pes1dQELqw+KTOYmLil7WfRr+hcUOE49Bk1jeMDXC mhUvKnKrsjdxU9lSqexId+KR49eSEtt28EZDEEa0+FegfXUU4PkoUqQIxHir5slY0dbJ xB7iTeuSJ4MgSppitcG2ctwsYCbLnQ4SiqmMVIXfYw2zZvIoyxXr+p/as1J7QIub5yZL Cq/Q== X-Gm-Message-State: APjAAAWrxvYOARmyxtiLJAByj/Y4mFG3S2Og56YWvJ21NCRo3tyRLTix qRrNZr2AjI0XMV5gk77pJyLY2S6T X-Google-Smtp-Source: APXvYqzvnsYGcGrS8nYaQmH6KjJa7oRVBMPDhKGIAE+5/oBv/SkpmcF93owMKk9V8w9CdvLE9b8TWg== X-Received: by 2002:a25:5089:: with SMTP id e131mr7852663ybb.322.1558644283566; Thu, 23 May 2019 13:44:43 -0700 (PDT) From: Jan Bobek To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 16:44:09 -0400 Message-Id: <20190523204409.21068-12-jan.bobek@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::b2e Subject: [Qemu-devel] [RISU v3 11/11] risu_reginfo_i386: rework --xfeatures value parsing 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: Jan Bobek , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Have the --xfeatures option accept "sse", "avx" and "avx512" in addition to a plain numerical value, purely for users' convenience. Don't fail silently when an incorrect value is specified, to avoid confusion. Suggested-by: Richard Henderson Signed-off-by: Jan Bobek Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e --- risu_reginfo_i386.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 01ea179..194e0ad 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -53,8 +53,25 @@ const char * const arch_extra_help =20 void process_arch_opt(int opt, const char *arg) { + char *endptr; + assert(opt =3D=3D FIRST_ARCH_OPT); - xfeatures =3D strtoull(arg, 0, 0); + + if (!strcmp(arg, "sse")) { + xfeatures =3D XFEAT_X87 | XFEAT_SSE; + } else if (!strcmp(arg, "avx")) { + xfeatures =3D XFEAT_X87 | XFEAT_SSE | XFEAT_AVX; + } else if (!strcmp(arg, "avx512")) { + xfeatures =3D XFEAT_X87 | XFEAT_SSE | XFEAT_AVX | XFEAT_AVX512; + } else { + xfeatures =3D strtoull(arg, &endptr, 0); + if (*endptr) { + fprintf(stderr, + "Unable to parse '%s' in '%s' into an xfeatures intege= r mask\n", + endptr, arg); + exit(1); + } + } } =20 const int reginfo_size(void) --=20 2.20.1 From nobody Sat May 4 20:10:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1558690178; cv=none; d=zoho.com; s=zohoarc; b=UN9U8TTgX/KFIb/BcIzCam8U2L4gq3NUxnvoW7u+0aHvj6iidcB8VvsZzcZ8zZ9uznBAGc5o6hPI8v5HuCirlRP5O+OngGlLrQo5FcvpPF56XB7/oWe46yKihG0S2YDeebgXn/7iqf8pO+AeQcAHZbZpp8qPnvtMLIKkZmBtWdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558690178; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ax5Lq5sVicqsAzQYBOYT8ZLwPonXUFJFttZD6qBtBR8=; b=iDuBMfBcAZVbUa55kixjrB8hDagIFpI1jfm3rHAh9WFrC2H0VI+LYui/SRFuf2dkJMgtGlcLNxHPx0WROIEoCUONzpFILOteKAlfkVntry5BCc9gpweUGHySElSm+IfEKwUK4PjECqzzQZe//0LOCsA/TTvw53DkCyCxFEeTFSA= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558690178805763.9638500619928; Fri, 24 May 2019 02:29:38 -0700 (PDT) Received: from localhost ([127.0.0.1]:51523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU6VP-0005cs-0j for importer@patchew.org; Fri, 24 May 2019 05:28:52 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hU6UP-0005Ia-Rn for qemu-devel@nongnu.org; Fri, 24 May 2019 05:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hU6UO-0001gm-Sl for qemu-devel@nongnu.org; Fri, 24 May 2019 05:27:49 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:36060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hU6UO-0001fw-JE for qemu-devel@nongnu.org; Fri, 24 May 2019 05:27:48 -0400 Received: by mail-wm1-x344.google.com with SMTP id v22so1226071wml.1 for ; Fri, 24 May 2019 02:27:48 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b10sm3019121wrh.59.2019.05.24.02.27.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 02:27:46 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id A8A581FF87; Fri, 24 May 2019 10:27:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ax5Lq5sVicqsAzQYBOYT8ZLwPonXUFJFttZD6qBtBR8=; b=FmHvZyHj1stO3ub0RBeC8hP/ucGVs1dYtjX7bOeIH8OI1iIGEtwy2dy43gjJiB/yB5 UsgsZcBMHqf0TZT3hl2L6U/X0rImslz8+buamn2L2+xzgAFz4jKOVZ/5keaVpPV0Jdib 2667sGPXptXeeLJc02OLLo/CNlnPO7/km/ExBdyOdsQ1fU+Z5a0C2+/H7eoxj2m83VqH HN5m8J7hyCT5VFwFKlgNhMPgqsfrlKs9ETTQPUaFA8ZpVbzs8P7xVSiX/UGtwAr6zUj4 PYqOWlvZLFTHup1cvQDs6jJqv6Zg/Jz4zvwGESkzQuD72r7SQI3eSnijr4L9CmEEt5mv 4IDQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ax5Lq5sVicqsAzQYBOYT8ZLwPonXUFJFttZD6qBtBR8=; b=NMdaJJkev0KmTe1LzEqvVOn6NT4eWOLKK3hVIiW2VeNPsCiAJRsoZeHKjMOsBm50DB L/qpfDcCx7tXJ3kD1Pt7R6aFkTXWuSP30V94OVT3GzA/0fvrZvNOitXwWCdt6t829lMe /9hUy+lxztBHcoUcD4LGsLT5BrxeiHf6vIzT+20L1KVPLdZikJ8SiO701xDThwSj69YP XeIeroe6ufHwpak3Mm3bMLIs2I8stz0nEhTuVwtjA/tfVUjYj6rkWxycffz/53yl22cJ iour9ak5gMNmhuw0FLC2oq97zVbQulRHQjTJYopZ0VdVqWBOG4NldDt/py5oV5KyucWp 8xUA== X-Gm-Message-State: APjAAAV4nfqmYHf9AvLcLhJMqs7SPrKezaLba3ZFrZay59r15+CZl2Fz EKIZGw4ado3XnjcUqnFSIudvdw== X-Google-Smtp-Source: APXvYqwkXyj7X1QerqIPMnFeVUSlawg5o5tWHAeCTZA7zyB1khuXbpwZm/zqKo8EOzl5jBtJP6Ba+A== X-Received: by 2002:a1c:7f10:: with SMTP id a16mr14866134wmd.30.1558690066759; Fri, 24 May 2019 02:27:46 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: jan.bobek@gmail.com Date: Fri, 24 May 2019 10:27:36 +0100 Message-Id: <20190524092736.21734-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190523204409.21068-1-jan.bobek@gmail.com> References: <20190523204409.21068-1-jan.bobek@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [RISU PATCH] build-all-arches: include x86 triplets in the build 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: =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There are a couple of minor warts: - 32 bit x86 can be either i386-linux-gnu or i686-linux-gnu - skip looking for x86_64-linux-gnu-gcc in docker cross envs Signed-off-by: Alex Benn=C3=A9e --- build-all-archs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build-all-archs b/build-all-archs index a7cd7c2..e5dcfc8 100755 --- a/build-all-archs +++ b/build-all-archs @@ -39,7 +39,7 @@ while [[ "$1" =3D -* ]]; do ;; --use-docker) if [ -z "$arg" ]; then - default_tags=3D$(docker images qemu --format "{{.Repositor= y}}:{{.Tag}}" | grep "\(arm\|ppc64el\|m68k\).*cross$") + default_tags=3D$(docker images qemu --format "{{.Repositor= y}}:{{.Tag}}" | grep "\(arm\|ppc64el\|m68k\|i386\).*cross$") docker_tags=3D$(echo $default_tags | sed 's/\n/\s/g' ) else docker_tags=3D"$arg" @@ -74,7 +74,7 @@ fi DOCKER_RUN=3D"docker run --rm -u $(id -u) -v $(pwd):$(pwd) -w $(pwd)" =20 program_exists() { - if [ ! -z "$docker_tags" ]; then + if [[ ! -z "$docker_tags" && ! "$1" =3D=3D "x86_64-linux-gnu-gcc" ]]; = then use_docker_tag=3D"" for tag in $docker_tags; do if ${DOCKER_RUN} ${tag} /bin/bash -c "command -v $1 >/dev/null= "; then @@ -88,8 +88,10 @@ program_exists() { } =20 # powerpc64-linux-gnu doesn't work at the moment, so not yet listed. -for triplet in aarch64-linux-gnu arm-linux-gnueabihf m68k-linux-gnu \ - powerpc64le-linux-gnu powerpc64-linux-gnu ; do +for triplet in i386-linux-gnu i686-linux-gnu x86_64-linux-gnu \ + aarch64-linux-gnu arm-linux-gnueabihf \ + m68k-linux-gnu \ + powerpc64le-linux-gnu powerpc64-linux-gnu ; do =20 if ! program_exists "${triplet}-gcc"; then echo "Skipping ${triplet}: no compiler found" --=20 2.20.1