From patchwork Fri Feb 7 15:01:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183203 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp852226ile; Fri, 7 Feb 2020 07:13:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyMpcUXT9fCV78i+2wQ8hEYPmPlMRQD1WoyAiB3vHwintAx3rGmJh043xa5u92QUmBWmion X-Received: by 2002:a05:620a:557:: with SMTP id o23mr7937235qko.246.1581088425911; Fri, 07 Feb 2020 07:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581088425; cv=none; d=google.com; s=arc-20160816; b=QMLNcE69BoLYHu452WUvcHmNNxys/RoGPwSpNVWqvu1NCOm6dVJComREzu9BPNWgxW Ew8rjVRb6Su/2sT9dZ/YLeWuCb8REo4wenqJVHp6v2935xzKsSkn88N/kb3gYGynP3IA HT6ZgByqTAT0ZPYxbzcfUKB5w54nfyDTrpjjF5pcwMgHy+YFj9EtHqk1/JDt2Lg7nA3X Ozy9+MkC3T89y4Bw8VpQBVQ2ESnBQwJAtJe4PDMjhrYMBOFyUvbYYmM4FOb9pvKITNSo uEJ8wY2a22YHY3VfT0WU8ZrVopz2IqIe1L0irr9ierWTwnVxqIgYf6Cs/HyLHKl+sEC4 rppg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/ZswA9Otu9vtfPLtWP689YkHSf+JvE188+hies8lU5M=; b=lBCq+o28uUjaWKved1YEUV9R8D/dXEtmxfJ5KqyfowxjBeTXAMkT7gv+e1Nrux4a+9 4+RWQU+EUfwCf0rZHBPsT4KbcP+sV4CGm9fEnlvmGENNfb2r8XZeTnkSqb+lIUluI5pn k1sxw8p7Qgy4//5rfmcduZBrbiRwVtncUFNywvp2gva9dsiHIgLHLca/Dw/jCTXs7fQZ IYY25txFZAVBp6fHZWR0lk82VxDTjMFr2j0zjIF1j4TrjvLqac9vEeMNVJnrkcQcvH1+ 8oiXQnF6J9FOxgKwzxzpAG5cNvJBsF0MsmIyPBS2g10Ifgj2EdcuXVvBAHtA7xvZrlNg q/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ncgrbPZh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r23si1543831qtn.80.2020.02.07.07.13.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 07:13:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ncgrbPZh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05KD-0005s3-Dy for patch@linaro.org; Fri, 07 Feb 2020 10:13:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60353) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058L-0000zO-VN for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058H-0003yA-0P for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:40209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058G-0003tK-Pp for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:24 -0500 Received: by mail-wr1-x441.google.com with SMTP id t3so3050146wru.7 for ; Fri, 07 Feb 2020 07:01:24 -0800 (PST) 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=/ZswA9Otu9vtfPLtWP689YkHSf+JvE188+hies8lU5M=; b=ncgrbPZhSiBQ/R5Vkz0ucSHt+Y6ZL1DKItYxxKSCAY1OrG7J9mSyFjzO6CLX/7hagI f+9tyPzRLU0pHlBuFLMlRa0E7/tD9RyRQZ8WK2+EZiU/GPJ70jbBJSJz3ZD79TcwvVgI I5LNMRXIOi9C44YyNDnZhrxo7ZaBDZtKR47dXRBJzNVDQcY7u5aCWiD1ft5maLVRwL/3 dI8UHnl7YimIhYMjvrEi7Foeli7NCsdjRAclY+UlKzlAMYStTwFbz5dwCm2RIuEx3/h6 NnHXifni6JuBfLhb/is3SBSc54N7R1Ib1tEx4R+9PluCt8Zp2NHXf6NzORnz35UlsO/U A7hA== 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=/ZswA9Otu9vtfPLtWP689YkHSf+JvE188+hies8lU5M=; b=DHYSXQVZ/mHzrhTza4LHhQN55fS5CDGwUhhYDAokBwMHx62pi5Uou9tOvkM2SYcrBi 2nx2hY4YazGdSe5PlGD2MJEPbZgf5eFwP7/M0YDy9CYaKUSJmchukrhb1AJW0CkgQN49 yzVdPpgIeAV9eKh7+4xlOVjIHUSW6rJt+iBJtFO9xcMWzpFa7NAMih0tXu7iTuoYHc6D JG75EvtjqRCSaA+5gkB/0AGTfkgWhM8JHKcQEsP7mnrSn4A2JK9zCD2fCOnHq0EwKrhW 0h982SwgeCHwFIn8eX/cbC1EL1DTAbJYP0h1Lqo4hXas81Iqa8z3j+CROEnIKWO/4vJH EepQ== X-Gm-Message-State: APjAAAUebOudGfMLhBKVJUJskuT7CJaultjAW/mjHP36V9lEKWbUEi77 Ru2Al020KkwU3h4L7Oy6zl3dTQ== X-Received: by 2002:a5d:40d1:: with SMTP id b17mr4958979wrq.93.1581087682781; Fri, 07 Feb 2020 07:01:22 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r14sm3595073wrj.26.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:19 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 033271FF8C; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 1/5] docs/devel: document query handle lifetimes Date: Fri, 7 Feb 2020 15:01:14 +0000 Message-Id: <20200207150118.23007-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" I forgot to document the lifetime of handles in the developer documentation. Do so now. Signed-off-by: Alex Bennée --- docs/devel/tcg-plugins.rst | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -- 2.20.1 Reviewed-by: Robert Foley Reviewed-by: Richard Henderson diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index 718eef00f22..a05990906cc 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -51,8 +51,17 @@ about how QEMU's translation works to the plugins. While there are conceptions such as translation time and translation blocks the details are opaque to plugins. The plugin is able to query select details of instructions and system configuration only through the -exported *qemu_plugin* functions. The types used to describe -instructions and events are opaque to the plugins themselves. +exported *qemu_plugin* functions. + +Query Handle Lifetime +--------------------- + +Each callback provides an opaque anonymous information handle which +can usually be further queried to find out information about a +translation, instruction or operation. The handles themselves are only +valid during the lifetime of the callback so it is important that any +information that is needed is extracted during the callback and saved +by the plugin. Usage ===== From patchwork Fri Feb 7 15:01:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183199 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp845265ile; Fri, 7 Feb 2020 07:07:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyA/r+07kOGqqiPrgkYkz35lW8X+aGUrsKe8ZO/FiQIDBXrU2AWCx6FBbHWysLewZaVN+tK X-Received: by 2002:ae9:e811:: with SMTP id a17mr7831511qkg.93.1581088056401; Fri, 07 Feb 2020 07:07:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581088056; cv=none; d=google.com; s=arc-20160816; b=lgT2JeOxw1coiRZ9Dj0xSxYUWPV6BjRr3nSeqlII4Psu2Gm7h1rxVI6kPgwk9iNQuk c/U35uuXvU6j4HphlKGGjauG2eGJD9s7V6i5YzIfHpi3cnWwIKmYga9Y9ZU5pFPvWGuC wo8WKqip7TUCgvO8S8Uvzmdbl9OX9AVTdb/wQZRIwPrFEE21KauoOmsrVqlqPOm/3aGg PhKj5NLoVoHKmzR1DlDvjQGIx/8Jr8dom2RhxVPMHXteMv9C8X/JH1odAr1xg4rrndZO hE5mGIh994MT8yQsa0gEPeTymDCRPRUHnwAi2MQLQ761gykH0fSwe04UbmEgsXk1PcpW 4jMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=geflNNg5itN8dXnNJ+nN1Foj8Td7+gJztf5WRFw/CZI=; b=QBUxMbbAmkQ4GY4Eek7vGiB1N3lQkOWa3wX5Z/scbVMfwj2JguCnP/hxOxrav3hjPC dfzo0tF5gNKTSj9xX7kO+K+GFcFf6rN2OMMAN2dtLJ/S/dsq4J7XRpLr+v4InrHwvlBg 3E/rCZ2LsxrdtWhkE/yX+hRqABPReOl/Fwsaw8FoxEfbRPw2gdUxZpeAe2IrpUhchzSW mCoZeMZK4QcEBfeyXx9wjjq2AXx6BALkv5/M1Bqo1pzrMliXVpET0tcUH8bmLnuE6j7C N03YbFML/fpfUHPLNhhn6XVzEJuTKrLqaCR/uPKuIvABLNjdYyJSV2KS66TamYAXR7VI HECg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DH02ILyn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u13si1277685qvq.122.2020.02.07.07.07.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 07:07:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=DH02ILyn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05EF-0003OQ-Ru for patch@linaro.org; Fri, 07 Feb 2020 10:07:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60234) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058G-0000nN-Jd for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058E-0003ni-A4 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:24 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35171) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058E-0003gZ-3j for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:22 -0500 Received: by mail-wr1-x442.google.com with SMTP id w12so3087807wrt.2 for ; Fri, 07 Feb 2020 07:01:22 -0800 (PST) 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=geflNNg5itN8dXnNJ+nN1Foj8Td7+gJztf5WRFw/CZI=; b=DH02ILyn31hWZDIn7PbXVwUTONERvvLND5bXRV94M7JO4SmRqYA0gjtHKA7eCS/xvc 52titBIzfHffSdrESWMFb6DrjvxZZzvzHf+0a/68KKicLArTWpDh+b31eDJSqBij72VW XiJZYh7qq3CuYVXxqbfOayOgPIF7IkhvoB1zyguZ4mgfyzYWOT743Vb9WKmS4EgI2bUB Pl3HR8GOr7rf1UGfk8wWj8F5OExi5Ylp6gWBLTisimWZEL1xxpky9OMeUljgOSfo2M1L n6ivpcAzndODuuBpkkf72+PPp5/8YvREoLb5qzgpOQYDkgKAHaZvMEjCnnMoOvc0u5aM xdlw== 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=geflNNg5itN8dXnNJ+nN1Foj8Td7+gJztf5WRFw/CZI=; b=HmL8C8kA+AsUN1TJTeZDcjj9pHOdd0bVkc8OBUSavw/sBFzgorkmacLMcQ3m5zUHs8 FSgGL3JxJhEP+V1LyRLwY95fXUWfEhrGlOGcxHlwoBgGJaZd3oNAFF/6G+03EOpGK53E Zq+jEU+75nCz8R0p8ox96JiRsdtfxxK6sWsbVwU7t5+Xe8MBUuxXOUZsWEVWb/Oa58UX hBOZP1kjhikSGCgOzfLvSSqEaxI2wTaF7T8KCuL6HVng1pKXdHj2/r8x2prsHI26HJB5 z5kVTcVyPwnrlhqqlhwdrMpANQ6t4AzuZuvZtIO9P+IQuqIr0NXxSsDa/J1HozRNzXpI YjHQ== X-Gm-Message-State: APjAAAX7hy8ZcgjyqEUZ6BObMXxRvObcsGrMaLi3ykArwXTTE3kJbWm3 suT/UgHDJW5cOyRyGhXxR3OA6A== X-Received: by 2002:adf:f6c8:: with SMTP id y8mr5043627wrp.167.1581087680720; Fri, 07 Feb 2020 07:01:20 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a26sm3688453wmm.18.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:19 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 1A7F21FF8F; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 2/5] plugins/core: add missing break in cb_to_tcg_flags Date: Fri, 7 Feb 2020 15:01:15 +0000 Message-Id: <20200207150118.23007-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Reported-by: Robert Henry Signed-off-by: Emilio G. Cota Message-Id: <20200105072940.32204-1-cota@braap.org> --- plugins/core.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/plugins/core.c b/plugins/core.c index 9e1b9e7a915..ed863011baf 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -286,6 +286,7 @@ static inline uint32_t cb_to_tcg_flags(enum qemu_plugin_cb_flags flags) switch (flags) { case QEMU_PLUGIN_CB_RW_REGS: ret = 0; + break; case QEMU_PLUGIN_CB_R_REGS: ret = TCG_CALL_NO_WG; break; From patchwork Fri Feb 7 15:01:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183201 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848782ile; Fri, 7 Feb 2020 07:10:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwtbCNUOQwAco6LZQbIYzSvS/1cyKNnZw1cqZ4uCsnXv/kQz5b6Wc69M9nkKhhyINKd6GJW X-Received: by 2002:ac8:5358:: with SMTP id d24mr7627196qto.161.1581088230271; Fri, 07 Feb 2020 07:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581088230; cv=none; d=google.com; s=arc-20160816; b=IfmmfSYsfWN9mGuUHMcKwC5GkXeGISta1VFL1k/MJAciFulRk3E3lSBlBR1bW70XCC yJPgCg+Iez4RuIoiTsEVyX9wKUyKXdJLd8PbL1PTElHYf4z/P/KkAyR/5vgWA/EcHsWl aXJ2ne7AiGhZ93OaV9vKqzzKJvdwEmu9dqX7Ddyk7i6nt9TxmY5opMwNgA7D8xX1UVny zeInsD0xREPkS26pnENAAeJdcJfsIEKLjLmxO/NivjOj6MtEPa0oboCu0qIO57LDDdEW HnHLGXt8AOfAqLoxrxoBaG9jwyk+O1UYcJKJ0CN5OVFTYVzOPVblTvd5kmuoUNF7+kpP U52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NuT51ChIEQ4Kna0auqW3OS2c6axOB9q/YF3f1QpycFw=; b=S3jXtesqp6Fq4wVry85uDlUR5fN5M8Ycz6QiXhJ7aeyHj3O4K9LqB0rGDszKpLDR0B q1DTLEre4Ru/g1uy9GbAdqVd7WENXw7xqj91ydjRLYlaPLoVZdnpgIP+k0sfOTZ1VuTW lIAbfbDhNvxMFgjFfSkVowKJAGolTq3QtqJpqcJvvWFOMD+HVWv1GhJ1cA2+Y4Ol/mEF C/tdkDgSyOpSTgSoaz5xEPtf5DayPfl67OkiCND4vcrV0WI6bpGvCYKLg9O6m3csKI37 LxnWppzEnJhfZmb/NHGzWDXSMZ6xCRRCHNAvrTKoRsBx7GHXjFgAHkCI3yVPcgSLqj5Z CUOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WboE51Sf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n88si1327902qva.73.2020.02.07.07.10.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 07:10:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WboE51Sf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59032 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05H3-0000GF-PP for patch@linaro.org; Fri, 07 Feb 2020 10:10:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058I-0000rP-Ai for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058H-0003yi-4G for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:26 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:38148) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058G-0003us-T9 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:25 -0500 Received: by mail-wr1-x442.google.com with SMTP id y17so3064128wrh.5 for ; Fri, 07 Feb 2020 07:01:24 -0800 (PST) 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=NuT51ChIEQ4Kna0auqW3OS2c6axOB9q/YF3f1QpycFw=; b=WboE51SfCbCsN9Z4ZbYGqNSOhCeN32zDKYJ4nQEYHWwgsyeaIWcoZ0BpqncKpZy1Td XfE5NPZR9lszSRZ2gtpv8q2lzbV8bVDHKLunBSSaVpJyjl/AS4xBSZotrNNgLAHJ/Z9P qWQjilgeTpkXuswEN4LP348xFDlFPcr25CzLSARth60+x/CaHnf/DRYfuy2XpfVSgAXP CG4SJnxmw2M0wZs0SuH2bPDhOknMArsFL7baSMOQS4tWzdHye51y0vm0zu76DHiG0B3x 9mfHKAF9nkInFyD0DoXtfbsuELFBaweHc7rRC12H3mdT8Bs6H741h/ZQA9AVkijpREUl 7ZGw== 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=NuT51ChIEQ4Kna0auqW3OS2c6axOB9q/YF3f1QpycFw=; b=E2fASua470+wEUVWBd7VwUgc4R0Vv/MwiavhWnC10VU0Fki74h1G6omH/lQaAAa7Sp 5Vl0d0qy7u0u/ScfT7vxd1pZgb0333RYBa74hBTx3jvkBYikO84xJxYdVCdfovcnsOhK WKOs3IMDbsAnaWwoDrR7xxGmcavifz1FBeXX7YFqDw2kSnwo9SL51BMoXYW4ADeslfEI MAhzDhCp4vBhOtyKTEGnTCFBXNB2RgxHaDZAWTukc09tRdwkrjvda3MQajMNrUUQPeam sz6P14xNBVa+WI3rwDn+7QSgvf+nvswCPSnrTAfH0GKfd+cvcC1Siuep3mG8WucRP1Rn jkPw== X-Gm-Message-State: APjAAAXOC7WRB3yqdG03qLv0cztkb6j4wouBvtLZ5mf2RTL2pNkVWg7A 6LyujzG3gebUrkB0ApI14YHN/9rwgvc= X-Received: by 2002:adf:b193:: with SMTP id q19mr5099864wra.78.1581087683942; Fri, 07 Feb 2020 07:01:23 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b10sm3706967wrt.90.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:20 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 2F7EA1FF90; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 3/5] tests/plugin: prevent uninitialized warning Date: Fri, 7 Feb 2020 15:01:16 +0000 Message-Id: <20200207150118.23007-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , robert.foley@linaro.org, Euler Robot , robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Chen Qun According to the glibc function requirements, we need initialise the variable. Otherwise there will be compilation warnings: glib-autocleanups.h:28:3: warning: ‘out’ may be used uninitialized in this function [-Wmaybe-uninitialized] g_free (*pp); ^~~~~~~~~~~~ Reported-by: Euler Robot Signed-off-by: Chen Qun Reviewed-by: Thomas Huth Message-Id: <20200206093238.203984-1-kuhn.chenqun@huawei.com> [AJB: uses Thomas's single line allocation] Signed-off-by: Alex Bennée --- tests/plugin/bb.c | 6 +++--- tests/plugin/insn.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/tests/plugin/bb.c b/tests/plugin/bb.c index f30bea08dcc..df19fd359df 100644 --- a/tests/plugin/bb.c +++ b/tests/plugin/bb.c @@ -22,9 +22,9 @@ static bool do_inline; static void plugin_exit(qemu_plugin_id_t id, void *p) { - g_autofree gchar *out; - out = g_strdup_printf("bb's: %" PRIu64", insns: %" PRIu64 "\n", - bb_count, insn_count); + g_autofree gchar *out = g_strdup_printf( + "bb's: %" PRIu64", insns: %" PRIu64 "\n", + bb_count, insn_count); qemu_plugin_outs(out); } diff --git a/tests/plugin/insn.c b/tests/plugin/insn.c index 0a8f5a0000e..a9a6e412373 100644 --- a/tests/plugin/insn.c +++ b/tests/plugin/insn.c @@ -44,8 +44,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) static void plugin_exit(qemu_plugin_id_t id, void *p) { - g_autofree gchar *out; - out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count); + g_autofree gchar *out = g_strdup_printf("insns: %" PRIu64 "\n", insn_count); qemu_plugin_outs(out); } From patchwork Fri Feb 7 15:01:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183202 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp850752ile; Fri, 7 Feb 2020 07:12:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxxS71+aqG5q3FNIX5q1w/aPKFoRkkw0e86weNW73YgxMuTjxbIIRDwRbYf7i8rj2CQkeUd X-Received: by 2002:ac8:2bf9:: with SMTP id n54mr7681871qtn.280.1581088337191; Fri, 07 Feb 2020 07:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581088337; cv=none; d=google.com; s=arc-20160816; b=jQdfl5jzoncknyKOFhPEIHJn1f6OzH3CVJdNldHLy4SN/9n11ZC3MB2ZGWX73WNMcG gHdQX6d0df2rt+Drj/7YeXTEYlHQsoxcRVYQMU4Yj9U0+bq9DeIpGWwQhZxuUHf0v06H PSTIZG6lkTZZma6Eo+HKUAMCYDIidCug0hcyQ73X1oSLBsSfVU5m6avv3AkS4i2KNyCz wzoVagUsyLdY5YMdKmsEDHenf3UC86XX7DlMA233wP2CYBlqvi0+/77+kmChMDsBl9My 6cdORevvIdP4dZy6lE/ZBs0vjGsnNlJhQ980j7Oc3biMe55zpsqOUgwrxMXn7yDZRt8P gzSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=U6Am3X6OQTZ1x+tf20LucVI7jeDaV7FG5H5GI7lV8EE=; b=Aa1mP67QkpNRfPAVM1KKGaWe4R5fzvionql0z4StzHlN3aOKIA4iqXU+RmvQy9u9F8 eEG398eY9zLwscoIjzzZpICWmQwexxnbqCUlwyHLe712ARdVS0n4TIcYpJWXLTdZ6ZRB u5u9uhswvKWrrub3O8f86Gwh8aELtT0RRiLGTH4rEtIY8+sXWPLh2uPwVaKkHBr5mjnM fG44QbP13OG+ggzp6I6U7UNf0tw0VHdCRcjY7PknJgBNVDLABBB9xqKVnNtE0bykvHcj oMF7487lSf7hsnkJBQoWYlg/lkilcVNUb977TN7f6H8EUvoj6pdZPCjfQp2+Lej95L5S Wt/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=w2WmCj33; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d7si1521399qtn.182.2020.02.07.07.12.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 07:12:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=w2WmCj33; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05Im-0002wY-MO for patch@linaro.org; Fri, 07 Feb 2020 10:12:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60316) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058J-0000uF-Rj for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058I-000470-DI for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058I-00040s-50 for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:26 -0500 Received: by mail-wm1-x344.google.com with SMTP id g1so2881177wmh.4 for ; Fri, 07 Feb 2020 07:01:26 -0800 (PST) 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=U6Am3X6OQTZ1x+tf20LucVI7jeDaV7FG5H5GI7lV8EE=; b=w2WmCj33W1pPjplq1vkGvP4r1LLm/qIZk/PhWqJ2Ao2pD2xj1LPBVu1ZAdDEC0C5DY YSKINVK4XvBick/c6PVD+n0aS729CVzuF+EaMguiB3oV3SVr2cUsNBHsfKg4X3am0xWu 0SNDwohlhnz72jbGkdz8/1TGMuO7NynmCQFEvjm/I/n9cMSybW/+ptVslwkXo86GEZJe mBv9yqp29GLdn4Da4ty9P3Ugw4R+2tFsADBU59s4WKiORfC1aaLw8jD/CHMOqR1VV+HL vZS3q1Dh5BtWtgB9SRwUs8SPiF/z2MhezuehcCB/sV3USuaqRSLTIMckwR86PqYuiouP Nd+Q== 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=U6Am3X6OQTZ1x+tf20LucVI7jeDaV7FG5H5GI7lV8EE=; b=VihXl8fffGRU1hx6+iybggOt6H8T81gVTt0FL4kNpXbhBcA1FKyd2+ZDqGzmQe81Mr m8+I4gHjnPS0mGCcSkm9xwknDhMui3dbknzpi3V0w9rpu8l4Bz5HWPcjxMm4Wx7IjUM1 TqzlfQXqLJLkeFUYZMlL4MVUIqCPilzeiaxUL6MdCfXuTDQKFdSWY63cC4RPFjt3EDmI KKVMrknEwohqahHWBwuwWhUtQ6Viao3uCH2leqhg+S5VgGViiI6Qg+kpBefDs7FKSwWc Ot8IULb7NAOpKLJuwgzdGeA6jcYoFEKzvbebUTmxm1R5sDDOa29rKoeFFypKF7+HwygC eMpw== X-Gm-Message-State: APjAAAWMINohVM4GMYO0zndUn3v+CQu5WAv+zA0mpgTVR88HzBUgrFS1 8V21kiqbnCdbjUeJ2rKi7LE3yw== X-Received: by 2002:a1c:7907:: with SMTP id l7mr4652088wme.37.1581087685087; Fri, 07 Feb 2020 07:01:25 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id d23sm3790469wra.30.2020.02.07.07.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:22 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4621E1FF91; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 4/5] target/riscv: progressively load the instruction during decode Date: Fri, 7 Feb 2020 15:01:17 +0000 Message-Id: <20200207150118.23007-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alistair Francis , "open list:RISC-V TCG CPUs" , robert.foley@linaro.org, Sagar Karandikar , Bastian Koppelmann , robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, Palmer Dabbelt , kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The plugin system would throw up a harmless warning when it detected that a disassembly of an instruction didn't use all it's bytes. Fix the riscv decoder to only load the instruction bytes it needs as it needs them. This drops opcode from the ctx in favour if passing the appropriately sized opcode down a few levels of the decode. Signed-off-by: Alex Bennée --- target/riscv/translate.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) -- 2.20.1 Reviewed-by: Richard Henderson diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 14dc71156be..99f2bcf177c 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -44,7 +44,6 @@ typedef struct DisasContext { /* pc_succ_insn points to the instruction following base.pc_next */ target_ulong pc_succ_insn; target_ulong priv_ver; - uint32_t opcode; uint32_t mstatus_fs; uint32_t misa; uint32_t mem_idx; @@ -492,45 +491,45 @@ static void gen_set_rm(DisasContext *ctx, int rm) tcg_temp_free_i32(t0); } -static void decode_RV32_64C0(DisasContext *ctx) +static void decode_RV32_64C0(DisasContext *ctx, uint16_t opcode) { - uint8_t funct3 = extract32(ctx->opcode, 13, 3); - uint8_t rd_rs2 = GET_C_RS2S(ctx->opcode); - uint8_t rs1s = GET_C_RS1S(ctx->opcode); + uint8_t funct3 = extract32(opcode, 13, 3); + uint8_t rd_rs2 = GET_C_RS2S(opcode); + uint8_t rs1s = GET_C_RS1S(opcode); switch (funct3) { case 3: #if defined(TARGET_RISCV64) /* C.LD(RV64/128) -> ld rd', offset[7:3](rs1')*/ gen_load_c(ctx, OPC_RISC_LD, rd_rs2, rs1s, - GET_C_LD_IMM(ctx->opcode)); + GET_C_LD_IMM(opcode)); #else /* C.FLW (RV32) -> flw rd', offset[6:2](rs1')*/ gen_fp_load(ctx, OPC_RISC_FLW, rd_rs2, rs1s, - GET_C_LW_IMM(ctx->opcode)); + GET_C_LW_IMM(opcode)); #endif break; case 7: #if defined(TARGET_RISCV64) /* C.SD (RV64/128) -> sd rs2', offset[7:3](rs1')*/ gen_store_c(ctx, OPC_RISC_SD, rs1s, rd_rs2, - GET_C_LD_IMM(ctx->opcode)); + GET_C_LD_IMM(opcode)); #else /* C.FSW (RV32) -> fsw rs2', offset[6:2](rs1')*/ gen_fp_store(ctx, OPC_RISC_FSW, rs1s, rd_rs2, - GET_C_LW_IMM(ctx->opcode)); + GET_C_LW_IMM(opcode)); #endif break; } } -static void decode_RV32_64C(DisasContext *ctx) +static void decode_RV32_64C(DisasContext *ctx, uint16_t opcode) { - uint8_t op = extract32(ctx->opcode, 0, 2); + uint8_t op = extract32(opcode, 0, 2); switch (op) { case 0: - decode_RV32_64C0(ctx); + decode_RV32_64C0(ctx, opcode); break; } } @@ -709,22 +708,24 @@ static bool gen_shift(DisasContext *ctx, arg_r *a, /* Include the auto-generated decoder for 16 bit insn */ #include "decode_insn16.inc.c" -static void decode_opc(DisasContext *ctx) +static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode) { /* check for compressed insn */ - if (extract32(ctx->opcode, 0, 2) != 3) { + if (extract32(opcode, 0, 2) != 3) { if (!has_ext(ctx, RVC)) { gen_exception_illegal(ctx); } else { ctx->pc_succ_insn = ctx->base.pc_next + 2; - if (!decode_insn16(ctx, ctx->opcode)) { + if (!decode_insn16(ctx, opcode)) { /* fall back to old decoder */ - decode_RV32_64C(ctx); + decode_RV32_64C(ctx, opcode); } } } else { + uint32_t opcode32 = opcode; + opcode32 = deposit32(opcode32, 16, 16, translator_lduw(env, ctx->base.pc_next + 2)); ctx->pc_succ_insn = ctx->base.pc_next + 4; - if (!decode_insn32(ctx, ctx->opcode)) { + if (!decode_insn32(ctx, opcode32)) { gen_exception_illegal(ctx); } } @@ -776,9 +777,9 @@ static void riscv_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *ctx = container_of(dcbase, DisasContext, base); CPURISCVState *env = cpu->env_ptr; + uint16_t opcode16 = translator_lduw(env, ctx->base.pc_next); - ctx->opcode = translator_ldl(env, ctx->base.pc_next); - decode_opc(ctx); + decode_opc(env, ctx, opcode16); ctx->base.pc_next = ctx->pc_succ_insn; if (ctx->base.is_jmp == DISAS_NEXT) { From patchwork Fri Feb 7 15:01:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 183204 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp853571ile; Fri, 7 Feb 2020 07:15:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwCeWU2W0PD2WdhqlfbEom7+qj09od0YAMBtwkWhsYCfYlGNQj7iM03HlrQHhG69kzqvUEj X-Received: by 2002:a37:6897:: with SMTP id d145mr7575370qkc.398.1581088503888; Fri, 07 Feb 2020 07:15:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581088503; cv=none; d=google.com; s=arc-20160816; b=QWyY6gks/DY+I0PdMjbCc5+CT66Dzzmfz02PtHYCXTzM8uEqF+XeK53Uux3/T130Tm TDMhyjv53odceMQoeo4Vw+lcUYNye8XXPXO9Z15XA1i2wDpk4lotYNbn42NaPQ9/4R8L MJskS/aMBH5lUki1pFlKjrOBm2larmyj8Mg/N5HTU7RYnodAw6RhDioPi6BI8rtGQoru 53Q0eyVDNHZAgg5Ag9AxQCDbrWuI/BATv1YcH1LbpM8z+AzTrQ7huIXz3KDKaSumjvEK GsL6LYUvf1e1TlfPV+SW21eJ+ChTYhrYk8hDedq7WA47pXVJUzC2WkeZGPw8PDxBhBHz 2QmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=20w7i9jiAm5hvyfwFIkzlqbRcfX9RLZbq6NcYeukZyY=; b=NXL5HLa0NbD26o4Nqb5UlZ4nkC6Xre/7noAujWXKGEqPGhKygWfUFd2SIQq28Z7Osj sQGnHyh8debxr//D7vPWv/8ywFAO0zlu3D8V+XFrrcw3oARphPbQWIpu3cQMBC9OoIjr FH2f4Egw6uuKTQnyDV7GufsVpdZxO30O5JgeY3+xEcs1zopUZbyl/zq3Re+3mniafok9 HHwjxOPu9LLySYgTe9DWN9Fv6La2lpDrQhCbsodyBb+BBS7aSzBBEvtaNqwNEgmSEfAw 3goMvcKuECMb37E9GRP4AQHnIodADMp6E4xUe4B1Ch4sLuYp8LtqoExXlRNdQP7cQbFz 0dPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OLxckoe3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u18si1621441qtq.36.2020.02.07.07.15.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2020 07:15:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=OLxckoe3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j05LT-000865-EV for patch@linaro.org; Fri, 07 Feb 2020 10:15:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60333) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j058K-0000wL-JE for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j058J-0004D6-BW for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:28 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:55457) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j058J-00047j-3I for qemu-devel@nongnu.org; Fri, 07 Feb 2020 10:01:27 -0500 Received: by mail-wm1-x343.google.com with SMTP id q9so2869375wmj.5 for ; Fri, 07 Feb 2020 07:01:26 -0800 (PST) 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=20w7i9jiAm5hvyfwFIkzlqbRcfX9RLZbq6NcYeukZyY=; b=OLxckoe3p/ZV52/++8NBWwJliB6tjTDM7yc0RH2OX4Wutq0kcWEFI1ohBipqxVjeRj DLZ14vPK1pUv9xrG3Ni1fGdTJgbDoSl5Ic09YpiYJFvyp/wfpwZWGsP2uhDjHjghj6Az k+p3PTKVBPDlMj6k5qbhVGZ1hjpf5JN6ABTtzz6S1O4vnQ5eguAczP4wTt57N7AgocUf zn62knDIgt5wFA7SXOfZfLSOaaUnRVgz6IN0H0wWUTJ29RUN6ybt5zmyb15qt+yYmxPb fS+sTqjgjlQqrxFJeVbMpF12Kx/m1jlbiqgmrGAvy0Bdae4CnE5GpHMWH201757AEEpt Hhpg== 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=20w7i9jiAm5hvyfwFIkzlqbRcfX9RLZbq6NcYeukZyY=; b=UJjlxpNEXXR82YibifaBWhawMTzHWxjMm1XiC5Z8wLMkGf/O9Zpc7QGMbTrBM5EWYS tohjlVewGddZahIyCGx65Jv8SkEGSSxI5m073i2P5Rje0i62S39CMBkoaocuLcZNv/b0 +5xoaHqypZfIVrbSHzWCqU6gkAuaiMM0faNffdiYdPxI6/3r90tQZRHVQeFsUImxmLto sGiJ66OqK5o8CaRnA37b8MpUErXsFB64swNwzGfHfB/UFbic2Nsi5rjRgvtcsDgec/O9 jdZQ+urpp9vcr4SvrDQLmB/f2mEl4m6pAdYVxxLYjxdUWvxiQapRxeHw9RM0h//Wmrw2 Q7Mg== X-Gm-Message-State: APjAAAVJ5p/HRnr84WVnXT0m0kZgycd5NnNkBwsuI7w04Uzb8gJNFc+L iHEZI8RxdRdjV/axBAof0kJdaA== X-Received: by 2002:a05:600c:d5:: with SMTP id u21mr4819763wmm.98.1581087686129; Fri, 07 Feb 2020 07:01:26 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id s22sm3535449wmh.4.2020.02.07.07.01.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 07:01:23 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5CAAE1FF92; Fri, 7 Feb 2020 15:01:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 5/5] tests/plugins: make howvec clean-up after itself. Date: Fri, 7 Feb 2020 15:01:18 +0000 Message-Id: <20200207150118.23007-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200207150118.23007-1-alex.bennee@linaro.org> References: <20200207150118.23007-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robert.foley@linaro.org, robhenry@microsoft.com, aaron@os.amperecomputing.com, cota@braap.org, kuhn.chenqun@huawei.com, peter.puhov@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" TCG plugins are responsible for their own memory usage and although the plugin_exit is tied to the end of execution in this case it is still poor practice. Ensure we delete the hash table and related data when we are done to be a good plugin citizen. Signed-off-by: Alex Bennée --- tests/plugin/howvec.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.20.1 Reviewed-by: Robert Foley Reviewed-by: Richard Henderson diff --git a/tests/plugin/howvec.c b/tests/plugin/howvec.c index 4ca555e1239..7b77403559d 100644 --- a/tests/plugin/howvec.c +++ b/tests/plugin/howvec.c @@ -163,6 +163,13 @@ static gint cmp_exec_count(gconstpointer a, gconstpointer b) return ea->count > eb->count ? -1 : 1; } +static void free_record(gpointer data) +{ + InsnExecCount *rec = (InsnExecCount *) data; + g_free(rec->insn); + g_free(rec); +} + static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) report = g_string_new("Instruction Classes:\n"); @@ -213,12 +220,15 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) g_list_free(it); } + g_list_free(counts); + g_hash_table_destroy(insns); + qemu_plugin_outs(report->str); } static void plugin_init(void) { - insns = g_hash_table_new(NULL, g_direct_equal); + insns = g_hash_table_new_full(NULL, g_direct_equal, NULL, &free_record); } static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata)