From patchwork Thu Mar 2 19:08:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 658131 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp65459wrb; Thu, 2 Mar 2023 11:11:45 -0800 (PST) X-Google-Smtp-Source: AK7set/wpCpJBoF65pQn0lRUysVk1p3IYDX6fE5UVXa7+ewPFI16PXXzFxfVhOApppL9YVo1/nyE X-Received: by 2002:a05:6214:2a4b:b0:56c:858:6c00 with SMTP id jf11-20020a0562142a4b00b0056c08586c00mr22166794qvb.32.1677784305042; Thu, 02 Mar 2023 11:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677784305; cv=none; d=google.com; s=arc-20160816; b=datrKJV8VWPctVhjU56oeS/ZMHugUsPrKvG9xbcvd/4wzUxklWtEJ+9AMNXm8MQpe3 7UZSOZPC/VT9OWpZQyd/E88S9y/CvpOIahY5i3PPmXwkWPUMJ7yFsdUDvZB0YlpV7J6t MHLhchNc7WOuTCtqU7L2pSbiVDSogEcEsNNkuBkKl+bb+zH8Fu01Dhcr50k9TrFaUJYd QUOstV83Qb9QHByK5waJNPUXS/kDe79AzC+iKMLrTf2q1kAv5KT5VDWNkqnMBEaYPlDW ZAuYMfOvSdYVchnH4cf/h2a+/SjRFKhJ607yJV3sCsfNgM5NKfPygaHvK7JaVyKLvRBv Eu5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=fbnWOXh4ZExL9KJ5IqauLpuFcCfssFumF9ny95ox2i8=; b=IK97r9FPyUMSHEBRbPEYgrc2zoOQjA3MmB79soxG0P1dlHYqyjsPeAV+9MwZq8/rhF rikjOWghVVq9qBVkA64RjHnoRaTdcdj4MY0jl7QC6gNO2bJK+QnOvn/5MJJXuTKd1Di2 1y+eU8ic5zfnNG7BAZZua0Sd0VN447vUYG2SUrP2fB4ZTGQ90OSS5jD6j8RApnBUUvtj 6hJut7bbJxVc8GMwlDyZA722joLPqnTI8tPOc12+Co3aqcmdNyNrR0FZJTkmZNR+Kra2 hPpqh9YMc2xzoGl6R8IWK8uDACz7TymbGCst48zo7TP5XkC53gHA9LZmXbRdD6ZSwkwt 8xmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IPI+6Gk7; 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 a25-20020a0cb359000000b0056ee5ebb3c3si11872723qvf.566.2023.03.02.11.11.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Mar 2023 11:11:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IPI+6Gk7; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXoIg-0007Ze-7H; Thu, 02 Mar 2023 14:09:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXoIf-0007YT-7u for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:09:09 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXoIQ-0004UG-3n for qemu-devel@nongnu.org; Thu, 02 Mar 2023 14:09:08 -0500 Received: by mail-wr1-x430.google.com with SMTP id bw19so98820wrb.13 for ; Thu, 02 Mar 2023 11:08:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fbnWOXh4ZExL9KJ5IqauLpuFcCfssFumF9ny95ox2i8=; b=IPI+6Gk7NYKXNZza05A834y6TpN8DALtHsZetaiTaxMlqJmMqUfqEWijlq7+vj+GZU T4sTwET7CEM0Ksqjf8q9uWmPjCMFogW6HfCic9FuCGZAsCc9vYNfJ09m3CIBzt1lhNMu mW35GsGmBrUNTqCqT/LByr1cOumN1O9v9jHOe0Xp7urTyaTpW3yrs1I7ExnPRg3hoppv 68AC9nvaklylPBBkUSjNThhscvVbQFRit+YWGCe+U5bqbNE838b0cxUA6VoDi2RsjcVt h76y+TstjC5Kp07+PUCXJP2gbzVDGslt6hZUyRcsBzLvS8ApKyeVt9vTxTjng939Qw5u RWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fbnWOXh4ZExL9KJ5IqauLpuFcCfssFumF9ny95ox2i8=; b=CxC/k20JndPiEZTyx0z+fZAgfBvy3ooXnNJq9aKDxD5rFzV9hkDzpsfq+coUJAekTG kII6awsRA4hoF3s3UJFflegwlKkh5mk14JpB2TxxbV4i9KQJXhjLJq50g/vaJwkLE/O9 9CveRlVr7UpgeHQYap1WywFDdsafu4Ji+XRroBW0WKX3mtp4EMiTBdzqlK3fcVZVDbbx f7AZmSKqSvO26LBnkTPIz0TBUn8Jgh+9nfBbNQUSbiJfx+S56um00vVp+FqOHJEgMXdx d0YA7qrHz004F5XcYUI3rVvEn86+XI6T/MlKvUgJtc4RsTR2/o0QgczXnpODmoRzewfL KN8w== X-Gm-Message-State: AO0yUKULD0Bh2To+5tBLPXHrsscekYGdKP+sXBpkE9jCYIirzaQuc+nf iTEgKY3EDdCcTRwGx2O1Cl56iA== X-Received: by 2002:adf:f483:0:b0:2c7:d7ca:4c89 with SMTP id l3-20020adff483000000b002c7d7ca4c89mr8552024wro.58.1677784133103; Thu, 02 Mar 2023 11:08:53 -0800 (PST) Received: from zen.linaroharston ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id n1-20020adffe01000000b002c4084d3472sm141397wrr.58.2023.03.02.11.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 11:08:52 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4781C1FFC1; Thu, 2 Mar 2023 19:08:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Weiwei Li , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Palmer Dabbelt , Laurent Vivier , nicolas.eder@lauterbach.com, Ilya Leoshkevich , kvm@vger.kernel.org, "Edgar E. Iglesias" , David Gibson , Max Filippov , Sunil Muthuswamy , qemu-s390x@nongnu.org, Stafford Horne , Bin Meng , Marek Vasut , Greg Kurz , Song Gao , Aleksandar Rikalo , Liu Zhiwei , Alistair Francis , Chris Wulff , qemu-riscv@nongnu.org, Michael Rolnik , qemu-arm@nongnu.org, Cleber Rosa , Artyom Tarasenko , Marcel Apfelbaum , Eduardo Habkost , Yoshinori Sato , Alexandre Iooss , Daniel Henrique Barboza , Jiaxun Yang , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , mads@ynddal.dk, Mark Cave-Ayland , qemu-ppc@nongnu.org, Richard Henderson , John Snow , Xiaojuan Yang , Thomas Huth , Paolo Bonzini , Mahmoud Mandour , Aurelien Jarno , Bastian Koppelmann , Yanan Wang , David Hildenbrand , Taylor Simpson , Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v4 12/26] gdbstub: rationalise signal mapping in softmmu Date: Thu, 2 Mar 2023 19:08:32 +0000 Message-Id: <20230302190846.2593720-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230302190846.2593720-1-alex.bennee@linaro.org> References: <20230302190846.2593720-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We don't really need a table for mapping two symbols. Reviewed-by: Richard Henderson Signed-off-by: Alex Bennée --- gdbstub/softmmu.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c index a6c196ade6..6796761fd9 100644 --- a/gdbstub/softmmu.c +++ b/gdbstub/softmmu.c @@ -506,20 +506,14 @@ enum { TARGET_SIGTRAP = 5 }; -static int gdb_signal_table[] = { - -1, - -1, - TARGET_SIGINT, - -1, - -1, - TARGET_SIGTRAP -}; - int gdb_signal_to_target(int sig) { - if (sig < ARRAY_SIZE(gdb_signal_table)) { - return gdb_signal_table[sig]; - } else { + switch (sig) { + case 2: + return TARGET_SIGINT; + case 5: + return TARGET_SIGTRAP; + default: return -1; } }