From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393560; cv=none; d=zohomail.com; s=zohoarc; b=gYDi39hOMtlS1VH5vJMba7vJXuBFs7OMkqaIhG2SFNAcPKLdE2edeNKqC111tIcwAq5bTmFuzkI6Iq2ysvE70VWsUEn4IyGIZ19vxtO6rz8GCkZn3gWjmFSLYr9a3lSeTj159uvFZtTk+KGbp+U7H0iF5fnJglXfNosyiLfWLLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393560; 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; bh=ZgV2/q17x6H7Sn6RUMsv4Yoy4IHja1Ijjf8wQZe1BeM=; b=Uk71llN34aujurpIDsd81DbXTfB9WvOrtvc6hpSNPi15ji1rbR2dwCCoiukYn+q/z4hdeQUZGL/1rGbBd+uojtoXEd13Jj+157f2pp8jAlWK8Uc4uede82AzEYwKOAcKP+d0evMlKkj41glwimF4o2Gcn3k4EaMl98Fg7E8SJZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393560092895.9393696074673; Wed, 13 May 2020 11:12:40 -0700 (PDT) Received: from localhost ([::1]:36064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvry-0007W7-OG for importer@patchew.org; Wed, 13 May 2020 14:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpP-0003gI-5N for qemu-devel@nongnu.org; Wed, 13 May 2020 14:09:59 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:44302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpO-0000Ki-Ag for qemu-devel@nongnu.org; Wed, 13 May 2020 14:09:58 -0400 Received: by mail-pf1-x432.google.com with SMTP id x13so85146pfn.11 for ; Wed, 13 May 2020 11:09:57 -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.09.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:09:55 -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=ZgV2/q17x6H7Sn6RUMsv4Yoy4IHja1Ijjf8wQZe1BeM=; b=hJzWjm/Ppdu4ojt5uk9DhZXaiL2o1DLHMEPiJMtnDM4oyAVwviuFTUy+5enIa72Q4S qGYwo4XgeI4PIrCqPfTwaa2P1TYWMFjZNku0E0qNigNbIOmWr+Z+KGqZmWhUJRMnwK0W ANkSzqKY5ScNQZ3hL1x9JnWqL3ti8mp2yEzt8xMunPqEGFwgAjfnTOWdUVnyZTbrEHCU gEzguY0YUhTtk2WssiW2ffhA2zxSr2eNX0V+wF49jhWDeogaSVxm9AhErt8Ycvs5dWRw uD7rfqfOijhklUm8J/QVI4RYgKN3bsXaA4YME6qCx75sGhEPC4TrpfDTc4XAcTBXfxbG xhrw== 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=ZgV2/q17x6H7Sn6RUMsv4Yoy4IHja1Ijjf8wQZe1BeM=; b=J8YxVJG+B1fZ1tskhxtbn5zFEqbBi0WFep9+tcODWjOt6EzBI8PNtOx3Z5KC154foo f2VYSUK9DJWRV+KogiaC2rNoNnqWLtWLB1AYJG/X42+szeUkd0+feKgGhaDPYyR5dX/x TGYpihTaD2hPFQtMe5ZlMncGyxpI0JCl0FFoLY2FY2deoPECvZnkG61k0zVaXH3xcFO/ K0LrqieFHcSwNzL2SiKCR+K16EKZtYjY+6ag5vDtMH6E5bg8S5mVfbV55CutonEJcX6B gSBYvUchvG4PGW+cmiRCh72IZrSPKeC5cyHkMV+lQORupFP4h1V23HoWQLlF6D5ch1dc UUgA== X-Gm-Message-State: AOAM530+EZBL6fz27TSirzKyNrKYuKEb7FrYcz2gcplBGqB/9xuf1pL2 8Z4dZ1gVwG8I2errru/s6251Hp4sZgg= X-Google-Smtp-Source: ABdhPJxXMxBE0LYNq2Tl0U1T1fa6C97Tl0S4773WsE1+oGD7GRNbe8cFNayHBpN1dN5M4nABjbzEJg== X-Received: by 2002:a63:150:: with SMTP id 77mr495647pgb.136.1589393396669; Wed, 13 May 2020 11:09:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 1/9] Use bool for tracing variables Date: Wed, 13 May 2020 11:09:45 -0700 Message-Id: <20200513180953.20376-2-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu.h | 3 ++- reginfo.c | 2 +- risu.c | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/risu.h b/risu.h index 8d2d646..e2b4508 100644 --- a/risu.h +++ b/risu.h @@ -17,6 +17,7 @@ #include #include #include +#include =20 /* Extra option processing for architectures */ extern const struct option * const arch_long_opts; @@ -96,7 +97,7 @@ int recv_and_compare_register_info(read_fn read_fn, * Should return 0 if it was a good match (ie end of test) * and 1 for a mismatch. */ -int report_match_status(int trace); +int report_match_status(bool trace); =20 /* Interface provided by CPU-specific code: */ =20 diff --git a/reginfo.c b/reginfo.c index dd42ae2..1b2a821 100644 --- a/reginfo.c +++ b/reginfo.c @@ -141,7 +141,7 @@ int recv_and_compare_register_info(read_fn read_fn, * Should return 0 if it was a good match (ie end of test) * and 1 for a mismatch. */ -int report_match_status(int trace) +int report_match_status(bool trace) { int resp =3D 0; fprintf(stderr, "match status...\n"); diff --git a/risu.c b/risu.c index 01525d2..79b1092 100644 --- a/risu.c +++ b/risu.c @@ -31,7 +31,7 @@ void *memblock; =20 int apprentice_fd, master_fd; -int trace; +bool trace; size_t signal_count; =20 #ifdef HAVE_ZLIB @@ -228,7 +228,7 @@ int master(void) signal_count); return 0; } else { - return report_match_status(0); + return report_match_status(false); } } set_sigill_handler(&master_sigill); @@ -250,7 +250,7 @@ int apprentice(void) #endif close(apprentice_fd); fprintf(stderr, "finished early after %zd checkpoints\n", signal_c= ount); - return report_match_status(1); + return report_match_status(true); } set_sigill_handler(&apprentice_sigill); fprintf(stderr, "starting apprentice image at 0x%"PRIxPTR"\n", @@ -344,7 +344,7 @@ int main(int argc, char **argv) break; case 't': trace_fn =3D optarg; - trace =3D 1; + trace =3D true; break; case 'h': hostname =3D optarg; --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393560; cv=none; d=zohomail.com; s=zohoarc; b=cV12+6Or5tjr8WRQ9aiH5sUPhV/YpeIUZiWKitC2y7IA8/tRkDA/7TIll9E8zN48wir0ewz0dpH1ey4rY4CbJtpRnajj1HJ/m1/LGHBnc99tx4FQPMieMJAcBNVW7PA9UykpK+NokL9ncTmGjfZZ6F7smjb0eQ6blqzGNi8opGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393560; 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; bh=QFzU9EJ6IyuyhrhMiANrpQRCnZfFACVjoAb6ym/Zpjk=; b=czvbFr7z70ZFf63F8VG8WQS6HklLpoktzGUTi9Qjyx7vzMXQbjYyhzP4Mjf2Y9B/3lDv5TaMX0+xYp/+x6HAaGzGAYHI/EC6gqHiCbPsAKcIbOxA9cJ1cDcwqwc40PKK6bBXS0SXtOxbRmKy2GFoxNP/UoJy7qNWYIg55rrK/ac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 15893935602431023.9101738841447; Wed, 13 May 2020 11:12:40 -0700 (PDT) Received: from localhost ([::1]:36134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvry-0007Xw-V0 for importer@patchew.org; Wed, 13 May 2020 14:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpS-0003kp-3f for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:02 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:55129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpQ-0000Kz-96 for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:01 -0400 Received: by mail-pj1-x1031.google.com with SMTP id s69so3155726pjb.4 for ; Wed, 13 May 2020 11:09:59 -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.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:09:57 -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=QFzU9EJ6IyuyhrhMiANrpQRCnZfFACVjoAb6ym/Zpjk=; b=r8FwMa94VsjeF2dEKwVrbAE75YVKx9F85MBWEmXZB73xGvmT0RaF76mesHjLbsIBL3 h2Qix5o72Jky34NNbxRHlYhRr90yPBjZnOBZWu1yGRh54bnbQVUcNVyYE3/tmdSelvRF WkYPDpGNeO1PO6PLs0RxRdZ82DFXCjLDc4SkrdvXehKSs0OxEJMxwLvmb51BuDdXm5Ut +4PrWB3oAlgf/xUWf0WyVmDVaHGEvQdgeB18H29v+hH6PtuC1jDzTMUXJud+14tM3+Ta VjcCMAt+SYNw9ioWkh6K6YI0PF6noz765PZ9nMmBOuXkTz3jWhiHmRIinpWLv8ShQBrs RjGw== 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=QFzU9EJ6IyuyhrhMiANrpQRCnZfFACVjoAb6ym/Zpjk=; b=JQ2CVG5YfTtizRmqcCQwtzUHwg9n+8+OwIshuKM/zEloBBkfQrKQSfKGzu5784p2Nm FYxiEWX7V8t8asyLRePRI+7ZcpmLG2K9YG2rTP9EplaHK/lxhhTsdPGL/O6DWN0nkWRV 8CkNdnQHgvOOACdG6DwxmgIuh/tO0sGnce6k61eXNMkP4nMXuTS0AYR9eQ6JRKCDLrFz zaxf9vFudqtB6g/s1q8Jo2X2cDi4riDRHNGi9Ym1vnZgdN05UxvA3TB8IHU4zKTEx/vM QPEdcw6husRIVD/DL+RZ1am8WloO2tisuFIkgIFb4E6xad2rUn4ZxUdwMIG0GRiwB7YY XiSQ== X-Gm-Message-State: AOAM530FhwmjwWJJsRWmKNrDpulfc+qkamW09yKZtKgsKqgTdR0UQKkG TI4xRXu943DpzdohDnNkKE4wPkTGFH0= X-Google-Smtp-Source: ABdhPJxCYRyw6Q9obx4XWbdTvUYGtCwqvEm35Izbu0vZXfvrpkExpy0DaosZir01Da7z9Skj/z20Uw== X-Received: by 2002:a17:902:7885:: with SMTP id q5mr19434pll.320.1589393398207; Wed, 13 May 2020 11:09:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 2/9] Unify master_fd and apprentice_fd to comm_fd Date: Wed, 13 May 2020 11:09:46 -0700 Message-Id: <20200513180953.20376-3-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Any one invocation cannot be both master and apprentice. Let's use only one variable for the file descriptor. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/risu.c b/risu.c index 79b1092..059348f 100644 --- a/risu.c +++ b/risu.c @@ -30,7 +30,7 @@ =20 void *memblock; =20 -int apprentice_fd, master_fd; +static int comm_fd; bool trace; size_t signal_count; =20 @@ -50,7 +50,7 @@ sigjmp_buf jmpbuf; =20 int read_sock(void *ptr, size_t bytes) { - return recv_data_pkt(master_fd, ptr, bytes); + return recv_data_pkt(comm_fd, ptr, bytes); } =20 int write_trace(void *ptr, size_t bytes) @@ -58,9 +58,9 @@ int write_trace(void *ptr, size_t bytes) size_t res; =20 #ifdef HAVE_ZLIB - if (master_fd =3D=3D STDOUT_FILENO) { + if (comm_fd =3D=3D STDOUT_FILENO) { #endif - res =3D write(master_fd, ptr, bytes); + res =3D write(comm_fd, ptr, bytes); #ifdef HAVE_ZLIB } else { res =3D gzwrite(gz_trace_file, ptr, bytes); @@ -71,14 +71,14 @@ int write_trace(void *ptr, size_t bytes) =20 void respond_sock(int r) { - send_response_byte(master_fd, r); + send_response_byte(comm_fd, r); } =20 /* Apprentice function */ =20 int write_sock(void *ptr, size_t bytes) { - return send_data_pkt(apprentice_fd, ptr, bytes); + return send_data_pkt(comm_fd, ptr, bytes); } =20 int read_trace(void *ptr, size_t bytes) @@ -86,9 +86,9 @@ int read_trace(void *ptr, size_t bytes) size_t res; =20 #ifdef HAVE_ZLIB - if (apprentice_fd =3D=3D STDIN_FILENO) { + if (comm_fd =3D=3D STDIN_FILENO) { #endif - res =3D read(apprentice_fd, ptr, bytes); + res =3D read(comm_fd, ptr, bytes); #ifdef HAVE_ZLIB } else { res =3D gzread(gz_trace_file, ptr, bytes); @@ -218,11 +218,11 @@ int master(void) { if (sigsetjmp(jmpbuf, 1)) { #ifdef HAVE_ZLIB - if (trace && master_fd !=3D STDOUT_FILENO) { + if (trace && comm_fd !=3D STDOUT_FILENO) { gzclose(gz_trace_file); } #endif - close(master_fd); + close(comm_fd); if (trace) { fprintf(stderr, "trace complete after %zd checkpoints\n", signal_count); @@ -244,11 +244,11 @@ int apprentice(void) { if (sigsetjmp(jmpbuf, 1)) { #ifdef HAVE_ZLIB - if (trace && apprentice_fd !=3D STDIN_FILENO) { + if (trace && comm_fd !=3D STDIN_FILENO) { gzclose(gz_trace_file); } #endif - close(apprentice_fd); + close(comm_fd); fprintf(stderr, "finished early after %zd checkpoints\n", signal_c= ount); return report_match_status(true); } @@ -375,31 +375,31 @@ int main(int argc, char **argv) if (ismaster) { if (trace) { if (strcmp(trace_fn, "-") =3D=3D 0) { - master_fd =3D STDOUT_FILENO; + comm_fd =3D STDOUT_FILENO; } else { - master_fd =3D open(trace_fn, O_WRONLY | O_CREAT, S_IRWXU); + comm_fd =3D open(trace_fn, O_WRONLY | O_CREAT, S_IRWXU); #ifdef HAVE_ZLIB - gz_trace_file =3D gzdopen(master_fd, "wb9"); + gz_trace_file =3D gzdopen(comm_fd, "wb9"); #endif } } else { fprintf(stderr, "master port %d\n", port); - master_fd =3D master_connect(port); + comm_fd =3D master_connect(port); } return master(); } else { if (trace) { if (strcmp(trace_fn, "-") =3D=3D 0) { - apprentice_fd =3D STDIN_FILENO; + comm_fd =3D STDIN_FILENO; } else { - apprentice_fd =3D open(trace_fn, O_RDONLY); + comm_fd =3D open(trace_fn, O_RDONLY); #ifdef HAVE_ZLIB - gz_trace_file =3D gzdopen(apprentice_fd, "rb"); + gz_trace_file =3D gzdopen(comm_fd, "rb"); #endif } } else { fprintf(stderr, "apprentice host %s port %d\n", hostname, port= ); - apprentice_fd =3D apprentice_connect(hostname, port); + comm_fd =3D apprentice_connect(hostname, port); } return apprentice(); } --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393557; cv=none; d=zohomail.com; s=zohoarc; b=Aa8vDHC14LJklvUwmch3yr+Gw3eeOiNOwy7YVj4R45qrxfa7csvHwc698n82Z2FX4bdrz7nnH7LOek00nThdTWTjTI7aGyX5oQ2Fy26fOyM5IJ6/ujy/+YBcF80Dkun3D4XBlu8tr5P/w6tc8H6bqVC4VV9gD0rQBVHlwuCr74w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393557; 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; bh=6WnKJJxVIg6V1eDs3yOOQwU7naceEXc9NpTs3O74BXg=; b=D5/qePpUSEOF448ObF9nTzuBnKBdE3tzpHg4yvNZWwlmp3QjOp4G/vD+Qe+ZdtE64d3KvwQwFYb8EITQNdo+72MlE6E/hyv+pqqA8Hxsq6SFDprxIBCaxjzvJcIpkLeXDJ2zlf5gR4BRwM5ON1EcHt0gzxJlzvPR17WQI05ZVyg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393557816540.3505271053131; Wed, 13 May 2020 11:12:37 -0700 (PDT) Received: from localhost ([::1]:35860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvrw-0007QX-Gw for importer@patchew.org; Wed, 13 May 2020 14:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpT-0003mj-FA for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:03 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:41358) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpR-0000L3-O5 for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:02 -0400 Received: by mail-pl1-x630.google.com with SMTP id u10so139814pls.8 for ; Wed, 13 May 2020 11:10:00 -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.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:09:58 -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=6WnKJJxVIg6V1eDs3yOOQwU7naceEXc9NpTs3O74BXg=; b=nfi2McyhWp5KlLT7B06opOJr3FBtWlysLiXVLx64YHZNK5Zz5OuDvWRhL+PYRUJgrl Ye0EUEVdtFau36gY1+8+RpR5H/serJmfVatuu8ifL61DIl8mi1kzJP41Y9+X/WW0ulyL sqG5LV/EPGSKp+9zx7q5b5aUxVAMUdx+MK5drcN8MUMYvXSn0M6oVhFw8wGzZ7EzfxPS iWp3div9b23xgpNCy5y2ZIIprc4+2RomQw6NKNoLPzbsBylgXN9jv3lJx3JN9YXbaiIM teice8DetAKE2bClgZhTSzIpTtdEDEKY/yl42Bdx95EJ55or4yhr/QEyDeg6zR/bNum6 PutA== 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=6WnKJJxVIg6V1eDs3yOOQwU7naceEXc9NpTs3O74BXg=; b=lLzR9BDHroooZcw2fXKqT+OJnkOS6Dy4bh35g2RL394LuQgH0BjixT6nEByEdnjVIY xVEKPqKGqMN7WAmnO1yum1UrqfQhN5A21poeyGTOWHLvD7DPIzoAKT2Nn5teVuuswukj OZNVr5HC29Kno0Z60xg0grJl5gv9+RPeQItOEWWUP9uJ0+/fYjUFbjo1GuoSEkUGpJ61 Rit8pC6TmxhXz8bO266+ab2ijn7a/I0kIWTzOI+B5MIAguM7si1MqcSwR/eWQjYzRaYS uSOAN7elyyL9p5UIMw5VpWe1+ScVQFxEf9XabDZjS0/l9thkyP4TjJG/biUfQ9ujxmNY V36A== X-Gm-Message-State: AOAM530Wsst7NDB4phl9YLCJG3POiQJRPDBGqFxoa9E0qasvm8p2zYk+ 8oX0dfvzTBo/EIso3Bn9+lYQQOFfPqo= X-Google-Smtp-Source: ABdhPJyrjMWSo+6Kz1+4qe/3MThC7RsJn/8OCPOyxNIfCJxIhKBaqIqP4sOP9BqdcBbwUnXp4hbEeg== X-Received: by 2002:a17:90a:df03:: with SMTP id gp3mr5378232pjb.50.1589393399401; Wed, 13 May 2020 11:09:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 3/9] Hoist trace file opening Date: Wed, 13 May 2020 11:09:47 -0700 Message-Id: <20200513180953.20376-4-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/risu.c b/risu.c index 059348f..1c66885 100644 --- a/risu.c +++ b/risu.c @@ -363,6 +363,21 @@ int main(int argc, char **argv) } } =20 + if (trace) { + if (strcmp(trace_fn, "-") =3D=3D 0) { + comm_fd =3D ismaster ? STDOUT_FILENO : STDIN_FILENO; + } else { + if (ismaster) { + comm_fd =3D open(trace_fn, O_WRONLY | O_CREAT, S_IRWXU); + } else { + comm_fd =3D open(trace_fn, O_RDONLY); + } +#ifdef HAVE_ZLIB + gz_trace_file =3D gzdopen(comm_fd, ismaster ? "wb9" : "rb"); +#endif + } + } + imgfile =3D argv[optind]; if (!imgfile) { fprintf(stderr, "Error: must specify image file name\n\n"); @@ -373,31 +388,13 @@ int main(int argc, char **argv) load_image(imgfile); =20 if (ismaster) { - if (trace) { - if (strcmp(trace_fn, "-") =3D=3D 0) { - comm_fd =3D STDOUT_FILENO; - } else { - comm_fd =3D open(trace_fn, O_WRONLY | O_CREAT, S_IRWXU); -#ifdef HAVE_ZLIB - gz_trace_file =3D gzdopen(comm_fd, "wb9"); -#endif - } - } else { + if (!trace) { fprintf(stderr, "master port %d\n", port); comm_fd =3D master_connect(port); } return master(); } else { - if (trace) { - if (strcmp(trace_fn, "-") =3D=3D 0) { - comm_fd =3D STDIN_FILENO; - } else { - comm_fd =3D open(trace_fn, O_RDONLY); -#ifdef HAVE_ZLIB - gz_trace_file =3D gzdopen(comm_fd, "rb"); -#endif - } - } else { + if (!trace) { fprintf(stderr, "apprentice host %s port %d\n", hostname, port= ); comm_fd =3D apprentice_connect(hostname, port); } --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393764; cv=none; d=zohomail.com; s=zohoarc; b=RfT1YNwn3AuxcRXCQ/oR1vnteiKtGpdEm4SyPJNAyRMFpz+Qrt69FlKChqFOMqBKr9iZngBu6jcxrpBwMwbnuxQga9883J3BoRCV2GfgB+RSHMmqfZQcEct+5H9NqJYYi2IScbwUeSfnnQPijIIdJbx0vvj1QDsn/R9EAdiCWXY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393764; 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; bh=lLvKLW9QkwF6CYlMcG5jB8i9eNtam9qfgfh7941aYEI=; b=kjcA4/DkYz9bdzKWxNpzAJSJ1XvDnyKULfMQsZ+i5kSQYpt8FXhB9PQke0Wi3YQih/QRGBk0CaifJ6AUPxJaRPxzHbSY8HlR7zAqeci8KmxEhoxKDxvFp3npbTUfNIehCA1JKmsnDyLBlRe/+SClKa0MYF9eSwfcFAsuHM0wgRg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 15893937645448.91255076635457; Wed, 13 May 2020 11:16:04 -0700 (PDT) Received: from localhost ([::1]:44650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvvG-0005OY-Nq for importer@patchew.org; Wed, 13 May 2020 14:16:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpW-0003og-IF for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:08 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:40029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpT-0000ME-5z for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:03 -0400 Received: by mail-pl1-x644.google.com with SMTP id t16so141199plo.7 for ; Wed, 13 May 2020 11:10:02 -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.09.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:10:00 -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=lLvKLW9QkwF6CYlMcG5jB8i9eNtam9qfgfh7941aYEI=; b=qBexN1V5iAhi/Y3W2qYSdY2X2j5MqvO+VRrkXN+YKGMef35whPusMsSCg4I515AoAK ciN8FpFypbDlMvXFJV6hHr0WIBCNb1GNnXd1jFmsSXP2q1bQaoj9h7cr3g0PqGX1P6Om Vf16XHf2JvH6uq9pnIS0KFREPjpbRqRkfGYeWNoqXx6Xn2cdM/UuJMm41yAjIXTk+56H 8PabMse08+IKcxaT1BYeHY320jtPej62P88f98HKzT3zxyQMqIBhv7ClmuiP5h/zVGtC hBsj9ErF9pUKzcptWwKHFkLZwHG0nno4GIlxy5NK3fjIabnZIpHvFDbL4WbmdgJU5H7t kT+g== 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=lLvKLW9QkwF6CYlMcG5jB8i9eNtam9qfgfh7941aYEI=; b=W1HXQmS9nMl62zP7tH2//Gh763L/47NpmTzo65qtpnPzoLxTvpq3AY3MxoOrfE9JwQ GyYPEYO6FEQeWGSJ662ZZn/UMKTOOoe79bANHRdyhb3iS5+hPDrMq4tN/V+pD9mlcb9k SOU6eMMWucECFOItZEwaY7o8VPCwGQlgOjledeE60Vt0mQF30CJlt/BcHKBa/OaxBokL yzOE+yjTVJoc2R9ACcq7vlX6d2TKU+7t9d7h3+pjibVhYsom/AbzKAvaXH/yGzw3aQDi C+cvjcpl1kHUdJwPmb32LDsZS+kUe697IvRjPCI8E5GrBUWDcwb2TsYj/eHYyatyNnD8 n9iw== X-Gm-Message-State: AGi0PuZGZsg9P8RX+kzL5Fj8JambCpXW4+QiXxVynrUF/19n+DboaOXk dTSr1nCl5fvxwj31jVRr+HTlHGXesvQ= X-Google-Smtp-Source: APiQypI878sRt8iPBlDc/wXsDjVyLR00uYdbvInFQVXRjaT2A8DwjP0EKQ45GSWV+xdO/2TBBu8Uhw== X-Received: by 2002:a17:90a:204b:: with SMTP id n69mr35084488pjc.176.1589393400875; Wed, 13 May 2020 11:10:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 4/9] Adjust tracefile open for write Date: Wed, 13 May 2020 11:09:48 -0700 Message-Id: <20200513180953.20376-5-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x644.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Truncate the new output file. Rely on umask to remove group+other file permissions, if desired. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- risu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/risu.c b/risu.c index 1c66885..f404d8f 100644 --- a/risu.c +++ b/risu.c @@ -368,7 +368,7 @@ int main(int argc, char **argv) comm_fd =3D ismaster ? STDOUT_FILENO : STDIN_FILENO; } else { if (ismaster) { - comm_fd =3D open(trace_fn, O_WRONLY | O_CREAT, S_IRWXU); + comm_fd =3D open(trace_fn, O_WRONLY | O_CREAT | O_TRUNC, 0= 666); } else { comm_fd =3D open(trace_fn, O_RDONLY); } --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393765; cv=none; d=zohomail.com; s=zohoarc; b=MHfhRQJaWp15UzUuMBFXUxxy5+3QBcliUVaZAGy+lwmS4mrSkhcCAvnaRL/LdgQ0+GTQE0RA3LqNIV+kS3IGdOKZTkq1xtLLcIlbnNiyQGCNQlo7sH7aFxGEi81J/bkVvKBcn7N16yhXBE2lCYrlAe7UqymPauGtitEzHry9GnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393765; 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; bh=AMQUtdh7GLtHPDRn6Oq7V+4ssQorJyRBdGwREFAHbh4=; b=W8aWRvO9uY9MZJxWNBLeRm76G3JrpwGyL4qraUcxIJPB3IThPDmwoWDuFk3NEK4c+YmmyccCEeXXk1YOhpH5SEdkbnyX0TChaMq/hdvP36E7s1PMmL6Hiq2osK/LRT7xMF1FHhMN0J7nIrrOZd3HQSJt3Uv7B4y9CLZAAz5faRA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393765560371.53694416685005; Wed, 13 May 2020 11:16:05 -0700 (PDT) Received: from localhost ([::1]:44760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvvI-0005RS-3S for importer@patchew.org; Wed, 13 May 2020 14:16:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpY-0003pP-DW for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:09 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:44305) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpW-0000MT-De for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:08 -0400 Received: by mail-pf1-x435.google.com with SMTP id x13so85235pfn.11 for ; Wed, 13 May 2020 11:10:03 -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.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:10:01 -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=AMQUtdh7GLtHPDRn6Oq7V+4ssQorJyRBdGwREFAHbh4=; b=kymvCFFhFOFLhJ4hFYNOMm3/3e3hmC5maCZsO3r0Usp++7HlaZ0iBISGndlnh243l7 bQvFecuDz3lGzcbpy7jbrFeJ+ZSmUZPrRZn20e7IllcuwVL4ZR8L24Vvn8J2fpTQQmAk U5eI5Oq/eYBKYSSHcGNy2GuQwkwxNb79kDU9B6zqy1S6fPhOgeRBJerOnAfg457cVctI ZiNB8SmXDFWFcQIuZMtfsCFQtb6x7oBmp8VPB1YoaqWw5Bj+oonN0FMiDogUOPCYkURM nytDtGjk4yblUJ2f/dSSlnigS5S0Bl0X1EN+37tAxWH2EhBG2T+bwEJWLLALWcBPGn7f osVA== 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=AMQUtdh7GLtHPDRn6Oq7V+4ssQorJyRBdGwREFAHbh4=; b=jESNxP/QkAJKdqRfrIOPGq0/PDMluxR/hECnlRQGRg8re1dm1ghN45Hna78gBlJ4Ki 8v9s4nyVvbtYiFioJI4VJ3B5QAsCl95HDHHsTFlAmrTVZQDV3yhZppKqaSmZthq5YBpa X9LM/jqxBCPp0bL6ihKHEyKDN01SUPyou6dJ8afUAFYZiNB+5mfrnrME5SUQrvtwAK5i 03ZcPr7YyY7mZiwNynD9FAZHeltcbOxhkljuKHApODRE0vyoUiwCZ3MsgampSw8ffMK8 sAMxOJ5+3rAh+bF+WL7yFdJihj473oLP1E2JmirFWbrVY6NfY5YzqRXK+LBgHyGUGBTg 2WTQ== X-Gm-Message-State: AOAM531qsTN+Vh9F092AqFShItGfS31fPcYfLoWbn65It+Y5cz2MA2uO XFXIycM5/ZfIWjxnoBwBP5MjCyYTGzs= X-Google-Smtp-Source: ABdhPJxPsUq4BV0znn8LSy5Q8X5IvJNNg9vZ8Vr8iGOiak2Wx6Mk7ExopK6xiFHsTWWq7fbYS140Qg== X-Received: by 2002:a62:144b:: with SMTP id 72mr516753pfu.246.1589393402119; Wed, 13 May 2020 11:10:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 5/9] Use EXIT_FAILURE, EXIT_SUCCESS Date: Wed, 13 May 2020 11:09:49 -0700 Message-Id: <20200513180953.20376-6-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Some of the time we exit via the return value from main. This can make it easier to tell what it is we're returning. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- comms.c | 26 +++++++++++++------------- risu.c | 22 +++++++++++----------- risu_reginfo_aarch64.c | 4 ++-- risu_reginfo_i386.c | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/comms.c b/comms.c index 6946fd9..861e845 100644 --- a/comms.c +++ b/comms.c @@ -31,7 +31,7 @@ int apprentice_connect(const char *hostname, int port) sock =3D socket(PF_INET, SOCK_STREAM, 0); if (sock < 0) { perror("socket"); - exit(1); + exit(EXIT_FAILURE); } struct hostent *hostinfo; sa.sin_family =3D AF_INET; @@ -39,12 +39,12 @@ int apprentice_connect(const char *hostname, int port) hostinfo =3D gethostbyname(hostname); if (!hostinfo) { fprintf(stderr, "Unknown host %s\n", hostname); - exit(1); + exit(EXIT_FAILURE); } sa.sin_addr =3D *(struct in_addr *) hostinfo->h_addr; if (connect(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0) { perror("connect"); - exit(1); + exit(EXIT_FAILURE); } return sock; } @@ -56,13 +56,13 @@ int master_connect(int port) sock =3D socket(PF_INET, SOCK_STREAM, 0); if (sock < 0) { perror("socket"); - exit(1); + exit(EXIT_FAILURE); } int sora =3D 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &sora, sizeof(sora)) != =3D 0) { perror("setsockopt(SO_REUSEADDR)"); - exit(1); + exit(EXIT_FAILURE); } =20 sa.sin_family =3D AF_INET; @@ -70,11 +70,11 @@ int master_connect(int port) sa.sin_addr.s_addr =3D htonl(INADDR_ANY); if (bind(sock, (struct sockaddr *) &sa, sizeof(sa)) < 0) { perror("bind"); - exit(1); + exit(EXIT_FAILURE); } if (listen(sock, 1) < 0) { perror("listen"); - exit(1); + exit(EXIT_FAILURE); } /* Just block until we get a connection */ fprintf(stderr, "master: waiting for connection on port %d...\n", @@ -84,7 +84,7 @@ int master_connect(int port) int nsock =3D accept(sock, (struct sockaddr *) &csa, &csasz); if (nsock < 0) { perror("accept"); - exit(1); + exit(EXIT_FAILURE); } /* We're done with the server socket now */ close(sock); @@ -104,7 +104,7 @@ static void recv_bytes(int sock, void *pkt, int pktlen) continue; } perror("read failed"); - exit(1); + exit(EXIT_FAILURE); } pktlen -=3D i; p +=3D i; @@ -127,7 +127,7 @@ static void recv_and_discard_bytes(int sock, int pktlen) continue; } perror("read failed"); - exit(1); + exit(EXIT_FAILURE); } pktlen -=3D i; } @@ -186,12 +186,12 @@ int send_data_pkt(int sock, void *pkt, int pktlen) =20 if (safe_writev(sock, iov, 2) =3D=3D -1) { perror("writev failed"); - exit(1); + exit(EXIT_FAILURE); } =20 if (read(sock, &resp, 1) !=3D 1) { perror("read failed"); - exit(1); + exit(EXIT_FAILURE); } return resp; } @@ -217,6 +217,6 @@ void send_response_byte(int sock, int resp) unsigned char r =3D resp; if (write(sock, &r, 1) !=3D 1) { perror("write failed"); - exit(1); + exit(EXIT_FAILURE); } } diff --git a/risu.c b/risu.c index f404d8f..979341c 100644 --- a/risu.c +++ b/risu.c @@ -153,13 +153,13 @@ void apprentice_sigill(int sig, siginfo_t *si, void *= uc) return; case 1: /* end of test */ - exit(0); + exit(EXIT_SUCCESS); default: /* mismatch */ if (trace) { siglongjmp(jmpbuf, 1); } - exit(1); + exit(EXIT_FAILURE); } } =20 @@ -173,7 +173,7 @@ static void set_sigill_handler(void (*fn) (int, siginfo= _t *, void *)) sigemptyset(&sa.sa_mask); if (sigaction(SIGILL, &sa, 0) !=3D 0) { perror("sigaction"); - exit(1); + exit(EXIT_FAILURE); } } =20 @@ -190,11 +190,11 @@ void load_image(const char *imgfile) int fd =3D open(imgfile, O_RDONLY); if (fd < 0) { fprintf(stderr, "failed to open image file %s\n", imgfile); - exit(1); + exit(EXIT_FAILURE); } if (fstat(fd, &st) !=3D 0) { perror("fstat"); - exit(1); + exit(EXIT_FAILURE); } size_t len =3D st.st_size; void *addr; @@ -207,7 +207,7 @@ void load_image(const char *imgfile) 0); if (!addr) { perror("mmap"); - exit(1); + exit(EXIT_FAILURE); } close(fd); image_start =3D addr; @@ -226,7 +226,7 @@ int master(void) if (trace) { fprintf(stderr, "trace complete after %zd checkpoints\n", signal_count); - return 0; + return EXIT_SUCCESS; } else { return report_match_status(false); } @@ -237,7 +237,7 @@ int master(void) fprintf(stderr, "starting image\n"); image_start(); fprintf(stderr, "image returned unexpectedly\n"); - exit(1); + return EXIT_FAILURE; } =20 int apprentice(void) @@ -258,7 +258,7 @@ int apprentice(void) fprintf(stderr, "starting image\n"); image_start(); fprintf(stderr, "image returned unexpectedly\n"); - exit(1); + return EXIT_FAILURE; } =20 int ismaster; @@ -355,7 +355,7 @@ int main(int argc, char **argv) break; case '?': usage(); - exit(1); + return EXIT_FAILURE; default: assert(c >=3D FIRST_ARCH_OPT); process_arch_opt(c, optarg); @@ -382,7 +382,7 @@ int main(int argc, char **argv) if (!imgfile) { fprintf(stderr, "Error: must specify image file name\n\n"); usage(); - exit(1); + return EXIT_FAILURE; } =20 load_image(imgfile); diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 00d1c8b..028c690 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -51,7 +51,7 @@ void process_arch_opt(int opt, const char *arg) =20 if (test_sve <=3D 0 || test_sve > SVE_VQ_MAX) { fprintf(stderr, "Invalid value for VQ (1-%d)\n", SVE_VQ_MAX); - exit(1); + exit(EXIT_FAILURE); } want =3D sve_vl_from_vq(test_sve); got =3D prctl(PR_SVE_SET_VL, want); @@ -62,7 +62,7 @@ void process_arch_opt(int opt, const char *arg) fprintf(stderr, "Unsupported value for VQ (%d !=3D %d)\n", test_sve, (int)sve_vq_from_vl(got)); } - exit(1); + exit(EXIT_FAILURE); } #else abort(); diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 194e0ad..60fc239 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -69,7 +69,7 @@ void process_arch_opt(int opt, const char *arg) fprintf(stderr, "Unable to parse '%s' in '%s' into an xfeatures intege= r mask\n", endptr, arg); - exit(1); + exit(EXIT_FAILURE); } } } --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393915; cv=none; d=zohomail.com; s=zohoarc; b=NH/HUqXFrP2FCR9KqrVxcYCfijg0OQE8Ms8SDd+Qbl76lKqOt92y4bMCvpPVAyPun1olURg5x8gYQdY+ZUHcTKAGf/cRx2/gRIvmEaVcXhnGhu+9GG6beBNeCRsk/KjQKE5iXlDBGpnvG25ZLvsUcAt7CGq+H5JvmFSRz7tJmQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393915; 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; bh=JSmowOO+YiAA0eSN0s8xOlbrTguVMlQ6LjWvJ71pNA4=; b=fwiRMyajdNEo8SQXVzyq8IGD+mDvVFpwmLjPdk4sKTKtf9gxiQFhp8hgLuZhvKFJc2CYc9OSZ9n4BKaku74BXAbOFUV7L0MGsEbxAVeefUevK+fT5D1tEWaMr1TDPnrAWzZSjQ4eUNK4rXTDZtS453rUk1gU+vq1aoD252qQd7c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393915478808.2369030906868; Wed, 13 May 2020 11:18:35 -0700 (PDT) Received: from localhost ([::1]:52474 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvxi-0000Pl-0o for importer@patchew.org; Wed, 13 May 2020 14:18:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpZ-0003qA-QU for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:09 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:42175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpW-0000Me-E1 for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:09 -0400 Received: by mail-pl1-x62a.google.com with SMTP id k19so136966pll.9 for ; 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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:10:02 -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=JSmowOO+YiAA0eSN0s8xOlbrTguVMlQ6LjWvJ71pNA4=; b=uRuXKhanODepsH+nLE0Bb8fz3ZKAZFQjhC1YneZy2V5DmXo9Afaj/r790teAy/xf4P qEX9WC/A+s00ibSqa2gk2EDgt3CJzKts3E1vXGhdTnqjlO4rVwKTC1lZp0EZrs31nDC9 YW6msOereGCOEgUxgkrQZssyah5L+Zd0XJRgmr/OHQ8S9JOtAmLVTtsrdvb2vyJNA8V9 QQy36j+xLsHIkeGZsYTED/iAj8U5rSKIQ9AUIsHOtj8yVDAzmVmVjnrKdR//scCYcJ9g eO9W8jodpSbuXG38j2sK4P1sM+TzNt/EgncxOCtQuIHPaFFAfOhIaU1LP/UBKaWjSHZ3 2ZlQ== 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=JSmowOO+YiAA0eSN0s8xOlbrTguVMlQ6LjWvJ71pNA4=; b=JvvGSQ94vva7VwMMK5vxRRk9RRrcW/f0OOKNqK2RciedXs7i6Ngtr6rqWA/rE1h+ZI gG3u+0QVxAm+JFTZCnFMJC5IqtiEmbL1s9lTbYE9Pb2XL3rO2V3wWHSjwqJAvnhCZB7W YZdF9KcTdUURENOSpaxdIevymAUDkS/OOMKgMV3fBKbBC6EAGqn9SibY0Sixowa4mplL O4qIu7eWJ2nvjtZWTPCEA7HO8KR29fxjDdLAtm2S+Jx4p89OyGa7dimmWUvYzUllJjed Sn4E3B3/8tMP0w1nIRQEKCBYMAphsmE217cVhRs6uWPK4Me4ZK05vkSQr2WJ0DGV/kiR 5EDQ== X-Gm-Message-State: AOAM531HSTl/sOSv8eOeE/sAoFvUcH0S/Fj8FL1BhXQrdZRM1FfutTkZ ALHYRJsU685Xmjp6SLYkIplPDPnC50o= X-Google-Smtp-Source: ABdhPJw7g4PxyzaTN7O9I3mh7nZi82hE9YDbRpG8X7a6cvSiMopn09USryoCl4EU+/oTnJOOJwIfoA== X-Received: by 2002:a17:90a:be09:: with SMTP id a9mr2678962pjs.165.1589393403834; Wed, 13 May 2020 11:10:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 6/9] Add magic and size to the trace header Date: Wed, 13 May 2020 11:09:50 -0700 Message-Id: <20200513180953.20376-7-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Sanity check that we're not getting out of sync with the trace stream. This will be especially bad with the change in size of the sve save data. Signed-off-by: Richard Henderson --- risu.h | 6 +++++- reginfo.c | 42 ++++++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/risu.h b/risu.h index e2b4508..3fc198f 100644 --- a/risu.h +++ b/risu.h @@ -62,10 +62,14 @@ extern void *memblock; struct reginfo; =20 typedef struct { - uintptr_t pc; + uint32_t magic; + uint32_t size; uint32_t risu_op; + uintptr_t pc; } trace_header_t; =20 +#define RISU_MAGIC (('R' << 24) | ('i' << 16) | ('S' << 8) | 'u') + /* Functions operating on reginfo */ =20 /* Function prototypes for read/write helper functions. diff --git a/reginfo.c b/reginfo.c index 1b2a821..a4f7da6 100644 --- a/reginfo.c +++ b/reginfo.c @@ -26,20 +26,45 @@ int send_register_info(write_fn write_fn, void *uc) struct reginfo ri; trace_header_t header; int op; + void *extra; =20 reginfo_init(&ri, uc); op =3D get_risuop(&ri); =20 /* Write a header with PC/op to keep in sync */ + header.magic =3D RISU_MAGIC; header.pc =3D get_pc(&ri); header.risu_op =3D op; + + switch (op) { + case OP_TESTEND: + case OP_COMPARE: + default: + header.size =3D reginfo_size(); + extra =3D &ri; + break; + + case OP_SETMEMBLOCK: + case OP_GETMEMBLOCK: + header.size =3D 0; + extra =3D NULL; + break; + + case OP_COMPAREMEM: + header.size =3D MEMBLOCKLEN; + extra =3D memblock; + break; + } + if (write_fn(&header, sizeof(header)) !=3D 0) { return -1; } + if (extra && write_fn(extra, header.size) !=3D 0) { + return -1; + } =20 switch (op) { case OP_TESTEND: - write_fn(&ri, reginfo_size()); /* if we are tracing write_fn will return 0 unlike a remote end, hence we force return of 1 here */ return 1; @@ -51,14 +76,9 @@ int send_register_info(write_fn write_fn, void *uc) get_reginfo_paramreg(&ri) + (uintptr_t)membl= ock); break; case OP_COMPAREMEM: - return write_fn(memblock, MEMBLOCKLEN); - break; case OP_COMPARE: default: - /* Do a simple register compare on (a) explicit request - * (b) end of test (c) a non-risuop UNDEF - */ - return write_fn(&ri, reginfo_size()); + break; } return 0; } @@ -84,7 +104,7 @@ int recv_and_compare_register_info(read_fn read_fn, return -1; } =20 - if (header.risu_op !=3D op) { + if (header.magic !=3D RISU_MAGIC || header.risu_op !=3D op) { /* We are out of sync */ resp =3D 2; resp_fn(resp); @@ -101,7 +121,8 @@ 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 (read_fn(&apprentice_ri, reginfo_size())) { + if (header.size !=3D reginfo_size() || + read_fn(&apprentice_ri, header.size)) { packet_mismatch =3D 1; resp =3D 2; } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { @@ -121,7 +142,8 @@ int recv_and_compare_register_info(read_fn read_fn, break; case OP_COMPAREMEM: mem_used =3D 1; - if (read_fn(apprentice_memblock, MEMBLOCKLEN)) { + if (header.size !=3D MEMBLOCKLEN || + read_fn(apprentice_memblock, MEMBLOCKLEN)) { packet_mismatch =3D 1; resp =3D 2; } else if (memcmp(memblock, apprentice_memblock, MEMBLOCKLEN) !=3D= 0) { --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393915; cv=none; d=zohomail.com; s=zohoarc; b=ljJ24VOy3NbYmJkBEaxFQXaw6v/lk/qzDSm6bJwaulaWsy0v+I+wqiZQSsjTO2rIh4bLNXLKzb7HFxtP0HFz/Kh1r5avbELhKKrYf8Rwq5mMXB/OV6YXhdBNJyDqJB8Hu0gisxe3ar1RmcwlXsOdSyvLn8EGgfZhoi6RLg4Yujw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393915; 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; bh=jBzLmvDxBp3zJZsO6hz95Oe3IMjRgxYk/8WAQc4mszU=; b=faP4qfiU1FXhx+DVp6IVJeLiAWU+cbhRpq2cnw/fv+r2Bxf0RDV8r3VhjiWrbPi22isgOnjfWQWzrN+k/hznokvIsJiA2ImowJRppwYTKdXhOy4Lql3lH8DBzACEtEB1xCiZbmPXQ8REOD0zs00i/MsomPlAs8X1d5SGEkn+hgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393915479736.6567107247126; Wed, 13 May 2020 11:18:35 -0700 (PDT) Received: from localhost ([::1]:52488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvxi-0000Q8-5x for importer@patchew.org; Wed, 13 May 2020 14:18:34 -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) 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) 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-Google-Smtp-Source: ABdhPJw1LG3t7HpO7Q+OBSRjH17grKticq+XR9a7ssIJwNpzOWV4Z7E2zB0HkgAomRO7Dr675HJ6Hw== X-Received: by 2002:a63:4911:: with SMTP id w17mr498675pga.13.1589393405167; Wed, 13 May 2020 11:10:05 -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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" 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(-) 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); =20 /* return size of reginfo */ -const int reginfo_size(void); +int reginfo_size(struct reginfo *ri); =20 #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 =3D reginfo_size(); + header.size =3D reginfo_size(&ri); extra =3D &ri; break; =20 @@ -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 !=3D reginfo_size() || - read_fn(&apprentice_ri, header.size)) { + if (header.size > sizeof(struct reginfo) || + read_fn(&apprentice_ri, header.size) || + header.size !=3D reginfo_size(&apprentice_ri)) { packet_mismatch =3D 1; resp =3D 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 } =20 -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { int size =3D 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()) =3D=3D 0; + return memcmp(r1, r2, reginfo_size(r1)) =3D=3D 0; } =20 #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(); } =20 -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) } } =20 -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(); } =20 -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(); } =20 -const int reginfo_size(void) +int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); } --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589393917; cv=none; d=zohomail.com; s=zohoarc; b=TTwBM6DH6e3WI8Kea4AjUzeh2DTVwAhDtLS88wsB2WR6HzPruu0V93mqk5X9cB6j2dyl1yYyx/8ArBjsG9xVkczLOJwhSn8Jn0HmxzIC80Lh7WhIhVdIeGUpdo89QHN0TsPbHywhzZ0i5xU0X2UkxqWWcKEjBcXGl+G6JoAbzXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589393917; 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; bh=hhzEI0zY7uuhea/eDo3m8LR1KeJI+fOWQZOyopQnOJc=; b=fX4wX34D40/v9JXZisHLdLaH9El62TOAq0PGdZY1fESSCcq9L6tb5+yJ2yDQhoR75lN0Ql2LhDJsSyf4k9KGBBsF4pjR8B3XQZZrusgn1IgtN6sH0rRgJGavJESs1xZN63xIv9kvH7qQzhIL3BfwlPRI4bvo0PpZ6bLOdds/p+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589393917194146.0676955142361; Wed, 13 May 2020 11:18:37 -0700 (PDT) Received: from localhost ([::1]:52630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYvxj-0000TY-S9 for importer@patchew.org; Wed, 13 May 2020 14:18:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpb-0003tO-1n for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:11 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:36626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpY-0000N3-7U for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:10 -0400 Received: by mail-pf1-x429.google.com with SMTP id z1so104434pfn.3 for ; Wed, 13 May 2020 11:10:07 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:10:05 -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=hhzEI0zY7uuhea/eDo3m8LR1KeJI+fOWQZOyopQnOJc=; b=PB7H4u210KUQ9tNmfJ2Pxvt+sxIe8i80ily4c7jkb+26Mt9DpTGIXOnKDZtixo6dzI abqEfS2BuXL/Owwgd+u+vqyp/nfp9DcMXAnYBK+ZqBBf2IFw8vrutJCySHRiHZ7zHEcF mL9Ywju1nDwLTW1oAPp7/sEaM/kSrzRJgereHnjPH2w1K24y4Ld8otpcUP/SkhShzWUC VIIK4XdRq7NrS6CBQcezh4eFQ0JlcQjAAbcQfKbVY5Oxjt5ZBp1/tr19Cs6k8qkt+QTC OhsC9QXrcjkN+l554N8Tk4IvwU4j2pO4Hv6cVdTdKQ7IluVk1OOWdo5f3N020pmEUGSN XuEg== 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=hhzEI0zY7uuhea/eDo3m8LR1KeJI+fOWQZOyopQnOJc=; b=FIUJFCmoqCvECa2C/LtXgbmKSFe/gNr6o9WHL+YqbU/cbrLsDQGwfCXeQDH30q9Qil 6dAMwSQXk/YP9KA4LE9+v85i0h2bGfP3zcniM+/WQhZcBS/5cUzMFjmt1PsRmx5Yci0q jwbsy0ZI+Sfsc99r8AOOgJYhhhUP9do7VkHlLWUMszqeqD1I+ZPnu5y9IjZr0Atl9tjy tdpfli4ZJs2i0Vr3i5mEs7HsQWayGDGUPHPX3fztGHh2QWfF99HSEWDIydv8c2yjAmEQ t+Ynkc4O4Q/YmQUcD9s+1Iyu0LAxMPR5fggUzDHBecVcRZiZRKX4lDm2H0MuSEWo4wnv 5G7g== X-Gm-Message-State: AOAM532t9NL/rVkJ18nV2VeGAGLrWExL8NtuqCva+RDXGY4XmC9TM14P GjNkUcaVP2in9+mRq4FkmsF00qNMCQ8= X-Google-Smtp-Source: ABdhPJwANDU/dblQAGWM3xGI7vTI35KzZdhIqaCIJ5i2RiE4U8eL71N2SJBCzIS6pbEJ4LCZMjL7Yw== X-Received: by 2002:aa7:8091:: with SMTP id v17mr497009pff.93.1589393406381; Wed, 13 May 2020 11:10:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 8/9] aarch64: Reorg sve reginfo to save space Date: Wed, 13 May 2020 11:09:52 -0700 Message-Id: <20200513180953.20376-9-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Mirror the signal frame by storing all of the registers as a lump. Use the signal macros to pull out the values. Signed-off-by: Richard Henderson --- risu_reginfo_aarch64.h | 16 +---- risu_reginfo_aarch64.c | 135 +++++++++++++++++++++-------------------- 2 files changed, 73 insertions(+), 78 deletions(-) diff --git a/risu_reginfo_aarch64.h b/risu_reginfo_aarch64.h index c33b86f..01076b4 100644 --- a/risu_reginfo_aarch64.h +++ b/risu_reginfo_aarch64.h @@ -17,20 +17,8 @@ =20 struct simd_reginfo { __uint128_t vregs[32]; - char end[0]; }; =20 -#ifdef SVE_MAGIC -struct sve_reginfo { - /* SVE */ - uint16_t vl; /* current VL */ - __uint128_t zregs[SVE_NUM_ZREGS][SVE_VQ_MAX]; - uint16_t pregs[SVE_NUM_PREGS][SVE_VQ_MAX]; - uint16_t ffr[SVE_VQ_MAX]; - char end[0]; -}; -#endif - /* The kernel headers set this based on future arch extensions. The current arch maximum is 16. Save space below. */ #undef SVE_VQ_MAX @@ -47,11 +35,13 @@ struct reginfo { /* FP/SIMD */ uint32_t fpsr; uint32_t fpcr; + uint32_t sve_vl; =20 union { struct simd_reginfo simd; #ifdef SVE_MAGIC - struct sve_reginfo sve; + char sve[SVE_SIG_CONTEXT_SIZE(16) - SVE_SIG_REGS_OFFSET] + __attribute__((aligned(16))); #endif }; }; diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index 7044648..a1020ac 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -71,15 +71,30 @@ void process_arch_opt(int opt, const char *arg) =20 int reginfo_size(struct reginfo *ri) { - int size =3D offsetof(struct reginfo, simd.end); #ifdef SVE_MAGIC - if (test_sve) { - size =3D offsetof(struct reginfo, sve.end); + if (ri->sve_vl) { + int vq =3D sve_vq_from_vl(ri->sve_vl); + return (offsetof(struct reginfo, sve) + + SVE_SIG_CONTEXT_SIZE(vq) - SVE_SIG_REGS_OFFSET); } #endif - return size; + return offsetof(struct reginfo, simd) + sizeof(ri->simd); } =20 +#ifdef SVE_MAGIC +static uint64_t *reginfo_zreg(struct reginfo *ri, int vq, int i) +{ + return (uint64_t *)(ri->sve + SVE_SIG_ZREG_OFFSET(vq, i) - + SVE_SIG_REGS_OFFSET); +} + +static uint16_t *reginfo_preg(struct reginfo *ri, int vq, int i) +{ + return (uint16_t *)(ri->sve + SVE_SIG_PREG_OFFSET(vq, i) - + SVE_SIG_REGS_OFFSET); +} +#endif + /* reginfo_init: initialize with a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc) { @@ -152,8 +167,6 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) return; } =20 - ri->sve.vl =3D sve->vl; - if (sve->head.size < SVE_SIG_CONTEXT_SIZE(vq)) { if (sve->head.size =3D=3D sizeof(*sve)) { /* SVE state is empty -- not an error. */ @@ -164,24 +177,9 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) return; } =20 - /* Copy ZREG's one at a time */ - for (i =3D 0; i < SVE_NUM_ZREGS; i++) { - memcpy(&ri->sve.zregs[i], - (void *)sve + SVE_SIG_ZREG_OFFSET(vq, i), - SVE_SIG_ZREG_SIZE(vq)); - } - - /* Copy PREG's one at a time */ - for (i =3D 0; i < SVE_NUM_PREGS; i++) { - memcpy(&ri->sve.pregs[i], - (void *)sve + SVE_SIG_PREG_OFFSET(vq, i), - SVE_SIG_PREG_SIZE(vq)); - } - - /* Finally the FFR */ - memcpy(&ri->sve.ffr, (void *)sve + SVE_SIG_FFR_OFFSET(vq), - SVE_SIG_FFR_SIZE(vq)); - + ri->sve_vl =3D sve->vl; + memcpy(ri->sve, (char *)sve + SVE_SIG_REGS_OFFSET, + SVE_SIG_CONTEXT_SIZE(vq) - SVE_SIG_REGS_OFFSET); return; } #endif /* SVE_MAGIC */ @@ -225,18 +223,20 @@ static void sve_dump_preg_diff(FILE *f, int vq, const= uint16_t *p1, fprintf(f, "\n"); } =20 -static void sve_dump_zreg_diff(FILE *f, int vq, const __uint128_t *z1, - const __uint128_t *z2) +static void sve_dump_zreg_diff(FILE *f, int vq, const uint64_t *za, + const uint64_t *zb) { const char *pad =3D ""; int q; =20 for (q =3D 0; q < vq; ++q) { - if (z1[q] !=3D z2[q]) { + uint64_t za0 =3D za[2 * q], za1 =3D za[2 * q + 1]; + uint64_t zb0 =3D zb[2 * q], zb1 =3D zb[2 * q + 1]; + + if (za0 !=3D zb0 || za1 !=3D zb1) { fprintf(f, "%sq%-2d: %016" PRIx64 "%016" PRIx64 - " vs %016" PRIx64 "%016" PRIx64"\n", pad, q, - (uint64_t)(z1[q] >> 64), (uint64_t)z1[q], - (uint64_t)(z2[q] >> 64), (uint64_t)z2[q]); + " vs %016" PRIx64 "%016" PRIx64"\n", + pad, q, za1, za0, zb1, zb0); pad =3D " "; } } @@ -263,28 +263,30 @@ int reginfo_dump(struct reginfo *ri, FILE * f) if (test_sve) { int q, vq =3D test_sve; =20 - fprintf(f, " vl : %d\n", ri->sve.vl); + fprintf(f, " vl : %d\n", ri->sve_vl); =20 - for (i =3D 0; i < 32; i++) { - fprintf(f, " Z%-2d q%-2d: %016" PRIx64 "%016" PRIx64 "\n", i,= 0, - (uint64_t)(ri->sve.zregs[i][0] >> 64), - (uint64_t)ri->sve.zregs[i][0]); + for (i =3D 0; i < SVE_NUM_ZREGS; i++) { + uint64_t *z =3D reginfo_zreg(ri, vq, i); + + fprintf(f, " Z%-2d q%-2d: %016" PRIx64 "%016" PRIx64 "\n", + i, 0, z[1], z[0]); for (q =3D 1; q < vq; ++q) { - fprintf(f, " q%-2d: %016" PRIx64 "%016" PRIx64 "\n", = q, - (uint64_t)(ri->sve.zregs[i][q] >> 64), - (uint64_t)ri->sve.zregs[i][q]); + fprintf(f, " q%-2d: %016" PRIx64 "%016" PRIx64 "\n", + q, z[q * 2 + 1], z[q * 2]); } } =20 - for (i =3D 0; i < 16; i++) { - fprintf(f, " P%-2d : ", i); - sve_dump_preg(f, vq, &ri->sve.pregs[i][0]); + for (i =3D 0; i < SVE_NUM_PREGS + 1; i++) { + uint16_t *p =3D reginfo_preg(ri, vq, i); + + if (i =3D=3D SVE_NUM_PREGS) { + fprintf(f, " FFR : "); + } else { + fprintf(f, " P%-2d : ", i); + } + sve_dump_preg(f, vq, p); fprintf(f, "\n"); } - fprintf(f, " FFR : "); - sve_dump_preg(f, vq, &ri->sve.ffr[0]); - fprintf(f, "\n"); - return !ferror(f); } #endif @@ -338,31 +340,34 @@ int reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) =20 #ifdef SVE_MAGIC if (test_sve) { - int vq =3D sve_vq_from_vl(m->sve.vl); + int vq =3D sve_vq_from_vl(m->sve_vl); =20 - if (m->sve.vl !=3D a->sve.vl) { - fprintf(f, " vl : %d vs %d\n", m->sve.vl, a->sve.vl); + if (m->sve_vl !=3D a->sve_vl) { + fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); } =20 for (i =3D 0; i < SVE_NUM_ZREGS; i++) { - if (!sve_zreg_is_eq(vq, &m->sve.zregs[i], &a->sve.zregs[i])) { - fprintf(f, " Z%-2d ", i); - sve_dump_zreg_diff(f, vq, &m->sve.zregs[i][0], - &a->sve.zregs[i][0]); - } - } - for (i =3D 0; i < SVE_NUM_PREGS; i++) { - if (!sve_preg_is_eq(vq, &m->sve.pregs[i], &a->sve.pregs[i])) { - fprintf(f, " P%-2d : ", i); - sve_dump_preg_diff(f, vq, &m->sve.pregs[i][0], - &a->sve.pregs[i][0]); - } - } - if (!sve_preg_is_eq(vq, &m->sve.ffr, &a->sve.ffr)) { - fprintf(f, " FFR : "); - sve_dump_preg_diff(f, vq, &m->sve.pregs[i][0], &a->sve.pregs[i= ][0]); - } + uint64_t *zm =3D reginfo_zreg(m, vq, i); + uint64_t *za =3D reginfo_zreg(a, vq, i); =20 + if (!sve_zreg_is_eq(vq, zm, za)) { + fprintf(f, " Z%-2d ", i); + sve_dump_zreg_diff(f, vq, zm, za); + } + } + for (i =3D 0; i < SVE_NUM_PREGS + 1; i++) { + uint16_t *pm =3D reginfo_preg(m, vq, i); + uint16_t *pa =3D reginfo_preg(a, vq, i); + + if (!sve_preg_is_eq(vq, pm, pa)) { + if (i =3D=3D SVE_NUM_PREGS) { + fprintf(f, " FFR : "); + } else { + fprintf(f, " P%-2d : ", i); + } + sve_dump_preg_diff(f, vq, pm, pa); + } + } return !ferror(f); } #endif --=20 2.20.1 From nobody Fri Nov 1 00:05:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1589394070; cv=none; d=zohomail.com; s=zohoarc; b=UihjGF+17b2p7M5n1iTE64TMPaKfCEP9W0oJ9uzAKTnlBPPA6HJkx/CXYoSjPQWAYc6bDgiJlcu7F30xe7NQAqiD5chDqxfX0zE8JsklFhdPED0S7ihY5wjzBwZj6nBhS22cAdGLzR5RECySnSCgA82g5GnjL7kkip7oUDeoRRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589394070; 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; bh=NLyUmEZ5i6oZApVfDSFYVtzokpBFXsLQ3SNKAJFbA44=; b=ZEW44fiQ2Vimdu2PehVCCb6KXVpyRZ16OBd6JJtfQeVr9RGNEnNpLXTSvd0PABI7KfzdcCUckoCfNQSQKmA6dSb63QQIAMNj/8SAa/EWGCHYmrTQ3nVsta1nxcEgcN3vWrEtJGKwDfQ2VxJh8AyXHeOT1GFIrhxnH9rC2VZmBlM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass 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 1589394070321332.88939155581363; Wed, 13 May 2020 11:21:10 -0700 (PDT) Received: from localhost ([::1]:60442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYw0B-0003r9-Er for importer@patchew.org; Wed, 13 May 2020 14:21:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYvpc-0003vV-7P for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:12 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:36629) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYvpZ-0000NC-Pv for qemu-devel@nongnu.org; Wed, 13 May 2020 14:10:11 -0400 Received: by mail-pf1-x42c.google.com with SMTP id z1so104466pfn.3 for ; Wed, 13 May 2020 11:10:09 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); 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=NLyUmEZ5i6oZApVfDSFYVtzokpBFXsLQ3SNKAJFbA44=; b=jVxX5j5LyRLS0DrRPjvuhoE7z2M1L0tjIIJuQ64bdi7yqih7+KWZqf/t37HtF+5H/6 DBJLXN1rbhhtoDyj5CwrPd+SAFfh5kiled4mJmekfee1Iid07BNMluryy7VqIirSH49t jX9E8jL/iAarOnuj/R/wxrU1YU5tcWqvQBa6LE3P7zaxhIBsh2KTDnmCcedbnA5Q4ijX YiCr+uQxRXYrPXVEvueuGms8OdoF+VCkMmRRoG4yXOO/kG18I97mlUk3W1Dv8X3hq8EZ /nIiYff4oLIPX5Q/YJd+xj7dGJ6p6Uyitb9m0opDp5teBnQL1mdBLBcwsEE8y9M+DnER q1Iw== 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=NLyUmEZ5i6oZApVfDSFYVtzokpBFXsLQ3SNKAJFbA44=; b=RmMew+ipvmleTQBM9zQEsqEmVIe0p/X45VDCDwYhddcd1fbIk5IgwJYS5COzy5TCdr VwU7rRWvzJjhv7PoqXmAxRAsCnyH9IRxrzHBd9WQOMBmvP4K4jLWKJOPmWWfm/c11yoN lOwEwUZ2UMWYDiYLnShjK4Bx6L2S1qVepAcNuMG3OPt955ciPDb29dZ81UuCLi8grZ1A /rznhd3iOm981dXiO9DiRJceRz1VcKDPPyUFj26dp12SzUlqQdXePDdGL/ZyqKisQ9Yo L5xMIwigQmw1VuzhuvN7sqor0zwLhQP/VvuTJZ8OhnFSPgi+075Jx1E6MxPeoSJUYLCB tHEA== X-Gm-Message-State: AOAM531OC20bvQS4GAstSvuaiNY75frQUNAwBYfWhCXzLrZcOlh+A6iQ uFdbb6ao8UTm82Zk1jnJtjz7wIs77uQ= X-Google-Smtp-Source: ABdhPJz9bTowWW2/MORGr/yqj0c93Nq3mAwJa8A0xxX6Vqvt/4gW1JC+rFwFsW7QnKjpVbG9uxuYSA== X-Received: by 2002:a63:5542:: with SMTP id f2mr489628pgm.384.1589393407686; Wed, 13 May 2020 11:10:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [RISU 9/9] Add --dump option to inspect trace files Date: Wed, 13 May 2020 11:09:53 -0700 Message-Id: <20200513180953.20376-10-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Adjust some of the aarch64 code to look at the reginfo struct instead of looking at test_sve, so that we do not need to pass the --test-sve option in order to dump sve trace files. Signed-off-by: Richard Henderson --- risu.h | 1 + risu.c | 111 ++++++++++++++++++++++++++++++++++++++++- risu_reginfo_aarch64.c | 55 ++++++++++++-------- risu_reginfo_arm.c | 4 ++ risu_reginfo_i386.c | 4 ++ risu_reginfo_m68k.c | 4 ++ risu_reginfo_ppc64.c | 4 ++ 7 files changed, 161 insertions(+), 22 deletions(-) diff --git a/risu.h b/risu.h index 0ae7fa9..515e5c2 100644 --- a/risu.h +++ b/risu.h @@ -23,6 +23,7 @@ extern const struct option * const arch_long_opts; extern const char * const arch_extra_help; void process_arch_opt(int opt, const char *arg); +void arch_init(void); #define FIRST_ARCH_OPT 0x100 =20 /* GCC computed include to pull in the correct risu_reginfo_*.h for diff --git a/risu.c b/risu.c index 979341c..6410b2f 100644 --- a/risu.c +++ b/risu.c @@ -261,6 +261,94 @@ int apprentice(void) return EXIT_FAILURE; } =20 +int dump_trace(void) +{ + trace_header_t header; + union { + struct reginfo ri; + unsigned char memblock[MEMBLOCKLEN]; + } u; + const char *op_name; + + while (1) { + if (read_trace(&header, sizeof(header))) { + fprintf(stderr, "Trace header read failed\n"); + return EXIT_FAILURE; + } + + if (header.magic !=3D RISU_MAGIC) { + fprintf(stderr, "Unexpected header magic (%#x)\n", header.magi= c); + return EXIT_FAILURE; + } + + switch (header.risu_op) { + case OP_COMPARE: + op_name =3D "COMPARE"; + break; + case OP_TESTEND: + op_name =3D "TESTEND"; + break; + case OP_SETMEMBLOCK: + op_name =3D "SETMEMBLOCK"; + break; + case OP_GETMEMBLOCK: + op_name =3D "GETMEMBLOCK"; + break; + case OP_COMPAREMEM: + op_name =3D "COMPAREMEM"; + break; + case -1: + op_name =3D "FAULT"; + break; + default: + op_name =3D ""; + break; + } + + switch (header.risu_op) { + case OP_COMPARE: + case OP_TESTEND: + default: + if (header.size > sizeof(u.ri)) { + fprintf(stderr, "Unexpected trace size (%u)\n", header.siz= e); + return EXIT_FAILURE; + } + if (read_trace(&u.ri, header.size)) { + fprintf(stderr, "Reginfo read failed\n"); + return EXIT_FAILURE; + } + if (header.size !=3D reginfo_size(&u.ri)) { + fprintf(stderr, "Unexpected trace size (%u)\n", header.siz= e); + return EXIT_FAILURE; + } + printf("%s: (pc %#lx)\n", op_name, (unsigned long)header.pc); + reginfo_dump(&u.ri, stdout); + putchar('\n'); + if (header.risu_op =3D=3D OP_TESTEND) { + return EXIT_SUCCESS; + } + break; + + case OP_COMPAREMEM: + if (header.size !=3D MEMBLOCKLEN) { + fprintf(stderr, "Unexpected trace size (%u)\n", header.siz= e); + return EXIT_FAILURE; + } + if (read_trace(&u.memblock, MEMBLOCKLEN)) { + fprintf(stderr, "Memblock read failed\n"); + return EXIT_FAILURE; + } + /* TODO: Dump 8k of data? */ + /* fall through */ + + case OP_SETMEMBLOCK: + case OP_GETMEMBLOCK: + printf("%s\n", op_name); + break; + } + } +} + int ismaster; =20 void usage(void) @@ -273,6 +361,7 @@ void usage(void) fprintf(stderr, "between master and apprentice risu processes.\n\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, " --master Be the master (server)\n"); + fprintf(stderr, " -d, --dump=3DFILE Dump " TRACE_TYPE " trace file\= n"); fprintf(stderr, " -t, --trace=3DFILE Record/playback " TRACE_TYPE " = trace file\n"); fprintf(stderr, " -h, --host=3DHOST Specify master host machine (apprentice= only)" @@ -293,11 +382,12 @@ static struct option * setup_options(char **short_opt= s) {"host", required_argument, 0, 'h'}, {"port", required_argument, 0, 'p'}, {"trace", required_argument, 0, 't'}, + {"dump", required_argument, 0, 'd'}, {0, 0, 0, 0} }; struct option *lopts =3D &default_longopts[0]; =20 - *short_opts =3D "h:p:t:"; + *short_opts =3D "d:h:p:t:"; =20 if (arch_long_opts) { const size_t osize =3D sizeof(struct option); @@ -328,6 +418,7 @@ int main(int argc, char **argv) char *trace_fn =3D NULL; struct option *longopts; char *shortopts; + bool dump =3D false; =20 longopts =3D setup_options(&shortopts); =20 @@ -342,6 +433,10 @@ int main(int argc, char **argv) case 0: /* flag set by getopt_long, do nothing */ break; + case 'd': + trace_fn =3D optarg; + dump =3D true; + break; case 't': trace_fn =3D optarg; trace =3D true; @@ -363,7 +458,12 @@ int main(int argc, char **argv) } } =20 - if (trace) { + if (dump && ismaster) { + usage(); + exit(1); + } + + if (trace || dump) { if (strcmp(trace_fn, "-") =3D=3D 0) { comm_fd =3D ismaster ? STDOUT_FILENO : STDIN_FILENO; } else { @@ -378,6 +478,10 @@ int main(int argc, char **argv) } } =20 + if (dump) { + return dump_trace(); + } + imgfile =3D argv[optind]; if (!imgfile) { fprintf(stderr, "Error: must specify image file name\n\n"); @@ -387,6 +491,9 @@ int main(int argc, char **argv) =20 load_image(imgfile); =20 + /* Select requested SVE vector length. */ + arch_init(); + if (ismaster) { if (!trace) { fprintf(stderr, "master port %d\n", port); diff --git a/risu_reginfo_aarch64.c b/risu_reginfo_aarch64.c index a1020ac..fb8e11a 100644 --- a/risu_reginfo_aarch64.c +++ b/risu_reginfo_aarch64.c @@ -44,8 +44,6 @@ const char * const arch_extra_help void process_arch_opt(int opt, const char *arg) { #ifdef SVE_MAGIC - long want, got; - assert(opt =3D=3D FIRST_ARCH_OPT); test_sve =3D strtol(arg, 0, 10); =20 @@ -53,22 +51,37 @@ void process_arch_opt(int opt, const char *arg) fprintf(stderr, "Invalid value for VQ (1-%d)\n", SVE_VQ_MAX); exit(EXIT_FAILURE); } - want =3D sve_vl_from_vq(test_sve); - got =3D prctl(PR_SVE_SET_VL, want); - if (want !=3D got) { - if (got < 0) { - perror("prctl PR_SVE_SET_VL"); - } else { - fprintf(stderr, "Unsupported value for VQ (%d !=3D %d)\n", - test_sve, (int)sve_vq_from_vl(got)); - } - exit(EXIT_FAILURE); - } #else abort(); #endif } =20 +void arch_init(void) +{ +#ifdef SVE_MAGIC + long want, got1, got2; + + if (test_sve =3D=3D 0) { + return; + } + + want =3D sve_vl_from_vq(test_sve); + asm(".arch_extension sve\n\trdvl %0, #1" : "=3Dr"(got1)); + if (want !=3D got1) { + got2 =3D prctl(PR_SVE_SET_VL, want); + if (want !=3D got2) { + if (got2 < 0) { + perror("prctl PR_SVE_SET_VL"); + got2 =3D got1; + } + fprintf(stderr, "Unsupported value for VQ (%d !=3D %d)\n", + test_sve, (int)sve_vq_from_vl(got1)); + exit(EXIT_FAILURE); + } + } +#endif +} + int reginfo_size(struct reginfo *ri) { #ifdef SVE_MAGIC @@ -170,6 +183,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) if (sve->head.size < SVE_SIG_CONTEXT_SIZE(vq)) { if (sve->head.size =3D=3D sizeof(*sve)) { /* SVE state is empty -- not an error. */ + goto do_simd; } else { fprintf(stderr, "risu_reginfo_aarch64: " "failed to get complete SVE state\n"); @@ -182,6 +196,7 @@ void reginfo_init(struct reginfo *ri, ucontext_t *uc) SVE_SIG_CONTEXT_SIZE(vq) - SVE_SIG_REGS_OFFSET); return; } + do_simd: #endif /* SVE_MAGIC */ =20 for (i =3D 0; i < 32; i++) { @@ -260,8 +275,9 @@ int reginfo_dump(struct reginfo *ri, FILE * f) fprintf(f, " fpcr : %08x\n", ri->fpcr); =20 #ifdef SVE_MAGIC - if (test_sve) { - int q, vq =3D test_sve; + if (ri->sve_vl) { + int vq =3D sve_vq_from_vl(ri->sve_vl); + int q; =20 fprintf(f, " vl : %d\n", ri->sve_vl); =20 @@ -339,13 +355,12 @@ int reginfo_dump_mismatch(struct reginfo *m, struct r= eginfo *a, FILE * f) } =20 #ifdef SVE_MAGIC - if (test_sve) { + if (m->sve_vl !=3D a->sve_vl) { + fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); + } + if (m->sve_vl) { int vq =3D sve_vq_from_vl(m->sve_vl); =20 - if (m->sve_vl !=3D a->sve_vl) { - fprintf(f, " vl : %d vs %d\n", m->sve_vl, a->sve_vl); - } - for (i =3D 0; i < SVE_NUM_ZREGS; i++) { uint64_t *zm =3D reginfo_zreg(m, vq, i); uint64_t *za =3D reginfo_zreg(a, vq, i); diff --git a/risu_reginfo_arm.c b/risu_reginfo_arm.c index 3832e27..2982435 100644 --- a/risu_reginfo_arm.c +++ b/risu_reginfo_arm.c @@ -36,6 +36,10 @@ void process_arch_opt(int opt, const char *arg) abort(); } =20 +void arch_init(void) +{ +} + int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); diff --git a/risu_reginfo_i386.c b/risu_reginfo_i386.c index 902d33e..68f2323 100644 --- a/risu_reginfo_i386.c +++ b/risu_reginfo_i386.c @@ -74,6 +74,10 @@ void process_arch_opt(int opt, const char *arg) } } =20 +void arch_init(void) +{ +} + int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); diff --git a/risu_reginfo_m68k.c b/risu_reginfo_m68k.c index 361f172..499fdc4 100644 --- a/risu_reginfo_m68k.c +++ b/risu_reginfo_m68k.c @@ -23,6 +23,10 @@ void process_arch_opt(int opt, const char *arg) abort(); } =20 +void arch_init(void) +{ +} + int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); diff --git a/risu_reginfo_ppc64.c b/risu_reginfo_ppc64.c index c86313c..3b04747 100644 --- a/risu_reginfo_ppc64.c +++ b/risu_reginfo_ppc64.c @@ -32,6 +32,10 @@ void process_arch_opt(int opt, const char *arg) abort(); } =20 +void arch_init(void) +{ +} + int reginfo_size(struct reginfo *ri) { return sizeof(struct reginfo); --=20 2.20.1