From patchwork Wed May 13 18:09:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 186690 Delivered-To: patch@linaro.org Received: by 2002:a92:5b0a:0:0:0:0:0 with SMTP id p10csp688856ilb; Wed, 13 May 2020 11:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypySkiHf8Labunyqs5+m+PU1LXtkrs1B/BHeWv5A0mum+FNSrRbbx4XkFrYlIqNd2NsA/q X-Received: by 2002:ac8:2c44:: with SMTP id e4mr418465qta.13.1589393844188; Wed, 13 May 2020 11:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589393844; cv=none; d=google.com; s=arc-20160816; b=T0126tRzEs5OLVTrfM7f5QziXYeKJ9nbPuoRDMbjqsPcpk4UlCm8G5eiwEPZeY5IYl xgsjq8jxeVS7+OWNrBiIe5fY88oE5VLqDQzIdYcFKT+I4VIvXjjk0+BgnHuZUiHZpoQu eQWDjy6SEmKv+MhrFGXGaLLXupFJ84lpnLeShvEvXZpz19kSun/383NiJSdCLzwcgLJf y3RuNEVTPACUrBrWDzAr//7fdj3KccNvpoP3/YAN/LqKCNesrI77dwzhXABlSaHSa14H c08ydzoIRW9euhnP1f/AOiQ0V9nTAc8G9wSTqmCrC/ji85qKkaEJyMheVWI2GfIVA2jv GhnQ== 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=jBzLmvDxBp3zJZsO6hz95Oe3IMjRgxYk/8WAQc4mszU=; b=Epm/ZDTFCcprOxpq4Y1nba7PWo3svrM7lcaV2BjvFVYoPiixhz+WwwrdD6nvgDjcvY 4w8RDJZU50fwx1oeooKznd1bOU5dSLVphYmo9O0NZX1fIh82zDfzqEdezUBImIg4DaV+ 7atBYniLhaWnUlYsVCmQybstlxSBzKJhVlGUi1wmXj19nkTABPHgmzmEF24xM6G03+3q Go2CIIxx/OpYiEZCfrwupAooICula3w9OLj7ycT3pWS5NiN1QhJjuU3vxlHkyZ4TRAD7 6BGvivjfiDuMFxP6rlD8MCU6Hq0Qf9vQmqlRJOfXbt4A5KBkSyn3jZSmBoDKDDXQWXL9 1wbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EXLhM5+F; 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 y5si169433qvp.74.2020.05.13.11.17.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 May 2020 11:17:24 -0700 (PDT) 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=EXLhM5+F; 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]:49178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvwZ-0007Kq-Kc for patch@linaro.org; Wed, 13 May 2020 14:17:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpa-0003ru-DX for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:10 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:35664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpW-0000Mm-V2 for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:10 -0400 Received: by mail-pg1-x52f.google.com with SMTP id t11so107747pgg.2 for ; Wed, 13 May 2020 11:10:06 -0700 (PDT) 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=jBzLmvDxBp3zJZsO6hz95Oe3IMjRgxYk/8WAQc4mszU=; b=EXLhM5+FN0DVD7utH5kdiS/DzOjhprxOe0DBdpU4t0U+5gHbDoYHTITvehckOLmg4T fUkuwe2Gr9ofhCVGDL8J6DQAKNdgd7UId6BErNWv4lZY/bEg1KeBotPOcoVw2m75t+73 kkyc7QrY2lUIJeugyECDsxuwX0Mx4y7m3cQ98M6snA2b0fppsOZbH4iP4uy8XGDAZbNG nZwiVJ3DvvIN6XX/An+mwYNCTqo6sllUs3a0qC5UmVnv7RYNm/418E1YPHfoK62TNXlu byifNPTmh/AR0grWWVLUMXhk+d3hRFh9vJWLiwM1QheDhWxpCXE9yrQIWhYY/A2qZPY0 GWjQ== 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=jBzLmvDxBp3zJZsO6hz95Oe3IMjRgxYk/8WAQc4mszU=; b=UpxSQZF3EQmZzYoYHMy57R65WApBJ03QX09XJtD/cjC152sNRC2gSI0oZ3jMmeHXU9 jATZZF2tFT0iGbzGxP/8XHnh/+bQKHgZ6ea/Xu2m39QJrrCxtkRfqiC54AhlcdpoyYnD ml2APnj82UloXIg+zv7NI8QF05ETnWKPFBRWqnTHq+SzA8lN4Wvl8vXrifaE9BttnDVQ /qLQmd9KrNBOp/LNVCRsNU+3q5FRdU0Y9zHeHbBtpNkNWZY0pm5QmlonfRKiYLSHCbAW RFWuu8BcM4bo83QosrR7rCc4v0wkLJd5W55BEygn0eed78mPrEyPuT/w6aQ1RYq2u7Cb 63Qw== X-Gm-Message-State: AOAM532oDoP2d7w9hmA5UvfphdU0EwJsbFaZzc1Dlcbc1bf4PqKvmUxk zVwS8kuzhfHBZTPnCzenN4bSBADHH70= X-Received: by 2002:a63:4911:: with SMTP id w17mr498675pga.13.1589393405167; Wed, 13 May 2020 11:10:05 -0700 (PDT) Received: from localhost.localdomain (174-21-143-238.tukw.qwest.net. [174.21.143.238]) by smtp.gmail.com with ESMTPSA id i185sm197361pfg.14.2020.05.13.11.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:10:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 7/9] Compute reginfo_size based on the reginfo Date: Wed, 13 May 2020 11:09:51 -0700 Message-Id: <20200513180953.20376-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200513180953.20376-1-richard.henderson@linaro.org> References: <20200513180953.20376-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This will allow dumping of SVE frames without having to know the SVE vector length beforehand. Signed-off-by: Richard Henderson --- risu.h | 2 +- reginfo.c | 7 ++++--- risu_reginfo_aarch64.c | 4 ++-- risu_reginfo_arm.c | 2 +- risu_reginfo_i386.c | 2 +- risu_reginfo_m68k.c | 2 +- risu_reginfo_ppc64.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) -- 2.20.1 diff --git a/risu.h b/risu.h index 3fc198f..0ae7fa9 100644 --- a/risu.h +++ b/risu.h @@ -139,6 +139,6 @@ int reginfo_dump(struct reginfo *ri, FILE * f); int reginfo_dump_mismatch(struct reginfo *m, struct reginfo *a, FILE *f); /* return size of reginfo */ -const int reginfo_size(void); +int reginfo_size(struct reginfo *ri); #endif /* RISU_H */ diff --git a/reginfo.c b/reginfo.c index a4f7da6..1727867 100644 --- a/reginfo.c +++ b/reginfo.c @@ -40,7 +40,7 @@ int send_register_info(write_fn write_fn, void *uc) case OP_TESTEND: case OP_COMPARE: default: - header.size = reginfo_size(); + header.size = reginfo_size(&ri); extra = &ri; break; @@ -121,8 +121,9 @@ int recv_and_compare_register_info(read_fn read_fn, /* Do a simple register compare on (a) explicit request * (b) end of test (c) a non-risuop UNDEF */ - if (header.size != reginfo_size() || - read_fn(&apprentice_ri, header.size)) { + if (header.size > sizeof(struct reginfo) || + read_fn(&apprentice_ri, header.size) || + header.size != reginfo_size(&apprentice_ri)) { packet_mismatch = 1; resp = 2; } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 028c690..7044648 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -69,7 +69,7 @@ void process_arch_opt(int opt, const char *arg) #endif } -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { int size = offsetof(struct reginfo, simd.end); #ifdef SVE_MAGIC @@ -194,7 +194,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) /* reginfo_is_eq: compare the reginfo structs, returns nonzero if equal */ int reginfo_is_eq(struct reginfo *r1, struct reginfo *r2) { - return memcmp(r1, r2, reginfo_size()) == 0; + return memcmp(r1, r2, reginfo_size(r1)) == 0; } #ifdef SVE_MAGIC diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c index 3662f12..3832e27 100644 --- a/risu_reginfo_arm.c +++ b/risu_reginfo_arm.c @@ -36,7 +36,7 @@ void process_arch_opt(int opt, const char *arg) abort(); } -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); } diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 60fc239..902d33e 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -74,7 +74,7 @@ void process_arch_opt(int opt, const char *arg) } } -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); } diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c index 32b28c8..361f172 100644 --- a/risu_reginfo_m68k.c +++ b/risu_reginfo_m68k.c @@ -23,7 +23,7 @@ void process_arch_opt(int opt, const char *arg) abort(); } -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); } diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index 071c951..c86313c 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -32,7 +32,7 @@ void process_arch_opt(int opt, const char *arg) abort(); } -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); }