From patchwork Tue Jan 5 17:19:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 356889 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp308473ejs; Tue, 5 Jan 2021 09:33:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEwZ1aTsQay+j/0VTDCCQU9vwPk++0GZGJlkDkbrfmZdCCzRhXOIlLwuPIebZibFa7y2ME X-Received: by 2002:a5b:eca:: with SMTP id a10mr646483ybs.447.1609868027776; Tue, 05 Jan 2021 09:33:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609868027; cv=none; d=google.com; s=arc-20160816; b=qU/te1BvAmL7GFwAo2119LR99tLelD6qODYcWnCrBn5qss4Ui8s9tHaBFfXXvxY18O X0wsBrkPUbBuecgh/lw8uvn7BvuSQUm2s56IUM84ufbexjHhzEiGrjV6wLCC4y74K5XJ Q11klUpJdoQwgXKo1oGs6q/CxRc2VOgkV+ok7rtHJfXG/I4j6pIQvQtGFiPT04T62N4e tmLST3tgb/RdZI1tj/HLgrA1tNHVWSiLHJMWF9AXIWG8p/SPQDXyMB3c5bcjiLjMfv1x Eyl3rx7PI9GsgBJZQfHBf3k+DxdBkiJ20rY+ZkXv3cSX4qgKfX5VvP7Gq81TX0bLxX1U l+eg== 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=MOmUYS+2+okyDd2n7XwYqRe+eURAl58gvEsSNOVb+48=; b=gip7boDYxINNSeNSwzI8YopGtX3NnQDskA22t/dn5POpqZf26qL9e3lpBazPyiKo5a Y18MQeSEhynZT3d8W5o+uvpzMwKh2ZQZa1vDhYBouyyBvZfox5zETOxK57aaG5dDw8hS 8W/AXU7SY05EEQyOulxJu20moqSnEMN4TTu/wDb28vxBdORQwJX70UaPWgwjm90pICnk qBhNxWrF4OvUsZyk//Lvx8sCzjcPYxgGFZVV72T5o4hwEcC+3Q7BjgNsFnLuDsjIr5aF A53B1+uhcQSmI0V5YNfB8B8oNaPugWRv/zqoUr8SJZowgckGgFliGnatjv1huW9eNW2I G/5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lKQTEa2J; 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=pass (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 w11si485266ybs.204.2021.01.05.09.33.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jan 2021 09:33:47 -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=pass header.i=@linaro.org header.s=google header.b=lKQTEa2J; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kwqDL-00022b-3l for patch@linaro.org; Tue, 05 Jan 2021 12:33:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kwq0e-0002S2-Bc for qemu-devel@nongnu.org; Tue, 05 Jan 2021 12:20:40 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:35542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kwq0c-0006dB-QY for qemu-devel@nongnu.org; Tue, 05 Jan 2021 12:20:40 -0500 Received: by mail-pl1-x631.google.com with SMTP id g3so71057plp.2 for ; Tue, 05 Jan 2021 09:20:38 -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=MOmUYS+2+okyDd2n7XwYqRe+eURAl58gvEsSNOVb+48=; b=lKQTEa2J6twkaMH79bT86tXW3YD7i8Fg3sN0m6rTYxiY+TwTPaT1K5Et634nZJh+FZ AEodrGXkUK2oQ05+gyhtt/56mi2OVayKHEZCbZJj39WMwMwOFb0tZjmKSzoPIHPMSNhW 9Nc2DaudNHbKQWx0wAGYCqXVAhyQAQ/+45blxI3/ryyl45g3oEfS2X9yYi0ESf3hEwlQ kXG1aasXr0MY5I8iIZhOnceHurvDRLNkrTpPrx0kbvfVZaeixDmXSVna6Bu4WtSkTWlT qt8bv03FzDX2VRRI3XWTnJmuAW78HQmXmdFHK0PGa94Ho0nGDiijuesorLrLZjrytvZ/ ixsA== 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=MOmUYS+2+okyDd2n7XwYqRe+eURAl58gvEsSNOVb+48=; b=TKUzRFFAoRKbxuVy/Zyd/R5kuYzZAwjIxlAp3DnHRkKW5RsiLByWtq3KYUkSdDQTs9 2MiypYRuYTCOKCi/Yf0qoydEgRHtaNyM5nET8VgWiRvgKZ/VwWQywVKwO/RgbrIBPAcH NAOr3gY/YYhAvZLh1RNyJvO+Zi5oASEqKRtRvmle5IrHuT6Xg+fGo39zeHEsPuQkZiI9 H2onpus0RRUkEYAP1UR44x7l3D1OUdG93RBcduo5VoL1kBZJPf9VoA6CQs9WHog6zAX6 OUkNz/+majgz7l0o6Kbt/OWpLlZbWfE0iKqbYADgcbNcBJtu7Xrr2Y38sc4blhNVymIc aDbg== X-Gm-Message-State: AOAM5311/rLKOttFNy+XAAWBCVxSbOjFdxM9cOkE7BwYsM0OieI0EfzK AM1wFep31bcv8TkY0JWoXi68WbODuwS2AQ== X-Received: by 2002:a17:90a:5b06:: with SMTP id o6mr154305pji.49.1609867237113; Tue, 05 Jan 2021 09:20:37 -0800 (PST) Received: from localhost.localdomain (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id u12sm2010pfh.98.2021.01.05.09.20.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jan 2021 09:20:36 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v5 24/43] disas: Push const down through host disassembly Date: Tue, 5 Jan 2021 07:19:31 -1000 Message-Id: <20210105171950.415486-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210105171950.415486-1-richard.henderson@linaro.org> References: <20210105171950.415486-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Joelle van Dyne , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Joelle van Dyne Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- include/disas/dis-asm.h | 4 ++-- disas.c | 4 +--- disas/capstone.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/include/disas/dis-asm.h b/include/disas/dis-asm.h index 2164762b46..d1133a4e04 100644 --- a/include/disas/dis-asm.h +++ b/include/disas/dis-asm.h @@ -358,7 +358,7 @@ typedef struct disassemble_info { (bfd_vma addr, struct disassemble_info * info); /* These are for buffer_read_memory. */ - bfd_byte *buffer; + const bfd_byte *buffer; bfd_vma buffer_vma; int buffer_length; @@ -462,7 +462,7 @@ int print_insn_rx(bfd_vma, disassemble_info *); #ifdef CONFIG_CAPSTONE bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size); -bool cap_disas_host(disassemble_info *info, void *code, size_t size); +bool cap_disas_host(disassemble_info *info, const void *code, size_t size); bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count); bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size); #else diff --git a/disas.c b/disas.c index de1de7be94..a61f95b580 100644 --- a/disas.c +++ b/disas.c @@ -299,10 +299,8 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size) } /* Disassemble this for me please... (debugging). */ -void disas(FILE *out, const void *ccode, unsigned long size) +void disas(FILE *out, const void *code, unsigned long size) { - /* TODO: Push constness through the disas backends. */ - void *code = (void *)ccode; uintptr_t pc; int count; CPUDebug s; diff --git a/disas/capstone.c b/disas/capstone.c index 7462c0e305..20bc8f9669 100644 --- a/disas/capstone.c +++ b/disas/capstone.c @@ -229,7 +229,7 @@ bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size) } /* Disassemble SIZE bytes at CODE for the host. */ -bool cap_disas_host(disassemble_info *info, void *code, size_t size) +bool cap_disas_host(disassemble_info *info, const void *code, size_t size) { csh handle; const uint8_t *cbuf;